@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.describeEnvironment(any())) .thenReturn( com.amazonaws.blox.dataservicemodel.v1.model.wrappers.DescribeEnvironmentResponse .builder() .environment(environment) .build()); DescribeEnvironmentResponse response = controller.describeEnvironment(TEST_CLUSTER, ENVIRONMENT_NAME); verify(dataService) .describeEnvironment( com.amazonaws.blox.dataservicemodel.v1.model.wrappers.DescribeEnvironmentRequest .builder() .environmentId(id) .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.GET) @ApiOperation(value = "Describe an Environment by name") @ApiResponses( value = { @ApiResponse( code = ResourceNotFoundExceptionResponse.STATUS_CODE, message = ResourceNotFoundExceptionResponse.MESSAGE, response = ResourceNotFoundExceptionResponse.class ) } ) public DescribeEnvironmentResponse describeEnvironment( @PathVariable("cluster") String cluster, @PathVariable("environmentName") String environmentName) throws ServiceException, ClientException { return mapper.fromDataServiceResponse( dataService.describeEnvironment( mapper.toDataServiceRequest(getApiGatewayRequestContext(), cluster, environmentName))); }
DescribeEnvironment extends EnvironmentController { @RequestMapping(path = "/{environmentName}", method = RequestMethod.GET) @ApiOperation(value = "Describe an Environment by name") @ApiResponses( value = { @ApiResponse( code = ResourceNotFoundExceptionResponse.STATUS_CODE, message = ResourceNotFoundExceptionResponse.MESSAGE, response = ResourceNotFoundExceptionResponse.class ) } ) public DescribeEnvironmentResponse describeEnvironment( @PathVariable("cluster") String cluster, @PathVariable("environmentName") String environmentName) throws ServiceException, ClientException { return mapper.fromDataServiceResponse( dataService.describeEnvironment( mapper.toDataServiceRequest(getApiGatewayRequestContext(), cluster, environmentName))); } }
DescribeEnvironment extends EnvironmentController { @RequestMapping(path = "/{environmentName}", method = RequestMethod.GET) @ApiOperation(value = "Describe an Environment by name") @ApiResponses( value = { @ApiResponse( code = ResourceNotFoundExceptionResponse.STATUS_CODE, message = ResourceNotFoundExceptionResponse.MESSAGE, response = ResourceNotFoundExceptionResponse.class ) } ) public DescribeEnvironmentResponse describeEnvironment( @PathVariable("cluster") String cluster, @PathVariable("environmentName") String environmentName) throws ServiceException, ClientException { return mapper.fromDataServiceResponse( dataService.describeEnvironment( mapper.toDataServiceRequest(getApiGatewayRequestContext(), cluster, environmentName))); }  }
DescribeEnvironment extends EnvironmentController { @RequestMapping(path = "/{environmentName}", method = RequestMethod.GET) @ApiOperation(value = "Describe an Environment by name") @ApiResponses( value = { @ApiResponse( code = ResourceNotFoundExceptionResponse.STATUS_CODE, message = ResourceNotFoundExceptionResponse.MESSAGE, response = ResourceNotFoundExceptionResponse.class ) } ) public DescribeEnvironmentResponse describeEnvironment( @PathVariable("cluster") String cluster, @PathVariable("environmentName") String environmentName) throws ServiceException, ClientException { return mapper.fromDataServiceResponse( dataService.describeEnvironment( mapper.toDataServiceRequest(getApiGatewayRequestContext(), cluster, environmentName))); }  @RequestMapping(path = "/{environmentName}", method = RequestMethod.GET) @ApiOperation(value = "Describe an Environment by name") @ApiResponses( value = { @ApiResponse( code = ResourceNotFoundExceptionResponse.STATUS_CODE, message = ResourceNotFoundExceptionResponse.MESSAGE, response = ResourceNotFoundExceptionResponse.class ) } ) DescribeEnvironmentResponse describeEnvironment(
      @PathVariable("cluster") String cluster,
      @PathVariable("environmentName") String environmentName); }
DescribeEnvironment extends EnvironmentController { @RequestMapping(path = "/{environmentName}", method = RequestMethod.GET) @ApiOperation(value = "Describe an Environment by name") @ApiResponses( value = { @ApiResponse( code = ResourceNotFoundExceptionResponse.STATUS_CODE, message = ResourceNotFoundExceptionResponse.MESSAGE, response = ResourceNotFoundExceptionResponse.class ) } ) public DescribeEnvironmentResponse describeEnvironment( @PathVariable("cluster") String cluster, @PathVariable("environmentName") String environmentName) throws ServiceException, ClientException { return mapper.fromDataServiceResponse( dataService.describeEnvironment( mapper.toDataServiceRequest(getApiGatewayRequestContext(), cluster, environmentName))); }  @RequestMapping(path = "/{environmentName}", method = RequestMethod.GET) @ApiOperation(value = "Describe an Environment by name") @ApiResponses( value = { @ApiResponse( code = ResourceNotFoundExceptionResponse.STATUS_CODE, message = ResourceNotFoundExceptionResponse.MESSAGE, response = ResourceNotFoundExceptionResponse.class ) } ) DescribeEnvironmentResponse describeEnvironment(
      @PathVariable("cluster") String cluster,
      @PathVariable("environmentName") String environmentName);  }