use of org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl in project activemq-artemis by apache.
the class DivertTest method testInjectedTransformer.
@Test
public void testInjectedTransformer() throws Exception {
final SimpleString ADDRESS = new SimpleString("myAddress");
final String DIVERT = "myDivert";
ServiceRegistryImpl serviceRegistry = new ServiceRegistryImpl();
Transformer transformer = new Transformer() {
@Override
public Message transform(Message message) {
return null;
}
};
serviceRegistry.addDivertTransformer(DIVERT, transformer);
ActiveMQServer server = addServer(new ActiveMQServerImpl(null, null, null, null, serviceRegistry));
server.start();
server.waitForActivation(100, TimeUnit.MILLISECONDS);
server.createQueue(ADDRESS, RoutingType.MULTICAST, SimpleString.toSimpleString("myQueue"), null, false, false);
server.deployDivert(new DivertConfiguration().setName(DIVERT).setAddress(ADDRESS.toString()).setForwardingAddress(ADDRESS.toString()));
Collection<Binding> bindings = server.getPostOffice().getBindingsForAddress(ADDRESS).getBindings();
Divert divert = null;
for (Binding binding : bindings) {
if (binding instanceof DivertBinding) {
divert = ((DivertBinding) binding).getDivert();
}
}
assertNotNull(divert);
assertEquals(transformer, divert.getTransformer());
}
use of org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl in project activemq-artemis by apache.
the class RemotingServiceImplTest method setUp.
@Before
public void setUp() throws Exception {
serviceRegistry = new ServiceRegistryImpl();
configuration = new ConfigurationImpl();
configuration.setAcceptorConfigurations(new HashSet<TransportConfiguration>());
remotingService = new RemotingServiceImpl(null, configuration, null, null, null, null, null, serviceRegistry);
}
use of org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl in project activemq-artemis by apache.
the class ConnectorsServiceTest method setUp.
@Override
@Before
public void setUp() throws Exception {
// Setup Configuration
configuration = new ConfigurationImpl();
serviceRegistry = new ServiceRegistryImpl();
}
use of org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl in project activemq-artemis by apache.
the class SuppliedThreadPoolTest method setup.
@Before
public void setup() throws Exception {
serviceRegistry = new ServiceRegistryImpl();
serviceRegistry.setExecutorService(Executors.newFixedThreadPool(1, ActiveMQThreadFactory.defaultThreadFactory()));
serviceRegistry.setIOExecutorService(Executors.newFixedThreadPool(5, ActiveMQThreadFactory.defaultThreadFactory()));
serviceRegistry.setScheduledExecutorService(Executors.newScheduledThreadPool(1, ActiveMQThreadFactory.defaultThreadFactory()));
server = new ActiveMQServerImpl(null, null, null, null, serviceRegistry);
server.start();
server.waitForActivation(100, TimeUnit.MILLISECONDS);
}
use of org.apache.activemq.artemis.core.server.impl.ServiceRegistryImpl in project activemq-artemis by apache.
the class BridgeTest method testInjectedTransformer.
@Test
public void testInjectedTransformer() throws Exception {
final SimpleString ADDRESS = new SimpleString("myAddress");
final SimpleString QUEUE = new SimpleString("myQueue");
final String BRIDGE = "myBridge";
ServiceRegistryImpl serviceRegistry = new ServiceRegistryImpl();
Transformer transformer = new Transformer() {
@Override
public Message transform(Message message) {
return null;
}
};
serviceRegistry.addBridgeTransformer(BRIDGE, transformer);
Configuration config = createDefaultInVMConfig().addConnectorConfiguration("in-vm", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
ActiveMQServer server = addServer(new ActiveMQServerImpl(config, null, null, null, serviceRegistry));
server.start();
server.waitForActivation(100, TimeUnit.MILLISECONDS);
server.createQueue(ADDRESS, RoutingType.ANYCAST, QUEUE, null, false, false);
List<String> connectors = new ArrayList<>();
connectors.add("in-vm");
server.deployBridge(new BridgeConfiguration().setName(BRIDGE).setQueueName(QUEUE.toString()).setForwardingAddress(ADDRESS.toString()).setStaticConnectors(connectors));
Bridge bridge = server.getClusterManager().getBridges().get(BRIDGE);
assertNotNull(bridge);
assertEquals(transformer, ((BridgeImpl) bridge).getTransformer());
}
Aggregations