@Test public void mapsInputsAndOutputsCorrectly() throws Exception { EnvironmentId id = EnvironmentId.builder() .accountId(ACCOUNT_ID) .cluster(TEST_CLUSTER) .environmentName(ENVIRONMENT_NAME) .build(); InstanceGroup instanceGroup = instanceGroupWithAttributeDS(ATTRIBUTE_NAME, ATTRIBUTE_VALUE); DeploymentConfiguration deploymentConfiguration = deploymentConfigurationDS(); when(dataService.createEnvironment(any())) .thenReturn( com.amazonaws.blox.dataservicemodel.v1.model.wrappers.CreateEnvironmentResponse .builder() .environment(environmentDS(id, deploymentConfiguration)) .environmentRevision(environmentRevisionDS(id, instanceGroup)) .build()); CreateEnvironmentResponse response = controller.createEnvironment( TEST_CLUSTER, CreateEnvironmentRequest.builder() .environmentName(ENVIRONMENT_NAME) .environmentType(ENVIRONMENT_TYPE_STRING) .role(ROLE) .deploymentMethod(DEPLOYMENT_METHOD) .deploymentConfiguration(deploymentConfigurationFE()) .instanceGroup(instanceGroupWithAttributeFE(ATTRIBUTE_NAME, ATTRIBUTE_VALUE)) .taskDefinition(TASK_DEFINITION) .build()); verify(dataService) .createEnvironment( com.amazonaws.blox.dataservicemodel.v1.model.wrappers.CreateEnvironmentRequest.builder() .environmentId(id) .environmentType(ENVIRONMENT_TYPE) .deploymentMethod(DEPLOYMENT_METHOD) .deploymentConfiguration(deploymentConfiguration) .instanceGroup(instanceGroup) .role(ROLE) .taskDefinition(TASK_DEFINITION) .build()); assertThat(response).isNotNull(); assertThat(response.getEnvironmentRevisionId()).isEqualTo(ENVIRONMENT_REVISION_ID); }
@RequestMapping(method = RequestMethod.POST, consumes = "application/json") @ApiOperation(value = "Create a new Environment", notes = CREATE_ENVIRONMENT_NOTES) public CreateEnvironmentResponse createEnvironment( @ApiParam(name = "cluster", value = CLUSTER_PARAM_DESCRIPTION) @PathVariable String cluster, @ApiParam(required = true) @RequestBody CreateEnvironmentRequest request) throws InvalidParameterException, ServiceException, ResourceExistsException { return mapper.fromDataServiceResponse( dataService.createEnvironment( mapper.toDataServiceRequest(getApiGatewayRequestContext(), cluster, request))); }
CreateEnvironment extends EnvironmentController { @RequestMapping(method = RequestMethod.POST, consumes = "application/json") @ApiOperation(value = "Create a new Environment", notes = CREATE_ENVIRONMENT_NOTES) public CreateEnvironmentResponse createEnvironment( @ApiParam(name = "cluster", value = CLUSTER_PARAM_DESCRIPTION) @PathVariable String cluster, @ApiParam(required = true) @RequestBody CreateEnvironmentRequest request) throws InvalidParameterException, ServiceException, ResourceExistsException { return mapper.fromDataServiceResponse( dataService.createEnvironment( mapper.toDataServiceRequest(getApiGatewayRequestContext(), cluster, request))); } }
CreateEnvironment extends EnvironmentController { @RequestMapping(method = RequestMethod.POST, consumes = "application/json") @ApiOperation(value = "Create a new Environment", notes = CREATE_ENVIRONMENT_NOTES) public CreateEnvironmentResponse createEnvironment( @ApiParam(name = "cluster", value = CLUSTER_PARAM_DESCRIPTION) @PathVariable String cluster, @ApiParam(required = true) @RequestBody CreateEnvironmentRequest request) throws InvalidParameterException, ServiceException, ResourceExistsException { return mapper.fromDataServiceResponse( dataService.createEnvironment( mapper.toDataServiceRequest(getApiGatewayRequestContext(), cluster, request))); }  }
CreateEnvironment extends EnvironmentController { @RequestMapping(method = RequestMethod.POST, consumes = "application/json") @ApiOperation(value = "Create a new Environment", notes = CREATE_ENVIRONMENT_NOTES) public CreateEnvironmentResponse createEnvironment( @ApiParam(name = "cluster", value = CLUSTER_PARAM_DESCRIPTION) @PathVariable String cluster, @ApiParam(required = true) @RequestBody CreateEnvironmentRequest request) throws InvalidParameterException, ServiceException, ResourceExistsException { return mapper.fromDataServiceResponse( dataService.createEnvironment( mapper.toDataServiceRequest(getApiGatewayRequestContext(), cluster, request))); }  @RequestMapping(method = RequestMethod.POST, consumes = "application/json") @ApiOperation(value = "Create a new Environment", notes = CREATE_ENVIRONMENT_NOTES) CreateEnvironmentResponse createEnvironment(
      @ApiParam(name = "cluster", value = CLUSTER_PARAM_DESCRIPTION) @PathVariable String cluster,
      @ApiParam(required = true) @RequestBody CreateEnvironmentRequest request); }
CreateEnvironment extends EnvironmentController { @RequestMapping(method = RequestMethod.POST, consumes = "application/json") @ApiOperation(value = "Create a new Environment", notes = CREATE_ENVIRONMENT_NOTES) public CreateEnvironmentResponse createEnvironment( @ApiParam(name = "cluster", value = CLUSTER_PARAM_DESCRIPTION) @PathVariable String cluster, @ApiParam(required = true) @RequestBody CreateEnvironmentRequest request) throws InvalidParameterException, ServiceException, ResourceExistsException { return mapper.fromDataServiceResponse( dataService.createEnvironment( mapper.toDataServiceRequest(getApiGatewayRequestContext(), cluster, request))); }  @RequestMapping(method = RequestMethod.POST, consumes = "application/json") @ApiOperation(value = "Create a new Environment", notes = CREATE_ENVIRONMENT_NOTES) CreateEnvironmentResponse createEnvironment(
      @ApiParam(name = "cluster", value = CLUSTER_PARAM_DESCRIPTION) @PathVariable String cluster,
      @ApiParam(required = true) @RequestBody CreateEnvironmentRequest request);  }