@Test public void testGetAllPolicyMetadata() throws Exception { final String uri = API + "/policies"; final String id1 = "id1"; final String id2 = "id2"; final boolean valid1 = true; final boolean valid2 = false; final PolicyMetadataDto response1 = new PolicyMetadataDto(); response1.setId(id1); response1.setValid(valid1); final PolicyMetadataDto response2 = new PolicyMetadataDto(); response2.setId(id2); response2.setValid(valid2); final PolicyMetadataContainerDto policyMetadataContainerDto = new PolicyMetadataContainerDto( response1, response2); when(policyService.getAllPolicyMetadata()).thenReturn( policyMetadataContainerDto); mockMvc.perform(get(uri).contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andExpect(content().contentType(APPLICATION_JSON_UTF8)) .andExpect( jsonPath("$.policies", hasSize(policyMetadataContainerDto .getPolicies().size()))) .andExpect(jsonPath("$.policies[0].id", is(id1))) .andExpect(jsonPath("$.policies[0].valid", is(valid1))) .andExpect(jsonPath("$.policies[1].id", is(id2))) .andExpect(jsonPath("$.policies[1].valid", is(valid2))); verify(policyService, times(1)).getAllPolicyMetadata(); }
@RequestMapping(value = "/policies", method = RequestMethod.GET) public PolicyMetadataContainerDto getAllPolicyMetadata() { return policyService.getAllPolicyMetadata(); }
PolicyControllerV1 extends AbstractPolRepRestApiControllerV1 { @RequestMapping(value = "/policies", method = RequestMethod.GET) public PolicyMetadataContainerDto getAllPolicyMetadata() { return policyService.getAllPolicyMetadata(); } }
PolicyControllerV1 extends AbstractPolRepRestApiControllerV1 { @RequestMapping(value = "/policies", method = RequestMethod.GET) public PolicyMetadataContainerDto getAllPolicyMetadata() { return policyService.getAllPolicyMetadata(); }  }
PolicyControllerV1 extends AbstractPolRepRestApiControllerV1 { @RequestMapping(value = "/policies", method = RequestMethod.GET) public PolicyMetadataContainerDto getAllPolicyMetadata() { return policyService.getAllPolicyMetadata(); }  @RequestMapping(value = "/policies", method = RequestMethod.POST) PolicyMetadataContainerDto addPolicies(
			@Valid @RequestBody PolicyContentContainerDto addPolicyRequestContainerDto,
			@RequestParam(value = "force", required = false) boolean force); @RequestMapping(value = "/policies/{policyId}", method = RequestMethod.DELETE) void deletePolicy(@PathVariable(value = "policyId") String policyId,
			HttpServletResponse response); @RequestMapping(value = "/policies", method = RequestMethod.GET) PolicyMetadataContainerDto getAllPolicyMetadata(); @RequestMapping(value = "/policies/{policyId}", method = RequestMethod.GET) PolicyContainerDto getPolicies(
			@PathVariable(value = "policyId") String policyId,
			@RequestParam(value = "wildcard", required = false) String wildcard); @RequestMapping(value = "/policies/{policyId}/combined", method = RequestMethod.GET) PolicyDto getPoliciesCombinedAsPolicySet(
			@PathVariable(value = "policyId") String policyId,
			@RequestParam(value = "wildcard", required = false) String wildcard,
			@RequestParam(value = "policySetId", required = false) String policySetId,
			@RequestParam(value = "policyCombiningAlgId", required = true) String policyCombiningAlgId); @RequestMapping(value = "/policyCombiningAlgIds", method = RequestMethod.GET) Map<String, String> getPolicyCombiningAlgIds(); @RequestMapping(value = "/policies/{policyId}", method = RequestMethod.PUT) PolicyMetadataDto updatePolicy(
			@Valid @RequestBody PolicyContentDto updatePolicyRequestDto,
			@PathVariable(value = "policyId") String policyId); }
PolicyControllerV1 extends AbstractPolRepRestApiControllerV1 { @RequestMapping(value = "/policies", method = RequestMethod.GET) public PolicyMetadataContainerDto getAllPolicyMetadata() { return policyService.getAllPolicyMetadata(); }  @RequestMapping(value = "/policies", method = RequestMethod.POST) PolicyMetadataContainerDto addPolicies(
			@Valid @RequestBody PolicyContentContainerDto addPolicyRequestContainerDto,
			@RequestParam(value = "force", required = false) boolean force); @RequestMapping(value = "/policies/{policyId}", method = RequestMethod.DELETE) void deletePolicy(@PathVariable(value = "policyId") String policyId,
			HttpServletResponse response); @RequestMapping(value = "/policies", method = RequestMethod.GET) PolicyMetadataContainerDto getAllPolicyMetadata(); @RequestMapping(value = "/policies/{policyId}", method = RequestMethod.GET) PolicyContainerDto getPolicies(
			@PathVariable(value = "policyId") String policyId,
			@RequestParam(value = "wildcard", required = false) String wildcard); @RequestMapping(value = "/policies/{policyId}/combined", method = RequestMethod.GET) PolicyDto getPoliciesCombinedAsPolicySet(
			@PathVariable(value = "policyId") String policyId,
			@RequestParam(value = "wildcard", required = false) String wildcard,
			@RequestParam(value = "policySetId", required = false) String policySetId,
			@RequestParam(value = "policyCombiningAlgId", required = true) String policyCombiningAlgId); @RequestMapping(value = "/policyCombiningAlgIds", method = RequestMethod.GET) Map<String, String> getPolicyCombiningAlgIds(); @RequestMapping(value = "/policies/{policyId}", method = RequestMethod.PUT) PolicyMetadataDto updatePolicy(
			@Valid @RequestBody PolicyContentDto updatePolicyRequestDto,
			@PathVariable(value = "policyId") String policyId);  }