@Test public void test_searchByCorpId() throws Exception { DirectoryUser directoryUser = new DirectoryUser(); directoryUser.setDisplayName("testUser"); directoryUser.setGivenName("testUser"); directoryUser.setUserEmail("testUser@t-mobile.com"); directoryUser.setUserId("testuser01"); directoryUser.setUserName("testUser"); List<DirectoryUser> persons = new ArrayList<>(); persons.add(directoryUser); DirectoryObjects users = new DirectoryObjects(); DirectoryObjectsList usersList = new DirectoryObjectsList(); usersList.setValues(persons.toArray(new DirectoryUser[persons.size()])); users.setData(usersList); String responseMessage =new ObjectMapper().writeValueAsString(users); ResponseEntity<DirectoryObjects> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body(users); when(directoryService.searchByCorpId(Mockito.any())).thenReturn(responseEntityExpected); mockMvc.perform(MockMvcRequestBuilders.get("/v2/ldap/corpusers?CorpId=corpid") .header("vault-token", "5PDrOhsy4ig8L3EpsJZSLAMg") .header("Content-Type", "application/json;charset=UTF-8")) .andExpect(status().isOk()) .andExpect(content().string(containsString(responseMessage))); }
@ApiOperation(value = "${DirectoryServiceControllerV2.searchByCorpId.value}", notes = "${DirectoryServiceControllerV2.searchByCorpId.notes}") @GetMapping(value="/v2/ldap/corpusers",produces="application/json") public ResponseEntity<DirectoryObjects> searchByCorpId(@ApiParam(name="CorpId", defaultValue="") @RequestParam(name="CorpId", defaultValue="") String corpId ){ return directoryService.searchByCorpId(corpId); }
DirectoryServiceControllerV2 { @ApiOperation(value = "${DirectoryServiceControllerV2.searchByCorpId.value}", notes = "${DirectoryServiceControllerV2.searchByCorpId.notes}") @GetMapping(value="/v2/ldap/corpusers",produces="application/json") public ResponseEntity<DirectoryObjects> searchByCorpId(@ApiParam(name="CorpId", defaultValue="") @RequestParam(name="CorpId", defaultValue="") String corpId ){ return directoryService.searchByCorpId(corpId); } }
DirectoryServiceControllerV2 { @ApiOperation(value = "${DirectoryServiceControllerV2.searchByCorpId.value}", notes = "${DirectoryServiceControllerV2.searchByCorpId.notes}") @GetMapping(value="/v2/ldap/corpusers",produces="application/json") public ResponseEntity<DirectoryObjects> searchByCorpId(@ApiParam(name="CorpId", defaultValue="") @RequestParam(name="CorpId", defaultValue="") String corpId ){ return directoryService.searchByCorpId(corpId); }  }
DirectoryServiceControllerV2 { @ApiOperation(value = "${DirectoryServiceControllerV2.searchByCorpId.value}", notes = "${DirectoryServiceControllerV2.searchByCorpId.notes}") @GetMapping(value="/v2/ldap/corpusers",produces="application/json") public ResponseEntity<DirectoryObjects> searchByCorpId(@ApiParam(name="CorpId", defaultValue="") @RequestParam(name="CorpId", defaultValue="") String corpId ){ return directoryService.searchByCorpId(corpId); }  @ApiOperation(value = "${DirectoryServiceControllerV2.searchByUPN.value}", notes = "${DirectoryServiceControllerV2.searchByUPN.notes}") @GetMapping(value="/v2/ldap/users",produces="application/json") ResponseEntity<DirectoryObjects> searchByUPN(@ApiParam(name="UserPrincipalName", defaultValue="") 
	@RequestParam(name="UserPrincipalName", defaultValue="") String userPrincipalName ); @ApiOperation(value = "${DirectoryServiceControllerV2.searchByCorpId.value}", notes = "${DirectoryServiceControllerV2.searchByCorpId.notes}") @GetMapping(value="/v2/ldap/corpusers",produces="application/json") ResponseEntity<DirectoryObjects> searchByCorpId(@ApiParam(name="CorpId", defaultValue="") 
	@RequestParam(name="CorpId", defaultValue="") String corpId ); @ApiOperation(value = "${DirectoryServiceControllerV2.searchByGroup.value}", notes = "${DirectoryServiceControllerV2.searchByGroup.notes}") @GetMapping(value="/v2/ldap/groups",produces="application/json") ResponseEntity<DirectoryObjects> searchByGroup(@ApiParam(name="groupName", defaultValue="") 
	@RequestParam(name="groupName", defaultValue="") String groupName ); }
DirectoryServiceControllerV2 { @ApiOperation(value = "${DirectoryServiceControllerV2.searchByCorpId.value}", notes = "${DirectoryServiceControllerV2.searchByCorpId.notes}") @GetMapping(value="/v2/ldap/corpusers",produces="application/json") public ResponseEntity<DirectoryObjects> searchByCorpId(@ApiParam(name="CorpId", defaultValue="") @RequestParam(name="CorpId", defaultValue="") String corpId ){ return directoryService.searchByCorpId(corpId); }  @ApiOperation(value = "${DirectoryServiceControllerV2.searchByUPN.value}", notes = "${DirectoryServiceControllerV2.searchByUPN.notes}") @GetMapping(value="/v2/ldap/users",produces="application/json") ResponseEntity<DirectoryObjects> searchByUPN(@ApiParam(name="UserPrincipalName", defaultValue="") 
	@RequestParam(name="UserPrincipalName", defaultValue="") String userPrincipalName ); @ApiOperation(value = "${DirectoryServiceControllerV2.searchByCorpId.value}", notes = "${DirectoryServiceControllerV2.searchByCorpId.notes}") @GetMapping(value="/v2/ldap/corpusers",produces="application/json") ResponseEntity<DirectoryObjects> searchByCorpId(@ApiParam(name="CorpId", defaultValue="") 
	@RequestParam(name="CorpId", defaultValue="") String corpId ); @ApiOperation(value = "${DirectoryServiceControllerV2.searchByGroup.value}", notes = "${DirectoryServiceControllerV2.searchByGroup.notes}") @GetMapping(value="/v2/ldap/groups",produces="application/json") ResponseEntity<DirectoryObjects> searchByGroup(@ApiParam(name="groupName", defaultValue="") 
	@RequestParam(name="groupName", defaultValue="") String groupName );  }