@Test public void mapsInputsAndOutputsCorrectly() throws Exception { EnvironmentId id = EnvironmentId.builder() .accountId(ACCOUNT_ID) .cluster(TEST_CLUSTER) .environmentName(ENVIRONMENT_NAME) .build(); Environment environment = Environment.builder() .environmentId(id) .role(ROLE) .environmentType(ENVIRONMENT_TYPE) .environmentHealth(HEALTHY) .environmentStatus(STATUS) .deploymentMethod(DEPLOYMENT_METHOD) .createdTime(Instant.now()) .lastUpdatedTime(Instant.now()) .build(); when(dataService.deleteEnvironment(any())) .thenReturn( com.amazonaws.blox.dataservicemodel.v1.model.wrappers.DeleteEnvironmentResponse .builder() .environment(environment) .build()); DeleteEnvironmentResponse response = controller.deleteEnvironment(TEST_CLUSTER, ENVIRONMENT_NAME, false); verify(dataService) .deleteEnvironment( com.amazonaws.blox.dataservicemodel.v1.model.wrappers.DeleteEnvironmentRequest.builder() .environmentId(id) .forceDelete(false) .build()); assertThat(response).isNotNull(); assertThat(response.getEnvironment()) .isEqualToIgnoringGivenFields(environment, "environmentName", "cluster", "environmentType"); assertThat(response.getEnvironment()) .hasFieldOrPropertyWithValue("cluster", id.getCluster()) .hasFieldOrPropertyWithValue("environmentName", id.getEnvironmentName()) .hasFieldOrPropertyWithValue("environmentType", ENVIRONMENT_TYPE_STRING); }
@RequestMapping(path = "/{environmentName}", method = RequestMethod.DELETE) @ApiOperation(value = "Delete an Environment by name") public DeleteEnvironmentResponse deleteEnvironment( @PathVariable("cluster") String cluster, @PathVariable("environmentName") String environmentName, @RequestParam(value = "forceDelete", required = false, defaultValue = "false") boolean forceDelete) throws ServiceException, ClientException { return mapper.fromDataServiceResponse( dataService.deleteEnvironment( mapper.toDataServiceRequest( getApiGatewayRequestContext(), cluster, environmentName, forceDelete))); }
DeleteEnvironment extends EnvironmentController { @RequestMapping(path = "/{environmentName}", method = RequestMethod.DELETE) @ApiOperation(value = "Delete an Environment by name") public DeleteEnvironmentResponse deleteEnvironment( @PathVariable("cluster") String cluster, @PathVariable("environmentName") String environmentName, @RequestParam(value = "forceDelete", required = false, defaultValue = "false") boolean forceDelete) throws ServiceException, ClientException { return mapper.fromDataServiceResponse( dataService.deleteEnvironment( mapper.toDataServiceRequest( getApiGatewayRequestContext(), cluster, environmentName, forceDelete))); } }
DeleteEnvironment extends EnvironmentController { @RequestMapping(path = "/{environmentName}", method = RequestMethod.DELETE) @ApiOperation(value = "Delete an Environment by name") public DeleteEnvironmentResponse deleteEnvironment( @PathVariable("cluster") String cluster, @PathVariable("environmentName") String environmentName, @RequestParam(value = "forceDelete", required = false, defaultValue = "false") boolean forceDelete) throws ServiceException, ClientException { return mapper.fromDataServiceResponse( dataService.deleteEnvironment( mapper.toDataServiceRequest( getApiGatewayRequestContext(), cluster, environmentName, forceDelete))); }  }
DeleteEnvironment extends EnvironmentController { @RequestMapping(path = "/{environmentName}", method = RequestMethod.DELETE) @ApiOperation(value = "Delete an Environment by name") public DeleteEnvironmentResponse deleteEnvironment( @PathVariable("cluster") String cluster, @PathVariable("environmentName") String environmentName, @RequestParam(value = "forceDelete", required = false, defaultValue = "false") boolean forceDelete) throws ServiceException, ClientException { return mapper.fromDataServiceResponse( dataService.deleteEnvironment( mapper.toDataServiceRequest( getApiGatewayRequestContext(), cluster, environmentName, forceDelete))); }  @RequestMapping(path = "/{environmentName}", method = RequestMethod.DELETE) @ApiOperation(value = "Delete an Environment by name") DeleteEnvironmentResponse deleteEnvironment(
      @PathVariable("cluster") String cluster,
      @PathVariable("environmentName") String environmentName,
      @RequestParam(value = "forceDelete", required = false, defaultValue = "false")
          boolean forceDelete); }
DeleteEnvironment extends EnvironmentController { @RequestMapping(path = "/{environmentName}", method = RequestMethod.DELETE) @ApiOperation(value = "Delete an Environment by name") public DeleteEnvironmentResponse deleteEnvironment( @PathVariable("cluster") String cluster, @PathVariable("environmentName") String environmentName, @RequestParam(value = "forceDelete", required = false, defaultValue = "false") boolean forceDelete) throws ServiceException, ClientException { return mapper.fromDataServiceResponse( dataService.deleteEnvironment( mapper.toDataServiceRequest( getApiGatewayRequestContext(), cluster, environmentName, forceDelete))); }  @RequestMapping(path = "/{environmentName}", method = RequestMethod.DELETE) @ApiOperation(value = "Delete an Environment by name") DeleteEnvironmentResponse deleteEnvironment(
      @PathVariable("cluster") String cluster,
      @PathVariable("environmentName") String environmentName,
      @RequestParam(value = "forceDelete", required = false, defaultValue = "false")
          boolean forceDelete);  }