use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class ServiceNameRefArrayEditorTest method testSetAsText5.
public void testSetAsText5() throws Exception {
ServiceNameRefArrayEditor editor = new ServiceNameRefArrayEditor();
editor.setServiceManagerName("Manager1");
editor.setAsText("Service1=#Service1\n<!-- Service2=Manager2#Service2 -->\nService3=Service3");
Object val = editor.getValue();
assertEquals(2, Array.getLength(val));
assertEquals(new ServiceNameRef("Service1", new ServiceName("Manager1", "Service1")), Array.get(val, 0));
assertEquals(new ServiceNameRef("Service3", new ServiceName("Service3")), Array.get(val, 1));
}
use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class ServiceNameRefEditorTest method testSetAsText1.
public void testSetAsText1() throws Exception {
ServiceNameRefEditor editor = new ServiceNameRefEditor();
editor.setServiceManagerName("Manager1");
editor.setAsText("Service1=#Service1");
assertEquals(new ServiceNameRef("Service1", new ServiceName("Manager1", "Service1")), editor.getValue());
}
use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class ServiceNameRefEditorTest method testSetValue1.
public void testSetValue1() throws Exception {
ServiceNameRefEditor editor = new ServiceNameRefEditor();
editor.setValue(new ServiceNameRef("Service1", new ServiceName("Manager1", "Service1")));
assertEquals("Service1=Manager1#Service1", editor.getAsText());
}
use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class ServiceNameRefEditorTest method testSetAsText4.
public void testSetAsText4() throws Exception {
ServiceNameRefEditor editor = new ServiceNameRefEditor();
System.setProperty("test.ServiceNameRefEditor.value", "Manager1#Service1");
editor.setAsText("Service1=${test.ServiceNameRefEditor.value}");
assertEquals(new ServiceNameRef("Service1", new ServiceName("Manager1", "Service1")), editor.getValue());
}
use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class MessageReceiverService method startService.
public void startService() throws Exception {
if (messageQueueDistributedSize > 1) {
messageQueueSelector = new MessageDistributedQueueSelector();
messageQueueSelector.setServiceManagerName(getServiceManagerName());
messageQueueSelector.setServiceName(getServiceName() + "$MessageQueueSelector");
messageQueueSelector.create();
messageQueueSelector.setDistributedSize(messageQueueDistributedSize);
if (messageQueueFactoryServiceName != null) {
messageQueueSelector.setQueueFactoryServiceName(messageQueueFactoryServiceName);
}
messageQueueSelector.start();
DistributedQueueHandlerContainerService queueHandlerContainer = new DistributedQueueHandlerContainerService();
queueHandlerContainer.setServiceManagerName(getServiceManagerName());
queueHandlerContainer.setServiceName(getServiceName() + "$MessageQueueHandlerContainer");
queueHandlerContainer.create();
queueHandlerContainer.setDistributedQueueSelector(messageQueueSelector);
queueHandlerContainer.setQueueHandler(new MessageQueueHandler());
queueHandlerContainer.setIgnoreNullElement(true);
queueHandlerContainer.setWaitTimeout(1000l);
queueHandlerContainer.start();
messageQueueHandlerContainer = queueHandlerContainer;
} else if (messageQueueDistributedSize == 1) {
QueueHandlerContainerService queueHandlerContainer = new QueueHandlerContainerService();
queueHandlerContainer.setServiceManagerName(getServiceManagerName());
queueHandlerContainer.setServiceName(getServiceName() + "$MessageQueueHandlerContainer");
queueHandlerContainer.create();
queueHandlerContainer.setQueueServiceName(messageQueueFactoryServiceName);
queueHandlerContainer.setQueueHandler(new MessageQueueHandler());
queueHandlerContainer.setIgnoreNullElement(true);
queueHandlerContainer.setWaitTimeout(1000l);
queueHandlerContainer.start();
messageQueueHandlerContainer = queueHandlerContainer;
}
if (messageListenerQueueDistributedSize > 0) {
messageListenerQueueSelector = new MessageListenerDistributedQueueSelector();
messageListenerQueueSelector.setServiceManagerName(getServiceManagerName());
messageListenerQueueSelector.setServiceName(getServiceName() + "$MessageListenerQueueSelector");
messageListenerQueueSelector.create();
messageListenerQueueSelector.setDistributedSize(messageListenerQueueDistributedSize);
if (messageListenerQueueFactoryServiceName != null) {
messageListenerQueueSelector.setQueueFactoryServiceName(messageListenerQueueFactoryServiceName);
}
messageListenerQueueSelector.start();
messageListenerQueueHandlerContainer = new DistributedQueueHandlerContainerService();
messageListenerQueueHandlerContainer.setServiceManagerName(getServiceManagerName());
messageListenerQueueHandlerContainer.setServiceName(getServiceName() + "$MessageListenerQueueHandlerContainer");
messageListenerQueueHandlerContainer.create();
messageListenerQueueHandlerContainer.setDistributedQueueSelector(messageListenerQueueSelector);
messageListenerQueueHandlerContainer.setQueueHandler(new MessageListenerQueueHandler());
messageListenerQueueHandlerContainer.setIgnoreNullElement(true);
messageListenerQueueHandlerContainer.setWaitTimeout(1000l);
messageListenerQueueHandlerContainer.start();
}
if (messageLatencyPerformanceRecorderServiceName != null) {
messageLatencyPerformanceRecorder = (PerformanceRecorder) ServiceManagerFactory.getServiceObject(messageLatencyPerformanceRecorderServiceName);
}
clientConnection = new WrappedClientConnection();
if (isConnectOnStart) {
connect();
}
if (registeredListenerMap.size() != 0) {
final Iterator listenerEntries = registeredListenerMap.entrySet().iterator();
while (listenerEntries.hasNext()) {
final Map.Entry listenerEntry = (Map.Entry) listenerEntries.next();
Object listenerObj = listenerEntry.getKey();
MessageListener listener = null;
if (listenerObj instanceof ServiceName) {
listener = (MessageListener) ServiceManagerFactory.getServiceObject((ServiceName) listenerObj);
} else {
listener = (MessageListener) listenerObj;
}
final Map subjectMap = (Map) listenerEntry.getValue();
final Iterator subjectEntries = subjectMap.entrySet().iterator();
while (subjectEntries.hasNext()) {
final Map.Entry subjectEntry = (Map.Entry) subjectEntries.next();
String subject = (String) subjectEntry.getKey();
Set keySet = (Set) subjectEntry.getValue();
if (keySet.remove(null)) {
addSubject(listener, subject);
}
addSubject(listener, subject, (String[]) keySet.toArray(new String[keySet.size()]));
}
}
}
if (isStartReceiveOnStart) {
startReceive();
}
}
Aggregations