Skip to content

Commit 78eecd6

Browse files
authored
Merge pull request #393 from devicehive/development
Development
2 parents f62b398 + 9ae2ccb commit 78eecd6

File tree

56 files changed

+1683
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1683
-194
lines changed

Jenkinsfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ if (publishable_branches.contains(env.BRANCH_NAME)) {
7070

7171
echo("Install dependencies with npm")
7272
sh '''
73-
sudo npm install -g mocha mochawesome
73+
sudo npm install -g mocha@3.5.3 mochawesome
7474
sudo npm i
7575
'''
7676

@@ -84,8 +84,10 @@ if (publishable_branches.contains(env.BRANCH_NAME)) {
8484
jq ".server.restUrl = \\"http://127.0.0.1:8080/api/rest\\"" > config.json
8585
'''
8686

87-
echo("Run integration tests")
88-
sh 'mocha -R mochawesome integration-tests'
87+
timeout(time:10, unit: 'MINUTES') {
88+
echo("Run integration tests")
89+
sh 'mocha -R mochawesome integration-tests'
90+
}
8991
}
9092
} finally {
9193
archiveArtifacts artifacts: 'devicehive-tests/mochawesome-report/mochawesome.json, devicehive-tests/mochawesome-report/mochawesome.html', fingerprint: true, onlyIfSuccessful: true

devicehive-backend/pom.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>devicehive-server</artifactId>
77
<groupId>com.devicehive</groupId>
8-
<version>3.3.3</version>
8+
<version>3.3.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

@@ -81,6 +81,19 @@
8181
</dependency>
8282
</dependencies>
8383
</profile>
84+
<profile>
85+
<id>proxy-ws-kafka</id>
86+
<activation>
87+
<activeByDefault>true</activeByDefault>
88+
</activation>
89+
<dependencies>
90+
<dependency>
91+
<groupId>com.devicehive</groupId>
92+
<artifactId>devicehive-proxy-ws-kafka-impl</artifactId>
93+
<version>${project.version}</version>
94+
</dependency>
95+
</dependencies>
96+
</profile>
8497
</profiles>
8598
<build>
8699
<plugins>

devicehive-backend/src/main/resources/messages.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,4 @@ CANT_DELETE_CURRENT_USER_KEY=You can not delete a user or access key that you us
110110
CANT_DELETE_LAST_DEFAULT_ACCESS_KEY=You can not delete your last default access key
111111
PAYLOAD_NOT_FOUND=Missing or invalid payload in request
112112
SUBSCRIPTION_NOT_FOUND=Subscription with id %s was not found
113-
DEVICE_ID_CONTAINS_INVALID_CHARACTERS=Device Id can only contain letters, digits, dashes and underscores.
113+
DEVICE_ID_CONTAINS_INVALID_CHARACTERS=Device Id can only contain letters, digits and dashes.

devicehive-common-dao/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.devicehive</groupId>
99
<artifactId>devicehive-server</artifactId>
10-
<version>3.3.3</version>
10+
<version>3.3.4</version>
1111
</parent>
1212
<artifactId>devicehive-common-dao</artifactId>
1313
<packaging>jar</packaging>

devicehive-common/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.devicehive</groupId>
99
<artifactId>devicehive-server</artifactId>
10-
<version>3.3.3</version>
10+
<version>3.3.4</version>
1111
</parent>
1212
<artifactId>devicehive-common</artifactId>
1313
<packaging>jar</packaging>
@@ -29,6 +29,11 @@
2929
</exclusion>
3030
</exclusions>
3131
</dependency>
32+
<dependency>
33+
<groupId>com.devicehive</groupId>
34+
<artifactId>devicehive-proxy-api</artifactId>
35+
<version>${project.parent.version}</version>
36+
</dependency>
3237
<dependency>
3338
<groupId>io.swagger</groupId>
3439
<artifactId>swagger-annotations</artifactId>

devicehive-common/src/main/java/com/devicehive/model/updates/DeviceUpdate.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ public class DeviceUpdate implements HiveEntity {
3636

3737
private static final long serialVersionUID = -7498444232044147881L;
3838

39-
@SerializedName("id")
40-
@JsonPolicyDef({DEVICE_PUBLISHED, NETWORK_PUBLISHED})
41-
private String id;
42-
4339
@Size(min = 1, max = 128, message = "Field name cannot be empty. The length of name should not be more than 128 symbols.")
4440
@SerializedName("name")
4541
@JsonPolicyDef({DEVICE_PUBLISHED, DEVICE_SUBMITTED, NETWORK_PUBLISHED})
@@ -57,14 +53,6 @@ public class DeviceUpdate implements HiveEntity {
5753
@SerializedName("isBlocked")
5854
private Boolean blocked;
5955

60-
public Optional<String> getId() {
61-
return Optional.ofNullable(id);
62-
}
63-
64-
public void setId(String id) {
65-
this.id = id;
66-
}
67-
6856
public Optional<String> getName() {
6957
return Optional.ofNullable(name);
7058
}
@@ -97,10 +85,10 @@ public void setBlocked(Boolean blocked) {
9785
this.blocked = blocked;
9886
}
9987

100-
public DeviceVO convertTo() {
88+
public DeviceVO convertTo(String deviceId) {
10189
DeviceVO device = new DeviceVO();
102-
if (this.id != null){
103-
device.setDeviceId(this.id);
90+
if (deviceId != null){
91+
device.setDeviceId(deviceId);
10492
}
10593
if (this.data != null){
10694
device.setData(this.data);

devicehive-frontend/pom.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>devicehive-server</artifactId>
77
<groupId>com.devicehive</groupId>
8-
<version>3.3.3</version>
8+
<version>3.3.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<packaging>jar</packaging>
@@ -181,5 +181,18 @@
181181
</dependency>
182182
</dependencies>
183183
</profile>
184+
<profile>
185+
<id>proxy-ws-kafka</id>
186+
<activation>
187+
<activeByDefault>true</activeByDefault>
188+
</activation>
189+
<dependencies>
190+
<dependency>
191+
<groupId>com.devicehive</groupId>
192+
<artifactId>devicehive-proxy-ws-kafka-impl</artifactId>
193+
<version>${project.version}</version>
194+
</dependency>
195+
</dependencies>
196+
</profile>
184197
</profiles>
185198
</project>

devicehive-frontend/src/main/java/com/devicehive/resource/DeviceResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
@Api(tags = {"Device"}, description = "Represents a device, a unit that runs microcode and communicates to this API.", consumes = "application/json")
4545
@Produces({"application/json"})
4646
public interface DeviceResource {
47-
String DEVICE_ID_CONTAINS_INVALID_CHARACTERS = "Device Id can only contain letters, digits, dashes and underscores.";
47+
String DEVICE_ID_CONTAINS_INVALID_CHARACTERS = "Device Id can only contain letters, digits and dashes.";
4848

4949
/**
5050
* Implementation of <a href="http://www.devicehive.com/restful#Reference/Device/list"> DeviceHive RESTful API:
@@ -132,7 +132,7 @@ Response register(
132132
DeviceUpdate deviceUpdate,
133133
@ApiParam(name = "id", value = "Device unique identifier.", required = true)
134134
@PathParam("id")
135-
@Pattern(regexp = "[a-zA-Z0-9-_]+", message = DEVICE_ID_CONTAINS_INVALID_CHARACTERS)
135+
@Pattern(regexp = "[a-zA-Z0-9-]+", message = DEVICE_ID_CONTAINS_INVALID_CHARACTERS)
136136
String deviceId);
137137

138138
/**

devicehive-frontend/src/main/java/com/devicehive/resource/exceptions/AllExceptionMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class AllExceptionMapper implements ExceptionMapper<Exception> {
4444

4545
@Override
4646
public Response toResponse(Exception exception) {
47-
logger.error("Error: ", exception);
47+
logger.error("Error: {}", exception.getMessage());
4848

4949
Response.Status responseCode = Response.Status.INTERNAL_SERVER_ERROR;
5050
String message = exception.getMessage();

devicehive-frontend/src/main/java/com/devicehive/resource/impl/DeviceResourceImpl.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,8 @@ public Response register(DeviceUpdate deviceUpdate, String deviceId) {
123123
}
124124
logger.debug("Device register method requested. Device ID : {}, Device: {}", deviceId, deviceUpdate);
125125

126-
deviceUpdate.setId(deviceId);
127-
128126
HivePrincipal principal = (HivePrincipal) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
129-
deviceService.deviceSaveAndNotify(deviceUpdate, principal);
127+
deviceService.deviceSaveAndNotify(deviceId, deviceUpdate, principal);
130128
logger.debug("Device register finished successfully. Device ID: {}", deviceId);
131129

132130
return ResponseFactory.response(Response.Status.NO_CONTENT);

0 commit comments

Comments
 (0)