@Test public void testUpdateIntegrationNullSessionToken() { String expectedMessage = String.format("Missing the required parameter %s", SESSION_TOKEN_HEADER_PARAM); String expectedSolution = String.format("Please check if the required field '%s' is not empty", SESSION_TOKEN_HEADER_PARAM); when(logMessage.getMessage(MISSING_PARAMETER, SESSION_TOKEN_HEADER_PARAM)).thenReturn( expectedMessage); when(logMessage.getMessage(MISSING_PARAMETER_SOLUTION, SESSION_TOKEN_HEADER_PARAM)).thenReturn( expectedSolution); try { apiClient.updateIntegration(null, null, null); fail(); } catch (RemoteApiException e) { assertEquals(400, e.getCode()); assertEquals(ExceptionMessageFormatter.format("Commons", expectedMessage, expectedSolution), e.getMessage()); } }
public IntegrationSettings updateIntegration(String sessionToken, String integrationId, IntegrationSubmissionCreate integration) throws RemoteApiException { checkAuthToken(sessionToken); if (integrationId == null) { String reason = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING, INTEGRATION_ID, UPDATE_INTEGRATION); String solution = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING_SOLUTION, INTEGRATION_ID); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } if (integration == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, UPDATE_INTEGRATION); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, UPDATE_INTEGRATION); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v1/configuration/" + apiClient.escapeString(integrationId); Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPut(path, headerParams, Collections.<String, String>emptyMap(), integration, IntegrationSettings.class); }
IntegrationApiClient extends BasePodApiClient { public IntegrationSettings updateIntegration(String sessionToken, String integrationId, IntegrationSubmissionCreate integration) throws RemoteApiException { checkAuthToken(sessionToken); if (integrationId == null) { String reason = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING, INTEGRATION_ID, UPDATE_INTEGRATION); String solution = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING_SOLUTION, INTEGRATION_ID); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } if (integration == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, UPDATE_INTEGRATION); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, UPDATE_INTEGRATION); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v1/configuration/" + apiClient.escapeString(integrationId); Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPut(path, headerParams, Collections.<String, String>emptyMap(), integration, IntegrationSettings.class); } }
IntegrationApiClient extends BasePodApiClient { public IntegrationSettings updateIntegration(String sessionToken, String integrationId, IntegrationSubmissionCreate integration) throws RemoteApiException { checkAuthToken(sessionToken); if (integrationId == null) { String reason = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING, INTEGRATION_ID, UPDATE_INTEGRATION); String solution = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING_SOLUTION, INTEGRATION_ID); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } if (integration == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, UPDATE_INTEGRATION); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, UPDATE_INTEGRATION); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v1/configuration/" + apiClient.escapeString(integrationId); Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPut(path, headerParams, Collections.<String, String>emptyMap(), integration, IntegrationSettings.class); } IntegrationApiClient(HttpApiClient apiClient, LogMessageSource logMessage); }
IntegrationApiClient extends BasePodApiClient { public IntegrationSettings updateIntegration(String sessionToken, String integrationId, IntegrationSubmissionCreate integration) throws RemoteApiException { checkAuthToken(sessionToken); if (integrationId == null) { String reason = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING, INTEGRATION_ID, UPDATE_INTEGRATION); String solution = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING_SOLUTION, INTEGRATION_ID); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } if (integration == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, UPDATE_INTEGRATION); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, UPDATE_INTEGRATION); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v1/configuration/" + apiClient.escapeString(integrationId); Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPut(path, headerParams, Collections.<String, String>emptyMap(), integration, IntegrationSettings.class); } IntegrationApiClient(HttpApiClient apiClient, LogMessageSource logMessage); IntegrationSettingsList listIntegrations(String sessionToken, int offset, int limit); IntegrationSettings getIntegrationById(String sessionToken, String integrationId); IntegrationSettings getIntegrationByType(String sessionToken, String integrationType); IntegrationSettings createIntegration(String sessionToken,
      IntegrationSubmissionCreate integration); IntegrationSettings updateIntegration(String sessionToken, String integrationId,
      IntegrationSubmissionCreate integration); IntegrationSettings activateIntegration(String sessionToken, String integrationId); IntegrationSettings deactivateIntegration(String sessionToken, String integrationId); }
IntegrationApiClient extends BasePodApiClient { public IntegrationSettings updateIntegration(String sessionToken, String integrationId, IntegrationSubmissionCreate integration) throws RemoteApiException { checkAuthToken(sessionToken); if (integrationId == null) { String reason = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING, INTEGRATION_ID, UPDATE_INTEGRATION); String solution = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING_SOLUTION, INTEGRATION_ID); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } if (integration == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, UPDATE_INTEGRATION); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, UPDATE_INTEGRATION); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v1/configuration/" + apiClient.escapeString(integrationId); Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPut(path, headerParams, Collections.<String, String>emptyMap(), integration, IntegrationSettings.class); } IntegrationApiClient(HttpApiClient apiClient, LogMessageSource logMessage); IntegrationSettingsList listIntegrations(String sessionToken, int offset, int limit); IntegrationSettings getIntegrationById(String sessionToken, String integrationId); IntegrationSettings getIntegrationByType(String sessionToken, String integrationType); IntegrationSettings createIntegration(String sessionToken,
      IntegrationSubmissionCreate integration); IntegrationSettings updateIntegration(String sessionToken, String integrationId,
      IntegrationSubmissionCreate integration); IntegrationSettings activateIntegration(String sessionToken, String integrationId); IntegrationSettings deactivateIntegration(String sessionToken, String integrationId);  }