@Test public void testGetIntegrationByIdNull() { String expectedMessage = String.format("Missing the required parameter '%s' when calling %s", INTEGRATION_ID, GET_INTEGRATION_BY_ID); String expectedSolution = String.format("Please check if the required field '%s' is not empty", INTEGRATION_ID); when(logMessage.getMessage(BaseIntegrationInstanceApiClientProperties.MISSING_PARAMETER_WHEN_CALLING, INTEGRATION_ID, GET_INTEGRATION_BY_ID)).thenReturn(expectedMessage); when( logMessage.getMessage(BaseIntegrationInstanceApiClientProperties.MISSING_PARAMETER_WHEN_CALLING_SOLUTION, INTEGRATION_ID)).thenReturn( expectedSolution); try { apiClient.getIntegrationById(MOCK_SESSION, null); fail(); } catch (RemoteApiException e) { assertEquals(400, e.getCode()); assertEquals(ExceptionMessageFormatter.format("Commons", expectedMessage, expectedSolution), e.getMessage()); } }
public IntegrationSettings getIntegrationById(String sessionToken, String integrationId) throws RemoteApiException { checkAuthToken(sessionToken); if (integrationId == null) { String reason = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING, INTEGRATION_ID, GET_INTEGRATION_BY_ID); String solution = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING_SOLUTION, INTEGRATION_ID); 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.doGet(path, headerParams, Collections.<String, String>emptyMap(), IntegrationSettings.class); }
IntegrationApiClient extends BasePodApiClient { public IntegrationSettings getIntegrationById(String sessionToken, String integrationId) throws RemoteApiException { checkAuthToken(sessionToken); if (integrationId == null) { String reason = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING, INTEGRATION_ID, GET_INTEGRATION_BY_ID); String solution = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING_SOLUTION, INTEGRATION_ID); 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.doGet(path, headerParams, Collections.<String, String>emptyMap(), IntegrationSettings.class); } }
IntegrationApiClient extends BasePodApiClient { public IntegrationSettings getIntegrationById(String sessionToken, String integrationId) throws RemoteApiException { checkAuthToken(sessionToken); if (integrationId == null) { String reason = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING, INTEGRATION_ID, GET_INTEGRATION_BY_ID); String solution = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING_SOLUTION, INTEGRATION_ID); 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.doGet(path, headerParams, Collections.<String, String>emptyMap(), IntegrationSettings.class); } IntegrationApiClient(HttpApiClient apiClient, LogMessageSource logMessage); }
IntegrationApiClient extends BasePodApiClient { public IntegrationSettings getIntegrationById(String sessionToken, String integrationId) throws RemoteApiException { checkAuthToken(sessionToken); if (integrationId == null) { String reason = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING, INTEGRATION_ID, GET_INTEGRATION_BY_ID); String solution = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING_SOLUTION, INTEGRATION_ID); 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.doGet(path, headerParams, Collections.<String, String>emptyMap(), 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 getIntegrationById(String sessionToken, String integrationId) throws RemoteApiException { checkAuthToken(sessionToken); if (integrationId == null) { String reason = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING, INTEGRATION_ID, GET_INTEGRATION_BY_ID); String solution = logMessage.getMessage(MISSING_PARAMETER_WHEN_CALLING_SOLUTION, INTEGRATION_ID); 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.doGet(path, headerParams, Collections.<String, String>emptyMap(), 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);  }