.assignDistributionSet(set.getId(), Arrays.asList(target.getTargetWithActionType())).getActions() .get(0); final Action cancelAction = deploymentManagement.cancelAction(actionId);
@Test @Description("This base resource can be regularly polled by the controller on the provisiong target or device " + "in order to retrieve actions that need to be executed. In this case including a config pull request and a cancellation. " + "Note: as with deployments the cancel action has to be confirmed or rejected in order to move on to the next action.") @WithUser(tenantId = "TENANT_ID", authorities = "ROLE_CONTROLLER", allSpPermissions = true) public void getControllerBaseWithOpenDeploymentCancellation() throws Exception { final DistributionSet set = testdataFactory.createDistributionSet("one"); final DistributionSet setTwo = testdataFactory.createDistributionSet("two"); final Target target = targetManagement.create(entityFactory.target().create().controllerId(CONTROLLER_ID)); deploymentManagement.assignDistributionSet(set.getId(), Arrays.asList(target.getTargetWithActionType())); deploymentManagement.assignDistributionSet(setTwo.getId(), Arrays.asList(target.getTargetWithActionType())); mockMvc.perform(get(DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}", tenantAware.getCurrentTenant(), target.getControllerId()).accept(MediaTypes.HAL_JSON_VALUE)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) .andDo(this.document.document( pathParameters(parameterWithName("tenant").description(ApiModelPropertiesGeneric.TENANT), parameterWithName("controllerId").description(DdiApiModelProperties.CONTROLLER_ID)), responseFields( fieldWithPath("config.polling").description(DdiApiModelProperties.TARGET_POLL_TIME), fieldWithPath("config.polling.sleep").description(DdiApiModelProperties.TARGET_SLEEP), fieldWithPath("_links").description(DdiApiModelProperties.TARGET_OPEN_ACTIONS), fieldWithPath("_links.cancelAction").description(DdiApiModelProperties.DEPLOYMENT), fieldWithPath("_links.configData") .description(DdiApiModelProperties.TARGET_CONFIG_DATA)))); }
deploymentManagement.assignDistributionSet(set.getId(), Arrays.asList(target.getTargetWithActionType()));
@Test @Description("This base resource can be regularly polled by the controller on the provisiong target or device " + "in order to retrieve actions that need to be executed. In this case including a config pull request and a deployment. The resource supports Etag based modification " + "checks in order to save traffic.") @WithUser(tenantId = "TENANT_ID", authorities = "ROLE_CONTROLLER", allSpPermissions = true) public void getControllerBaseWithOpenDeplyoment() throws Exception { final DistributionSet set = testdataFactory.createDistributionSet("one"); final Target target = targetManagement.create(entityFactory.target().create().controllerId(CONTROLLER_ID)); deploymentManagement.assignDistributionSet(set.getId(), Arrays.asList(target.getTargetWithActionType())); mockMvc.perform(get(DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}", tenantAware.getCurrentTenant(), target.getControllerId()).accept(MediaTypes.HAL_JSON_VALUE)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8)) .andDo(this.document.document( pathParameters(parameterWithName("tenant").description(ApiModelPropertiesGeneric.TENANT), parameterWithName("controllerId").description(DdiApiModelProperties.CONTROLLER_ID)), responseFields( fieldWithPath("config.polling").description(DdiApiModelProperties.TARGET_POLL_TIME), fieldWithPath("config.polling.sleep").description(DdiApiModelProperties.TARGET_SLEEP), fieldWithPath("_links").description(DdiApiModelProperties.TARGET_OPEN_ACTIONS), fieldWithPath("_links.deploymentBase").description(DdiApiModelProperties.DEPLOYMENT), fieldWithPath("_links.configData") .description(DdiApiModelProperties.TARGET_CONFIG_DATA)))); }
.assignDistributionSet(set.getId(), Arrays.asList(target.getTargetWithActionType())).getActions() .get(0); final Action cancelAction = deploymentManagement.cancelAction(actionId);
.assignDistributionSet(set.getId(), Arrays.asList(target.getTargetWithActionType())).getActions() .get(0);