Search in sources :

Example 1 with MonitoringProvider

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);
}
Also used : IntegrationHandler(io.syndesis.server.endpoint.v1.handler.integration.IntegrationHandler) IntegrationDeploymentStateDetails(io.syndesis.common.model.monitoring.IntegrationDeploymentStateDetails) Integration(io.syndesis.common.model.integration.Integration) EnvironmentHandler(io.syndesis.server.endpoint.v1.handler.environment.EnvironmentHandler) DataManager(io.syndesis.server.dao.manager.DataManager) MonitoringProvider(io.syndesis.server.endpoint.monitoring.MonitoringProvider) Test(org.junit.Test)

Aggregations

Integration (io.syndesis.common.model.integration.Integration)1 IntegrationDeploymentStateDetails (io.syndesis.common.model.monitoring.IntegrationDeploymentStateDetails)1 DataManager (io.syndesis.server.dao.manager.DataManager)1 MonitoringProvider (io.syndesis.server.endpoint.monitoring.MonitoringProvider)1 EnvironmentHandler (io.syndesis.server.endpoint.v1.handler.environment.EnvironmentHandler)1 IntegrationHandler (io.syndesis.server.endpoint.v1.handler.integration.IntegrationHandler)1 Test (org.junit.Test)1