diff --git a/examples/hawkbit-device-simulator/pom.xml b/examples/hawkbit-device-simulator/pom.xml
index b8539296a..1b1bc5fdc 100644
--- a/examples/hawkbit-device-simulator/pom.xml
+++ b/examples/hawkbit-device-simulator/pom.xml
@@ -82,16 +82,26 @@
org.springframework.boot
spring-boot-starter
-
-
- org.springframework.boot
- spring-boot-starter-logging
-
-
+
- org.springframework.boot
- spring-boot-starter-log4j2
+ org.apache.logging.log4j
+ log4j-api
+
+
+
+ org.slf4j
+ jul-to-slf4j
+
+
+
+ org.slf4j
+ jcl-over-slf4j
+
+
+
+ org.slf4j
+ log4j-over-slf4j
com.vaadin
diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java
index e7b81b017..34c5f548e 100644
--- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java
+++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java
@@ -149,6 +149,8 @@ public class DeviceSimulatorUpdater {
eventbus.post(new ProgressUpdate(device));
return;
}
+ // download is 80% of the game after all
+ device.setProgress(0.8);
}
final double newProgress = device.getProgress() + 0.2;
@@ -262,7 +264,7 @@ public class DeviceSimulatorUpdater {
}
} catch (IOException | KeyManagementException | NoSuchAlgorithmException | KeyStoreException e) {
- LOGGER.error("Failed to download {} with {}", url, e.getMessage());
+ LOGGER.error("Failed to download" + url, e);
return new UpdateStatus(ResponseStatus.ERROR, "Failed to download " + url + ": " + e.getMessage());
}
@@ -272,6 +274,10 @@ public class DeviceSimulatorUpdater {
}
private static String hideTokenDetails(final String targetToken) {
+ if (targetToken == null) {
+ return "";
+ }
+
if (targetToken.isEmpty()) {
return "";
}
diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/SimulatorView.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/SimulatorView.java
index bd6ecbe8b..4834bece9 100644
--- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/SimulatorView.java
+++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/SimulatorView.java
@@ -53,11 +53,13 @@ import com.vaadin.ui.renderers.ProgressBarRenderer;
*
*/
@SpringView(name = "")
+// The inheritance comes from Vaadin
+@SuppressWarnings("squid:MaximumInheritanceDepth")
public class SimulatorView extends VerticalLayout implements View {
private static final String NEXT_POLL_COUNTER_SEC_COL = "nextPollCounterSec";
- private static final String RESPONSE_STATUS_COL = "responseStatus";
+ private static final String RESPONSE_STATUS_COL = "updateStatus";
private static final String PROTOCOL_COL = "protocol";
@@ -141,10 +143,9 @@ public class SimulatorView extends VerticalLayout implements View {
responseComboBox.setItemIcon(ResponseStatus.ERROR, FontAwesome.EXCLAMATION_CIRCLE);
responseComboBox.setNullSelectionAllowed(false);
responseComboBox.setValue(ResponseStatus.SUCCESSFUL);
- responseComboBox.addValueChangeListener(valueChangeEvent -> {
- beanContainer.getItemIds().forEach(itemId -> beanContainer.getItem(itemId)
- .getItemProperty(RESPONSE_STATUS_COL).setValue(valueChangeEvent.getProperty().getValue()));
- });
+ responseComboBox.addValueChangeListener(
+ valueChangeEvent -> beanContainer.getItemIds().forEach(itemId -> beanContainer.getItem(itemId)
+ .getItemProperty(RESPONSE_STATUS_COL).setValue(valueChangeEvent.getProperty().getValue())));
// add all components
addComponent(caption);
diff --git a/examples/hawkbit-device-simulator/src/main/resources/logback.xml b/examples/hawkbit-device-simulator/src/main/resources/logback.xml
new file mode 100644
index 000000000..da64e62d1
--- /dev/null
+++ b/examples/hawkbit-device-simulator/src/main/resources/logback.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/hawkbit-example-app/pom.xml b/examples/hawkbit-example-app/pom.xml
index 721966026..957ba8d6a 100644
--- a/examples/hawkbit-example-app/pom.xml
+++ b/examples/hawkbit-example-app/pom.xml
@@ -101,16 +101,26 @@
org.springframework.boot
spring-boot-starter
-
-
- org.springframework.boot
- spring-boot-starter-logging
-
-
+
- org.springframework.boot
- spring-boot-starter-log4j2
+ org.apache.logging.log4j
+ log4j-api
+
+
+
+ org.slf4j
+ jul-to-slf4j
+
+
+
+ org.slf4j
+ jcl-over-slf4j
+
+
+
+ org.slf4j
+ log4j-over-slf4j
org.springframework.security
diff --git a/examples/hawkbit-example-app/src/main/resources/logback.xml b/examples/hawkbit-example-app/src/main/resources/logback.xml
new file mode 100644
index 000000000..a76e39683
--- /dev/null
+++ b/examples/hawkbit-example-app/src/main/resources/logback.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/hawkbit-example-core-feign-client/src/main/java/org/eclipse/hawkbit/feign/core/client/FeignClientConfiguration.java b/examples/hawkbit-example-core-feign-client/src/main/java/org/eclipse/hawkbit/feign/core/client/FeignClientConfiguration.java
index 2723a251e..1512b7f9e 100644
--- a/examples/hawkbit-example-core-feign-client/src/main/java/org/eclipse/hawkbit/feign/core/client/FeignClientConfiguration.java
+++ b/examples/hawkbit-example-core-feign-client/src/main/java/org/eclipse/hawkbit/feign/core/client/FeignClientConfiguration.java
@@ -18,8 +18,8 @@ import feign.Contract;
import feign.Feign;
/**
- *
- *
+ * Spring annotated java configuration class which defines necessary beans for
+ * configure the feign-client.
*/
@Configuration
@ConditionalOnClass(Feign.class)
diff --git a/examples/hawkbit-example-ddi-feign-client/pom.xml b/examples/hawkbit-example-ddi-feign-client/pom.xml
index 8256b5b30..5388544db 100644
--- a/examples/hawkbit-example-ddi-feign-client/pom.xml
+++ b/examples/hawkbit-example-ddi-feign-client/pom.xml
@@ -55,7 +55,6 @@
com.netflix.feign
feign-core
-
com.netflix.feign
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDownloadArtifactClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDownloadArtifactClientResource.java
index f32e448ac..d25a609b2 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDownloadArtifactClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtDownloadArtifactClientResource.java
@@ -13,7 +13,8 @@ import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.springframework.cloud.netflix.feign.FeignClient;
/**
- *
+ * A feign-client interface declaration which allows to build a feign-client
+ * stub.
*/
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING)
public interface MgmtDownloadArtifactClientResource extends MgmtDownloadArtifactRestApi {
diff --git a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSoftwareModuleTypeClientResource.java b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSoftwareModuleTypeClientResource.java
index 766ec215f..1e9462c47 100644
--- a/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSoftwareModuleTypeClientResource.java
+++ b/examples/hawkbit-example-mgmt-feign-client/src/main/java/org/eclipse/hawkbit/mgmt/client/resource/MgmtSoftwareModuleTypeClientResource.java
@@ -13,7 +13,7 @@ import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleTypeRestApi;
import org.springframework.cloud.netflix.feign.FeignClient;
/**
- * Client binding for the oftwareModuleType resource of the management API.
+ * Client binding for the SoftwareModuleType resource of the management API.
*/
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING)
public interface MgmtSoftwareModuleTypeClientResource extends MgmtSoftwareModuleTypeRestApi {
diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/api/PropertyBasedArtifactUrlHandler.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/api/PropertyBasedArtifactUrlHandler.java
index 0072f2fbd..d43d660ca 100644
--- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/api/PropertyBasedArtifactUrlHandler.java
+++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/api/PropertyBasedArtifactUrlHandler.java
@@ -61,7 +61,7 @@ public class PropertyBasedArtifactUrlHandler implements ArtifactUrlHandler {
for (final Entry entry : entrySet) {
if (entry.getKey().equals(PORT_PLACEHOLDER)) {
urlPattern = urlPattern.replace(":{" + entry.getKey() + "}",
- Strings.isNullOrEmpty(entry.getValue()) ? "" : ":" + entry.getValue());
+ Strings.isNullOrEmpty(entry.getValue()) ? "" : (":" + entry.getValue()));
} else {
urlPattern = urlPattern.replace("{" + entry.getKey() + "}", entry.getValue());
}
diff --git a/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiDeploymentBaseTest.java b/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiDeploymentBaseTest.java
index 741a6729a..0790a6705 100644
--- a/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiDeploymentBaseTest.java
+++ b/hawkbit-ddi-resource/src/test/java/org/eclipse/hawkbit/ddi/rest/resource/DdiDeploymentBaseTest.java
@@ -56,6 +56,9 @@ import ru.yandex.qatools.allure.annotations.Stories;
@Stories("Deployment Action Resource")
public class DdiDeploymentBaseTest extends AbstractRestIntegrationTestWithMongoDB {
+ private static final String HTTP_LOCALHOST = "http://localhost:8080/";
+ private static final String HTTPS_LOCALHOST = "https://localhost:8080/";
+
@Test()
@Description("Ensures that artifacts are not found, when softare module does not exists.")
public void artifactsNotFound() throws Exception {
@@ -170,24 +173,22 @@ public class DdiDeploymentBaseTest extends AbstractRestIntegrationTestWithMongoD
jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[0].hashes.sha1",
equalTo(artifact.getSha1Hash())))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[0]._links.download.href",
- equalTo("https://localhost:8080/" + tenantAware.getCurrentTenant()
+ equalTo(HTTPS_LOCALHOST + tenantAware.getCurrentTenant()
+ "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[0]._links.md5sum.href",
- equalTo("https://localhost:8080/" + tenantAware.getCurrentTenant()
+ equalTo(HTTPS_LOCALHOST + tenantAware.getCurrentTenant()
+ "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.MD5SUM")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[0]._links.download-http.href",
- equalTo("http://localhost:8080/" + tenantAware.getCurrentTenant()
- + "/controller/v1/4712/softwaremodules/"
+ equalTo(HTTP_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[0]._links.md5sum-http.href",
- equalTo("http://localhost:8080/" + tenantAware.getCurrentTenant()
- + "/controller/v1/4712/softwaremodules/"
+ equalTo(HTTP_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.MD5SUM")))
@@ -200,23 +201,21 @@ public class DdiDeploymentBaseTest extends AbstractRestIntegrationTestWithMongoD
jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1].hashes.sha1",
equalTo(artifactSignature.getSha1Hash())))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1]._links.download.href",
- equalTo("https://localhost:8080/" + tenantAware.getCurrentTenant()
+ equalTo(HTTPS_LOCALHOST + tenantAware.getCurrentTenant()
+ "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.signature")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1]._links.md5sum.href",
- equalTo("https://localhost:8080/" + tenantAware.getCurrentTenant()
+ equalTo(HTTPS_LOCALHOST + tenantAware.getCurrentTenant()
+ "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.signature.MD5SUM")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1]._links.download-http.href",
- equalTo("http://localhost:8080/" + tenantAware.getCurrentTenant()
- + "/controller/v1/4712/softwaremodules/"
+ equalTo(HTTP_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.signature")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1]._links.md5sum-http.href",
- equalTo("http://localhost:8080/" + tenantAware.getCurrentTenant()
- + "/controller/v1/4712/softwaremodules/"
+ equalTo(HTTP_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.signature.MD5SUM")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==bApp)][0].version",
@@ -315,12 +314,12 @@ public class DdiDeploymentBaseTest extends AbstractRestIntegrationTestWithMongoD
jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[0].hashes.sha1",
equalTo(artifact.getSha1Hash())))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[0]._links.download.href",
- equalTo("https://localhost:8080/" + tenantAware.getCurrentTenant()
+ equalTo(HTTPS_LOCALHOST + tenantAware.getCurrentTenant()
+ "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[0]._links.md5sum.href",
- equalTo("https://localhost:8080/" + tenantAware.getCurrentTenant()
+ equalTo(HTTPS_LOCALHOST + tenantAware.getCurrentTenant()
+ "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.MD5SUM")))
@@ -333,23 +332,21 @@ public class DdiDeploymentBaseTest extends AbstractRestIntegrationTestWithMongoD
jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1].hashes.sha1",
equalTo(artifactSignature.getSha1Hash())))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1]._links.download.href",
- equalTo("https://localhost:8080/" + tenantAware.getCurrentTenant()
+ equalTo(HTTPS_LOCALHOST + tenantAware.getCurrentTenant()
+ "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.signature")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1]._links.md5sum.href",
- equalTo("https://localhost:8080/" + tenantAware.getCurrentTenant()
+ equalTo(HTTPS_LOCALHOST + tenantAware.getCurrentTenant()
+ "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.signature.MD5SUM")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1]._links.download-http.href",
- equalTo("http://localhost:8080/" + tenantAware.getCurrentTenant()
- + "/controller/v1/4712/softwaremodules/"
+ equalTo(HTTP_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.signature")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1]._links.md5sum-http.href",
- equalTo("http://localhost:8080/" + tenantAware.getCurrentTenant()
- + "/controller/v1/4712/softwaremodules/"
+ equalTo(HTTP_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.signature.MD5SUM")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==bApp)][0].version",
@@ -445,23 +442,21 @@ public class DdiDeploymentBaseTest extends AbstractRestIntegrationTestWithMongoD
equalTo(artifact.getSha1Hash())))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[0]._links.download.href",
- equalTo("https://localhost:8080/" + tenantAware.getCurrentTenant()
+ equalTo(HTTPS_LOCALHOST + tenantAware.getCurrentTenant()
+ "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[0]._links.md5sum.href",
- equalTo("https://localhost:8080/" + tenantAware.getCurrentTenant()
+ equalTo(HTTPS_LOCALHOST + tenantAware.getCurrentTenant()
+ "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.MD5SUM")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[0]._links.download-http.href",
- equalTo("http://localhost:8080/" + tenantAware.getCurrentTenant()
- + "/controller/v1/4712/softwaremodules/"
+ equalTo(HTTP_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[0]._links.md5sum-http.href",
- equalTo("http://localhost:8080/" + tenantAware.getCurrentTenant()
- + "/controller/v1/4712/softwaremodules/"
+ equalTo(HTTP_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.MD5SUM")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1].size", equalTo(5 * 1024)))
@@ -473,24 +468,22 @@ public class DdiDeploymentBaseTest extends AbstractRestIntegrationTestWithMongoD
jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1].hashes.sha1",
equalTo(artifactSignature.getSha1Hash())))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1]._links.download.href",
- equalTo("https://localhost:8080/" + tenantAware.getCurrentTenant()
+ equalTo(HTTPS_LOCALHOST + tenantAware.getCurrentTenant()
+ "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.signature")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1]._links.md5sum.href",
- equalTo("https://localhost:8080/" + tenantAware.getCurrentTenant()
+ equalTo(HTTPS_LOCALHOST + tenantAware.getCurrentTenant()
+ "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.signature.MD5SUM")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1]._links.download-http.href",
- equalTo("http://localhost:8080/" + tenantAware.getCurrentTenant()
- + "/controller/v1/4712/softwaremodules/"
+ equalTo(HTTP_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.signature")))
.andExpect(jsonPath("$deployment.chunks[?(@.part==os)][0].artifacts[1]._links.md5sum-http.href",
- equalTo("http://localhost:8080/" + tenantAware.getCurrentTenant()
- + "/controller/v1/4712/softwaremodules/"
+ equalTo(HTTP_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/4712/softwaremodules/"
+ findDistributionSetByAction.findFirstModuleByType(osType).getId()
+ "/artifacts/test1.signature.MD5SUM")))
diff --git a/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageDispatcherServiceTest.java b/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageDispatcherServiceTest.java
index c5cea9e05..9164e655d 100644
--- a/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageDispatcherServiceTest.java
+++ b/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/amqp/AmqpMessageDispatcherServiceTest.java
@@ -100,6 +100,7 @@ public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWit
amqpMessageDispatcherService.targetAssignDistributionSet(targetAssignDistributionSetEvent);
final Message sendMessage = createArgumentCapture(targetAssignDistributionSetEvent.getTargetAdress());
final DownloadAndUpdateRequest downloadAndUpdateRequest = assertDownloadAndInstallMessage(sendMessage);
+ assertThat(downloadAndUpdateRequest.getTargetSecurityToken()).isEqualTo(TEST_TOKEN);
assertTrue("No softwaremmodule should be contained in the request",
downloadAndUpdateRequest.getSoftwareModules().isEmpty());
}
@@ -116,6 +117,7 @@ public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWit
final DownloadAndUpdateRequest downloadAndUpdateRequest = assertDownloadAndInstallMessage(sendMessage);
assertEquals("Expecting a size of 3 software modules in the reuqest", 3,
downloadAndUpdateRequest.getSoftwareModules().size());
+ assertThat(downloadAndUpdateRequest.getTargetSecurityToken()).isEqualTo(TEST_TOKEN);
for (final org.eclipse.hawkbit.dmf.json.model.SoftwareModule softwareModule : downloadAndUpdateRequest
.getSoftwareModules()) {
assertTrue("Artifact list for softwaremodule should be empty", softwareModule.getArtifacts().isEmpty());
@@ -155,6 +157,8 @@ public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWit
final DownloadAndUpdateRequest downloadAndUpdateRequest = assertDownloadAndInstallMessage(sendMessage);
assertEquals("DownloadAndUpdateRequest event should contains 3 software modules", 3,
downloadAndUpdateRequest.getSoftwareModules().size());
+ assertThat(downloadAndUpdateRequest.getTargetSecurityToken()).isEqualTo(TEST_TOKEN);
+
for (final org.eclipse.hawkbit.dmf.json.model.SoftwareModule softwareModule : downloadAndUpdateRequest
.getSoftwareModules()) {
if (!softwareModule.getModuleId().equals(module.getId())) {
diff --git a/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/util/PropertyBasedArtifactUrlHandlerTest.java b/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/util/PropertyBasedArtifactUrlHandlerTest.java
index 27021d265..f9a2ea316 100644
--- a/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/util/PropertyBasedArtifactUrlHandlerTest.java
+++ b/hawkbit-dmf-amqp/src/test/java/org/eclipse/hawkbit/util/PropertyBasedArtifactUrlHandlerTest.java
@@ -39,6 +39,8 @@ import ru.yandex.qatools.allure.annotations.Stories;
AmqpTestConfiguration.class })
public class PropertyBasedArtifactUrlHandlerTest extends AbstractIntegrationTestWithMongoDB {
+ private static final String HTTPS_LOCALHOST = "https://localhost:8080/";
+ private static final String HTTP_LOCALHOST = "http://localhost:8080/";
@Autowired
private ArtifactUrlHandler urlHandlerProperties;
@Autowired
@@ -69,9 +71,8 @@ public class PropertyBasedArtifactUrlHandlerTest extends AbstractIntegrationTest
final String url = urlHandlerProperties.getUrl(controllerId, softwareModuleId, fileName, sha1Hash,
UrlProtocol.HTTP);
assertEquals("http is build incorrect",
- "http://localhost:8080/" + tenantAware.getCurrentTenant() + "/controller/v1/" + controllerId
- + "/softwaremodules/" + localArtifact.getSoftwareModule().getId() + "/artifacts/"
- + localArtifact.getFilename(),
+ HTTP_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/" + controllerId + "/softwaremodules/"
+ + localArtifact.getSoftwareModule().getId() + "/artifacts/" + localArtifact.getFilename(),
url);
}
@@ -81,7 +82,7 @@ public class PropertyBasedArtifactUrlHandlerTest extends AbstractIntegrationTest
final String url = urlHandlerProperties.getUrl(controllerId, softwareModuleId, fileName, sha1Hash,
UrlProtocol.HTTPS);
assertEquals("https is build incorrect",
- "https://localhost:8080/" + tenantAware.getCurrentTenant() + "/controller/v1/" + controllerId
+ HTTPS_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/" + controllerId
+ "/softwaremodules/" + localArtifact.getSoftwareModule().getId() + "/artifacts/"
+ localArtifact.getFilename(),
url);
diff --git a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSystemRestApi.java b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSystemRestApi.java
index 92c732c96..d120759b2 100644
--- a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSystemRestApi.java
+++ b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtSystemRestApi.java
@@ -85,4 +85,4 @@ public interface MgmtSystemRestApi {
@PathVariable("keyName") final String keyName,
@RequestBody final MgmtSystemTenantConfigurationValueRequest configurationValueRest);
-}
\ No newline at end of file
+}
diff --git a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetRestApi.java b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetRestApi.java
index d44d473b1..bf4e169a0 100644
--- a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetRestApi.java
+++ b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetRestApi.java
@@ -260,4 +260,4 @@ public interface MgmtTargetRestApi {
MediaType.APPLICATION_JSON_VALUE })
ResponseEntity getInstalledDistributionSet(@PathVariable("targetId") final String targetId);
-}
\ No newline at end of file
+}
diff --git a/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSystemResource.java b/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSystemResource.java
index 5aac17318..fb9218d31 100644
--- a/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSystemResource.java
+++ b/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSystemResource.java
@@ -122,4 +122,5 @@ public class MgmtSystemResource implements MgmtSystemRestApi {
return new ResponseEntity<>(MgmtSystemMapper.toResponse(keyName, updatedValue), HttpStatus.OK);
}
-}
\ No newline at end of file
+}
+
diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaDeploymentManagement.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaDeploymentManagement.java
index e0ace822d..999a5a5c9 100644
--- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaDeploymentManagement.java
+++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaDeploymentManagement.java
@@ -67,6 +67,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
+import org.eclipse.hawkbit.security.SystemSecurityContext;
import org.hibernate.validator.constraints.NotEmpty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -131,6 +132,9 @@ public class JpaDeploymentManagement implements DeploymentManagement {
@Autowired
private AfterTransactionCommitExecutor afterCommit;
+ @Autowired
+ private SystemSecurityContext systemSecurityContext;
+
@Override
@Transactional(isolation = Isolation.READ_COMMITTED)
@Modifying
@@ -348,14 +352,14 @@ public class JpaDeploymentManagement implements DeploymentManagement {
private void assignDistributionSetEvent(final JpaTarget target, final Long actionId,
final List modules) {
((JpaTargetInfo) target.getTargetInfo()).setUpdateStatus(TargetUpdateStatus.PENDING);
-
+ final String targetSecurityToken = systemSecurityContext.runAsSystem(() -> target.getSecurityToken());
@SuppressWarnings({ "unchecked", "rawtypes" })
final Collection softwareModules = (Collection) modules;
afterCommit.afterCommit(() -> {
eventBus.post(new TargetInfoUpdateEvent(target.getTargetInfo()));
eventBus.post(new TargetAssignDistributionSetEvent(target.getOptLockRevision(), target.getTenant(),
target.getControllerId(), actionId, softwareModules, target.getTargetInfo().getAddress(),
- target.getSecurityToken()));
+ targetSecurityToken));
});
}
diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaTarget.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaTarget.java
index 229ef1a42..4540b68d3 100644
--- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaTarget.java
+++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/jpa/model/JpaTarget.java
@@ -44,6 +44,7 @@ import org.eclipse.hawkbit.repository.model.TargetInfo;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.repository.model.helper.SecurityChecker;
import org.eclipse.hawkbit.repository.model.helper.SecurityTokenGeneratorHolder;
+import org.eclipse.hawkbit.repository.model.helper.SystemSecurityContextHolder;
import org.eclipse.persistence.annotations.CascadeOnDelete;
import org.springframework.data.domain.Persistable;
@@ -210,11 +211,15 @@ public class JpaTarget extends AbstractJpaNamedEntity implements Persistable {
+ return createdTarget.getSecurityToken();
+ });
+
+ // retrieve security token as system code execution
+ final String securityTokenAsSystemCode = systemSecurityContext.runAsSystem(() -> {
+ return createdTarget.getSecurityToken();
+ });
+
+ // retrieve security token without any permissions
+ final String securityTokenWithoutPermission = securityRule
+ .runAs(WithSpringAuthorityRule.withUser("NoPermission", false), () -> {
+ return createdTarget.getSecurityToken();
+ });
+
+ assertThat(createdTarget.getSecurityToken()).isNotNull();
+ assertThat(securityTokenWithReadPermission).isNotNull();
+ assertThat(securityTokenAsSystemCode).isNotNull();
+
+ assertThat(securityTokenWithoutPermission).isNull();
+
+ }
+
@Test
@Description("Ensures that targets cannot be created e.g. in plug'n play scenarios when tenant does not exists.")
@WithUser(tenantId = "tenantWhichDoesNotExists", allSpPermissions = true, autoCreateTenant = false)
diff --git a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SystemSecurityContext.java b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SystemSecurityContext.java
index b22b54e39..f849eb541 100644
--- a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SystemSecurityContext.java
+++ b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SystemSecurityContext.java
@@ -49,6 +49,21 @@ public class SystemSecurityContext {
this.tenantAware = tenantAware;
}
+ /**
+ * Runs a given {@link Callable} within a system security context, which is
+ * permitted to call secured system code. Often the system needs to call
+ * secured methods by it's own without relying on the current security
+ * context e.g. if the current security context does not contain the
+ * necessary permission it's necessary to execute code as system code to
+ * execute necessary methods and functionality.
+ *
+ * The security context will be switched to the system code and back after
+ * the callable is called.
+ *
+ * @param callable
+ * the callable to call within the system security context
+ * @return the return value of the {@link Callable#call()} method.
+ */
public T runAsSystem(final Callable callable) {
final SecurityContext oldContext = SecurityContextHolder.getContext();
try {
@@ -68,6 +83,14 @@ public class SystemSecurityContext {
}
}
+ /**
+ * @return {@code true} if the current running code is running as system
+ * code block.
+ */
+ public boolean isCurrentThreadSystemCode() {
+ return SecurityContextHolder.getContext().getAuthentication() instanceof SystemCodeAuthentication;
+ }
+
private static void setSystemContext() {
final SecurityContextImpl securityContextImpl = new SecurityContextImpl();
securityContextImpl.setAuthentication(new SystemCodeAuthentication());
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/TargetFilterHeader.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/TargetFilterHeader.java
index 08592f20c..79877f299 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/TargetFilterHeader.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/TargetFilterHeader.java
@@ -13,7 +13,6 @@ import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.ui.components.SPUIButton;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
-import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
@@ -79,9 +78,8 @@ public class TargetFilterHeader extends VerticalLayout {
}
private Label createHeaderCaption() {
- final Label captionLabel = SPUIComponentProvider.getLabel("Custom Filters",
+ return SPUIComponentProvider.getLabel(SPUIDefinitions.TARGET_FILTER_LIST_HEADER_CAPTION,
SPUILabelDefinitions.SP_WIDGET_CAPTION);
- return captionLabel;
}
private void buildLayout() {
@@ -110,10 +108,9 @@ public class TargetFilterHeader extends VerticalLayout {
}
private Button createAddButton() {
- final Button button = SPUIComponentProvider.getButton("camp.search.add.Id", "Create Filter", "Create Filter",
- "", false, null, SPUIButtonStyleSmall.class);
+ final Button button = SPUIComponentProvider.getButton(SPUIComponetIdProvider.TARGET_FILTER_ADD_ICON_ID, "", "",
+ null, false, FontAwesome.PLUS, SPUIButtonStyleSmallNoBorder.class);
button.addClickListener(event -> addNewFilter());
- button.addStyleName("on-focus-no-border link");
return button;
}
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryTable.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryTable.java
index 0288cf9c2..74f518d56 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryTable.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryTable.java
@@ -296,8 +296,8 @@ public class ActionHistoryTable extends TreeTable implements Handler {
* add distribution name to the item which will be displayed in the
* table. The name should not exceed certain limit.
*/
- item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(HawkbitCommonUtil
- .getFormattedText(actionWithStatusCount.getDsName() + ":" + actionWithStatusCount.getDsVersion()));
+ item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(actionWithStatusCount.getDsName() + ":" +
+ actionWithStatusCount.getDsVersion());
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_FORCED).setValue(action);
/* Default no child */
@@ -446,8 +446,8 @@ public class ActionHistoryTable extends TreeTable implements Handler {
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE_HIDDEN).setValue("");
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST)
- .setValue(HawkbitCommonUtil.getFormattedText(action.getDistributionSet().getName() + ":"
- + action.getDistributionSet().getVersion()));
+ .setValue(action.getDistributionSet().getName() + ":"
+ + action.getDistributionSet().getVersion());
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME)
.setValue(SPDateTimeUtil.getFormattedDate(actionStatus.getCreatedAt()));
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java
index 5491acaaf..575b73b4d 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java
@@ -431,27 +431,7 @@ public final class HawkbitCommonUtil {
return trimAndNullIfEmpty(orgText) == null ? SPUIDefinitions.SPACE : orgText;
}
- /**
- * Format the lengthy text.
- *
- * @param orgText
- * text to be formatted
- * @return String formatted text
- */
- public static String getFormattedText(final String orgText) {
- if (orgText == null) {
- return StringUtils.EMPTY;
- }
-
- final int txtLengthAllowed = SPUIDefinitions.NAME_DESCRIPTION_LENGTH;
- if (orgText.length() > txtLengthAllowed) {
- return new StringBuilder(orgText.substring(0, txtLengthAllowed)).append("...").toString();
- }
-
- return orgText;
- }
-
- /**
+ /**
* Find extra height required to increase by all the components to utilize
* the full height of browser for the responsive UI.
*
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPUIComponetIdProvider.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPUIComponetIdProvider.java
index 91f54c9c4..fa1b6759d 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPUIComponetIdProvider.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPUIComponetIdProvider.java
@@ -75,6 +75,11 @@ public final class SPUIComponetIdProvider {
*/
public static final String TARGET_TEXT_FIELD = "target.search.textfield";
+ /**
+ * ID for add target filter icon
+ */
+ public static final String TARGET_FILTER_ADD_ICON_ID = "target.filter.add.id";
+
/**
* ID-Dist.
*/
diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPUIDefinitions.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPUIDefinitions.java
index b29283ef8..75ea912a9 100644
--- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPUIDefinitions.java
+++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPUIDefinitions.java
@@ -922,6 +922,11 @@ public final class SPUIDefinitions {
*/
public static final String CUSTOM_FILTER_ASSIGNED_DS = "Assigned DS";
+ /**
+ * TARGET_FILTER_MANAGEMENT - header caption .
+ */
+ public static final String TARGET_FILTER_LIST_HEADER_CAPTION = "Custom Filters";
+
/**
* CUSTOM_FILTER_STATUS.
*/
@@ -1001,7 +1006,6 @@ public final class SPUIDefinitions {
*/
public static final String ROLLOUT_GROUP_STARTED_DATE = "Started date";
-
/**
* Rollout group status column property.
*/
diff --git a/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/hawkbittheme.scss b/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/hawkbittheme.scss
index a344cb5ae..128c66e55 100644
--- a/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/hawkbittheme.scss
+++ b/hawkbit-ui/src/main/resources/VAADIN/themes/hawkbit/hawkbittheme.scss
@@ -132,4 +132,12 @@ $v-included-components: remove($v-included-components, form);
left: 50%;
margin-left: -20px;
}
+ .v-generated-body &.v-app {
+ background-image: $app-background-image, linear-gradient(to bottom, $app-background-image-gradient) !important;
+ background-image: $app-background-image, -webkit-linear-gradient(top, $app-background-image-gradient) !important;
+ background-image: $app-background-image, -moz-linear-gradient(top, $app-background-image-gradient) !important;
+ background-position: bottom;
+ background-repeat: no-repeat;
+ }
+
}
diff --git a/pom.xml b/pom.xml
index d32d2324b..58e7b56dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -105,7 +105,6 @@
1.1
1.1.1
3.4
- 2.3
20141113
2.0.0
@@ -449,39 +448,16 @@
org.springframework.boot
spring-boot-starter-actuator
${spring.boot.version}
-
-
- org.springframework.boot
- spring-boot-starter-logging
-
-
-
-
- org.springframework.boot
- spring-boot-starter-log4j2
- ${spring.boot.version}
org.springframework.boot
spring-boot-starter-web
${spring.boot.version}
-
-
- org.springframework.boot
- spring-boot-starter-logging
-
-
org.springframework.boot
spring-boot-starter
${spring.boot.version}
-
-
- org.springframework.boot
- spring-boot-starter-logging
-
-
org.springframework.boot
@@ -557,11 +533,6 @@
commons-lang3
${commons-lang3.version}
-
- commons-lang
- commons-lang
- ${commons.lang}
-
org.springframework.boot
spring-boot-starter-test