Search in sources :

Example 1 with FakeConnectorService

use of org.apache.activemq.artemis.tests.unit.core.config.impl.fakes.FakeConnectorService in project activemq-artemis by apache.

the class ConnectorsServiceTest method testConnectorsServiceUsesInjectedConnectorServiceFactory.

/**
 * Test that the connectors added via the service registry are added to the connectorsService,
 *
 * @throws Exception
 */
@Test
public void testConnectorsServiceUsesInjectedConnectorServiceFactory() throws Exception {
    ConnectorServiceConfiguration connectorServiceConfiguration = new ConnectorServiceConfiguration().setFactoryClassName(null).setParams(new HashMap<String, Object>()).setName("myfact");
    // Creates a fake connector service factory that returns the fake connector service object
    ConnectorService connectorService = new FakeConnectorService();
    FakeConnectorServiceFactory connectorServiceFactory = new FakeConnectorServiceFactory();
    serviceRegistry.addConnectorService(connectorServiceFactory, connectorServiceConfiguration);
    ConnectorsService connectorsService = new ConnectorsService(configuration, null, null, null, serviceRegistry);
    connectorsService.start();
    assertTrue(connectorsService.getConnectors().size() == 1);
    assertTrue(connectorsService.getConnectors().values().contains(connectorServiceFactory.getConnectorService()));
}
Also used : FakeConnectorServiceFactory(org.apache.activemq.artemis.tests.unit.core.config.impl.fakes.FakeConnectorServiceFactory) HashMap(java.util.HashMap) FakeConnectorService(org.apache.activemq.artemis.tests.unit.core.config.impl.fakes.FakeConnectorService) ConnectorServiceConfiguration(org.apache.activemq.artemis.core.config.ConnectorServiceConfiguration) ConnectorsService(org.apache.activemq.artemis.core.server.impl.ConnectorsService) FakeConnectorService(org.apache.activemq.artemis.tests.unit.core.config.impl.fakes.FakeConnectorService) ConnectorService(org.apache.activemq.artemis.core.server.ConnectorService) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 ConnectorServiceConfiguration (org.apache.activemq.artemis.core.config.ConnectorServiceConfiguration)1 ConnectorService (org.apache.activemq.artemis.core.server.ConnectorService)1 ConnectorsService (org.apache.activemq.artemis.core.server.impl.ConnectorsService)1 FakeConnectorService (org.apache.activemq.artemis.tests.unit.core.config.impl.fakes.FakeConnectorService)1 FakeConnectorServiceFactory (org.apache.activemq.artemis.tests.unit.core.config.impl.fakes.FakeConnectorServiceFactory)1 Test (org.junit.Test)1