use of io.syndesis.server.endpoint.monitoring.MonitoringProvider in project syndesis by syndesisio.
the class PublicApiHandlerTest method testGetIntegrationState.
@Test
public void testGetIntegrationState() {
final DataManager dataManager = mock(DataManager.class);
final Integration integration = new Integration.Builder().id("integration-id").name("integration-name").build();
when(dataManager.fetch(Integration.class, "integration-name")).thenReturn(integration);
final IntegrationHandler integrationHandler = mock(IntegrationHandler.class);
when(integrationHandler.get("integration-id")).thenReturn(new IntegrationOverview.Builder().createFrom(integration).currentState(IntegrationDeploymentState.Unpublished).build());
final MonitoringProvider monitoringProvider = mock(MonitoringProvider.class);
final IntegrationDeploymentStateDetails stateDetails = new IntegrationDeploymentStateDetails.Builder().build();
when(monitoringProvider.getIntegrationStateDetails("integration-id")).thenReturn(stateDetails);
// null's are not used
final PublicApiHandler handler = new PublicApiHandler(dataManager, null, null, null, monitoringProvider, new EnvironmentHandler(dataManager), null, integrationHandler);
final PublicApiHandler.IntegrationState integrationState = handler.getIntegrationState(newMockSecurityContext(), "integration-name");
assertThat(integrationState.getCurrentState()).isEqualTo(IntegrationDeploymentState.Unpublished);
assertThat(integrationState.getStateDetails()).isEqualTo(stateDetails);
}
Aggregations