@Test public void testCreateCompanyCert() throws RemoteApiException { Map<String, String> headerParams = new HashMap<>(); headerParams.put("sessionToken", MOCK_SESSION); CompanyCert companyCert = mockCompanyCert(); CompanyCertDetail expected = new CompanyCertDetail(); expected.setCompanyCertAttributes(companyCert.getAttributes()); CompanyCertInfo companyCertInfo = new CompanyCertInfo(); companyCertInfo.setCommonName("commonName"); companyCertInfo.setExpiryDate(0l); companyCertInfo.setFingerPrint("fingerPrint"); companyCertInfo.setIssuerFingerPrint("issuerFingerPrint"); companyCertInfo.setLastSeen(0l); companyCertInfo.setUpdatedAt(0l); companyCertInfo.setUpdatedBy(0l); expected.setCompanyCertInfo(companyCertInfo); doReturn(expected).when(httpClient) .doPost("/v2/companycert/create", headerParams, Collections.<String, String>emptyMap(), companyCert, CompanyCertDetail.class); CompanyCertDetail result = apiClient.createCompanyCert(MOCK_SESSION, companyCert); assertEquals(expected.getCompanyCertAttributes(), result.getCompanyCertAttributes()); assertEquals(expected.getCompanyCertInfo(), result.getCompanyCertInfo()); assertEquals(expected, result); }
public CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert) throws RemoteApiException { checkAuthToken(sessionToken); if (cert == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_COMPANY_CERT); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_COMPANY_CERT); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v2/companycert/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), cert, CompanyCertDetail.class); }
SecurityApiClient extends BasePodApiClient { public CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert) throws RemoteApiException { checkAuthToken(sessionToken); if (cert == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_COMPANY_CERT); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_COMPANY_CERT); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v2/companycert/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), cert, CompanyCertDetail.class); } }
SecurityApiClient extends BasePodApiClient { public CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert) throws RemoteApiException { checkAuthToken(sessionToken); if (cert == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_COMPANY_CERT); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_COMPANY_CERT); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v2/companycert/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), cert, CompanyCertDetail.class); } SecurityApiClient(HttpApiClient apiClient, LogMessageSource logMessage); }
SecurityApiClient extends BasePodApiClient { public CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert) throws RemoteApiException { checkAuthToken(sessionToken); if (cert == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_COMPANY_CERT); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_COMPANY_CERT); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v2/companycert/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), cert, CompanyCertDetail.class); } SecurityApiClient(HttpApiClient apiClient, LogMessageSource logMessage); CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert); }
SecurityApiClient extends BasePodApiClient { public CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert) throws RemoteApiException { checkAuthToken(sessionToken); if (cert == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_COMPANY_CERT); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_COMPANY_CERT); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v2/companycert/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), cert, CompanyCertDetail.class); } SecurityApiClient(HttpApiClient apiClient, LogMessageSource logMessage); CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert);  }