Search in sources :

Example 1 with ServiceStartContext

use of io.zeebe.servicecontainer.ServiceStartContext in project zeebe by zeebe-io.

the class BrokerTest method shouldCreateBrokerWithConfigurationManager.

/**
 * This tests the constructor that takes a {@link ConfigurationManager} instance.
 * This is used in the Spring integration.
 */
@Test
public void shouldCreateBrokerWithConfigurationManager() {
    final InputStream configStream = BrokerTest.class.getClassLoader().getResourceAsStream("zeebe.unit-test.cfg.toml");
    final ConfigurationManager configurationManager = new ConfigurationManagerImpl(configStream);
    // when
    broker = new Broker(configurationManager);
    // then I can register a dependency to a broker service successfully
    final ActorFuture<Void> future = broker.getBrokerContext().getServiceContainer().createService(ServiceName.newServiceName("foo", Object.class), new Service<Object>() {

        @Override
        public void start(ServiceStartContext startContext) {
        }

        @Override
        public void stop(ServiceStopContext stopContext) {
        }

        @Override
        public Object get() {
            return null;
        }
    }).dependency(ClusterServiceNames.CLUSTER_MANAGER_SERVICE).install();
    waitUntil(future::isDone);
    assertThat(future).isDone();
}
Also used : ServiceStartContext(io.zeebe.servicecontainer.ServiceStartContext) InputStream(java.io.InputStream) ConfigurationManagerImpl(io.zeebe.broker.system.ConfigurationManagerImpl) ServiceStopContext(io.zeebe.servicecontainer.ServiceStopContext) ConfigurationManager(io.zeebe.broker.system.ConfigurationManager) Test(org.junit.Test)

Aggregations

ConfigurationManager (io.zeebe.broker.system.ConfigurationManager)1 ConfigurationManagerImpl (io.zeebe.broker.system.ConfigurationManagerImpl)1 ServiceStartContext (io.zeebe.servicecontainer.ServiceStartContext)1 ServiceStopContext (io.zeebe.servicecontainer.ServiceStopContext)1 InputStream (java.io.InputStream)1 Test (org.junit.Test)1