@Test public void testGetInstanceById() throws IntegrationConfigException, IOException, ClassNotFoundException { service.init(); IntegrationInstance instance = service.getInstanceById("575062074b54ba5e759c0fd0", "4321", TEST_USER); assertEquals("4321", instance.getInstanceId()); assertEquals("575062074b54ba5e759c0fd0", instance.getConfigurationId()); assertEquals("First GitHub integration", instance.getName()); assertEquals("test3", instance.getCreatorId()); assertEquals(new Long(1462371116436L), instance.getCreatedDate()); JsonNode whiConfigInstance = WebHookConfigurationUtils.fromJsonString(instance.getOptionalProperties()); assertEquals(1463165031800L, whiConfigInstance.path(LAST_POSTED_DATE).asLong()); }
@Override public IntegrationInstance getInstanceById(String configurationId, String instanceId, String userId) { if (instanceId == null) { String message = logMessage.getMessage(INTEGRATION_INVALID_INSTANCE); String solution = logMessage.getMessage(INTEGRATION_INVALID_INSTANCE_SOLUTION); throw new InvalidInstanceIdException(message, solution); } IntegrationInstance instance = repository.getInstanceById(instanceId); if (instance == null) { String message = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND, instanceId); String solution = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND_SOLUTION, instanceId); throw new InstanceNotFoundException(message, solution); } return instance; }
LocalIntegrationService implements IntegrationService { @Override public IntegrationInstance getInstanceById(String configurationId, String instanceId, String userId) { if (instanceId == null) { String message = logMessage.getMessage(INTEGRATION_INVALID_INSTANCE); String solution = logMessage.getMessage(INTEGRATION_INVALID_INSTANCE_SOLUTION); throw new InvalidInstanceIdException(message, solution); } IntegrationInstance instance = repository.getInstanceById(instanceId); if (instance == null) { String message = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND, instanceId); String solution = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND_SOLUTION, instanceId); throw new InstanceNotFoundException(message, solution); } return instance; } }
LocalIntegrationService implements IntegrationService { @Override public IntegrationInstance getInstanceById(String configurationId, String instanceId, String userId) { if (instanceId == null) { String message = logMessage.getMessage(INTEGRATION_INVALID_INSTANCE); String solution = logMessage.getMessage(INTEGRATION_INVALID_INSTANCE_SOLUTION); throw new InvalidInstanceIdException(message, solution); } IntegrationInstance instance = repository.getInstanceById(instanceId); if (instance == null) { String message = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND, instanceId); String solution = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND_SOLUTION, instanceId); throw new InstanceNotFoundException(message, solution); } return instance; }  }
LocalIntegrationService implements IntegrationService { @Override public IntegrationInstance getInstanceById(String configurationId, String instanceId, String userId) { if (instanceId == null) { String message = logMessage.getMessage(INTEGRATION_INVALID_INSTANCE); String solution = logMessage.getMessage(INTEGRATION_INVALID_INSTANCE_SOLUTION); throw new InvalidInstanceIdException(message, solution); } IntegrationInstance instance = repository.getInstanceById(instanceId); if (instance == null) { String message = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND, instanceId); String solution = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND_SOLUTION, instanceId); throw new InstanceNotFoundException(message, solution); } return instance; }  @Override @PostConstruct void init(); @Override IntegrationSettings getIntegrationById(String integrationId, String userId); @Override IntegrationSettings getIntegrationByType(String integrationType, String userId); @Override IntegrationSettings save(IntegrationSettings settings, String usedId); @Override IntegrationInstance getInstanceById(String configurationId, String instanceId,
      String userId); @Override IntegrationInstance save(IntegrationInstance instance, String userId); }
LocalIntegrationService implements IntegrationService { @Override public IntegrationInstance getInstanceById(String configurationId, String instanceId, String userId) { if (instanceId == null) { String message = logMessage.getMessage(INTEGRATION_INVALID_INSTANCE); String solution = logMessage.getMessage(INTEGRATION_INVALID_INSTANCE_SOLUTION); throw new InvalidInstanceIdException(message, solution); } IntegrationInstance instance = repository.getInstanceById(instanceId); if (instance == null) { String message = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND, instanceId); String solution = logMessage.getMessage(INTEGRATION_INSTANCE_NOT_FOUND_SOLUTION, instanceId); throw new InstanceNotFoundException(message, solution); } return instance; }  @Override @PostConstruct void init(); @Override IntegrationSettings getIntegrationById(String integrationId, String userId); @Override IntegrationSettings getIntegrationByType(String integrationType, String userId); @Override IntegrationSettings save(IntegrationSettings settings, String usedId); @Override IntegrationInstance getInstanceById(String configurationId, String instanceId,
      String userId); @Override IntegrationInstance save(IntegrationInstance instance, String userId);  }