use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class ServiceNameArrayEditorTest method testSetValue1.
public void testSetValue1() throws Exception {
ServiceNameArrayEditor editor = new ServiceNameArrayEditor();
editor.setValue(new ServiceName[] { new ServiceName("Manager1", "Service1") });
assertEquals("Manager1#Service1", editor.getAsText());
}
use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class ServiceNameEditorTest method testSetValue1.
public void testSetValue1() throws Exception {
ServiceNameEditor editor = new ServiceNameEditor();
editor.setValue(new ServiceName("Manager1", "Service1"));
assertEquals("Manager1#Service1", editor.getAsText());
}
use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class DefaultInterceptorChainListServiceTest method test2.
public void test2() throws Throwable {
final ServiceMetaData chainListServiceData = new ServiceMetaData();
chainListServiceData.setCode(DefaultInterceptorChainListService.class.getName());
chainListServiceData.setName("ChainList");
chainListServiceData.addDepends(chainListServiceData.createDependsMetaData("Test", "Interceptor1"));
chainListServiceData.addDepends(chainListServiceData.createDependsMetaData("Test", "Interceptor2"));
chainListServiceData.addDepends(chainListServiceData.createDependsMetaData("Test", "Interceptor3"));
final Interceptor interceptor1 = new TestInterceptor();
final Interceptor interceptor2 = new TestInterceptor();
final Interceptor interceptor3 = new TestInterceptor();
ServiceManagerFactory.registerManager("Test");
ServiceManagerFactory.registerService("Test", chainListServiceData);
ServiceManagerFactory.registerService("Test", "Interceptor1", interceptor1);
ServiceManagerFactory.registerService("Test", "Interceptor2", interceptor2);
ServiceManagerFactory.registerService("Test", "Interceptor3", interceptor3);
try {
DefaultInterceptorChainListService chainList = (DefaultInterceptorChainListService) ServiceManagerFactory.getServiceObject("Test", "ChainList");
chainList.setInterceptorServiceNames(new ServiceName[] { new ServiceName("Test", "Interceptor1"), new ServiceName("Test", "Interceptor2"), new ServiceName("Test", "Interceptor3") });
ServiceManagerFactory.findManager("Test").createAllService();
ServiceManagerFactory.findManager("Test").startAllService();
assertEquals(interceptor1, chainList.getInterceptor(null, 0));
assertEquals(interceptor2, chainList.getInterceptor(null, 1));
assertEquals(interceptor3, chainList.getInterceptor(null, 2));
} finally {
ServiceManagerFactory.findManager("Test").stop();
ServiceManagerFactory.findManager("Test").destroyAllService();
ServiceManagerFactory.unregisterManager("Test");
}
}
use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class DefaultInterceptorChainTest method test4.
public void test4() throws Throwable {
List upList = new ArrayList();
List downList = new ArrayList();
List catchList = new ArrayList();
TestInterceptorInvoker interceptor1 = new TestInterceptorInvoker(upList, downList, catchList);
TestInterceptorInvoker interceptor2 = new TestInterceptorInvoker(upList, downList, catchList);
TestInterceptorInvoker invoker = new TestInterceptorInvoker(upList, downList, catchList, "hoge");
InterceptorChainList chainList = new DefaultInterceptorChainList(new Interceptor[] { interceptor1, interceptor2 });
ServiceManagerFactory.registerManager("Test");
ServiceManagerFactory.registerService("Test", "ChainList", chainList);
ServiceManagerFactory.registerService("Test", "Invoker", invoker);
ServiceManagerFactory.findManager("Test").createAllService();
ServiceManagerFactory.findManager("Test").startAllService();
try {
DefaultInterceptorChain chain = new DefaultInterceptorChain(new ServiceName("Test", "ChainList"), new ServiceName("Test", "Invoker"));
Object result = null;
try {
result = chain.invokeNext(new DefaultInvocationContext());
} catch (Throwable th) {
fail();
}
assertEquals("hoge", result);
assertEquals(3, upList.size());
assertEquals(interceptor1, upList.get(0));
assertEquals(interceptor2, upList.get(1));
assertEquals(invoker, upList.get(2));
assertEquals(3, downList.size());
assertEquals(invoker, downList.get(0));
assertEquals(interceptor2, downList.get(1));
assertEquals(interceptor1, downList.get(2));
assertEquals(0, catchList.size());
} finally {
ServiceManagerFactory.findManager("Test").stopAllService();
ServiceManagerFactory.findManager("Test").destroyAllService();
ServiceManagerFactory.unregisterManager("Test");
}
}
use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.
the class ServiceNameEditorTest method testSetAsText2.
public void testSetAsText2() throws Exception {
ServiceNameEditor editor = new ServiceNameEditor();
editor.setServiceManagerName("Manager1");
editor.setAsText("Service1");
assertEquals(new ServiceName("Service1"), editor.getValue());
}
Aggregations