Test and build performance improvements (#552)
* Small build perf improvements. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Remove dead code. Stabilize test. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Further optimizations Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Upgrade mariadb driver. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Raise timeouts for more robustness on slower build environments. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Move webappcontext into rest tests. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Raised timeout. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Remove test dependency on target to groups distribution order. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Code reuse. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Context available to tests. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Typos fixed. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix PollEvent send. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix typos. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Test log readability and removed unused method from CM. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Remove empty payload. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Stabilize tests. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Raised timeout. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fixed fire directory change during one test class run. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -51,10 +51,9 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||||
final Target savedTarget = testdataFactory.createTarget();
|
final Target savedTarget = testdataFactory.createTarget();
|
||||||
|
|
||||||
final Action updateAction = deploymentManagement.findActionWithDetails(
|
final Long actionId = assignDistributionSet(ds.getId(), savedTarget.getControllerId()).getActions().get(0);
|
||||||
assignDistributionSet(ds.getId(), savedTarget.getControllerId()).getActions().get(0)).get();
|
|
||||||
|
|
||||||
final Action cancelAction = deploymentManagement.cancelAction(updateAction.getId());
|
final Action cancelAction = deploymentManagement.cancelAction(actionId);
|
||||||
|
|
||||||
// controller rejects cancelation
|
// controller rejects cancelation
|
||||||
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
|
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
|
||||||
@@ -66,11 +65,12 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
final long current = System.currentTimeMillis();
|
final long current = System.currentTimeMillis();
|
||||||
|
|
||||||
// get update action anyway
|
// get update action anyway
|
||||||
mvc.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/deploymentBase/"
|
mvc.perform(
|
||||||
+ updateAction.getId(), tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON))
|
get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/deploymentBase/" + actionId,
|
||||||
|
tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
||||||
.andExpect(jsonPath("$.id", equalTo(String.valueOf(updateAction.getId()))))
|
.andExpect(jsonPath("$.id", equalTo(String.valueOf(actionId))))
|
||||||
.andExpect(jsonPath("$.deployment.download", equalTo("forced")))
|
.andExpect(jsonPath("$.deployment.download", equalTo("forced")))
|
||||||
.andExpect(jsonPath("$.deployment.update", equalTo("forced")))
|
.andExpect(jsonPath("$.deployment.update", equalTo("forced")))
|
||||||
.andExpect(jsonPath("$.deployment.chunks[?(@.part==jvm)].version",
|
.andExpect(jsonPath("$.deployment.chunks[?(@.part==jvm)].version",
|
||||||
@@ -82,8 +82,8 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
// and finish it
|
// and finish it
|
||||||
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/deploymentBase/"
|
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/deploymentBase/"
|
||||||
+ updateAction.getId() + "/feedback", tenantAware.getCurrentTenant()).content(
|
+ actionId + "/feedback", tenantAware.getCurrentTenant())
|
||||||
JsonBuilder.deploymentActionFeedback(updateAction.getId().toString(), "closed", "success"))
|
.content(JsonBuilder.deploymentActionFeedback(actionId.toString(), "closed", "success"))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
||||||
|
|
||||||
@@ -103,8 +103,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||||
final Target savedTarget = testdataFactory.createTarget();
|
final Target savedTarget = testdataFactory.createTarget();
|
||||||
|
|
||||||
final Action updateAction = deploymentManagement.findActionWithDetails(
|
final Long actionId = assignDistributionSet(ds.getId(), savedTarget.getControllerId()).getActions().get(0);
|
||||||
assignDistributionSet(ds.getId(), savedTarget.getControllerId()).getActions().get(0)).get();
|
|
||||||
|
|
||||||
long current = System.currentTimeMillis();
|
long current = System.currentTimeMillis();
|
||||||
mvc.perform(get("/{tenant}/controller/v1/{controller}", tenantAware.getCurrentTenant(),
|
mvc.perform(get("/{tenant}/controller/v1/{controller}", tenantAware.getCurrentTenant(),
|
||||||
@@ -114,7 +113,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
.andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00")))
|
.andExpect(jsonPath("$.config.polling.sleep", equalTo("00:01:00")))
|
||||||
.andExpect(jsonPath("$._links.deploymentBase.href",
|
.andExpect(jsonPath("$._links.deploymentBase.href",
|
||||||
startsWith("http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/"
|
startsWith("http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/"
|
||||||
+ TestdataFactory.DEFAULT_CONTROLLER_ID + "/deploymentBase/" + updateAction.getId())));
|
+ TestdataFactory.DEFAULT_CONTROLLER_ID + "/deploymentBase/" + actionId)));
|
||||||
Thread.sleep(1); // is required: otherwise processing the next line is
|
Thread.sleep(1); // is required: otherwise processing the next line is
|
||||||
// often too fast and
|
// often too fast and
|
||||||
// the following assert will fail
|
// the following assert will fail
|
||||||
@@ -130,7 +129,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
assertThat(activeActionsByTarget).hasSize(1);
|
assertThat(activeActionsByTarget).hasSize(1);
|
||||||
assertThat(activeActionsByTarget.get(0).getStatus()).isEqualTo(Status.RUNNING);
|
assertThat(activeActionsByTarget.get(0).getStatus()).isEqualTo(Status.RUNNING);
|
||||||
final Action cancelAction = deploymentManagement.cancelAction(updateAction.getId());
|
final Action cancelAction = deploymentManagement.cancelAction(actionId);
|
||||||
|
|
||||||
activeActionsByTarget = deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())
|
activeActionsByTarget = deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())
|
||||||
.getContent();
|
.getContent();
|
||||||
@@ -164,14 +163,14 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
||||||
.andExpect(jsonPath("$.id", equalTo(String.valueOf(cancelAction.getId()))))
|
.andExpect(jsonPath("$.id", equalTo(String.valueOf(cancelAction.getId()))))
|
||||||
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(updateAction.getId()))));
|
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId))));
|
||||||
assertThat(targetManagement.findTargetByControllerID(TestdataFactory.DEFAULT_CONTROLLER_ID).get()
|
assertThat(targetManagement.findTargetByControllerID(TestdataFactory.DEFAULT_CONTROLLER_ID).get()
|
||||||
.getLastTargetQuery()).isLessThanOrEqualTo(System.currentTimeMillis());
|
.getLastTargetQuery()).isLessThanOrEqualTo(System.currentTimeMillis());
|
||||||
|
|
||||||
// controller confirmed cancelled action, should not be active anymore
|
// controller confirmed cancelled action, should not be active anymore
|
||||||
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
|
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
|
||||||
+ cancelAction.getId() + "/feedback", tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON)
|
+ cancelAction.getId() + "/feedback", tenantAware.getCurrentTenant()).accept(MediaType.APPLICATION_JSON)
|
||||||
.content(JsonBuilder.cancelActionFeedback(updateAction.getId().toString(), "closed"))
|
.content(JsonBuilder.cancelActionFeedback(actionId.toString(), "closed"))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
||||||
|
|
||||||
@@ -220,10 +219,9 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
final Target savedTarget = testdataFactory.createTarget(targetid);
|
final Target savedTarget = testdataFactory.createTarget(targetid);
|
||||||
final List<Target> toAssign = new ArrayList<>();
|
final List<Target> toAssign = new ArrayList<>();
|
||||||
toAssign.add(savedTarget);
|
toAssign.add(savedTarget);
|
||||||
final Action updateAction = deploymentManagement
|
final Long actionId = assignDistributionSet(ds, toAssign).getActions().get(0);
|
||||||
.findActionWithDetails(assignDistributionSet(ds, toAssign).getActions().get(0)).get();
|
|
||||||
|
|
||||||
return deploymentManagement.cancelAction(updateAction.getId());
|
return deploymentManagement.cancelAction(actionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -234,13 +232,11 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
final Target savedTarget = testdataFactory.createTarget();
|
final Target savedTarget = testdataFactory.createTarget();
|
||||||
|
|
||||||
final Action updateAction = deploymentManagement
|
final Long actionId = assignDistributionSet(ds.getId(), TestdataFactory.DEFAULT_CONTROLLER_ID).getActions()
|
||||||
.findActionWithDetails(
|
.get(0);
|
||||||
assignDistributionSet(ds.getId(), TestdataFactory.DEFAULT_CONTROLLER_ID).getActions().get(0))
|
|
||||||
.get();
|
|
||||||
|
|
||||||
// cancel action manually
|
// cancel action manually
|
||||||
final Action cancelAction = deploymentManagement.cancelAction(updateAction.getId());
|
final Action cancelAction = deploymentManagement.cancelAction(actionId);
|
||||||
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(2);
|
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(2);
|
||||||
|
|
||||||
assertThat(deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())).hasSize(1);
|
assertThat(deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())).hasSize(1);
|
||||||
@@ -311,26 +307,20 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
final Target savedTarget = testdataFactory.createTarget();
|
final Target savedTarget = testdataFactory.createTarget();
|
||||||
|
|
||||||
final Action updateAction = deploymentManagement
|
final Long actionId = assignDistributionSet(ds.getId(), TestdataFactory.DEFAULT_CONTROLLER_ID).getActions()
|
||||||
.findActionWithDetails(
|
.get(0);
|
||||||
assignDistributionSet(ds.getId(), TestdataFactory.DEFAULT_CONTROLLER_ID).getActions().get(0))
|
final Long actionId2 = assignDistributionSet(ds2.getId(), TestdataFactory.DEFAULT_CONTROLLER_ID).getActions()
|
||||||
.get();
|
.get(0);
|
||||||
final Action updateAction2 = deploymentManagement
|
final Long actionId3 = assignDistributionSet(ds3.getId(), TestdataFactory.DEFAULT_CONTROLLER_ID).getActions()
|
||||||
.findActionWithDetails(
|
.get(0);
|
||||||
assignDistributionSet(ds2.getId(), TestdataFactory.DEFAULT_CONTROLLER_ID).getActions().get(0))
|
|
||||||
.get();
|
|
||||||
final Action updateAction3 = deploymentManagement
|
|
||||||
.findActionWithDetails(
|
|
||||||
assignDistributionSet(ds3.getId(), TestdataFactory.DEFAULT_CONTROLLER_ID).getActions().get(0))
|
|
||||||
.get();
|
|
||||||
|
|
||||||
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(3);
|
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(3);
|
||||||
|
|
||||||
// 3 update actions, 0 cancel actions
|
// 3 update actions, 0 cancel actions
|
||||||
assertThat(deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())).hasSize(3);
|
assertThat(deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())).hasSize(3);
|
||||||
assertThat(deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())).hasSize(3);
|
assertThat(deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())).hasSize(3);
|
||||||
final Action cancelAction = deploymentManagement.cancelAction(updateAction.getId());
|
final Action cancelAction = deploymentManagement.cancelAction(actionId);
|
||||||
final Action cancelAction2 = deploymentManagement.cancelAction(updateAction2.getId());
|
final Action cancelAction2 = deploymentManagement.cancelAction(actionId2);
|
||||||
|
|
||||||
assertThat(deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())).hasSize(3);
|
assertThat(deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())).hasSize(3);
|
||||||
assertThat(deploymentManagement.countActionsByTarget(savedTarget.getControllerId())).isEqualTo(3);
|
assertThat(deploymentManagement.countActionsByTarget(savedTarget.getControllerId())).isEqualTo(3);
|
||||||
@@ -339,7 +329,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
|
||||||
.andExpect(jsonPath("$.id", equalTo(String.valueOf(cancelAction.getId()))))
|
.andExpect(jsonPath("$.id", equalTo(String.valueOf(cancelAction.getId()))))
|
||||||
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(updateAction.getId()))));
|
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId))));
|
||||||
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(6);
|
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(6);
|
||||||
|
|
||||||
mvc.perform(get("/{tenant}/controller/v1/{controllerId}", tenantAware.getCurrentTenant(),
|
mvc.perform(get("/{tenant}/controller/v1/{controllerId}", tenantAware.getCurrentTenant(),
|
||||||
@@ -366,7 +356,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
||||||
.andExpect(jsonPath("$.id", equalTo(String.valueOf(cancelAction2.getId()))))
|
.andExpect(jsonPath("$.id", equalTo(String.valueOf(cancelAction2.getId()))))
|
||||||
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(updateAction2.getId()))));
|
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId2))));
|
||||||
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(8);
|
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(8);
|
||||||
|
|
||||||
mvc.perform(get("/{tenant}/controller/v1/{controller}", tenantAware.getCurrentTenant(),
|
mvc.perform(get("/{tenant}/controller/v1/{controller}", tenantAware.getCurrentTenant(),
|
||||||
@@ -387,15 +377,16 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
assertThat(deploymentManagement.getAssignedDistributionSet(TestdataFactory.DEFAULT_CONTROLLER_ID).get())
|
assertThat(deploymentManagement.getAssignedDistributionSet(TestdataFactory.DEFAULT_CONTROLLER_ID).get())
|
||||||
.isEqualTo(ds3);
|
.isEqualTo(ds3);
|
||||||
mvc.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/deploymentBase/"
|
mvc.perform(
|
||||||
+ updateAction3.getId(), tenantAware.getCurrentTenant())).andDo(MockMvcResultPrinter.print())
|
get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/deploymentBase/" + actionId3,
|
||||||
.andExpect(status().isOk());
|
tenantAware.getCurrentTenant()))
|
||||||
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
||||||
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(10);
|
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(10);
|
||||||
|
|
||||||
// 1 update actions, 0 cancel actions
|
// 1 update actions, 0 cancel actions
|
||||||
assertThat(deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())).hasSize(1);
|
assertThat(deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())).hasSize(1);
|
||||||
|
|
||||||
final Action cancelAction3 = deploymentManagement.cancelAction(updateAction3.getId());
|
final Action cancelAction3 = deploymentManagement.cancelAction(actionId3);
|
||||||
|
|
||||||
// action is in cancelling state
|
// action is in cancelling state
|
||||||
assertThat(deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())).hasSize(1);
|
assertThat(deploymentManagement.findActiveActionsByTarget(PAGE, savedTarget.getControllerId())).hasSize(1);
|
||||||
@@ -408,7 +399,7 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
||||||
.andExpect(jsonPath("$.id", equalTo(String.valueOf(cancelAction3.getId()))))
|
.andExpect(jsonPath("$.id", equalTo(String.valueOf(cancelAction3.getId()))))
|
||||||
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(updateAction3.getId()))));
|
.andExpect(jsonPath("$.cancelAction.stopId", equalTo(String.valueOf(actionId3))));
|
||||||
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(12);
|
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(12);
|
||||||
|
|
||||||
// now lets return feedback for the third cancelation
|
// now lets return feedback for the third cancelation
|
||||||
@@ -427,15 +418,13 @@ public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
@Description("Tests the feeback channel closing for too many feedbacks, i.e. denial of service prevention.")
|
@Description("Tests the feeback channel closing for too many feedbacks, i.e. denial of service prevention.")
|
||||||
public void tooMuchCancelActionFeedback() throws Exception {
|
public void tooMuchCancelActionFeedback() throws Exception {
|
||||||
final Target target = testdataFactory.createTarget();
|
testdataFactory.createTarget();
|
||||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||||
|
|
||||||
final Action action = deploymentManagement
|
final Long actionId = assignDistributionSet(ds.getId(), TestdataFactory.DEFAULT_CONTROLLER_ID).getActions()
|
||||||
.findActionWithDetails(
|
.get(0);
|
||||||
assignDistributionSet(ds.getId(), TestdataFactory.DEFAULT_CONTROLLER_ID).getActions().get(0))
|
|
||||||
.get();
|
|
||||||
|
|
||||||
final Action cancelAction = deploymentManagement.cancelAction(action.getId());
|
final Action cancelAction = deploymentManagement.cancelAction(actionId);
|
||||||
|
|
||||||
final String feedback = JsonBuilder.cancelActionFeedback(cancelAction.getId().toString(), "proceeding");
|
final String feedback = JsonBuilder.cancelActionFeedback(cancelAction.getId().toString(), "proceeding");
|
||||||
// assignDistributionSet creates an ActionStatus and cancel action
|
// assignDistributionSet creates an ActionStatus and cancel action
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import org.eclipse.hawkbit.repository.model.Action.Status;
|
|||||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetAssignmentResult;
|
|
||||||
import org.eclipse.hawkbit.repository.model.RepositoryModelConstants;
|
import org.eclipse.hawkbit.repository.model.RepositoryModelConstants;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
@@ -231,12 +230,8 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
|||||||
final Target target = testdataFactory.createTarget("4712");
|
final Target target = testdataFactory.createTarget("4712");
|
||||||
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
|
final DistributionSet ds = testdataFactory.createDistributionSet("", true);
|
||||||
|
|
||||||
final DistributionSetAssignmentResult result = deploymentManagement.assignDistributionSet(ds.getId(),
|
final Long actionId = deploymentManagement.assignDistributionSet(ds.getId(), ActionType.TIMEFORCED,
|
||||||
ActionType.TIMEFORCED, System.currentTimeMillis() + 2_000, Arrays.asList(target.getControllerId()));
|
System.currentTimeMillis() + 2_000, Arrays.asList(target.getControllerId())).getActions().get(0);
|
||||||
|
|
||||||
final Action action = deploymentManagement
|
|
||||||
.findActiveActionsByTarget(PAGE, result.getAssignedEntity().get(0).getControllerId()).getContent()
|
|
||||||
.get(0);
|
|
||||||
|
|
||||||
MvcResult mvcResult = mvc.perform(get("/{tenant}/controller/v1/4712", tenantAware.getCurrentTenant()))
|
MvcResult mvcResult = mvc.perform(get("/{tenant}/controller/v1/4712", tenantAware.getCurrentTenant()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
@@ -252,7 +247,7 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
|||||||
assertThat(JsonPath.compile("_links.deploymentBase.href").read(mvcResult.getResponse().getContentAsString())
|
assertThat(JsonPath.compile("_links.deploymentBase.href").read(mvcResult.getResponse().getContentAsString())
|
||||||
.toString()).isEqualTo(urlBeforeSwitch)
|
.toString()).isEqualTo(urlBeforeSwitch)
|
||||||
.startsWith("http://localhost/" + tenantAware.getCurrentTenant()
|
.startsWith("http://localhost/" + tenantAware.getCurrentTenant()
|
||||||
+ "/controller/v1/4712/deploymentBase/" + action.getId());
|
+ "/controller/v1/4712/deploymentBase/" + actionId);
|
||||||
|
|
||||||
// After the time is over we should see a new etag
|
// After the time is over we should see a new etag
|
||||||
TimeUnit.MILLISECONDS.sleep(2_000);
|
TimeUnit.MILLISECONDS.sleep(2_000);
|
||||||
@@ -521,19 +516,15 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
|||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isNotFound());
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isNotFound());
|
||||||
|
|
||||||
// wrong media type
|
// wrong media type
|
||||||
final List<Target> toAssign = new ArrayList<>();
|
final List<Target> toAssign = Arrays.asList(target);
|
||||||
toAssign.add(target);
|
|
||||||
final DistributionSet savedSet = testdataFactory.createDistributionSet("");
|
final DistributionSet savedSet = testdataFactory.createDistributionSet("");
|
||||||
|
|
||||||
final Action action1 = deploymentManagement
|
final Long actionId = assignDistributionSet(savedSet, toAssign).getActions().get(0);
|
||||||
.findActionWithDetails(assignDistributionSet(savedSet, toAssign).getActions().get(0)).get();
|
mvc.perform(get("/{tenant}/controller/v1/4712/deploymentBase/" + actionId, tenantAware.getCurrentTenant()))
|
||||||
mvc.perform(
|
|
||||||
get("/{tenant}/controller/v1/4712/deploymentBase/" + action1.getId(), tenantAware.getCurrentTenant()))
|
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
||||||
mvc.perform(
|
mvc.perform(get("/{tenant}/controller/v1/4712/deploymentBase/" + actionId, tenantAware.getCurrentTenant())
|
||||||
get("/{tenant}/controller/v1/4712/deploymentBase/" + action1.getId(), tenantAware.getCurrentTenant())
|
.accept(MediaType.APPLICATION_ATOM_XML)).andDo(MockMvcResultPrinter.print())
|
||||||
.accept(MediaType.APPLICATION_ATOM_XML))
|
.andExpect(status().isNotAcceptable());
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isNotAcceptable());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -601,12 +592,9 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
|||||||
final List<Target> toAssign = new ArrayList<>();
|
final List<Target> toAssign = new ArrayList<>();
|
||||||
toAssign.add(savedTarget1);
|
toAssign.add(savedTarget1);
|
||||||
|
|
||||||
final Action action1 = deploymentManagement
|
final Long actionId1 = assignDistributionSet(ds1.getId(), "4712").getActions().get(0);
|
||||||
.findActionWithDetails(assignDistributionSet(ds1.getId(), "4712").getActions().get(0)).get();
|
final Long actionId2 = assignDistributionSet(ds2.getId(), "4712").getActions().get(0);
|
||||||
final Action action2 = deploymentManagement
|
final Long actionId3 = assignDistributionSet(ds3.getId(), "4712").getActions().get(0);
|
||||||
.findActionWithDetails(assignDistributionSet(ds2.getId(), "4712").getActions().get(0)).get();
|
|
||||||
final Action action3 = deploymentManagement
|
|
||||||
.findActionWithDetails(assignDistributionSet(ds3.getId(), "4712").getActions().get(0)).get();
|
|
||||||
|
|
||||||
Target myT = targetManagement.findTargetByControllerID("4712").get();
|
Target myT = targetManagement.findTargetByControllerID("4712").get();
|
||||||
assertThat(myT.getUpdateStatus()).isEqualTo(TargetUpdateStatus.PENDING);
|
assertThat(myT.getUpdateStatus()).isEqualTo(TargetUpdateStatus.PENDING);
|
||||||
@@ -618,9 +606,9 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
|||||||
|
|
||||||
// action1 done
|
// action1 done
|
||||||
|
|
||||||
mvc.perform(post("/{tenant}/controller/v1/4712/deploymentBase/" + action1.getId() + "/feedback",
|
mvc.perform(post("/{tenant}/controller/v1/4712/deploymentBase/" + actionId1 + "/feedback",
|
||||||
tenantAware.getCurrentTenant())
|
tenantAware.getCurrentTenant())
|
||||||
.content(JsonBuilder.deploymentActionFeedback(action1.getId().toString(), "closed"))
|
.content(JsonBuilder.deploymentActionFeedback(actionId1.toString(), "closed"))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
||||||
myT = targetManagement.findTargetByControllerID("4712").get();
|
myT = targetManagement.findTargetByControllerID("4712").get();
|
||||||
@@ -635,9 +623,9 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
|||||||
assertThat(actionStatusMessages.iterator().next().getStatus()).isEqualTo(Status.FINISHED);
|
assertThat(actionStatusMessages.iterator().next().getStatus()).isEqualTo(Status.FINISHED);
|
||||||
|
|
||||||
// action2 done
|
// action2 done
|
||||||
mvc.perform(post("/{tenant}/controller/v1/4712/deploymentBase/" + action2.getId() + "/feedback",
|
mvc.perform(post("/{tenant}/controller/v1/4712/deploymentBase/" + actionId2 + "/feedback",
|
||||||
tenantAware.getCurrentTenant())
|
tenantAware.getCurrentTenant())
|
||||||
.content(JsonBuilder.deploymentActionFeedback(action2.getId().toString(), "closed"))
|
.content(JsonBuilder.deploymentActionFeedback(actionId2.toString(), "closed"))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
||||||
myT = targetManagement.findTargetByControllerID("4712").get();
|
myT = targetManagement.findTargetByControllerID("4712").get();
|
||||||
@@ -652,9 +640,9 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
|||||||
assertThat(actionStatusMessages).haveAtLeast(1, new ActionStatusCondition(Status.FINISHED));
|
assertThat(actionStatusMessages).haveAtLeast(1, new ActionStatusCondition(Status.FINISHED));
|
||||||
|
|
||||||
// action3 done
|
// action3 done
|
||||||
mvc.perform(post("/{tenant}/controller/v1/4712/deploymentBase/" + action3.getId() + "/feedback",
|
mvc.perform(post("/{tenant}/controller/v1/4712/deploymentBase/" + actionId3 + "/feedback",
|
||||||
tenantAware.getCurrentTenant())
|
tenantAware.getCurrentTenant())
|
||||||
.content(JsonBuilder.deploymentActionFeedback(action3.getId().toString(), "closed"))
|
.content(JsonBuilder.deploymentActionFeedback(actionId3.toString(), "closed"))
|
||||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
||||||
myT = targetManagement.findTargetByControllerID("4712").get();
|
myT = targetManagement.findTargetByControllerID("4712").get();
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.springframework.test.context.ActiveProfiles;
|
|||||||
import org.springframework.test.web.servlet.MvcResult;
|
import org.springframework.test.web.servlet.MvcResult;
|
||||||
import org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder;
|
import org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder;
|
||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||||
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
|
|
||||||
import com.google.common.net.HttpHeaders;
|
import com.google.common.net.HttpHeaders;
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
public class DosFilterTest extends AbstractDDiApiIntegrationTest {
|
public class DosFilterTest extends AbstractDDiApiIntegrationTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DefaultMockMvcBuilder createMvcWebAppContext() {
|
protected DefaultMockMvcBuilder createMvcWebAppContext(final WebApplicationContext context) {
|
||||||
return MockMvcBuilders.webAppContextSetup(context)
|
return MockMvcBuilders.webAppContextSetup(context)
|
||||||
.addFilter(new DosFilter(null, 10, 10, "127\\.0\\.0\\.1|\\[0:0:0:0:0:0:0:1\\]", "(^192\\.168\\.)",
|
.addFilter(new DosFilter(null, 10, 10, "127\\.0\\.0\\.1|\\[0:0:0:0:0:0:0:1\\]", "(^192\\.168\\.)",
|
||||||
"X-Forwarded-For"))
|
"X-Forwarded-For"))
|
||||||
|
|||||||
1
hawkbit-dmf/hawkbit-dmf-amqp/.gitignore
vendored
Normal file
1
hawkbit-dmf/hawkbit-dmf-amqp/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/artifactrepo/
|
||||||
@@ -37,6 +37,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
@Features("Component Tests - Device Management Federation API")
|
@Features("Component Tests - Device Management Federation API")
|
||||||
@Stories("Amqp Message Dispatcher Service")
|
@Stories("Amqp Message Dispatcher Service")
|
||||||
public class AmqpMessageDispatcherServiceIntegrationTest extends AmqpServiceIntegrationTest {
|
public class AmqpMessageDispatcherServiceIntegrationTest extends AmqpServiceIntegrationTest {
|
||||||
|
private static final String TARGET_PREFIX = "Dmf_disp_";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verify that a distribution assignment send a download and install message.")
|
@Description("Verify that a distribution assignment send a download and install message.")
|
||||||
@@ -47,11 +48,12 @@ public class AmqpMessageDispatcherServiceIntegrationTest extends AmqpServiceInte
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 2) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 2) })
|
||||||
public void sendDownloadAndInstallStatus() {
|
public void sendDownloadAndInstallStatus() {
|
||||||
registerTargetAndAssignDistributionSet();
|
final String controllerId = TARGET_PREFIX + "sendDownloadAndInstallStatus";
|
||||||
|
registerTargetAndAssignDistributionSet(controllerId);
|
||||||
|
|
||||||
createAndSendTarget(TENANT_EXIST);
|
createAndSendTarget(controllerId, TENANT_EXIST);
|
||||||
waitUntilTargetStatusIsPending();
|
waitUntilTargetStatusIsPending(controllerId);
|
||||||
assertDownloadAndInstallMessage(getDistributionSet().getModules());
|
assertDownloadAndInstallMessage(getDistributionSet().getModules(), controllerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -64,16 +66,18 @@ public class AmqpMessageDispatcherServiceIntegrationTest extends AmqpServiceInte
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2), @Expect(type = TargetPollEvent.class, count = 3) })
|
@Expect(type = TargetUpdatedEvent.class, count = 2), @Expect(type = TargetPollEvent.class, count = 3) })
|
||||||
public void assignDistributionSetMultipleTimes() {
|
public void assignDistributionSetMultipleTimes() {
|
||||||
final DistributionSetAssignmentResult assignmentResult = registerTargetAndAssignDistributionSet();
|
final String controllerId = TARGET_PREFIX + "assignDistributionSetMultipleTimes";
|
||||||
|
|
||||||
|
final DistributionSetAssignmentResult assignmentResult = registerTargetAndAssignDistributionSet(controllerId);
|
||||||
|
|
||||||
final DistributionSet distributionSet2 = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
|
final DistributionSet distributionSet2 = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
|
||||||
registerTargetAndAssignDistributionSet(distributionSet2.getId(), TargetUpdateStatus.PENDING,
|
registerTargetAndAssignDistributionSet(distributionSet2.getId(), TargetUpdateStatus.PENDING,
|
||||||
getDistributionSet().getModules());
|
getDistributionSet().getModules(), controllerId);
|
||||||
assertCancelActionMessage(assignmentResult.getActions().get(0));
|
assertCancelActionMessage(assignmentResult.getActions().get(0), controllerId);
|
||||||
|
|
||||||
createAndSendTarget(TENANT_EXIST);
|
createAndSendTarget(controllerId, TENANT_EXIST);
|
||||||
waitUntilTargetStatusIsPending();
|
waitUntilTargetStatusIsPending(controllerId);
|
||||||
assertCancelActionMessage(assignmentResult.getActions().get(0));
|
assertCancelActionMessage(assignmentResult.getActions().get(0), controllerId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,11 +91,13 @@ public class AmqpMessageDispatcherServiceIntegrationTest extends AmqpServiceInte
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 2) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 2) })
|
||||||
public void sendCancelStatus() {
|
public void sendCancelStatus() {
|
||||||
final Long actionId = registerTargetAndCancelActionId();
|
final String controllerId = TARGET_PREFIX + "sendCancelStatus";
|
||||||
|
|
||||||
createAndSendTarget(TENANT_EXIST);
|
final Long actionId = registerTargetAndCancelActionId(controllerId);
|
||||||
waitUntilTargetStatusIsPending();
|
|
||||||
assertCancelActionMessage(actionId);
|
createAndSendTarget(controllerId, TENANT_EXIST);
|
||||||
|
waitUntilTargetStatusIsPending(controllerId);
|
||||||
|
assertCancelActionMessage(actionId, controllerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -99,16 +105,16 @@ public class AmqpMessageDispatcherServiceIntegrationTest extends AmqpServiceInte
|
|||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 1), @Expect(type = TargetDeletedEvent.class, count = 1) })
|
@Expect(type = TargetPollEvent.class, count = 1), @Expect(type = TargetDeletedEvent.class, count = 1) })
|
||||||
public void sendDeleteMessage() {
|
public void sendDeleteMessage() {
|
||||||
|
final String controllerId = TARGET_PREFIX + "sendDeleteMessage";
|
||||||
|
|
||||||
registerAndAssertTargetWithExistingTenant(REGISTER_TARGET, 1);
|
registerAndAssertTargetWithExistingTenant(controllerId, 1);
|
||||||
targetManagement.deleteTarget(REGISTER_TARGET);
|
targetManagement.deleteTarget(controllerId);
|
||||||
assertDeleteMessage(REGISTER_TARGET);
|
assertDeleteMessage(controllerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitUntilTargetStatusIsPending() {
|
private void waitUntilTargetStatusIsPending(final String controllerId) {
|
||||||
waitUntil(() -> {
|
waitUntil(() -> {
|
||||||
final Optional<Target> findTargetByControllerID = targetManagement
|
final Optional<Target> findTargetByControllerID = targetManagement.findTargetByControllerID(controllerId);
|
||||||
.findTargetByControllerID(REGISTER_TARGET);
|
|
||||||
return findTargetByControllerID.isPresent()
|
return findTargetByControllerID.isPresent()
|
||||||
&& TargetUpdateStatus.PENDING.equals(findTargetByControllerID.get().getUpdateStatus());
|
&& TargetUpdateStatus.PENDING.equals(findTargetByControllerID.get().getUpdateStatus());
|
||||||
});
|
});
|
||||||
@@ -119,9 +125,4 @@ public class AmqpMessageDispatcherServiceIntegrationTest extends AmqpServiceInte
|
|||||||
return securityRule.runAsPrivileged(callable);
|
return securityRule.runAsPrivileged(callable);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createAndSendTarget(final String tenant) {
|
|
||||||
createAndSendTarget(REGISTER_TARGET, tenant);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ import org.eclipse.hawkbit.repository.event.remote.entity.SoftwareModuleCreatedE
|
|||||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
||||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetUpdatedEvent;
|
import org.eclipse.hawkbit.repository.event.remote.entity.TargetUpdatedEvent;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||||
|
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetAssignmentResult;
|
import org.eclipse.hawkbit.repository.model.DistributionSetAssignmentResult;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
import org.eclipse.hawkbit.repository.test.matcher.Expect;
|
import org.eclipse.hawkbit.repository.test.matcher.Expect;
|
||||||
import org.eclipse.hawkbit.repository.test.matcher.ExpectEvents;
|
import org.eclipse.hawkbit.repository.test.matcher.ExpectEvents;
|
||||||
@@ -54,6 +54,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
@Stories("Amqp Message Handler Service")
|
@Stories("Amqp Message Handler Service")
|
||||||
public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegrationTest {
|
public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegrationTest {
|
||||||
private static final String CORRELATION_ID = UUID.randomUUID().toString();
|
private static final String CORRELATION_ID = UUID.randomUUID().toString();
|
||||||
|
private static final String TARGET_PREFIX = "Dmf_hand_";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AmqpProperties amqpProperties;
|
private AmqpProperties amqpProperties;
|
||||||
@@ -63,12 +64,13 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 2),
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 2),
|
||||||
@Expect(type = TargetPollEvent.class, count = 3) })
|
@Expect(type = TargetPollEvent.class, count = 3) })
|
||||||
public void registerTargets() {
|
public void registerTargets() {
|
||||||
registerAndAssertTargetWithExistingTenant(REGISTER_TARGET, 1);
|
final String controllerId = TARGET_PREFIX + "registerTargets";
|
||||||
|
registerAndAssertTargetWithExistingTenant(controllerId, 1);
|
||||||
|
|
||||||
final String target2 = "Target2";
|
final String target2 = "Target2";
|
||||||
registerAndAssertTargetWithExistingTenant(target2, 2);
|
registerAndAssertTargetWithExistingTenant(target2, 2);
|
||||||
final Long pollingTimeTarget2 = controllerManagement.findByControllerId(target2).get().getLastTargetQuery();
|
|
||||||
registerSameTargetAndAssertBasedOnLastPolling(target2, 2, TargetUpdateStatus.REGISTERED, pollingTimeTarget2);
|
registerSameTargetAndAssertBasedOnVersion(target2, 2, TargetUpdateStatus.REGISTERED);
|
||||||
Mockito.verifyZeroInteractions(getDeadletterListener());
|
Mockito.verifyZeroInteractions(getDeadletterListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +108,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Description("Tests not allowed content-type in message. This message should forwarded to the deadletter queue")
|
@Description("Tests not allowed content-type in message. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
||||||
public void wrongContentType() {
|
public void wrongContentType() {
|
||||||
final Message createTargetMessage = createTargetMessage(REGISTER_TARGET, TENANT_EXIST);
|
final String controllerId = TARGET_PREFIX + "wrongContentType";
|
||||||
|
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
|
||||||
createTargetMessage.getMessageProperties().setContentType("WrongContentType");
|
createTargetMessage.getMessageProperties().setContentType("WrongContentType");
|
||||||
getDmfClient().send(createTargetMessage);
|
getDmfClient().send(createTargetMessage);
|
||||||
|
|
||||||
@@ -118,7 +121,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Description("Tests null reply to property in message header. This message should forwarded to the deadletter queue")
|
@Description("Tests null reply to property in message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
||||||
public void missingReplyToProperty() {
|
public void missingReplyToProperty() {
|
||||||
final Message createTargetMessage = createTargetMessage(REGISTER_TARGET, TENANT_EXIST);
|
final String controllerId = TARGET_PREFIX + "missingReplyToProperty";
|
||||||
|
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
|
||||||
createTargetMessage.getMessageProperties().setReplyTo(null);
|
createTargetMessage.getMessageProperties().setReplyTo(null);
|
||||||
getDmfClient().send(createTargetMessage);
|
getDmfClient().send(createTargetMessage);
|
||||||
|
|
||||||
@@ -130,7 +134,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Description("Tests missing reply to property in message header. This message should forwarded to the deadletter queue")
|
@Description("Tests missing reply to property in message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
||||||
public void emptyReplyToProperty() {
|
public void emptyReplyToProperty() {
|
||||||
final Message createTargetMessage = createTargetMessage(REGISTER_TARGET, TENANT_EXIST);
|
final String controllerId = TARGET_PREFIX + "emptyReplyToProperty";
|
||||||
|
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
|
||||||
createTargetMessage.getMessageProperties().setReplyTo("");
|
createTargetMessage.getMessageProperties().setReplyTo("");
|
||||||
getDmfClient().send(createTargetMessage);
|
getDmfClient().send(createTargetMessage);
|
||||||
|
|
||||||
@@ -165,7 +170,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Description("Tests missing tenant message header. This message should forwarded to the deadletter queue")
|
@Description("Tests missing tenant message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
||||||
public void missingTenantHeader() {
|
public void missingTenantHeader() {
|
||||||
final Message createTargetMessage = createTargetMessage(REGISTER_TARGET, TENANT_EXIST);
|
final String controllerId = TARGET_PREFIX + "missingTenantHeader";
|
||||||
|
final Message createTargetMessage = createTargetMessage(controllerId, TENANT_EXIST);
|
||||||
createTargetMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.TENANT);
|
createTargetMessage.getMessageProperties().getHeaders().remove(MessageHeaderKey.TENANT);
|
||||||
getDmfClient().send(createTargetMessage);
|
getDmfClient().send(createTargetMessage);
|
||||||
|
|
||||||
@@ -177,7 +183,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Description("Tests null tenant message header. This message should forwarded to the deadletter queue")
|
@Description("Tests null tenant message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
||||||
public void nullTenantHeader() {
|
public void nullTenantHeader() {
|
||||||
final Message createTargetMessage = createTargetMessage(REGISTER_TARGET, null);
|
final String controllerId = TARGET_PREFIX + "nullTenantHeader";
|
||||||
|
final Message createTargetMessage = createTargetMessage(controllerId, null);
|
||||||
getDmfClient().send(createTargetMessage);
|
getDmfClient().send(createTargetMessage);
|
||||||
|
|
||||||
verifyOneDeadLetterMessage();
|
verifyOneDeadLetterMessage();
|
||||||
@@ -188,7 +195,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Description("Tests empty tenant message header. This message should forwarded to the deadletter queue")
|
@Description("Tests empty tenant message header. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
||||||
public void emptyTenantHeader() {
|
public void emptyTenantHeader() {
|
||||||
final Message createTargetMessage = createTargetMessage(REGISTER_TARGET, "");
|
final String controllerId = TARGET_PREFIX + "emptyTenantHeader";
|
||||||
|
final Message createTargetMessage = createTargetMessage(controllerId, "");
|
||||||
getDmfClient().send(createTargetMessage);
|
getDmfClient().send(createTargetMessage);
|
||||||
|
|
||||||
verifyOneDeadLetterMessage();
|
verifyOneDeadLetterMessage();
|
||||||
@@ -199,7 +207,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Description("Tests tenant not exist. This message should forwarded to the deadletter queue")
|
@Description("Tests tenant not exist. This message should forwarded to the deadletter queue")
|
||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 0) })
|
||||||
public void tenantNotExist() {
|
public void tenantNotExist() {
|
||||||
final Message createTargetMessage = createTargetMessage(REGISTER_TARGET, "TenantNotExist");
|
final String controllerId = TARGET_PREFIX + "tenantNotExist";
|
||||||
|
final Message createTargetMessage = createTargetMessage(controllerId, "TenantNotExist");
|
||||||
getDmfClient().send(createTargetMessage);
|
getDmfClient().send(createTargetMessage);
|
||||||
|
|
||||||
verifyOneDeadLetterMessage();
|
verifyOneDeadLetterMessage();
|
||||||
@@ -346,7 +355,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 2), @Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
public void finishActionStatus() {
|
public void finishActionStatus() {
|
||||||
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.FINISHED, Status.FINISHED);
|
final String controllerId = TARGET_PREFIX + "finishActionStatus";
|
||||||
|
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.FINISHED, Status.FINISHED, controllerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -358,7 +368,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
public void runningActionStatus() {
|
public void runningActionStatus() {
|
||||||
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.RUNNING, Status.RUNNING);
|
final String controllerId = TARGET_PREFIX + "runningActionStatus";
|
||||||
|
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.RUNNING, Status.RUNNING, controllerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -370,7 +381,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
public void downloadActionStatus() {
|
public void downloadActionStatus() {
|
||||||
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.DOWNLOAD, Status.DOWNLOAD);
|
final String controllerId = TARGET_PREFIX + "downloadActionStatus";
|
||||||
|
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.DOWNLOAD, Status.DOWNLOAD, controllerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -382,7 +394,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 2), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 2), @Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
public void errorActionStatus() {
|
public void errorActionStatus() {
|
||||||
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.ERROR, Status.ERROR);
|
final String controllerId = TARGET_PREFIX + "errorActionStatus";
|
||||||
|
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.ERROR, Status.ERROR, controllerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -394,7 +407,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
public void warningActionStatus() {
|
public void warningActionStatus() {
|
||||||
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.WARNING, Status.WARNING);
|
final String controllerId = TARGET_PREFIX + "warningActionStatus";
|
||||||
|
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.WARNING, Status.WARNING, controllerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -406,7 +420,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
public void retrievedActionStatus() {
|
public void retrievedActionStatus() {
|
||||||
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.RETRIEVED, Status.RETRIEVED);
|
final String controllerId = TARGET_PREFIX + "retrievedActionStatus";
|
||||||
|
registerTargetAndSendAndAssertUpdateActionStatus(DmfActionStatus.RETRIEVED, Status.RETRIEVED, controllerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -418,7 +433,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
public void cancelNotAllowActionStatus() {
|
public void cancelNotAllowActionStatus() {
|
||||||
registerTargetAndSendActionStatus(DmfActionStatus.CANCELED);
|
final String controllerId = TARGET_PREFIX + "cancelNotAllowActionStatus";
|
||||||
|
registerTargetAndSendActionStatus(DmfActionStatus.CANCELED, controllerId);
|
||||||
verifyOneDeadLetterMessage();
|
verifyOneDeadLetterMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,17 +447,18 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 2) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 2) })
|
||||||
public void receiveDownLoadAndInstallMessageAfterAssignment() {
|
public void receiveDownLoadAndInstallMessageAfterAssignment() {
|
||||||
|
final String controllerId = TARGET_PREFIX + "receiveDownLoadAndInstallMessageAfterAssignment";
|
||||||
|
|
||||||
// setup
|
// setup
|
||||||
controllerManagement.findOrRegisterTargetIfItDoesNotexist(REGISTER_TARGET, TEST_URI);
|
controllerManagement.findOrRegisterTargetIfItDoesNotexist(controllerId, TEST_URI);
|
||||||
final DistributionSet distributionSet = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
|
final DistributionSet distributionSet = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
|
||||||
assignDistributionSet(distributionSet.getId(), REGISTER_TARGET);
|
assignDistributionSet(distributionSet.getId(), controllerId);
|
||||||
|
|
||||||
// test
|
// test
|
||||||
registerAndAssertTargetWithExistingTenant(REGISTER_TARGET, 1, TargetUpdateStatus.PENDING, "bumlux");
|
registerSameTargetAndAssertBasedOnVersion(controllerId, 1, TargetUpdateStatus.PENDING);
|
||||||
|
|
||||||
// verify
|
// verify
|
||||||
assertDownloadAndInstallMessage(distributionSet.getModules());
|
assertDownloadAndInstallMessage(distributionSet.getModules(), controllerId);
|
||||||
Mockito.verifyZeroInteractions(getDeadletterListener());
|
Mockito.verifyZeroInteractions(getDeadletterListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,20 +473,20 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
@Expect(type = ActionUpdatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 2) })
|
@Expect(type = TargetPollEvent.class, count = 2) })
|
||||||
public void receiveCancelUpdateMessageAfterAssignmentWasCanceled() {
|
public void receiveCancelUpdateMessageAfterAssignmentWasCanceled() {
|
||||||
|
final String controllerId = TARGET_PREFIX + "receiveCancelUpdateMessageAfterAssignmentWasCanceled";
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotexist(REGISTER_TARGET, TEST_URI);
|
controllerManagement.findOrRegisterTargetIfItDoesNotexist(controllerId, TEST_URI);
|
||||||
final DistributionSet distributionSet = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
|
final DistributionSet distributionSet = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
|
||||||
final DistributionSetAssignmentResult distributionSetAssignmentResult = assignDistributionSet(
|
final DistributionSetAssignmentResult distributionSetAssignmentResult = assignDistributionSet(
|
||||||
distributionSet.getId(), REGISTER_TARGET);
|
distributionSet.getId(), controllerId);
|
||||||
deploymentManagement.cancelAction(distributionSetAssignmentResult.getActions().get(0));
|
deploymentManagement.cancelAction(distributionSetAssignmentResult.getActions().get(0));
|
||||||
|
|
||||||
// test
|
// test
|
||||||
registerSameTargetAndAssertBasedOnLastPolling(REGISTER_TARGET, 1, TargetUpdateStatus.PENDING,
|
registerSameTargetAndAssertBasedOnVersion(controllerId, 1, TargetUpdateStatus.PENDING);
|
||||||
target.getLastTargetQuery());
|
|
||||||
|
|
||||||
// verify
|
// verify
|
||||||
assertCancelActionMessage(distributionSetAssignmentResult.getActions().get(0));
|
assertCancelActionMessage(distributionSetAssignmentResult.getActions().get(0), controllerId);
|
||||||
Mockito.verifyZeroInteractions(getDeadletterListener());
|
Mockito.verifyZeroInteractions(getDeadletterListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,7 +500,9 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
public void actionNotExists() {
|
public void actionNotExists() {
|
||||||
final Long actionId = registerTargetAndCancelActionId();
|
final String controllerId = TARGET_PREFIX + "actionNotExists";
|
||||||
|
|
||||||
|
final Long actionId = registerTargetAndCancelActionId(controllerId);
|
||||||
final Long actionNotExist = actionId + 1;
|
final Long actionNotExist = actionId + 1;
|
||||||
|
|
||||||
sendActionUpdateStatus(new DmfActionUpdateStatus(actionNotExist, DmfActionStatus.CANCELED));
|
sendActionUpdateStatus(new DmfActionUpdateStatus(actionNotExist, DmfActionStatus.CANCELED));
|
||||||
@@ -499,7 +518,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
public void canceledRejectedNotAllowActionStatus() {
|
public void canceledRejectedNotAllowActionStatus() {
|
||||||
registerTargetAndSendActionStatus(DmfActionStatus.CANCEL_REJECTED);
|
final String controllerId = TARGET_PREFIX + "canceledRejectedNotAllowActionStatus";
|
||||||
|
registerTargetAndSendActionStatus(DmfActionStatus.CANCEL_REJECTED, controllerId);
|
||||||
verifyOneDeadLetterMessage();
|
verifyOneDeadLetterMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,7 +533,9 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
public void canceledRejectedActionStatus() {
|
public void canceledRejectedActionStatus() {
|
||||||
final Long actionId = registerTargetAndCancelActionId();
|
final String controllerId = TARGET_PREFIX + "canceledRejectedActionStatus";
|
||||||
|
|
||||||
|
final Long actionId = registerTargetAndCancelActionId(controllerId);
|
||||||
|
|
||||||
sendActionUpdateStatus(new DmfActionUpdateStatus(actionId, DmfActionStatus.CANCEL_REJECTED));
|
sendActionUpdateStatus(new DmfActionUpdateStatus(actionId, DmfActionStatus.CANCEL_REJECTED));
|
||||||
assertAction(actionId, 1, Status.RUNNING, Status.CANCELING, Status.CANCEL_REJECTED);
|
assertAction(actionId, 1, Status.RUNNING, Status.CANCELING, Status.CANCEL_REJECTED);
|
||||||
@@ -524,19 +546,19 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 1), @Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
public void updateAttributes() {
|
public void updateAttributes() {
|
||||||
|
final String controllerId = TARGET_PREFIX + "updateAttributes";
|
||||||
|
|
||||||
// setup
|
// setup
|
||||||
final String target = "ControllerAttributeTestTarget";
|
registerAndAssertTargetWithExistingTenant(controllerId, 1);
|
||||||
registerAndAssertTargetWithExistingTenant(target, 1);
|
|
||||||
final DmfAttributeUpdate controllerAttribute = new DmfAttributeUpdate();
|
final DmfAttributeUpdate controllerAttribute = new DmfAttributeUpdate();
|
||||||
controllerAttribute.getAttributes().put("test1", "testA");
|
controllerAttribute.getAttributes().put("test1", "testA");
|
||||||
controllerAttribute.getAttributes().put("test2", "testB");
|
controllerAttribute.getAttributes().put("test2", "testB");
|
||||||
|
|
||||||
// test
|
// test
|
||||||
sendUpdateAttributeMessage(target, TENANT_EXIST, controllerAttribute);
|
sendUpdateAttributeMessage(controllerId, TENANT_EXIST, controllerAttribute);
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
assertUpdateAttributes(target, controllerAttribute.getAttributes());
|
assertUpdateAttributes(controllerId, controllerAttribute.getAttributes());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -544,10 +566,10 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetUpdatedEvent.class, count = 0), @Expect(type = TargetPollEvent.class, count = 1) })
|
@Expect(type = TargetUpdatedEvent.class, count = 0), @Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
public void updateAttributesWithNoThingId() {
|
public void updateAttributesWithNoThingId() {
|
||||||
|
final String controllerId = TARGET_PREFIX + "updateAttributesWithNoThingId";
|
||||||
|
|
||||||
// setup
|
// setup
|
||||||
final String target = "ControllerAttributeTestTarget";
|
registerAndAssertTargetWithExistingTenant(controllerId, 1);
|
||||||
registerAndAssertTargetWithExistingTenant(target, 1);
|
|
||||||
final DmfAttributeUpdate controllerAttribute = new DmfAttributeUpdate();
|
final DmfAttributeUpdate controllerAttribute = new DmfAttributeUpdate();
|
||||||
controllerAttribute.getAttributes().put("test1", "testA");
|
controllerAttribute.getAttributes().put("test1", "testA");
|
||||||
controllerAttribute.getAttributes().put("test2", "testB");
|
controllerAttribute.getAttributes().put("test2", "testB");
|
||||||
@@ -561,7 +583,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
// verify
|
// verify
|
||||||
verifyOneDeadLetterMessage();
|
verifyOneDeadLetterMessage();
|
||||||
final DmfAttributeUpdate controllerAttributeEmpty = new DmfAttributeUpdate();
|
final DmfAttributeUpdate controllerAttributeEmpty = new DmfAttributeUpdate();
|
||||||
assertUpdateAttributes(target, controllerAttributeEmpty.getAttributes());
|
assertUpdateAttributes(controllerId, controllerAttributeEmpty.getAttributes());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -586,8 +608,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
verifyOneDeadLetterMessage();
|
verifyOneDeadLetterMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Long registerTargetAndSendActionStatus(final DmfActionStatus sendActionStatus) {
|
private Long registerTargetAndSendActionStatus(final DmfActionStatus sendActionStatus, final String controllerId) {
|
||||||
final DistributionSetAssignmentResult assignmentResult = registerTargetAndAssignDistributionSet();
|
final DistributionSetAssignmentResult assignmentResult = registerTargetAndAssignDistributionSet(controllerId);
|
||||||
final Long actionId = assignmentResult.getActions().get(0);
|
final Long actionId = assignmentResult.getActions().get(0);
|
||||||
sendActionUpdateStatus(new DmfActionUpdateStatus(actionId, sendActionStatus));
|
sendActionUpdateStatus(new DmfActionUpdateStatus(actionId, sendActionStatus));
|
||||||
return actionId;
|
return actionId;
|
||||||
@@ -599,8 +621,8 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void registerTargetAndSendAndAssertUpdateActionStatus(final DmfActionStatus sendActionStatus,
|
private void registerTargetAndSendAndAssertUpdateActionStatus(final DmfActionStatus sendActionStatus,
|
||||||
final Status expectedActionStatus) {
|
final Status expectedActionStatus, final String controllerId) {
|
||||||
final Long actionId = registerTargetAndSendActionStatus(sendActionStatus);
|
final Long actionId = registerTargetAndSendActionStatus(sendActionStatus, controllerId);
|
||||||
assertAction(actionId, 1, Status.RUNNING, expectedActionStatus);
|
assertAction(actionId, 1, Status.RUNNING, expectedActionStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,7 +630,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
createConditionFactory().await().until(() -> {
|
createConditionFactory().await().until(() -> {
|
||||||
try {
|
try {
|
||||||
securityRule.runAsPrivileged(() -> {
|
securityRule.runAsPrivileged(() -> {
|
||||||
final List<org.eclipse.hawkbit.repository.model.ActionStatus> actionStatusList = deploymentManagement
|
final List<ActionStatus> actionStatusList = deploymentManagement
|
||||||
.findActionStatusByAction(PAGE, actionId).getContent();
|
.findActionStatusByAction(PAGE, actionId).getContent();
|
||||||
|
|
||||||
// Check correlation ID
|
// Check correlation ID
|
||||||
@@ -623,7 +645,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
|
|||||||
assertThat(messagesFromServer).hasSize(messages)
|
assertThat(messagesFromServer).hasSize(messages)
|
||||||
.allMatch(message -> message.endsWith(CORRELATION_ID));
|
.allMatch(message -> message.endsWith(CORRELATION_ID));
|
||||||
|
|
||||||
final List<Status> status = actionStatusList.stream().map(actionStatus -> actionStatus.getStatus())
|
final List<Status> status = actionStatusList.stream().map(ActionStatus::getStatus)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
assertThat(status).containsOnly(expectedActionStates);
|
assertThat(status).containsOnly(expectedActionStates);
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ import org.springframework.boot.test.SpringApplicationConfiguration;
|
|||||||
public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegrationTest {
|
public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegrationTest {
|
||||||
|
|
||||||
protected static final String TENANT_EXIST = "DEFAULT";
|
protected static final String TENANT_EXIST = "DEFAULT";
|
||||||
protected static final String REGISTER_TARGET = "NewDmfTarget";
|
|
||||||
protected static final String CREATED_BY = "CONTROLLER_PLUG_AND_PLAY";
|
protected static final String CREATED_BY = "CONTROLLER_PLUG_AND_PLAY";
|
||||||
|
|
||||||
private DeadletterListener deadletterListener;
|
private DeadletterListener deadletterListener;
|
||||||
@@ -105,23 +104,24 @@ public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegration
|
|||||||
return distributionSet;
|
return distributionSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DistributionSetAssignmentResult registerTargetAndAssignDistributionSet() {
|
protected DistributionSetAssignmentResult registerTargetAndAssignDistributionSet(final String controllerId) {
|
||||||
distributionSet = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
|
distributionSet = testdataFactory.createDistributionSet(UUID.randomUUID().toString());
|
||||||
return registerTargetAndAssignDistributionSet(distributionSet.getId(), TargetUpdateStatus.REGISTERED,
|
return registerTargetAndAssignDistributionSet(distributionSet.getId(), TargetUpdateStatus.REGISTERED,
|
||||||
distributionSet.getModules());
|
distributionSet.getModules(), controllerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DistributionSetAssignmentResult registerTargetAndAssignDistributionSet(final Long assignDs,
|
protected DistributionSetAssignmentResult registerTargetAndAssignDistributionSet(final Long assignDs,
|
||||||
final TargetUpdateStatus expectedStatus, final Set<SoftwareModule> expectedSoftwareModulesInMessage) {
|
final TargetUpdateStatus expectedStatus, final Set<SoftwareModule> expectedSoftwareModulesInMessage,
|
||||||
registerAndAssertTargetWithExistingTenant(REGISTER_TARGET, 1, expectedStatus, CREATED_BY);
|
final String controllerId) {
|
||||||
|
registerAndAssertTargetWithExistingTenant(controllerId, 1, expectedStatus, CREATED_BY);
|
||||||
|
|
||||||
final DistributionSetAssignmentResult assignmentResult = assignDistributionSet(assignDs, REGISTER_TARGET);
|
final DistributionSetAssignmentResult assignmentResult = assignDistributionSet(assignDs, controllerId);
|
||||||
assertDownloadAndInstallMessage(expectedSoftwareModulesInMessage);
|
assertDownloadAndInstallMessage(expectedSoftwareModulesInMessage, controllerId);
|
||||||
return assignmentResult;
|
return assignmentResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertCancelActionMessage(final Long actionId) {
|
protected void assertCancelActionMessage(final Long actionId, final String controllerId) {
|
||||||
final Message replyMessage = assertReplyMessageHeader(EventTopic.CANCEL_DOWNLOAD);
|
final Message replyMessage = assertReplyMessageHeader(EventTopic.CANCEL_DOWNLOAD, controllerId);
|
||||||
|
|
||||||
final Long actionUpdateStatus = (Long) getDmfClient().getMessageConverter().fromMessage(replyMessage);
|
final Long actionUpdateStatus = (Long) getDmfClient().getMessageConverter().fromMessage(replyMessage);
|
||||||
assertThat(actionUpdateStatus).isEqualTo(actionId);
|
assertThat(actionUpdateStatus).isEqualTo(actionId);
|
||||||
@@ -138,8 +138,8 @@ public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegration
|
|||||||
assertThat(headers.get(MessageHeaderKey.TYPE)).isEqualTo(MessageType.THING_DELETED.toString());
|
assertThat(headers.get(MessageHeaderKey.TYPE)).isEqualTo(MessageType.THING_DELETED.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertDownloadAndInstallMessage(final Set<SoftwareModule> dsModules) {
|
protected void assertDownloadAndInstallMessage(final Set<SoftwareModule> dsModules, final String controllerId) {
|
||||||
final Message replyMessage = assertReplyMessageHeader(EventTopic.DOWNLOAD_AND_INSTALL);
|
final Message replyMessage = assertReplyMessageHeader(EventTopic.DOWNLOAD_AND_INSTALL, controllerId);
|
||||||
assertAllTargetsCount(1);
|
assertAllTargetsCount(1);
|
||||||
|
|
||||||
final DmfDownloadAndUpdateRequest downloadAndUpdateRequest = (DmfDownloadAndUpdateRequest) getDmfClient()
|
final DmfDownloadAndUpdateRequest downloadAndUpdateRequest = (DmfDownloadAndUpdateRequest) getDmfClient()
|
||||||
@@ -148,8 +148,7 @@ public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegration
|
|||||||
Assert.assertThat(dsModules,
|
Assert.assertThat(dsModules,
|
||||||
SoftwareModuleJsonMatcher.containsExactly(downloadAndUpdateRequest.getSoftwareModules()));
|
SoftwareModuleJsonMatcher.containsExactly(downloadAndUpdateRequest.getSoftwareModules()));
|
||||||
|
|
||||||
final Target updatedTarget = waitUntilIsPresent(
|
final Target updatedTarget = waitUntilIsPresent(() -> targetManagement.findTargetByControllerID(controllerId));
|
||||||
() -> targetManagement.findTargetByControllerID(REGISTER_TARGET));
|
|
||||||
|
|
||||||
assertThat(updatedTarget.getSecurityToken()).isEqualTo(downloadAndUpdateRequest.getTargetSecurityToken());
|
assertThat(updatedTarget.getSecurityToken()).isEqualTo(downloadAndUpdateRequest.getTargetSecurityToken());
|
||||||
}
|
}
|
||||||
@@ -165,28 +164,28 @@ public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegration
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Long cancelAction(final Long actionId) {
|
protected Long cancelAction(final Long actionId, final String controllerId) {
|
||||||
deploymentManagement.cancelAction(actionId);
|
deploymentManagement.cancelAction(actionId);
|
||||||
assertCancelActionMessage(actionId);
|
assertCancelActionMessage(actionId, controllerId);
|
||||||
return actionId;
|
return actionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Long registerTargetAndCancelActionId() {
|
protected Long registerTargetAndCancelActionId(final String controllerId) {
|
||||||
final DistributionSetAssignmentResult assignmentResult = registerTargetAndAssignDistributionSet();
|
final DistributionSetAssignmentResult assignmentResult = registerTargetAndAssignDistributionSet(controllerId);
|
||||||
return cancelAction(assignmentResult.getActions().get(0));
|
return cancelAction(assignmentResult.getActions().get(0), controllerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertAllTargetsCount(final long expectedTargetsCount) {
|
protected void assertAllTargetsCount(final long expectedTargetsCount) {
|
||||||
assertThat(targetManagement.countTargetsAll()).isEqualTo(expectedTargetsCount);
|
assertThat(targetManagement.countTargetsAll()).isEqualTo(expectedTargetsCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Message assertReplyMessageHeader(final EventTopic eventTopic) {
|
private Message assertReplyMessageHeader(final EventTopic eventTopic, final String controllerId) {
|
||||||
verifyReplyToListener();
|
verifyReplyToListener();
|
||||||
final Message replyMessage = replyToListener.getEventTopicMessages().get(eventTopic);
|
final Message replyMessage = replyToListener.getEventTopicMessages().get(eventTopic);
|
||||||
assertAllTargetsCount(1);
|
assertAllTargetsCount(1);
|
||||||
final Map<String, Object> headers = replyMessage.getMessageProperties().getHeaders();
|
final Map<String, Object> headers = replyMessage.getMessageProperties().getHeaders();
|
||||||
assertThat(headers.get(MessageHeaderKey.TOPIC)).isEqualTo(eventTopic.toString());
|
assertThat(headers.get(MessageHeaderKey.TOPIC)).isEqualTo(eventTopic.toString());
|
||||||
assertThat(headers.get(MessageHeaderKey.THING_ID)).isEqualTo(REGISTER_TARGET);
|
assertThat(headers.get(MessageHeaderKey.THING_ID)).isEqualTo(controllerId);
|
||||||
assertThat(headers.get(MessageHeaderKey.TENANT)).isEqualTo(TENANT_EXIST);
|
assertThat(headers.get(MessageHeaderKey.TENANT)).isEqualTo(TENANT_EXIST);
|
||||||
assertThat(headers.get(MessageHeaderKey.TYPE)).isEqualTo(MessageType.EVENT.toString());
|
assertThat(headers.get(MessageHeaderKey.TYPE)).isEqualTo(MessageType.EVENT.toString());
|
||||||
return replyMessage;
|
return replyMessage;
|
||||||
@@ -209,20 +208,18 @@ public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegration
|
|||||||
assertTarget(registerdTarget, expectedTargetStatus, createdBy);
|
assertTarget(registerdTarget, expectedTargetStatus, createdBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerSameTargetAndAssertBasedOnLastPolling(final String target,
|
protected void registerSameTargetAndAssertBasedOnVersion(final String controllerId,
|
||||||
final int existingTargetsAfterCreation, final TargetUpdateStatus expectedTargetStatus,
|
final int existingTargetsAfterCreation, final TargetUpdateStatus expectedTargetStatus) {
|
||||||
final Long pollingTimeTargetOld) {
|
final int version = controllerManagement.findByControllerId(controllerId).get().getOptLockRevision();
|
||||||
createAndSendTarget(target, TENANT_EXIST);
|
createAndSendTarget(controllerId, TENANT_EXIST);
|
||||||
final Target registerdTarget = waitUntilIsPresent(
|
final Target registeredTarget = waitUntilIsPresent(() -> findTargetBasedOnNewVersion(controllerId, version));
|
||||||
() -> findTargetBasedOnNewPolltime(target, pollingTimeTargetOld));
|
|
||||||
assertAllTargetsCount(existingTargetsAfterCreation);
|
assertAllTargetsCount(existingTargetsAfterCreation);
|
||||||
assertThat(registerdTarget.getUpdateStatus()).isEqualTo(expectedTargetStatus);
|
assertThat(registeredTarget.getUpdateStatus()).isEqualTo(expectedTargetStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Optional<Target> findTargetBasedOnNewPolltime(final String controllerId, final Long pollingTimeTargetOld) {
|
private Optional<Target> findTargetBasedOnNewVersion(final String controllerId, final int version) {
|
||||||
final Optional<Target> target2 = controllerManagement.findByControllerId(controllerId);
|
final Optional<Target> target2 = controllerManagement.findByControllerId(controllerId);
|
||||||
final Long pollingTimeTargetNew = target2.get().getLastTargetQuery();
|
if (version < target2.get().getOptLockRevision()) {
|
||||||
if (pollingTimeTargetOld < pollingTimeTargetNew) {
|
|
||||||
return target2;
|
return target2;
|
||||||
}
|
}
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
@@ -244,7 +241,7 @@ public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegration
|
|||||||
messageProperties.getHeaders().put(MessageHeaderKey.TYPE, MessageType.THING_CREATED.toString());
|
messageProperties.getHeaders().put(MessageHeaderKey.TYPE, MessageType.THING_CREATED.toString());
|
||||||
messageProperties.setReplyTo(DmfTestConfiguration.REPLY_TO_EXCHANGE);
|
messageProperties.setReplyTo(DmfTestConfiguration.REPLY_TO_EXCHANGE);
|
||||||
|
|
||||||
return createMessage("", messageProperties);
|
return createMessage(null, messageProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MessageProperties createMessagePropertiesWithTenant(final String tenant) {
|
protected MessageProperties createMessagePropertiesWithTenant(final String tenant) {
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
|
||||||
#
|
|
||||||
# All rights reserved. This program and the accompanying materials
|
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
# which accompanies this distribution, and is available at
|
|
||||||
# http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
#
|
|
||||||
|
|
||||||
# RabbitMQ
|
|
||||||
spring.rabbitmq.host=localhost
|
|
||||||
|
|
||||||
spring.jpa.database=H2
|
|
||||||
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
|
|
||||||
|
|
||||||
# Default tenant configuration properties
|
|
||||||
hawkbit.server.tenant.configuration.authentication-header-enabled.keyName=authentication.header.enabled
|
|
||||||
hawkbit.server.tenant.configuration.authentication-header-enabled.defaultValue=false
|
|
||||||
hawkbit.server.tenant.configuration.authentication-header-enabled.dataType=java.lang.Boolean
|
|
||||||
hawkbit.server.tenant.configuration.authentication-header-enabled.validator=org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationBooleanValidator
|
|
||||||
|
|
||||||
hawkbit.server.tenant.configuration.authentication-header-authority.keyName=authentication.header.authority
|
|
||||||
hawkbit.server.tenant.configuration.authentication-header-authority.defaultValue=false
|
|
||||||
|
|
||||||
hawkbit.server.tenant.configuration.authentication-targettoken-enabled.keyName=authentication.targettoken.enabled
|
|
||||||
hawkbit.server.tenant.configuration.authentication-targettoken-enabled.defaultValue=false
|
|
||||||
hawkbit.server.tenant.configuration.authentication-targettoken-enabled.dataType=java.lang.Boolean
|
|
||||||
hawkbit.server.tenant.configuration.authentication-targettoken-enabled.validator=org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationBooleanValidator
|
|
||||||
|
|
||||||
hawkbit.server.tenant.configuration.authentication-gatewaytoken-enabled.keyName=authentication.gatewaytoken.enabled
|
|
||||||
hawkbit.server.tenant.configuration.authentication-gatewaytoken-enabled.defaultValue=false
|
|
||||||
hawkbit.server.tenant.configuration.authentication-gatewaytoken-enabled.dataType=java.lang.Boolean
|
|
||||||
hawkbit.server.tenant.configuration.authentication-gatewaytoken-enabled.validator=org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationBooleanValidator
|
|
||||||
|
|
||||||
hawkbit.server.tenant.configuration.authentication-gatewaytoken-key.keyName=authentication.gatewaytoken.key
|
|
||||||
hawkbit.server.tenant.configuration.authentication-gatewaytoken-key.defaultValue=false
|
|
||||||
|
|
||||||
hawkbit.server.tenant.configuration.anonymous-download-enabled.keyName=anonymous.download.enabled
|
|
||||||
hawkbit.server.tenant.configuration.anonymous-download-enabled.defaultValue=false
|
|
||||||
hawkbit.server.tenant.configuration.anonymous-download-enabled.dataType=java.lang.Boolean
|
|
||||||
hawkbit.server.tenant.configuration.anonymous-download-enabled.validator=org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationBooleanValidator
|
|
||||||
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
|
|
||||||
Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
|
||||||
|
|
||||||
All rights reserved. This program and the accompanying materials
|
|
||||||
are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
which accompanies this distribution, and is available at
|
|
||||||
http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
|
|
||||||
-->
|
|
||||||
<configuration>
|
|
||||||
<include resource="org/springframework/boot/logging/logback/base.xml" />
|
|
||||||
|
|
||||||
<logger name="org.eclipse.hawkbit.eventbus.DeadEventListener" level="WARN" />
|
|
||||||
<Logger name="org.springframework.boot.actuate.audit.listener.AuditListener" level="WARN" />
|
|
||||||
|
|
||||||
<Logger name="org.hibernate.validator.internal.util.Version" level="WARN" />
|
|
||||||
|
|
||||||
<Logger name="org.apache.coyote.http11.Http11NioProtocol" level="WARN" />
|
|
||||||
<Logger name="org.apache.tomcat.util.net.NioSelectorPool" level="WARN" />
|
|
||||||
<Logger name="org.apache.tomcat.jdbc.pool.ConnectionPool" level="DEBUG" />
|
|
||||||
<Logger name="org.apache.catalina.startup.DigesterFactory" level="ERROR" />
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <Logger name="org.eclipse.hawkbit.rest.util.MockMvcResultPrinter" level="DEBUG" /> -->
|
|
||||||
|
|
||||||
<!-- Security Log with hints on potential attacks -->
|
|
||||||
<logger name="server-security" level="INFO" />
|
|
||||||
|
|
||||||
<Root level="INFO">
|
|
||||||
<appender-ref ref="CONSOLE" />
|
|
||||||
</Root>
|
|
||||||
|
|
||||||
</configuration>
|
|
||||||
1
hawkbit-mgmt-resource/.gitignore
vendored
Normal file
1
hawkbit-mgmt-resource/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/artifactrepo/
|
||||||
@@ -37,7 +37,6 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
|||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder;
|
import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
|
||||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||||
@@ -714,7 +713,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
|||||||
public void retrieveTargetsFromRolloutGroupWithQuery() throws Exception {
|
public void retrieveTargetsFromRolloutGroupWithQuery() throws Exception {
|
||||||
// setup
|
// setup
|
||||||
final int amountTargets = 10;
|
final int amountTargets = 10;
|
||||||
final List<Target> targets = testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||||
|
|
||||||
// create rollout including the created targets with prefix 'rollout'
|
// create rollout including the created targets with prefix 'rollout'
|
||||||
@@ -724,11 +723,13 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
|
|||||||
.findRolloutGroupsByRolloutId(rollout.getId(), new PageRequest(0, 1, Direction.ASC, "id")).getContent()
|
.findRolloutGroupsByRolloutId(rollout.getId(), new PageRequest(0, 1, Direction.ASC, "id")).getContent()
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
|
final String targetInGroup = rolloutGroupManagement.findRolloutGroupTargets(firstGroup.getId(), PAGE)
|
||||||
|
.getContent().get(0).getControllerId();
|
||||||
|
|
||||||
// retrieve targets from the first rollout group with known ID
|
// retrieve targets from the first rollout group with known ID
|
||||||
mvc.perform(
|
mvc.perform(
|
||||||
get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}/targets", rollout.getId(), firstGroup.getId())
|
get("/rest/v1/rollouts/{rolloutId}/deploygroups/{groupId}/targets", rollout.getId(), firstGroup.getId())
|
||||||
.accept(MediaType.APPLICATION_JSON).param("q",
|
.accept(MediaType.APPLICATION_JSON).param("q", "controllerId==" + targetInGroup))
|
||||||
"controllerId==" + targets.get(0).getControllerId()))
|
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
|
||||||
.andExpect(jsonPath("$.content", hasSize(1))).andExpect(jsonPath("$.total", equalTo(1)));
|
.andExpect(jsonPath("$.content", hasSize(1))).andExpect(jsonPath("$.total", equalTo(1)));
|
||||||
|
|||||||
@@ -86,8 +86,9 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
final String updateVendor = "newVendor1";
|
final String updateVendor = "newVendor1";
|
||||||
final String updateDescription = "newDescription1";
|
final String updateDescription = "newDescription1";
|
||||||
|
|
||||||
SoftwareModule sm = softwareModuleManagement.createSoftwareModule(entityFactory.softwareModule().create().type(osType)
|
SoftwareModule sm = softwareModuleManagement
|
||||||
.name(knownSWName).version(knownSWVersion).description(knownSWDescription).vendor(knownSWVendor));
|
.createSoftwareModule(entityFactory.softwareModule().create().type(osType).name(knownSWName)
|
||||||
|
.version(knownSWVersion).description(knownSWDescription).vendor(knownSWVendor));
|
||||||
|
|
||||||
assertThat(sm.getName()).as("Wrong name of the software module").isEqualTo(knownSWName);
|
assertThat(sm.getName()).as("Wrong name of the software module").isEqualTo(knownSWName);
|
||||||
|
|
||||||
@@ -140,7 +141,8 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
// check rest of response compared to DB
|
// check rest of response compared to DB
|
||||||
final MgmtArtifact artResult = ResourceUtility
|
final MgmtArtifact artResult = ResourceUtility
|
||||||
.convertArtifactResponse(mvcResult.getResponse().getContentAsString());
|
.convertArtifactResponse(mvcResult.getResponse().getContentAsString());
|
||||||
final Long artId = softwareModuleManagement.findSoftwareModuleById(sm.getId()).get().getArtifacts().get(0).getId();
|
final Long artId = softwareModuleManagement.findSoftwareModuleById(sm.getId()).get().getArtifacts().get(0)
|
||||||
|
.getId();
|
||||||
assertThat(artResult.getArtifactId()).as("Wrong artifact id").isEqualTo(artId);
|
assertThat(artResult.getArtifactId()).as("Wrong artifact id").isEqualTo(artId);
|
||||||
assertThat(JsonPath.compile("$._links.self.href").read(mvcResult.getResponse().getContentAsString()).toString())
|
assertThat(JsonPath.compile("$._links.self.href").read(mvcResult.getResponse().getContentAsString()).toString())
|
||||||
.as("Link contains no self url")
|
.as("Link contains no self url")
|
||||||
@@ -158,8 +160,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
assertThat(artifactManagement.countArtifactsAll()).as("Wrong artifact size").isEqualTo(1);
|
assertThat(artifactManagement.countArtifactsAll()).as("Wrong artifact size").isEqualTo(1);
|
||||||
|
|
||||||
// binary
|
// binary
|
||||||
try (InputStream fileInputStream = artifactManagement
|
try (InputStream fileInputStream = artifactManagement.loadArtifactBinary(
|
||||||
.loadArtifactBinary(
|
|
||||||
softwareModuleManagement.findSoftwareModuleById(sm.getId()).get().getArtifacts().get(0).getSha1Hash())
|
softwareModuleManagement.findSoftwareModuleById(sm.getId()).get().getArtifacts().get(0).getSha1Hash())
|
||||||
.get().getFileInputStream()) {
|
.get().getFileInputStream()) {
|
||||||
assertTrue("Wrong artifact content",
|
assertTrue("Wrong artifact content",
|
||||||
@@ -174,7 +175,8 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
.isEqualTo(HashGeneratorUtils.generateMD5(random));
|
.isEqualTo(HashGeneratorUtils.generateMD5(random));
|
||||||
|
|
||||||
// metadata
|
// metadata
|
||||||
assertThat(softwareModuleManagement.findSoftwareModuleById(sm.getId()).get().getArtifacts().get(0).getFilename())
|
assertThat(
|
||||||
|
softwareModuleManagement.findSoftwareModuleById(sm.getId()).get().getArtifacts().get(0).getFilename())
|
||||||
.as("wrong metadata of the filename").isEqualTo("origFilename");
|
.as("wrong metadata of the filename").isEqualTo("origFilename");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,27 +297,24 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
final Artifact artifact2 = artifactManagement.createArtifact(new ByteArrayInputStream(random), sm.getId(),
|
final Artifact artifact2 = artifactManagement.createArtifact(new ByteArrayInputStream(random), sm.getId(),
|
||||||
"file2", false);
|
"file2", false);
|
||||||
|
|
||||||
final MvcResult result = mvc
|
downloadAndVerify(sm, random, artifact);
|
||||||
.perform(
|
downloadAndVerify(sm, random, artifact2);
|
||||||
get("/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download", sm.getId(), artifact.getId()))
|
|
||||||
.andExpect(header().string("ETag", artifact.getSha1Hash()))
|
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_OCTET_STREAM)).andReturn();
|
|
||||||
|
|
||||||
assertTrue("Wrong response content", Arrays.equals(result.getResponse().getContentAsByteArray(), random));
|
|
||||||
|
|
||||||
final MvcResult result2 = mvc
|
|
||||||
.perform(get("/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download", sm.getId(),
|
|
||||||
artifact2.getId()))
|
|
||||||
.andExpect(header().string("ETag", artifact2.getSha1Hash()))
|
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_OCTET_STREAM)).andReturn();
|
|
||||||
|
|
||||||
assertTrue("Response has wrong response content",
|
|
||||||
Arrays.equals(result2.getResponse().getContentAsByteArray(), random));
|
|
||||||
|
|
||||||
assertThat(softwareModuleManagement.findSoftwareModulesAll(PAGE)).as("Softwaremodule size is wrong").hasSize(1);
|
assertThat(softwareModuleManagement.findSoftwareModulesAll(PAGE)).as("Softwaremodule size is wrong").hasSize(1);
|
||||||
assertThat(artifactManagement.countArtifactsAll()).isEqualTo(2);
|
assertThat(artifactManagement.countArtifactsAll()).isEqualTo(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void downloadAndVerify(final SoftwareModule sm, final byte[] random, final Artifact artifact)
|
||||||
|
throws Exception {
|
||||||
|
final MvcResult result = mvc
|
||||||
|
.perform(
|
||||||
|
get("/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download", sm.getId(), artifact.getId()))
|
||||||
|
.andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_OCTET_STREAM))
|
||||||
|
.andExpect(header().string("ETag", artifact.getSha1Hash())).andReturn();
|
||||||
|
|
||||||
|
assertTrue("Wrong response content", Arrays.equals(result.getResponse().getContentAsByteArray(), random));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Verifies the listing of one defined artifact assigned to a given software module. That includes the artifact metadata and download links.")
|
@Description("Verifies the listing of one defined artifact assigned to a given software module. That includes the artifact metadata and download links.")
|
||||||
public void getArtifact() throws Exception {
|
public void getArtifact() throws Exception {
|
||||||
@@ -444,10 +443,9 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
|
|
||||||
final SoftwareModule toLongName = entityFactory.softwareModule().create().type(osType)
|
final SoftwareModule toLongName = entityFactory.softwareModule().create().type(osType)
|
||||||
.name(RandomStringUtils.randomAscii(80)).build();
|
.name(RandomStringUtils.randomAscii(80)).build();
|
||||||
mvc.perform(
|
mvc.perform(post("/rest/v1/softwaremodules").content(JsonBuilder.softwareModules(Arrays.asList(toLongName)))
|
||||||
post("/rest/v1/softwaremodules").content(JsonBuilder.softwareModules(Arrays.asList(toLongName)))
|
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.andExpect(status().isBadRequest());
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest());
|
|
||||||
|
|
||||||
// unsupported media type
|
// unsupported media type
|
||||||
mvc.perform(post("/rest/v1/softwaremodules").content(JsonBuilder.softwareModules(modules))
|
mvc.perform(post("/rest/v1/softwaremodules").content(JsonBuilder.softwareModules(modules))
|
||||||
@@ -707,13 +705,15 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
.isEqualTo("http://localhost/rest/v1/softwaremodules/" + appCreated.getId() + "/artifacts");
|
.isEqualTo("http://localhost/rest/v1/softwaremodules/" + appCreated.getId() + "/artifacts");
|
||||||
|
|
||||||
assertThat(softwareModuleManagement.findSoftwareModulesAll(PAGE)).as("Wrong softwaremodule size").hasSize(2);
|
assertThat(softwareModuleManagement.findSoftwareModulesAll(PAGE)).as("Wrong softwaremodule size").hasSize(2);
|
||||||
assertThat(softwareModuleManagement.findSoftwareModulesByType(PAGE, osType.getId()).getContent().get(0).getName())
|
assertThat(
|
||||||
|
softwareModuleManagement.findSoftwareModulesByType(PAGE, osType.getId()).getContent().get(0).getName())
|
||||||
.as("Softwaremoudle name is wrong").isEqualTo(os.getName());
|
.as("Softwaremoudle name is wrong").isEqualTo(os.getName());
|
||||||
assertThat(softwareModuleManagement.findSoftwareModulesByType(PAGE, osType.getId()).getContent().get(0)
|
assertThat(softwareModuleManagement.findSoftwareModulesByType(PAGE, osType.getId()).getContent().get(0)
|
||||||
.getCreatedBy()).as("Softwaremoudle created by is wrong").isEqualTo("uploadTester");
|
.getCreatedBy()).as("Softwaremoudle created by is wrong").isEqualTo("uploadTester");
|
||||||
assertThat(softwareModuleManagement.findSoftwareModulesByType(PAGE, osType.getId()).getContent().get(0)
|
assertThat(softwareModuleManagement.findSoftwareModulesByType(PAGE, osType.getId()).getContent().get(0)
|
||||||
.getCreatedAt()).as("Softwaremoudle created at is wrong").isGreaterThanOrEqualTo(current);
|
.getCreatedAt()).as("Softwaremoudle created at is wrong").isGreaterThanOrEqualTo(current);
|
||||||
assertThat(softwareModuleManagement.findSoftwareModulesByType(PAGE, appType.getId()).getContent().get(0).getName())
|
assertThat(
|
||||||
|
softwareModuleManagement.findSoftwareModulesByType(PAGE, appType.getId()).getContent().get(0).getName())
|
||||||
.as("Softwaremoudle name is wrong").isEqualTo(ah.getName());
|
.as("Softwaremoudle name is wrong").isEqualTo(ah.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -819,10 +819,10 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
.andExpect(jsonPath("[1]key", equalTo(knownKey2)))
|
.andExpect(jsonPath("[1]key", equalTo(knownKey2)))
|
||||||
.andExpect(jsonPath("[1]value", equalTo(knownValue2)));
|
.andExpect(jsonPath("[1]value", equalTo(knownValue2)));
|
||||||
|
|
||||||
final SoftwareModuleMetadata metaKey1 = softwareModuleManagement.findSoftwareModuleMetadata(sm.getId(), knownKey1)
|
final SoftwareModuleMetadata metaKey1 = softwareModuleManagement
|
||||||
.get();
|
.findSoftwareModuleMetadata(sm.getId(), knownKey1).get();
|
||||||
final SoftwareModuleMetadata metaKey2 = softwareModuleManagement.findSoftwareModuleMetadata(sm.getId(), knownKey2)
|
final SoftwareModuleMetadata metaKey2 = softwareModuleManagement
|
||||||
.get();
|
.findSoftwareModuleMetadata(sm.getId(), knownKey2).get();
|
||||||
|
|
||||||
assertThat(metaKey1.getValue()).as("Metadata key is wrong").isEqualTo(knownValue1);
|
assertThat(metaKey1.getValue()).as("Metadata key is wrong").isEqualTo(knownValue1);
|
||||||
assertThat(metaKey2.getValue()).as("Metadata key is wrong").isEqualTo(knownValue2);
|
assertThat(metaKey2.getValue()).as("Metadata key is wrong").isEqualTo(knownValue2);
|
||||||
@@ -848,8 +848,8 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
|||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
|
||||||
.andExpect(jsonPath("key", equalTo(knownKey))).andExpect(jsonPath("value", equalTo(updateValue)));
|
.andExpect(jsonPath("key", equalTo(knownKey))).andExpect(jsonPath("value", equalTo(updateValue)));
|
||||||
|
|
||||||
final SoftwareModuleMetadata assertDS = softwareModuleManagement.findSoftwareModuleMetadata(sm.getId(), knownKey)
|
final SoftwareModuleMetadata assertDS = softwareModuleManagement
|
||||||
.get();
|
.findSoftwareModuleMetadata(sm.getId(), knownKey).get();
|
||||||
assertThat(assertDS.getValue()).as("Metadata is wrong").isEqualTo(updateValue);
|
assertThat(assertDS.getValue()).as("Metadata is wrong").isEqualTo(updateValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@@ -1322,7 +1323,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
|||||||
private Target createSingleTarget(final String controllerId, final String name) {
|
private Target createSingleTarget(final String controllerId, final String name) {
|
||||||
targetManagement.createTarget(entityFactory.target().create().controllerId(controllerId).name(name)
|
targetManagement.createTarget(entityFactory.target().create().controllerId(controllerId).name(name)
|
||||||
.description(TARGET_DESCRIPTION_TEST));
|
.description(TARGET_DESCRIPTION_TEST));
|
||||||
return controllerManagement.updateLastTargetQuery(controllerId, null);
|
return controllerManagement.findOrRegisterTargetIfItDoesNotexist(controllerId, LOCALHOST);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1331,13 +1332,14 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
|||||||
*
|
*
|
||||||
* @param amount
|
* @param amount
|
||||||
* The number of targets to create
|
* The number of targets to create
|
||||||
|
* @throws URISyntaxException
|
||||||
*/
|
*/
|
||||||
private void createTargetsAlphabetical(final int amount) {
|
private void createTargetsAlphabetical(final int amount) {
|
||||||
char character = 'a';
|
char character = 'a';
|
||||||
for (int index = 0; index < amount; index++) {
|
for (int index = 0; index < amount; index++) {
|
||||||
final String str = String.valueOf(character);
|
final String str = String.valueOf(character);
|
||||||
targetManagement.createTarget(entityFactory.target().create().controllerId(str).name(str).description(str));
|
targetManagement.createTarget(entityFactory.target().create().controllerId(str).name(str).description(str));
|
||||||
controllerManagement.updateLastTargetQuery(str, null);
|
controllerManagement.findOrRegisterTargetIfItDoesNotexist(str, LOCALHOST);
|
||||||
character++;
|
character++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,11 @@ public interface ControllerManagement {
|
|||||||
Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, @NotNull Long actionId);
|
Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, @NotNull Long actionId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* register new target in the repository (plug-and-play).
|
* Register new target in the repository (plug-and-play) and in case it
|
||||||
|
* already exists updates {@link Target#getAddress()} and
|
||||||
|
* {@link Target#getLastTargetQuery()} and switches if
|
||||||
|
* {@link TargetUpdateStatus#UNKNOWN} to
|
||||||
|
* {@link TargetUpdateStatus#REGISTERED}.
|
||||||
*
|
*
|
||||||
* @param controllerId
|
* @param controllerId
|
||||||
* reference
|
* reference
|
||||||
@@ -274,23 +278,6 @@ public interface ControllerManagement {
|
|||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
Target updateControllerAttributes(@NotEmpty String controllerId, @NotNull Map<String, String> attributes);
|
Target updateControllerAttributes(@NotEmpty String controllerId, @NotNull Map<String, String> attributes);
|
||||||
|
|
||||||
/**
|
|
||||||
* Refreshes the time of the last time the controller has been connected to
|
|
||||||
* the server. Switches {@link TargetUpdateStatus#UNKNOWN} to
|
|
||||||
* {@link TargetUpdateStatus#REGISTERED} if necessary.
|
|
||||||
*
|
|
||||||
* @param controllerId
|
|
||||||
* of the target to to update
|
|
||||||
* @param address
|
|
||||||
* the client address of the target, might be {@code null}
|
|
||||||
* @return the updated target
|
|
||||||
*
|
|
||||||
* @throws EntityNotFoundException
|
|
||||||
* if target with given ID could not be found
|
|
||||||
*/
|
|
||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
|
||||||
Target updateLastTargetQuery(@NotEmpty String controllerId, URI address);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds {@link Target} based on given controller ID returns found Target
|
* Finds {@link Target} based on given controller ID returns found Target
|
||||||
* without details, i.e. NO {@link Target#getTags()} and
|
* without details, i.e. NO {@link Target#getTags()} and
|
||||||
|
|||||||
@@ -126,17 +126,6 @@ public class JpaControllerManagement implements ControllerManagement {
|
|||||||
.getConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class).getValue());
|
.getConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class).getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
@Retryable(include = {
|
|
||||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
|
||||||
public Target updateLastTargetQuery(final String controllerId, final URI address) {
|
|
||||||
final JpaTarget target = (JpaTarget) targetRepository.findByControllerId(controllerId)
|
|
||||||
.orElseThrow(() -> new EntityNotFoundException(Target.class, controllerId));
|
|
||||||
|
|
||||||
return updateTargetStatus(target, null, System.currentTimeMillis(), address);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<Action> getActionForDownloadByTargetAndSoftwareModule(final String controllerId,
|
public Optional<Action> getActionForDownloadByTargetAndSoftwareModule(final String controllerId,
|
||||||
final Long moduleId) {
|
final Long moduleId) {
|
||||||
@@ -221,27 +210,20 @@ public class JpaControllerManagement implements ControllerManagement {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return updateTargetStatus(target, null, System.currentTimeMillis(), address);
|
return updateTargetStatus(target, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Target updateTargetStatus(final JpaTarget toUpdate, final TargetUpdateStatus status,
|
private Target updateTargetStatus(final JpaTarget toUpdate, final URI address) {
|
||||||
final Long lastTargetQuery, final URI address) {
|
|
||||||
if (status != null) {
|
|
||||||
toUpdate.setUpdateStatus(status);
|
|
||||||
}
|
|
||||||
if (lastTargetQuery != null) {
|
|
||||||
toUpdate.setLastTargetQuery(lastTargetQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TargetUpdateStatus.UNKNOWN.equals(toUpdate.getUpdateStatus())) {
|
if (TargetUpdateStatus.UNKNOWN.equals(toUpdate.getUpdateStatus())) {
|
||||||
toUpdate.setUpdateStatus(TargetUpdateStatus.REGISTERED);
|
toUpdate.setUpdateStatus(TargetUpdateStatus.REGISTERED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (address != null) {
|
|
||||||
toUpdate.setAddress(address.toString());
|
toUpdate.setAddress(address.toString());
|
||||||
|
toUpdate.setLastTargetQuery(System.currentTimeMillis());
|
||||||
|
|
||||||
afterCommit.afterCommit(
|
afterCommit.afterCommit(
|
||||||
() -> eventPublisher.publishEvent(new TargetPollEvent(toUpdate, applicationContext.getId())));
|
() -> eventPublisher.publishEvent(new TargetPollEvent(toUpdate, applicationContext.getId())));
|
||||||
}
|
|
||||||
|
|
||||||
return targetRepository.save(toUpdate);
|
return targetRepository.save(toUpdate);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import static org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpre
|
|||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -61,7 +60,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
@Features("Component Tests - Repository")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("Controller Management")
|
@Stories("Controller Management")
|
||||||
public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
||||||
private static final URI LOCALHOST = URI.create("http://127.0.0.1");
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RepositoryProperties repositoryProperties;
|
private RepositoryProperties repositoryProperties;
|
||||||
|
|
||||||
@@ -121,9 +120,6 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
verifyThrownExceptionBy(() -> controllerManagement.updateControllerAttributes(NOT_EXIST_ID, Maps.newHashMap()),
|
verifyThrownExceptionBy(() -> controllerManagement.updateControllerAttributes(NOT_EXIST_ID, Maps.newHashMap()),
|
||||||
"Target");
|
"Target");
|
||||||
|
|
||||||
verifyThrownExceptionBy(
|
|
||||||
() -> controllerManagement.updateLastTargetQuery(NOT_EXIST_ID, new URI("http://test.com")), "Target");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -424,17 +420,15 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetPollEvent.class, count = 2) })
|
@Expect(type = TargetPollEvent.class, count = 2) })
|
||||||
public void findOrRegisterTargetIfItDoesNotexist() {
|
public void findOrRegisterTargetIfItDoesNotexist() {
|
||||||
final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotexist("AA",
|
final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotexist("AA", LOCALHOST);
|
||||||
LOCALHOST);
|
|
||||||
assertThat(target).as("target should not be null").isNotNull();
|
assertThat(target).as("target should not be null").isNotNull();
|
||||||
|
|
||||||
final Target sameTarget = controllerManagement.findOrRegisterTargetIfItDoesNotexist("AA",
|
final Target sameTarget = controllerManagement.findOrRegisterTargetIfItDoesNotexist("AA", LOCALHOST);
|
||||||
LOCALHOST);
|
|
||||||
assertThat(target.getId()).as("Target should be the equals").isEqualTo(sameTarget.getId());
|
assertThat(target.getId()).as("Target should be the equals").isEqualTo(sameTarget.getId());
|
||||||
assertThat(targetRepository.count()).as("Only 1 target should be registred").isEqualTo(1L);
|
assertThat(targetRepository.count()).as("Only 1 target should be registred").isEqualTo(1L);
|
||||||
|
|
||||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||||
() -> controllerManagement.findOrRegisterTargetIfItDoesNotexist("", LOCALHOST))
|
.isThrownBy(() -> controllerManagement.findOrRegisterTargetIfItDoesNotexist("", LOCALHOST))
|
||||||
.as("register target with empty controllerId should fail");
|
.as("register target with empty controllerId should fail");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -869,17 +869,16 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
ds.getId(), ActionType.SOFT,
|
ds.getId(), ActionType.SOFT,
|
||||||
org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME,
|
org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME,
|
||||||
Arrays.asList(target.getControllerId()));
|
Arrays.asList(target.getControllerId()));
|
||||||
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0))
|
final Long actionId = assignDistributionSet.getActions().get(0);
|
||||||
.get();
|
|
||||||
// verify preparation
|
// verify preparation
|
||||||
Action findAction = deploymentManagement.findAction(action.getId()).get();
|
Action findAction = deploymentManagement.findAction(actionId).get();
|
||||||
assertThat(findAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.SOFT);
|
assertThat(findAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.SOFT);
|
||||||
|
|
||||||
// test
|
// test
|
||||||
deploymentManagement.forceTargetAction(action.getId());
|
deploymentManagement.forceTargetAction(actionId);
|
||||||
|
|
||||||
// verify test
|
// verify test
|
||||||
findAction = deploymentManagement.findAction(action.getId()).get();
|
findAction = deploymentManagement.findAction(actionId).get();
|
||||||
assertThat(findAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.FORCED);
|
assertThat(findAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.FORCED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -894,18 +893,17 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
ds.getId(), ActionType.FORCED,
|
ds.getId(), ActionType.FORCED,
|
||||||
org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME,
|
org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME,
|
||||||
Arrays.asList(target.getControllerId()));
|
Arrays.asList(target.getControllerId()));
|
||||||
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0))
|
final Long actionId = assignDistributionSet.getActions().get(0);
|
||||||
.get();
|
|
||||||
// verify perparation
|
// verify perparation
|
||||||
Action findAction = deploymentManagement.findAction(action.getId()).get();
|
Action findAction = deploymentManagement.findAction(actionId).get();
|
||||||
assertThat(findAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.FORCED);
|
assertThat(findAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.FORCED);
|
||||||
|
|
||||||
// test
|
// test
|
||||||
final Action forceTargetAction = deploymentManagement.forceTargetAction(action.getId());
|
final Action forceTargetAction = deploymentManagement.forceTargetAction(actionId);
|
||||||
|
|
||||||
// verify test
|
// verify test
|
||||||
assertThat(forceTargetAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.FORCED);
|
assertThat(forceTargetAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.FORCED);
|
||||||
findAction = deploymentManagement.findAction(action.getId()).get();
|
findAction = deploymentManagement.findAction(actionId).get();
|
||||||
assertThat(findAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.FORCED);
|
assertThat(findAction.getActionType()).as("action type is wrong").isEqualTo(ActionType.FORCED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -448,8 +447,8 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
.createDistributionSetTag(entityFactory.tag().create().name("DistributionSetTag-C"));
|
.createDistributionSetTag(entityFactory.tag().create().name("DistributionSetTag-C"));
|
||||||
tagManagement.createDistributionSetTag(entityFactory.tag().create().name("DistributionSetTag-D"));
|
tagManagement.createDistributionSetTag(entityFactory.tag().create().name("DistributionSetTag-D"));
|
||||||
|
|
||||||
Collection<DistributionSet> ds100Group1 = testdataFactory.createDistributionSets("", 100);
|
List<DistributionSet> ds5Group1 = testdataFactory.createDistributionSets("", 5);
|
||||||
Collection<DistributionSet> ds100Group2 = testdataFactory.createDistributionSets("test2", 100);
|
List<DistributionSet> dsGroup2 = testdataFactory.createDistributionSets("test2", 5);
|
||||||
DistributionSet dsDeleted = testdataFactory.createDistributionSet("deleted");
|
DistributionSet dsDeleted = testdataFactory.createDistributionSet("deleted");
|
||||||
final DistributionSet dsInComplete = distributionSetManagement.createDistributionSet(entityFactory
|
final DistributionSet dsInComplete = distributionSetManagement.createDistributionSet(entityFactory
|
||||||
.distributionSet().create().name("notcomplete").version("1").type(standardDsType.getKey()));
|
.distributionSet().create().name("notcomplete").version("1").type(standardDsType.getKey()));
|
||||||
@@ -470,27 +469,27 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
distributionSetManagement.deleteDistributionSet(dsDeleted.getId());
|
distributionSetManagement.deleteDistributionSet(dsDeleted.getId());
|
||||||
dsDeleted = distributionSetManagement.findDistributionSetById(dsDeleted.getId()).get();
|
dsDeleted = distributionSetManagement.findDistributionSetById(dsDeleted.getId()).get();
|
||||||
|
|
||||||
ds100Group1 = toggleTagAssignment(ds100Group1, dsTagA).getAssignedEntity();
|
ds5Group1 = toggleTagAssignment(ds5Group1, dsTagA).getAssignedEntity();
|
||||||
dsTagA = distributionSetTagRepository.findByNameEquals(dsTagA.getName()).get();
|
dsTagA = distributionSetTagRepository.findByNameEquals(dsTagA.getName()).get();
|
||||||
ds100Group1 = toggleTagAssignment(ds100Group1, dsTagB).getAssignedEntity();
|
ds5Group1 = toggleTagAssignment(ds5Group1, dsTagB).getAssignedEntity();
|
||||||
dsTagA = distributionSetTagRepository.findByNameEquals(dsTagA.getName()).get();
|
dsTagA = distributionSetTagRepository.findByNameEquals(dsTagA.getName()).get();
|
||||||
ds100Group2 = toggleTagAssignment(ds100Group2, dsTagA).getAssignedEntity();
|
dsGroup2 = toggleTagAssignment(dsGroup2, dsTagA).getAssignedEntity();
|
||||||
dsTagA = distributionSetTagRepository.findByNameEquals(dsTagA.getName()).get();
|
dsTagA = distributionSetTagRepository.findByNameEquals(dsTagA.getName()).get();
|
||||||
|
|
||||||
// check setup
|
// check setup
|
||||||
assertThat(distributionSetRepository.findAll()).hasSize(203);
|
assertThat(distributionSetRepository.findAll()).hasSize(13);
|
||||||
|
|
||||||
// Find all
|
// Find all
|
||||||
List<DistributionSet> expected = Lists.newArrayListWithExpectedSize(203);
|
List<DistributionSet> expected = Lists.newArrayListWithExpectedSize(13);
|
||||||
expected.addAll(ds100Group1);
|
expected.addAll(ds5Group1);
|
||||||
expected.addAll(ds100Group2);
|
expected.addAll(dsGroup2);
|
||||||
expected.add(dsDeleted);
|
expected.add(dsDeleted);
|
||||||
expected.add(dsInComplete);
|
expected.add(dsInComplete);
|
||||||
expected.add(dsNewType);
|
expected.add(dsNewType);
|
||||||
|
|
||||||
assertThat(distributionSetManagement
|
assertThat(distributionSetManagement
|
||||||
.findDistributionSetsByFilters(PAGE, getDistributionSetFilterBuilder().build()).getContent())
|
.findDistributionSetsByFilters(PAGE, getDistributionSetFilterBuilder().build()).getContent())
|
||||||
.hasSize(203).containsOnly(expected.toArray(new DistributionSet[0]));
|
.hasSize(13).containsOnly(expected.toArray(new DistributionSet[0]));
|
||||||
|
|
||||||
DistributionSetFilterBuilder distributionSetFilterBuilder;
|
DistributionSetFilterBuilder distributionSetFilterBuilder;
|
||||||
|
|
||||||
@@ -501,18 +500,18 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsDeleted(false);
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsDeleted(false);
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(202);
|
.getContent()).hasSize(12);
|
||||||
|
|
||||||
// search for completed
|
// search for completed
|
||||||
expected = new ArrayList<>();
|
expected = new ArrayList<>();
|
||||||
expected.addAll(ds100Group1);
|
expected.addAll(ds5Group1);
|
||||||
expected.addAll(ds100Group2);
|
expected.addAll(dsGroup2);
|
||||||
expected.add(dsDeleted);
|
expected.add(dsDeleted);
|
||||||
expected.add(dsNewType);
|
expected.add(dsNewType);
|
||||||
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true);
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true);
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(202).containsOnly(expected.toArray(new DistributionSet[0]));
|
.getContent()).hasSize(12).containsOnly(expected.toArray(new DistributionSet[0]));
|
||||||
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.FALSE);
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.FALSE);
|
||||||
expected = new ArrayList<>();
|
expected = new ArrayList<>();
|
||||||
@@ -527,31 +526,31 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setType(standardDsType);
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setType(standardDsType);
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(202);
|
.getContent()).hasSize(12);
|
||||||
|
|
||||||
// search for text
|
// search for text
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setSearchText("%test2");
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setSearchText("%test2");
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(100);
|
.getContent()).hasSize(5);
|
||||||
|
|
||||||
// search for tags
|
// search for tags
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setTagNames(Arrays.asList(dsTagA.getName()));
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setTagNames(Arrays.asList(dsTagA.getName()));
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(200);
|
.getContent()).hasSize(10);
|
||||||
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setTagNames(Arrays.asList(dsTagB.getName()));
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setTagNames(Arrays.asList(dsTagB.getName()));
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(100);
|
.getContent()).hasSize(5);
|
||||||
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder()
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder()
|
||||||
.setTagNames(Arrays.asList(dsTagA.getName(), dsTagB.getName()));
|
.setTagNames(Arrays.asList(dsTagA.getName(), dsTagB.getName()));
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(200);
|
.getContent()).hasSize(10);
|
||||||
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder()
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder()
|
||||||
.setTagNames(Arrays.asList(dsTagC.getName(), dsTagB.getName()));
|
.setTagNames(Arrays.asList(dsTagC.getName(), dsTagB.getName()));
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(100);
|
.getContent()).hasSize(5);
|
||||||
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setTagNames(Arrays.asList(dsTagC.getName()));
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setTagNames(Arrays.asList(dsTagC.getName()));
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
@@ -559,23 +558,21 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
// combine deleted and complete
|
// combine deleted and complete
|
||||||
expected = new ArrayList<>();
|
expected = new ArrayList<>();
|
||||||
expected.addAll(ds100Group1);
|
expected.addAll(ds5Group1);
|
||||||
expected.addAll(ds100Group2);
|
expected.addAll(dsGroup2);
|
||||||
expected.add(dsNewType);
|
expected.add(dsNewType);
|
||||||
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
||||||
.setIsDeleted(Boolean.FALSE);
|
.setIsDeleted(Boolean.FALSE);
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(201).containsOnly(expected.toArray(new DistributionSet[0]));
|
.getContent()).hasSize(11).containsOnly(expected.toArray(new DistributionSet[0]));
|
||||||
|
|
||||||
expected = new ArrayList<>();
|
expected = Arrays.asList(dsInComplete);
|
||||||
expected.add(dsInComplete);
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.FALSE);
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.FALSE);
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(1).containsOnly(expected.toArray(new DistributionSet[0]));
|
.getContent()).hasSize(1).containsOnly(expected.toArray(new DistributionSet[0]));
|
||||||
|
|
||||||
expected = new ArrayList<>();
|
expected = Arrays.asList(dsDeleted);
|
||||||
expected.add(dsDeleted);
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
||||||
.setIsDeleted(Boolean.TRUE);
|
.setIsDeleted(Boolean.TRUE);
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
@@ -588,15 +585,14 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
// combine deleted and complete and type
|
// combine deleted and complete and type
|
||||||
expected = new ArrayList<>();
|
expected = new ArrayList<>();
|
||||||
expected.addAll(ds100Group1);
|
expected.addAll(ds5Group1);
|
||||||
expected.addAll(ds100Group2);
|
expected.addAll(dsGroup2);
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsDeleted(Boolean.FALSE)
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsDeleted(Boolean.FALSE)
|
||||||
.setIsComplete(Boolean.TRUE).setType(standardDsType);
|
.setIsComplete(Boolean.TRUE).setType(standardDsType);
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(200).containsOnly(expected.toArray(new DistributionSet[0]));
|
.getContent()).hasSize(10).containsOnly(expected.toArray(new DistributionSet[0]));
|
||||||
|
|
||||||
expected = new ArrayList<>();
|
expected = Arrays.asList(dsDeleted);
|
||||||
expected.add(dsDeleted);
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
||||||
.setType(standardDsType).setIsDeleted(Boolean.TRUE);
|
.setType(standardDsType).setIsDeleted(Boolean.TRUE);
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
@@ -607,19 +603,17 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(0);
|
.getContent()).hasSize(0);
|
||||||
|
|
||||||
expected = new ArrayList<>();
|
expected = Arrays.asList(dsNewType);
|
||||||
expected.add(dsNewType);
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE).setType(newType);
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE).setType(newType);
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(1).containsOnly(expected.toArray(new DistributionSet[0]));
|
.getContent()).hasSize(1).containsOnly(expected.toArray(new DistributionSet[0]));
|
||||||
|
|
||||||
// combine deleted and complete and type and text
|
// combine deleted and complete and type and text
|
||||||
expected = new ArrayList<>();
|
expected = dsGroup2;
|
||||||
expected.addAll(ds100Group2);
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
||||||
.setType(standardDsType).setSearchText("%test2");
|
.setType(standardDsType).setSearchText("%test2");
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(100).containsOnly(expected.toArray(new DistributionSet[0]));
|
.getContent()).hasSize(5).containsOnly(expected.toArray(new DistributionSet[0]));
|
||||||
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
|
||||||
.setIsDeleted(Boolean.TRUE).setType(standardDsType).setSearchText("%test2");
|
.setIsDeleted(Boolean.TRUE).setType(standardDsType).setSearchText("%test2");
|
||||||
@@ -637,12 +631,11 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
.getContent()).hasSize(0);
|
.getContent()).hasSize(0);
|
||||||
|
|
||||||
// combine deleted and complete and type and text and tag
|
// combine deleted and complete and type and text and tag
|
||||||
expected = new ArrayList<>();
|
expected = dsGroup2;
|
||||||
expected.addAll(ds100Group2);
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true).setType(standardDsType)
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true).setType(standardDsType)
|
||||||
.setSearchText("%test2").setTagNames(Arrays.asList(dsTagA.getName()));
|
.setSearchText("%test2").setTagNames(Arrays.asList(dsTagA.getName()));
|
||||||
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
assertThat(distributionSetManagement.findDistributionSetsByFilters(PAGE, distributionSetFilterBuilder.build())
|
||||||
.getContent()).hasSize(100).containsOnly(expected.toArray(new DistributionSet[0]));
|
.getContent()).hasSize(5).containsOnly(expected.toArray(new DistributionSet[0]));
|
||||||
|
|
||||||
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setType(standardDsType).setSearchText("%test2")
|
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setType(standardDsType).setSearchText("%test2")
|
||||||
.setTagNames(Arrays.asList(dsTagA.getName())).setIsComplete(Boolean.FALSE).setIsDeleted(Boolean.FALSE);
|
.setTagNames(Arrays.asList(dsTagA.getName())).setIsComplete(Boolean.FALSE).setIsDeleted(Boolean.FALSE);
|
||||||
|
|||||||
@@ -1171,7 +1171,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@Description("Verify the creation and the start of a rollout.")
|
@Description("Verify the creation and the start of a rollout.")
|
||||||
public void createAndStartRollout() throws Exception {
|
public void createAndStartRollout() throws Exception {
|
||||||
|
|
||||||
final int amountTargetsForRollout = 500;
|
final int amountTargetsForRollout = 50;
|
||||||
final int amountGroups = 5;
|
final int amountGroups = 5;
|
||||||
final String successCondition = "50";
|
final String successCondition = "50";
|
||||||
final String errorCondition = "80";
|
final String errorCondition = "80";
|
||||||
@@ -1203,8 +1203,8 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
myRollout = rolloutManagement.findRolloutById(myRollout.getId()).get();
|
myRollout = rolloutManagement.findRolloutById(myRollout.getId()).get();
|
||||||
assertThat(myRollout.getStatus()).isEqualTo(RolloutStatus.RUNNING);
|
assertThat(myRollout.getStatus()).isEqualTo(RolloutStatus.RUNNING);
|
||||||
final Map<TotalTargetCountStatus.Status, Long> expectedTargetCountStatus = createInitStatusMap();
|
final Map<TotalTargetCountStatus.Status, Long> expectedTargetCountStatus = createInitStatusMap();
|
||||||
expectedTargetCountStatus.put(TotalTargetCountStatus.Status.RUNNING, 100L);
|
expectedTargetCountStatus.put(TotalTargetCountStatus.Status.RUNNING, 10L);
|
||||||
expectedTargetCountStatus.put(TotalTargetCountStatus.Status.SCHEDULED, 400L);
|
expectedTargetCountStatus.put(TotalTargetCountStatus.Status.SCHEDULED, 40L);
|
||||||
validateRolloutActionStatus(myRollout.getId(), expectedTargetCountStatus);
|
validateRolloutActionStatus(myRollout.getId(), expectedTargetCountStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1212,7 +1212,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@Description("Verify the creation and the automatic start of a rollout.")
|
@Description("Verify the creation and the automatic start of a rollout.")
|
||||||
public void createAndAutoStartRollout() throws Exception {
|
public void createAndAutoStartRollout() throws Exception {
|
||||||
|
|
||||||
final int amountTargetsForRollout = 500;
|
final int amountTargetsForRollout = 50;
|
||||||
final int amountGroups = 5;
|
final int amountGroups = 5;
|
||||||
final String successCondition = "50";
|
final String successCondition = "50";
|
||||||
final String errorCondition = "80";
|
final String errorCondition = "80";
|
||||||
@@ -1254,8 +1254,8 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
myRollout = rolloutManagement.findRolloutById(myRollout.getId()).get();
|
myRollout = rolloutManagement.findRolloutById(myRollout.getId()).get();
|
||||||
assertThat(myRollout.getStatus()).isEqualTo(RolloutStatus.RUNNING);
|
assertThat(myRollout.getStatus()).isEqualTo(RolloutStatus.RUNNING);
|
||||||
final Map<TotalTargetCountStatus.Status, Long> expectedTargetCountStatus = createInitStatusMap();
|
final Map<TotalTargetCountStatus.Status, Long> expectedTargetCountStatus = createInitStatusMap();
|
||||||
expectedTargetCountStatus.put(TotalTargetCountStatus.Status.RUNNING, 100L);
|
expectedTargetCountStatus.put(TotalTargetCountStatus.Status.RUNNING, 10L);
|
||||||
expectedTargetCountStatus.put(TotalTargetCountStatus.Status.SCHEDULED, 400L);
|
expectedTargetCountStatus.put(TotalTargetCountStatus.Status.SCHEDULED, 40L);
|
||||||
validateRolloutActionStatus(myRollout.getId(), expectedTargetCountStatus);
|
validateRolloutActionStatus(myRollout.getId(), expectedTargetCountStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -397,7 +397,8 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
@Expect(type = TargetCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 5),
|
@Expect(type = TargetCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 5),
|
||||||
@Expect(type = ActionCreatedEvent.class, count = 2), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
@Expect(type = ActionCreatedEvent.class, count = 2), @Expect(type = ActionUpdatedEvent.class, count = 1),
|
||||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
|
@Expect(type = TargetAssignDistributionSetEvent.class, count = 2),
|
||||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 6) })
|
@Expect(type = SoftwareModuleCreatedEvent.class, count = 6),
|
||||||
|
@Expect(type = TargetPollEvent.class, count = 1) })
|
||||||
public void findTargetByControllerIDWithDetails() {
|
public void findTargetByControllerIDWithDetails() {
|
||||||
final DistributionSet set = testdataFactory.createDistributionSet("test");
|
final DistributionSet set = testdataFactory.createDistributionSet("test");
|
||||||
final DistributionSet set2 = testdataFactory.createDistributionSet("test2");
|
final DistributionSet set2 = testdataFactory.createDistributionSet("test2");
|
||||||
@@ -414,7 +415,7 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
Target target = createTargetWithAttributes("4711");
|
Target target = createTargetWithAttributes("4711");
|
||||||
|
|
||||||
final long current = System.currentTimeMillis();
|
final long current = System.currentTimeMillis();
|
||||||
controllerManagement.updateLastTargetQuery("4711", null);
|
controllerManagement.findOrRegisterTargetIfItDoesNotexist("4711", LOCALHOST);
|
||||||
|
|
||||||
final DistributionSetAssignmentResult result = assignDistributionSet(set.getId(), "4711");
|
final DistributionSetAssignmentResult result = assignDistributionSet(set.getId(), "4711");
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.T
|
|||||||
import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationValidatorException;
|
import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationValidatorException;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.springframework.context.EnvironmentAware;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
|
||||||
import ru.yandex.qatools.allure.annotations.Description;
|
import ru.yandex.qatools.allure.annotations.Description;
|
||||||
import ru.yandex.qatools.allure.annotations.Features;
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
@@ -30,7 +32,14 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
|
|
||||||
@Features("Component Tests - Repository")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("Tenant Configuration Management")
|
@Stories("Tenant Configuration Management")
|
||||||
public class TenantConfigurationManagementTest extends AbstractJpaIntegrationTest {
|
public class TenantConfigurationManagementTest extends AbstractJpaIntegrationTest implements EnvironmentAware {
|
||||||
|
|
||||||
|
private Environment environment = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEnvironment(final Environment environment) {
|
||||||
|
this.environment = environment;
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests that tenant specific configuration can be persisted and in case the tenant does not have specific configuration the default from environment is used instead.")
|
@Description("Tests that tenant specific configuration can be persisted and in case the tenant does not have specific configuration the default from environment is used instead.")
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
|||||||
public void targetCreatedEventIsPublished() throws InterruptedException {
|
public void targetCreatedEventIsPublished() throws InterruptedException {
|
||||||
final Target createdTarget = testdataFactory.createTarget("12345");
|
final Target createdTarget = testdataFactory.createTarget("12345");
|
||||||
|
|
||||||
final TargetCreatedEvent targetCreatedEvent = eventListener.waitForEvent(TargetCreatedEvent.class, 1,
|
final TargetCreatedEvent targetCreatedEvent = eventListener.waitForEvent(TargetCreatedEvent.class);
|
||||||
TimeUnit.SECONDS);
|
|
||||||
assertThat(targetCreatedEvent).isNotNull();
|
assertThat(targetCreatedEvent).isNotNull();
|
||||||
assertThat(targetCreatedEvent.getEntity().getId()).isEqualTo(createdTarget.getId());
|
assertThat(targetCreatedEvent.getEntity().getId()).isEqualTo(createdTarget.getId());
|
||||||
}
|
}
|
||||||
@@ -73,8 +72,7 @@ public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
|||||||
targetManagement
|
targetManagement
|
||||||
.updateTarget(entityFactory.target().update(createdTarget.getControllerId()).name("updateName"));
|
.updateTarget(entityFactory.target().update(createdTarget.getControllerId()).name("updateName"));
|
||||||
|
|
||||||
final TargetUpdatedEvent targetUpdatedEvent = eventListener.waitForEvent(TargetUpdatedEvent.class, 1,
|
final TargetUpdatedEvent targetUpdatedEvent = eventListener.waitForEvent(TargetUpdatedEvent.class);
|
||||||
TimeUnit.SECONDS);
|
|
||||||
assertThat(targetUpdatedEvent).isNotNull();
|
assertThat(targetUpdatedEvent).isNotNull();
|
||||||
assertThat(targetUpdatedEvent.getEntity().getId()).isEqualTo(createdTarget.getId());
|
assertThat(targetUpdatedEvent.getEntity().getId()).isEqualTo(createdTarget.getId());
|
||||||
}
|
}
|
||||||
@@ -86,8 +84,7 @@ public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
targetManagement.deleteTarget("12345");
|
targetManagement.deleteTarget("12345");
|
||||||
|
|
||||||
final TargetDeletedEvent targetDeletedEvent = eventListener.waitForEvent(TargetDeletedEvent.class, 1,
|
final TargetDeletedEvent targetDeletedEvent = eventListener.waitForEvent(TargetDeletedEvent.class);
|
||||||
TimeUnit.SECONDS);
|
|
||||||
assertThat(targetDeletedEvent).isNotNull();
|
assertThat(targetDeletedEvent).isNotNull();
|
||||||
assertThat(targetDeletedEvent.getEntityId()).isEqualTo(createdTarget.getId());
|
assertThat(targetDeletedEvent.getEntityId()).isEqualTo(createdTarget.getId());
|
||||||
}
|
}
|
||||||
@@ -110,8 +107,7 @@ public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
|||||||
rolloutManagement.deleteRollout(createdRollout.getId());
|
rolloutManagement.deleteRollout(createdRollout.getId());
|
||||||
rolloutManagement.handleRollouts();
|
rolloutManagement.handleRollouts();
|
||||||
|
|
||||||
final RolloutDeletedEvent rolloutDeletedEvent = eventListener.waitForEvent(RolloutDeletedEvent.class, 1,
|
final RolloutDeletedEvent rolloutDeletedEvent = eventListener.waitForEvent(RolloutDeletedEvent.class);
|
||||||
TimeUnit.SECONDS);
|
|
||||||
assertThat(rolloutDeletedEvent).isNotNull();
|
assertThat(rolloutDeletedEvent).isNotNull();
|
||||||
assertThat(rolloutDeletedEvent.getEntityId()).isEqualTo(createdRollout.getId());
|
assertThat(rolloutDeletedEvent.getEntityId()).isEqualTo(createdRollout.getId());
|
||||||
}
|
}
|
||||||
@@ -121,8 +117,8 @@ public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
|||||||
public void distributionSetCreatedEventIsPublished() throws InterruptedException {
|
public void distributionSetCreatedEventIsPublished() throws InterruptedException {
|
||||||
final DistributionSet createDistributionSet = testdataFactory.createDistributionSet();
|
final DistributionSet createDistributionSet = testdataFactory.createDistributionSet();
|
||||||
|
|
||||||
final DistributionSetCreatedEvent dsCreatedEvent = eventListener.waitForEvent(DistributionSetCreatedEvent.class,
|
final DistributionSetCreatedEvent dsCreatedEvent = eventListener
|
||||||
1, TimeUnit.SECONDS);
|
.waitForEvent(DistributionSetCreatedEvent.class);
|
||||||
assertThat(dsCreatedEvent).isNotNull();
|
assertThat(dsCreatedEvent).isNotNull();
|
||||||
assertThat(dsCreatedEvent.getEntity().getId()).isEqualTo(createDistributionSet.getId());
|
assertThat(dsCreatedEvent.getEntity().getId()).isEqualTo(createDistributionSet.getId());
|
||||||
}
|
}
|
||||||
@@ -134,8 +130,8 @@ public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
|||||||
|
|
||||||
distributionSetManagement.deleteDistributionSet(createDistributionSet.getId());
|
distributionSetManagement.deleteDistributionSet(createDistributionSet.getId());
|
||||||
|
|
||||||
final DistributionSetDeletedEvent dsDeletedEvent = eventListener.waitForEvent(DistributionSetDeletedEvent.class,
|
final DistributionSetDeletedEvent dsDeletedEvent = eventListener
|
||||||
1, TimeUnit.SECONDS);
|
.waitForEvent(DistributionSetDeletedEvent.class);
|
||||||
assertThat(dsDeletedEvent).isNotNull();
|
assertThat(dsDeletedEvent).isNotNull();
|
||||||
assertThat(dsDeletedEvent.getEntityId()).isEqualTo(createDistributionSet.getId());
|
assertThat(dsDeletedEvent.getEntityId()).isEqualTo(createDistributionSet.getId());
|
||||||
}
|
}
|
||||||
@@ -146,7 +142,7 @@ public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
|||||||
final SoftwareModule softwareModule = testdataFactory.createSoftwareModuleApp();
|
final SoftwareModule softwareModule = testdataFactory.createSoftwareModuleApp();
|
||||||
|
|
||||||
final SoftwareModuleCreatedEvent softwareModuleCreatedEvent = eventListener
|
final SoftwareModuleCreatedEvent softwareModuleCreatedEvent = eventListener
|
||||||
.waitForEvent(SoftwareModuleCreatedEvent.class, 1, TimeUnit.SECONDS);
|
.waitForEvent(SoftwareModuleCreatedEvent.class);
|
||||||
assertThat(softwareModuleCreatedEvent).isNotNull();
|
assertThat(softwareModuleCreatedEvent).isNotNull();
|
||||||
assertThat(softwareModuleCreatedEvent.getEntity().getId()).isEqualTo(softwareModule.getId());
|
assertThat(softwareModuleCreatedEvent.getEntity().getId()).isEqualTo(softwareModule.getId());
|
||||||
}
|
}
|
||||||
@@ -159,7 +155,7 @@ public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
|||||||
.updateSoftwareModule(entityFactory.softwareModule().update(softwareModule.getId()).description("New"));
|
.updateSoftwareModule(entityFactory.softwareModule().update(softwareModule.getId()).description("New"));
|
||||||
|
|
||||||
final SoftwareModuleUpdatedEvent softwareModuleUpdatedEvent = eventListener
|
final SoftwareModuleUpdatedEvent softwareModuleUpdatedEvent = eventListener
|
||||||
.waitForEvent(SoftwareModuleUpdatedEvent.class, 1, TimeUnit.SECONDS);
|
.waitForEvent(SoftwareModuleUpdatedEvent.class);
|
||||||
assertThat(softwareModuleUpdatedEvent).isNotNull();
|
assertThat(softwareModuleUpdatedEvent).isNotNull();
|
||||||
assertThat(softwareModuleUpdatedEvent.getEntity().getId()).isEqualTo(softwareModule.getId());
|
assertThat(softwareModuleUpdatedEvent.getEntity().getId()).isEqualTo(softwareModule.getId());
|
||||||
}
|
}
|
||||||
@@ -171,7 +167,7 @@ public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
|||||||
softwareModuleManagement.deleteSoftwareModule(softwareModule.getId());
|
softwareModuleManagement.deleteSoftwareModule(softwareModule.getId());
|
||||||
|
|
||||||
final SoftwareModuleDeletedEvent softwareModuleDeletedEvent = eventListener
|
final SoftwareModuleDeletedEvent softwareModuleDeletedEvent = eventListener
|
||||||
.waitForEvent(SoftwareModuleDeletedEvent.class, 1, TimeUnit.SECONDS);
|
.waitForEvent(SoftwareModuleDeletedEvent.class);
|
||||||
assertThat(softwareModuleDeletedEvent).isNotNull();
|
assertThat(softwareModuleDeletedEvent).isNotNull();
|
||||||
assertThat(softwareModuleDeletedEvent.getEntityId()).isEqualTo(softwareModule.getId());
|
assertThat(softwareModuleDeletedEvent.getEntityId()).isEqualTo(softwareModule.getId());
|
||||||
}
|
}
|
||||||
@@ -194,15 +190,14 @@ public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
|
|||||||
queue.offer(event);
|
queue.offer(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T waitForEvent(final Class<T> eventType, final long timeout, final TimeUnit timeUnit)
|
public <T> T waitForEvent(final Class<T> eventType) throws InterruptedException {
|
||||||
throws InterruptedException {
|
|
||||||
TenantAwareEvent event = null;
|
TenantAwareEvent event = null;
|
||||||
while ((event = queue.poll(timeout, timeUnit)) != null) {
|
while ((event = queue.poll(5, TimeUnit.SECONDS)) != null) {
|
||||||
if (event.getClass().isAssignableFrom(eventType)) {
|
if (event.getClass().isAssignableFrom(eventType)) {
|
||||||
return (T) event;
|
return (T) event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Assertions.fail("Missing event " + eventType + " within timeout " + timeout + " " + timeUnit);
|
Assertions.fail("Missing event " + eventType + " within timeout.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class RSQLTargetFieldTest extends AbstractJpaIntegrationTest {
|
|||||||
private Target target2;
|
private Target target2;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void seuptBeforeTest() throws InterruptedException {
|
public void setupBeforeTest() throws InterruptedException {
|
||||||
|
|
||||||
final DistributionSet ds = testdataFactory.createDistributionSet("AssignedDs");
|
final DistributionSet ds = testdataFactory.createDistributionSet("AssignedDs");
|
||||||
|
|
||||||
@@ -48,14 +48,14 @@ public class RSQLTargetFieldTest extends AbstractJpaIntegrationTest {
|
|||||||
.name("targetName123").description("targetDesc123"));
|
.name("targetName123").description("targetDesc123"));
|
||||||
attributes.put("revision", "1.1");
|
attributes.put("revision", "1.1");
|
||||||
target = controllerManagement.updateControllerAttributes(target.getControllerId(), attributes);
|
target = controllerManagement.updateControllerAttributes(target.getControllerId(), attributes);
|
||||||
target = controllerManagement.updateLastTargetQuery(target.getControllerId(), null);
|
target = controllerManagement.findOrRegisterTargetIfItDoesNotexist(target.getControllerId(), LOCALHOST);
|
||||||
|
|
||||||
target2 = targetManagement
|
target2 = targetManagement
|
||||||
.createTarget(entityFactory.target().create().controllerId("targetId1234").description("targetId1234"));
|
.createTarget(entityFactory.target().create().controllerId("targetId1234").description("targetId1234"));
|
||||||
attributes.put("revision", "1.2");
|
attributes.put("revision", "1.2");
|
||||||
Thread.sleep(1);
|
Thread.sleep(1);
|
||||||
target2 = controllerManagement.updateControllerAttributes(target2.getControllerId(), attributes);
|
target2 = controllerManagement.updateControllerAttributes(target2.getControllerId(), attributes);
|
||||||
target2 = controllerManagement.updateLastTargetQuery(target2.getControllerId(), null);
|
target2 = controllerManagement.findOrRegisterTargetIfItDoesNotexist(target2.getControllerId(), LOCALHOST);
|
||||||
|
|
||||||
testdataFactory.createTarget("targetId1235");
|
testdataFactory.createTarget("targetId1235");
|
||||||
testdataFactory.createTarget("targetId1236");
|
testdataFactory.createTarget("targetId1236");
|
||||||
|
|||||||
@@ -13,12 +13,14 @@ import static org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpre
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
import org.eclipse.hawkbit.artifact.repository.ArtifactFilesystemProperties;
|
import org.eclipse.hawkbit.artifact.repository.ArtifactFilesystemProperties;
|
||||||
import org.eclipse.hawkbit.artifact.repository.ArtifactRepository;
|
import org.eclipse.hawkbit.artifact.repository.ArtifactRepository;
|
||||||
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
||||||
@@ -52,11 +54,12 @@ import org.eclipse.hawkbit.repository.model.Target;
|
|||||||
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
||||||
import org.eclipse.hawkbit.repository.test.TestConfiguration;
|
import org.eclipse.hawkbit.repository.test.TestConfiguration;
|
||||||
import org.eclipse.hawkbit.repository.test.matcher.EventVerifier;
|
import org.eclipse.hawkbit.repository.test.matcher.EventVerifier;
|
||||||
import org.eclipse.hawkbit.security.ExcludePathAwareShallowETagFilter;
|
|
||||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.rules.TestWatcher;
|
import org.junit.rules.TestWatcher;
|
||||||
import org.junit.runner.Description;
|
import org.junit.runner.Description;
|
||||||
@@ -67,8 +70,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||||
import org.springframework.cloud.bus.ServiceMatcher;
|
import org.springframework.cloud.bus.ServiceMatcher;
|
||||||
import org.springframework.cloud.stream.test.binder.TestSupportBinderAutoConfiguration;
|
import org.springframework.cloud.stream.test.binder.TestSupportBinderAutoConfiguration;
|
||||||
import org.springframework.context.EnvironmentAware;
|
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
import org.springframework.data.auditing.AuditingHandler;
|
import org.springframework.data.auditing.AuditingHandler;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@@ -81,14 +82,8 @@ import org.springframework.test.context.ActiveProfiles;
|
|||||||
import org.springframework.test.context.TestExecutionListeners;
|
import org.springframework.test.context.TestExecutionListeners;
|
||||||
import org.springframework.test.context.TestExecutionListeners.MergeMode;
|
import org.springframework.test.context.TestExecutionListeners.MergeMode;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
import org.springframework.test.context.web.WebAppConfiguration;
|
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
|
||||||
import org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder;
|
|
||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@WebAppConfiguration
|
|
||||||
@ActiveProfiles({ "test" })
|
@ActiveProfiles({ "test" })
|
||||||
@WithUser(principal = "bumlux", allSpPermissions = true, authorities = { CONTROLLER_ROLE, SYSTEM_ROLE })
|
@WithUser(principal = "bumlux", allSpPermissions = true, authorities = { CONTROLLER_ROLE, SYSTEM_ROLE })
|
||||||
@SpringApplicationConfiguration(classes = { TestConfiguration.class, TestSupportBinderAutoConfiguration.class })
|
@SpringApplicationConfiguration(classes = { TestConfiguration.class, TestSupportBinderAutoConfiguration.class })
|
||||||
@@ -102,11 +97,13 @@ import org.springframework.web.context.WebApplicationContext;
|
|||||||
// important!
|
// important!
|
||||||
@TestExecutionListeners(inheritListeners = true, listeners = { EventVerifier.class, CleanupTestExecutionListener.class,
|
@TestExecutionListeners(inheritListeners = true, listeners = { EventVerifier.class, CleanupTestExecutionListener.class,
|
||||||
MySqlTestDatabase.class }, mergeMode = MergeMode.MERGE_WITH_DEFAULTS)
|
MySqlTestDatabase.class }, mergeMode = MergeMode.MERGE_WITH_DEFAULTS)
|
||||||
public abstract class AbstractIntegrationTest implements EnvironmentAware {
|
public abstract class AbstractIntegrationTest {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AbstractIntegrationTest.class);
|
private static final Logger LOG = LoggerFactory.getLogger(AbstractIntegrationTest.class);
|
||||||
|
|
||||||
protected static final Pageable PAGE = new PageRequest(0, 400, new Sort(Direction.ASC, "id"));
|
protected static final Pageable PAGE = new PageRequest(0, 400, new Sort(Direction.ASC, "id"));
|
||||||
|
|
||||||
|
protected static final URI LOCALHOST = URI.create("http://127.0.0.1");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant for MediaType HAL with encoding UTF-8. Necessary since Spring
|
* Constant for MediaType HAL with encoding UTF-8. Necessary since Spring
|
||||||
* version 4.3.2 @see https://jira.spring.io/browse/SPR-14577
|
* version 4.3.2 @see https://jira.spring.io/browse/SPR-14577
|
||||||
@@ -154,9 +151,6 @@ public abstract class AbstractIntegrationTest implements EnvironmentAware {
|
|||||||
@Autowired
|
@Autowired
|
||||||
protected ArtifactManagement artifactManagement;
|
protected ArtifactManagement artifactManagement;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
protected WebApplicationContext context;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected AuditingHandler auditingHandler;
|
protected AuditingHandler auditingHandler;
|
||||||
|
|
||||||
@@ -190,8 +184,6 @@ public abstract class AbstractIntegrationTest implements EnvironmentAware {
|
|||||||
@Autowired
|
@Autowired
|
||||||
protected QuotaManagement quotaManagement;
|
protected QuotaManagement quotaManagement;
|
||||||
|
|
||||||
protected MockMvc mvc;
|
|
||||||
|
|
||||||
protected SoftwareModuleType osType;
|
protected SoftwareModuleType osType;
|
||||||
protected SoftwareModuleType appType;
|
protected SoftwareModuleType appType;
|
||||||
protected SoftwareModuleType runtimeType;
|
protected SoftwareModuleType runtimeType;
|
||||||
@@ -226,13 +218,6 @@ public abstract class AbstractIntegrationTest implements EnvironmentAware {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected Environment environment = null;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setEnvironment(final Environment environment) {
|
|
||||||
this.environment = environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected DistributionSetAssignmentResult assignDistributionSet(final Long dsID, final String controllerId) {
|
protected DistributionSetAssignmentResult assignDistributionSet(final Long dsID, final String controllerId) {
|
||||||
return deploymentManagement.assignDistributionSet(dsID, Arrays.asList(
|
return deploymentManagement.assignDistributionSet(dsID, Arrays.asList(
|
||||||
new TargetWithActionType(controllerId, ActionType.FORCED, RepositoryModelConstants.NO_FORCE_TIME)));
|
new TargetWithActionType(controllerId, ActionType.FORCED, RepositoryModelConstants.NO_FORCE_TIME)));
|
||||||
@@ -278,7 +263,6 @@ public abstract class AbstractIntegrationTest implements EnvironmentAware {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before() throws Exception {
|
public void before() throws Exception {
|
||||||
mvc = createMvcWebAppContext().build();
|
|
||||||
final String description = "Updated description.";
|
final String description = "Updated description.";
|
||||||
|
|
||||||
osType = securityRule
|
osType = securityRule
|
||||||
@@ -299,20 +283,32 @@ public abstract class AbstractIntegrationTest implements EnvironmentAware {
|
|||||||
standardDsType = securityRule.runAsPrivileged(() -> testdataFactory.findOrCreateDefaultTestDsType());
|
standardDsType = securityRule.runAsPrivileged(() -> testdataFactory.findOrCreateDefaultTestDsType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String artifactDirectory = "./artifactrepo/" + RandomStringUtils.randomAlphanumeric(20);
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void cleanUp() {
|
public void cleanUp() {
|
||||||
|
if (new File(artifactDirectory).exists()) {
|
||||||
try {
|
try {
|
||||||
FileUtils.deleteDirectory(new File(artifactFilesystemProperties.getPath()));
|
FileUtils.cleanDirectory(new File(artifactDirectory));
|
||||||
} catch (final IOException | IllegalArgumentException e) {
|
} catch (final IOException | IllegalArgumentException e) {
|
||||||
LOG.warn("Cannot cleanup file-directory", e);
|
LOG.warn("Cannot cleanup file-directory", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected DefaultMockMvcBuilder createMvcWebAppContext() {
|
@BeforeClass
|
||||||
return MockMvcBuilders.webAppContextSetup(context)
|
public static void beforeClass() {
|
||||||
.addFilter(new ExcludePathAwareShallowETagFilter(
|
System.setProperty("org.eclipse.hawkbit.repository.file.path", artifactDirectory);
|
||||||
"/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download",
|
}
|
||||||
"/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/**",
|
|
||||||
"/api/v1/downloadserver/**"));
|
@AfterClass
|
||||||
|
public static void afterClass() {
|
||||||
|
if (new File(artifactDirectory).exists()) {
|
||||||
|
try {
|
||||||
|
FileUtils.deleteDirectory(new File(artifactDirectory));
|
||||||
|
} catch (final IOException | IllegalArgumentException e) {
|
||||||
|
LOG.warn("Cannot delete file-directory", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
|||||||
import org.eclipse.hawkbit.repository.TagManagement;
|
import org.eclipse.hawkbit.repository.TagManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.builder.TagCreate;
|
import org.eclipse.hawkbit.repository.builder.TagCreate;
|
||||||
|
import org.eclipse.hawkbit.repository.builder.TargetCreate;
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||||
@@ -752,12 +753,13 @@ public class TestdataFactory {
|
|||||||
* @return {@link List} of {@link Target} entities
|
* @return {@link List} of {@link Target} entities
|
||||||
*/
|
*/
|
||||||
public List<Target> createTargets(final int number) {
|
public List<Target> createTargets(final int number) {
|
||||||
final List<Target> targets = Lists.newArrayListWithExpectedSize(number);
|
|
||||||
|
final List<TargetCreate> targets = Lists.newArrayListWithExpectedSize(number);
|
||||||
for (int i = 0; i < number; i++) {
|
for (int i = 0; i < number; i++) {
|
||||||
targets.add(createTarget(DEFAULT_CONTROLLER_ID + i));
|
targets.add(entityFactory.target().create().controllerId(DEFAULT_CONTROLLER_ID + i));
|
||||||
}
|
}
|
||||||
|
|
||||||
return targets;
|
return targetManagement.createTargets(targets);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
# Test utility properties for easier fault investigation - START
|
# Test utility properties for easier fault investigation - START
|
||||||
## Logging - START
|
## Logging - START
|
||||||
logging.level.=INFO
|
logging.level.root=ERROR
|
||||||
logging.level.org.eclipse.hawkbit.repository.test.matcher.EventVerifier=ERROR
|
logging.level.org.eclipse.hawkbit.repository.test.matcher.EventVerifier=ERROR
|
||||||
logging.level.org.eclipse.persistence=ERROR
|
logging.level.org.eclipse.persistence=ERROR
|
||||||
spring.datasource.eclipselink.logging.logger=JavaLogger
|
spring.datasource.eclipselink.logging.logger=JavaLogger
|
||||||
|
|||||||
@@ -10,23 +10,24 @@ package org.eclipse.hawkbit.rest;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.rest.exception.ResponseExceptionHandler;
|
||||||
import org.eclipse.hawkbit.rest.util.FilterHttpResponse;
|
import org.eclipse.hawkbit.rest.util.FilterHttpResponse;
|
||||||
import org.eclipse.hawkbit.rest.util.HttpResponseFactoryBean;
|
import org.eclipse.hawkbit.rest.util.HttpResponseFactoryBean;
|
||||||
import org.eclipse.hawkbit.rest.util.RequestResponseContextHolder;
|
import org.eclipse.hawkbit.rest.util.RequestResponseContextHolder;
|
||||||
import org.springframework.beans.factory.FactoryBean;
|
import org.springframework.beans.factory.FactoryBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
||||||
import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType;
|
import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration for Rest api.
|
* Configuration for Rest api.
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan
|
|
||||||
@EnableHypermediaSupport(type = { HypermediaType.HAL })
|
@EnableHypermediaSupport(type = { HypermediaType.HAL })
|
||||||
public class RestConfiguration {
|
public class RestConfiguration {
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ public class RestConfiguration {
|
|||||||
* Create filter for {@link HttpServletResponse}.
|
* Create filter for {@link HttpServletResponse}.
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public FilterHttpResponse filterHttpResponse() {
|
FilterHttpResponse filterHttpResponse() {
|
||||||
return new FilterHttpResponse();
|
return new FilterHttpResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ public class RestConfiguration {
|
|||||||
* Create factory bean for {@link HttpServletResponse}.
|
* Create factory bean for {@link HttpServletResponse}.
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public FactoryBean<HttpServletResponse> httpResponseFactoryBean() {
|
FactoryBean<HttpServletResponse> httpResponseFactoryBean() {
|
||||||
return new HttpResponseFactoryBean();
|
return new HttpResponseFactoryBean();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +52,16 @@ public class RestConfiguration {
|
|||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
@Scope(value = WebApplicationContext.SCOPE_REQUEST)
|
@Scope(value = WebApplicationContext.SCOPE_REQUEST)
|
||||||
public RequestResponseContextHolder requestResponseContextHolder() {
|
RequestResponseContextHolder requestResponseContextHolder() {
|
||||||
return new RequestResponseContextHolder();
|
return new RequestResponseContextHolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link ControllerAdvice} for mapping {@link RuntimeException}s from the
|
||||||
|
* repository to {@link HttpStatus} codes.
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
ResponseExceptionHandler responseExceptionHandler() {
|
||||||
|
return new ResponseExceptionHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,22 +11,47 @@ package org.eclipse.hawkbit.rest;
|
|||||||
import org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration;
|
import org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration;
|
||||||
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTest;
|
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTest;
|
||||||
import org.eclipse.hawkbit.rest.util.FilterHttpResponse;
|
import org.eclipse.hawkbit.rest.util.FilterHttpResponse;
|
||||||
|
import org.eclipse.hawkbit.security.ExcludePathAwareShallowETagFilter;
|
||||||
|
import org.junit.Before;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||||
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder;
|
import org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder;
|
||||||
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||||
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract Test for Rest tests.
|
* Abstract Test for Rest tests.
|
||||||
*/
|
*/
|
||||||
|
@WebAppConfiguration
|
||||||
@SpringApplicationConfiguration(classes = { RestConfiguration.class, RepositoryApplicationConfiguration.class })
|
@SpringApplicationConfiguration(classes = { RestConfiguration.class, RepositoryApplicationConfiguration.class })
|
||||||
public abstract class AbstractRestIntegrationTest extends AbstractIntegrationTest {
|
public abstract class AbstractRestIntegrationTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
protected MockMvc mvc;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FilterHttpResponse filterHttpResponse;
|
private FilterHttpResponse filterHttpResponse;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected WebApplicationContext webApplicationContext;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DefaultMockMvcBuilder createMvcWebAppContext() {
|
@Before
|
||||||
final DefaultMockMvcBuilder createMvcWebAppContext = super.createMvcWebAppContext();
|
public void before() throws Exception {
|
||||||
return createMvcWebAppContext.addFilter(filterHttpResponse);
|
super.before();
|
||||||
|
mvc = createMvcWebAppContext(webApplicationContext).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DefaultMockMvcBuilder createMvcWebAppContext(final WebApplicationContext context) {
|
||||||
|
final DefaultMockMvcBuilder createMvcWebAppContext = MockMvcBuilders.webAppContextSetup(context);
|
||||||
|
|
||||||
|
createMvcWebAppContext.addFilter(
|
||||||
|
new ExcludePathAwareShallowETagFilter("/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download",
|
||||||
|
"/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/**",
|
||||||
|
"/api/v1/downloadserver/**"));
|
||||||
|
createMvcWebAppContext.addFilter(filterHttpResponse);
|
||||||
|
|
||||||
|
return createMvcWebAppContext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ import org.eclipse.hawkbit.ui.distributions.smtype.DistSMTypeFilterLayout;
|
|||||||
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
import org.eclipse.hawkbit.ui.distributions.state.ManageDistUIState;
|
||||||
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
|
||||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||||
import org.eclipse.hawkbit.ui.push.DistributionCreatedEventContainer;
|
import org.eclipse.hawkbit.ui.push.DistributionSetCreatedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.push.DistributionDeletedEventContainer;
|
import org.eclipse.hawkbit.ui.push.DistributionSetDeletedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.push.SoftwareModuleCreatedEventContainer;
|
import org.eclipse.hawkbit.ui.push.SoftwareModuleCreatedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.push.SoftwareModuleDeletedEventContainer;
|
import org.eclipse.hawkbit.ui.push.SoftwareModuleDeletedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
@@ -278,8 +278,8 @@ public class DistributionsView extends AbstractNotificationView implements Brows
|
|||||||
protected Map<Class<?>, RefreshableContainer> getSupportedPushEvents() {
|
protected Map<Class<?>, RefreshableContainer> getSupportedPushEvents() {
|
||||||
final Map<Class<?>, RefreshableContainer> supportedEvents = Maps.newHashMapWithExpectedSize(2);
|
final Map<Class<?>, RefreshableContainer> supportedEvents = Maps.newHashMapWithExpectedSize(2);
|
||||||
|
|
||||||
supportedEvents.put(DistributionCreatedEventContainer.class, distributionTableLayout.getTable());
|
supportedEvents.put(DistributionSetCreatedEventContainer.class, distributionTableLayout.getTable());
|
||||||
supportedEvents.put(DistributionDeletedEventContainer.class, distributionTableLayout.getTable());
|
supportedEvents.put(DistributionSetDeletedEventContainer.class, distributionTableLayout.getTable());
|
||||||
|
|
||||||
supportedEvents.put(SoftwareModuleCreatedEventContainer.class, softwareModuleTableLayout.getTable());
|
supportedEvents.put(SoftwareModuleCreatedEventContainer.class, softwareModuleTableLayout.getTable());
|
||||||
supportedEvents.put(SoftwareModuleDeletedEventContainer.class, softwareModuleTableLayout.getTable());
|
supportedEvents.put(SoftwareModuleDeletedEventContainer.class, softwareModuleTableLayout.getTable());
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ import org.eclipse.hawkbit.ui.management.targettable.TargetTableLayout;
|
|||||||
import org.eclipse.hawkbit.ui.management.targettag.CreateUpdateTargetTagLayoutWindow;
|
import org.eclipse.hawkbit.ui.management.targettag.CreateUpdateTargetTagLayoutWindow;
|
||||||
import org.eclipse.hawkbit.ui.management.targettag.TargetTagFilterLayout;
|
import org.eclipse.hawkbit.ui.management.targettag.TargetTagFilterLayout;
|
||||||
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
import org.eclipse.hawkbit.ui.menu.DashboardMenuItem;
|
||||||
import org.eclipse.hawkbit.ui.push.DistributionCreatedEventContainer;
|
import org.eclipse.hawkbit.ui.push.DistributionSetCreatedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.push.DistributionDeletedEventContainer;
|
import org.eclipse.hawkbit.ui.push.DistributionSetDeletedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagCreatedEventContainer;
|
import org.eclipse.hawkbit.ui.push.DistributionSetTagCreatedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagDeletedEventContainer;
|
import org.eclipse.hawkbit.ui.push.DistributionSetTagDeletedEventContainer;
|
||||||
import org.eclipse.hawkbit.ui.push.DistributionSetTagUpdatedEventContainer;
|
import org.eclipse.hawkbit.ui.push.DistributionSetTagUpdatedEventContainer;
|
||||||
@@ -402,8 +402,8 @@ public class DeploymentView extends AbstractNotificationView implements BrowserW
|
|||||||
supportedEvents.put(TargetCreatedEventContainer.class, targetTableLayout.getTable());
|
supportedEvents.put(TargetCreatedEventContainer.class, targetTableLayout.getTable());
|
||||||
supportedEvents.put(TargetDeletedEventContainer.class, targetTableLayout.getTable());
|
supportedEvents.put(TargetDeletedEventContainer.class, targetTableLayout.getTable());
|
||||||
|
|
||||||
supportedEvents.put(DistributionCreatedEventContainer.class, distributionTableLayout.getTable());
|
supportedEvents.put(DistributionSetCreatedEventContainer.class, distributionTableLayout.getTable());
|
||||||
supportedEvents.put(DistributionDeletedEventContainer.class, distributionTableLayout.getTable());
|
supportedEvents.put(DistributionSetDeletedEventContainer.class, distributionTableLayout.getTable());
|
||||||
|
|
||||||
supportedEvents.put(TargetTagCreatedEventContainer.class, targetTagFilterLayout);
|
supportedEvents.put(TargetTagCreatedEventContainer.class, targetTagFilterLayout);
|
||||||
supportedEvents.put(TargetTagDeletedEventContainer.class, targetTagFilterLayout);
|
supportedEvents.put(TargetTagDeletedEventContainer.class, targetTagFilterLayout);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy, Applicati
|
|||||||
this.delay = delay;
|
this.delay = delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEventProvided(final org.eclipse.hawkbit.repository.event.TenantAwareEvent event) {
|
private boolean isEventProvided(final TenantAwareEvent event) {
|
||||||
return eventProvider.getEvents().containsKey(event.getClass());
|
return eventProvider.getEvents().containsKey(event.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,8 +174,7 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy, Applicati
|
|||||||
* @return {@code true} if the event can be dispatched to the UI
|
* @return {@code true} if the event can be dispatched to the UI
|
||||||
* otherwise {@code false}
|
* otherwise {@code false}
|
||||||
*/
|
*/
|
||||||
private boolean eventSecurityCheck(final SecurityContext userContext,
|
private boolean eventSecurityCheck(final SecurityContext userContext, final TenantAwareEvent event) {
|
||||||
final org.eclipse.hawkbit.repository.event.TenantAwareEvent event) {
|
|
||||||
if (userContext == null || userContext.getAuthentication() == null) {
|
if (userContext == null || userContext.getAuthentication() == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -187,8 +186,7 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy, Applicati
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doDispatch(final List<org.eclipse.hawkbit.repository.event.TenantAwareEvent> events,
|
private void doDispatch(final List<TenantAwareEvent> events, final WrappedSession wrappedSession) {
|
||||||
final WrappedSession wrappedSession) {
|
|
||||||
final SecurityContext userContext = (SecurityContext) wrappedSession
|
final SecurityContext userContext = (SecurityContext) wrappedSession
|
||||||
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
|
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
|
||||||
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreated
|
|||||||
* EventHolder for {@link DistributionSetCreatedEvent}s.
|
* EventHolder for {@link DistributionSetCreatedEvent}s.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DistributionCreatedEventContainer implements EventContainer<DistributionSetCreatedEvent> {
|
public class DistributionSetCreatedEventContainer implements EventContainer<DistributionSetCreatedEvent> {
|
||||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "distribution.created.event.container.notifcation.message";
|
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "distribution.created.event.container.notifcation.message";
|
||||||
private final List<DistributionSetCreatedEvent> events;
|
private final List<DistributionSetCreatedEvent> events;
|
||||||
|
|
||||||
DistributionCreatedEventContainer(final List<DistributionSetCreatedEvent> events) {
|
DistributionSetCreatedEventContainer(final List<DistributionSetCreatedEvent> events) {
|
||||||
this.events = events;
|
this.events = events;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,11 +16,11 @@ import org.eclipse.hawkbit.repository.event.remote.DistributionSetDeletedEvent;
|
|||||||
* EventHolder for {@link DistributionSetDeletedEvent}s.
|
* EventHolder for {@link DistributionSetDeletedEvent}s.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DistributionDeletedEventContainer implements EventContainer<DistributionSetDeletedEvent> {
|
public class DistributionSetDeletedEventContainer implements EventContainer<DistributionSetDeletedEvent> {
|
||||||
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "distribution.deleted.event.container.notifcation.message";
|
private static final String I18N_UNREAD_NOTIFICATION_UNREAD_MESSAGE = "distribution.deleted.event.container.notifcation.message";
|
||||||
private final List<DistributionSetDeletedEvent> events;
|
private final List<DistributionSetDeletedEvent> events;
|
||||||
|
|
||||||
DistributionDeletedEventContainer(final List<DistributionSetDeletedEvent> events) {
|
DistributionSetDeletedEventContainer(final List<DistributionSetDeletedEvent> events) {
|
||||||
this.events = events;
|
this.events = events;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +56,8 @@ public class HawkbitEventProvider implements UIEventProvider {
|
|||||||
EVENTS.put(CancelTargetAssignmentEvent.class, CancelTargetAssignmentEventContainer.class);
|
EVENTS.put(CancelTargetAssignmentEvent.class, CancelTargetAssignmentEventContainer.class);
|
||||||
|
|
||||||
EVENTS.put(DistributionSetUpdatedEvent.class, DistributionSetUpdatedEventContainer.class);
|
EVENTS.put(DistributionSetUpdatedEvent.class, DistributionSetUpdatedEventContainer.class);
|
||||||
EVENTS.put(DistributionSetDeletedEvent.class, DistributionDeletedEventContainer.class);
|
EVENTS.put(DistributionSetDeletedEvent.class, DistributionSetDeletedEventContainer.class);
|
||||||
EVENTS.put(DistributionSetCreatedEvent.class, DistributionCreatedEventContainer.class);
|
EVENTS.put(DistributionSetCreatedEvent.class, DistributionSetCreatedEventContainer.class);
|
||||||
|
|
||||||
EVENTS.put(RolloutGroupChangedEvent.class, RolloutGroupChangedEventContainer.class);
|
EVENTS.put(RolloutGroupChangedEvent.class, RolloutGroupChangedEventContainer.class);
|
||||||
EVENTS.put(RolloutChangedEvent.class, RolloutChangeEventContainer.class);
|
EVENTS.put(RolloutChangedEvent.class, RolloutChangeEventContainer.class);
|
||||||
|
|||||||
9
pom.xml
9
pom.xml
@@ -162,7 +162,7 @@
|
|||||||
<gwtmockito.version>1.1.6</gwtmockito.version>
|
<gwtmockito.version>1.1.6</gwtmockito.version>
|
||||||
<pl.pragmatists.version>1.0.2</pl.pragmatists.version>
|
<pl.pragmatists.version>1.0.2</pl.pragmatists.version>
|
||||||
<guava.version>19.0</guava.version>
|
<guava.version>19.0</guava.version>
|
||||||
<mariadb-java-client.version>1.5.7</mariadb-java-client.version>
|
<mariadb-java-client.version>2.0.2</mariadb-java-client.version>
|
||||||
<embedded-mongo.version>1.50.5</embedded-mongo.version>
|
<embedded-mongo.version>1.50.5</embedded-mongo.version>
|
||||||
<javax.el-api.version>2.2.4</javax.el-api.version>
|
<javax.el-api.version>2.2.4</javax.el-api.version>
|
||||||
<corn-cps.version>1.1.7</corn-cps.version>
|
<corn-cps.version>1.1.7</corn-cps.version>
|
||||||
@@ -194,6 +194,11 @@
|
|||||||
<jacoco.itReportPath>${jacoco.outputDir}/jacoco-it.exec</jacoco.itReportPath>
|
<jacoco.itReportPath>${jacoco.outputDir}/jacoco-it.exec</jacoco.itReportPath>
|
||||||
<sonar.jacoco.reportPaths>${jacoco.reportPath},${jacoco.itReportPath}</sonar.jacoco.reportPaths>
|
<sonar.jacoco.reportPaths>${jacoco.reportPath},${jacoco.itReportPath}</sonar.jacoco.reportPaths>
|
||||||
<!-- Sonar - END -->
|
<!-- Sonar - END -->
|
||||||
|
|
||||||
|
<!-- ************************ -->
|
||||||
|
<!-- Maven Surefire settings -->
|
||||||
|
<!-- ************************ -->
|
||||||
|
<surefire.forkcount>1</surefire.forkcount>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@@ -364,7 +369,7 @@
|
|||||||
<version>${maven.surefire.plugin.version}</version>
|
<version>${maven.surefire.plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<reuseForks>true</reuseForks>
|
<reuseForks>true</reuseForks>
|
||||||
<forkCount>1</forkCount>
|
<forkCount>${surefire.forkcount}</forkCount>
|
||||||
<argLine>
|
<argLine>
|
||||||
${jacoco.agent.ut.arg}
|
${jacoco.agent.ut.arg}
|
||||||
</argLine>
|
</argLine>
|
||||||
|
|||||||
Reference in New Issue
Block a user