@Test public void getTargetTypeAttributesTest() throws Exception { byte[] targetTypesDetailsContent = toJson(getTargetTypesDetails()); when(targetTypesService.getTargetTypeAttributes(any())).thenReturn(getTargetTypeAttributeDetails()); mockMvc.perform(post("/target-types/list-target-type-attributes") .content(targetTypesDetailsContent) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.message", is("success"))) .andExpect(jsonPath("$.data[0].includeAll", is(false))); }
@ApiOperation(httpMethod = "POST", value = "API to get all target type attributes", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-target-type-attributes", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getTargetTypeAttributes( @ApiParam(value = "provide valid target types details", required = true) @RequestBody(required = true) List<TargetTypes> targetTypes) { try { return ResponseUtils.buildSucessResponse(targetTypesService.getTargetTypeAttributes(targetTypes)); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } }
TargetTypesController { @ApiOperation(httpMethod = "POST", value = "API to get all target type attributes", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-target-type-attributes", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getTargetTypeAttributes( @ApiParam(value = "provide valid target types details", required = true) @RequestBody(required = true) List<TargetTypes> targetTypes) { try { return ResponseUtils.buildSucessResponse(targetTypesService.getTargetTypeAttributes(targetTypes)); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } } }
TargetTypesController { @ApiOperation(httpMethod = "POST", value = "API to get all target type attributes", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-target-type-attributes", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getTargetTypeAttributes( @ApiParam(value = "provide valid target types details", required = true) @RequestBody(required = true) List<TargetTypes> targetTypes) { try { return ResponseUtils.buildSucessResponse(targetTypesService.getTargetTypeAttributes(targetTypes)); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } }  }
TargetTypesController { @ApiOperation(httpMethod = "POST", value = "API to get all target type attributes", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-target-type-attributes", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getTargetTypeAttributes( @ApiParam(value = "provide valid target types details", required = true) @RequestBody(required = true) List<TargetTypes> targetTypes) { try { return ResponseUtils.buildSucessResponse(targetTypesService.getTargetTypeAttributes(targetTypes)); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } }  @ApiOperation(httpMethod = "GET", value = "API to get all target types details", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllTargetTypesDetails(
		@ApiParam(value = "provide valid page number", required = true) @RequestParam("page") Integer page,
		@ApiParam(value = "provide valid page size", required = true) @RequestParam("size") Integer size,
		@ApiParam(value = "provide valid search term", required = false) @RequestParam(defaultValue="", name = "searchTerm", required = false) String searchTerm); @ApiOperation(httpMethod = "GET", value = "API to get all target types categories", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-categories", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllTargetTypesCategories(); @ApiOperation(httpMethod = "GET", value = "API to get all target types by asset group name", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-by-asset-group-name", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getTargetTypesByAssetGroupName(
			@ApiParam(value = "provide valid asset group name", required = true) @RequestParam(defaultValue="", name = "assetGroupName", required = true) String assetGroupName); @ApiOperation(httpMethod = "GET", value = "API to get target types details by name", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-by-target-type-name", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getTargetTypesByName(
			@ApiParam(value = "provide valid target type name", required = true) @RequestParam(defaultValue="", name = "targetTypeName", required = true) String targetTypeName); @ApiOperation(httpMethod = "POST", value = "API to create new target type", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/create", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> createTargetType(@AuthenticationPrincipal Principal user, @RequestBody CreateUpdateTargetTypeDetailsRequest targetTypesDetails); @ApiOperation(httpMethod = "POST", value = "API to update target type", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> updateTargetType(@AuthenticationPrincipal Principal user, @RequestBody CreateUpdateTargetTypeDetailsRequest targetTypesDetails); @ApiOperation(httpMethod = "POST", value = "API to get all target types by domain", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-by-domains", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllTargetTypes(
		@ApiParam(value = "provide valid domain list", required = true) @RequestBody(required = true) List<String> domains); @ApiOperation(httpMethod = "GET", value = "API to get all target type names by datasource name", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-names-by-datasource", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getTargetTypesNamesByDataSourceName(
			@ApiParam(value = "provide valid dataSource name", required = true) @RequestParam(defaultValue="", name = "dataSourceName", required = true) String dataSourceName); @ApiOperation(httpMethod = "POST", value = "API to get all target type attributes", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-target-type-attributes", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getTargetTypeAttributes(
			@ApiParam(value = "provide valid target types details", required = true) @RequestBody(required = true) List<TargetTypes> targetTypes); @ApiOperation(httpMethod = "POST", value = "API to get attribute values", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-target-type-attributes-values", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAttributeValues(
			@ApiParam(value = "provide valid attribute request details", required = true) @RequestBody(required = true) AttributeValuesRequest attributeValuesRequest); }
TargetTypesController { @ApiOperation(httpMethod = "POST", value = "API to get all target type attributes", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-target-type-attributes", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getTargetTypeAttributes( @ApiParam(value = "provide valid target types details", required = true) @RequestBody(required = true) List<TargetTypes> targetTypes) { try { return ResponseUtils.buildSucessResponse(targetTypesService.getTargetTypeAttributes(targetTypes)); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } }  @ApiOperation(httpMethod = "GET", value = "API to get all target types details", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllTargetTypesDetails(
		@ApiParam(value = "provide valid page number", required = true) @RequestParam("page") Integer page,
		@ApiParam(value = "provide valid page size", required = true) @RequestParam("size") Integer size,
		@ApiParam(value = "provide valid search term", required = false) @RequestParam(defaultValue="", name = "searchTerm", required = false) String searchTerm); @ApiOperation(httpMethod = "GET", value = "API to get all target types categories", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-categories", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllTargetTypesCategories(); @ApiOperation(httpMethod = "GET", value = "API to get all target types by asset group name", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-by-asset-group-name", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getTargetTypesByAssetGroupName(
			@ApiParam(value = "provide valid asset group name", required = true) @RequestParam(defaultValue="", name = "assetGroupName", required = true) String assetGroupName); @ApiOperation(httpMethod = "GET", value = "API to get target types details by name", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-by-target-type-name", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getTargetTypesByName(
			@ApiParam(value = "provide valid target type name", required = true) @RequestParam(defaultValue="", name = "targetTypeName", required = true) String targetTypeName); @ApiOperation(httpMethod = "POST", value = "API to create new target type", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/create", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> createTargetType(@AuthenticationPrincipal Principal user, @RequestBody CreateUpdateTargetTypeDetailsRequest targetTypesDetails); @ApiOperation(httpMethod = "POST", value = "API to update target type", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> updateTargetType(@AuthenticationPrincipal Principal user, @RequestBody CreateUpdateTargetTypeDetailsRequest targetTypesDetails); @ApiOperation(httpMethod = "POST", value = "API to get all target types by domain", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-by-domains", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllTargetTypes(
		@ApiParam(value = "provide valid domain list", required = true) @RequestBody(required = true) List<String> domains); @ApiOperation(httpMethod = "GET", value = "API to get all target type names by datasource name", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-names-by-datasource", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getTargetTypesNamesByDataSourceName(
			@ApiParam(value = "provide valid dataSource name", required = true) @RequestParam(defaultValue="", name = "dataSourceName", required = true) String dataSourceName); @ApiOperation(httpMethod = "POST", value = "API to get all target type attributes", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-target-type-attributes", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getTargetTypeAttributes(
			@ApiParam(value = "provide valid target types details", required = true) @RequestBody(required = true) List<TargetTypes> targetTypes); @ApiOperation(httpMethod = "POST", value = "API to get attribute values", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list-target-type-attributes-values", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAttributeValues(
			@ApiParam(value = "provide valid attribute request details", required = true) @RequestBody(required = true) AttributeValuesRequest attributeValuesRequest);  }