Search in sources :

Example 16 with ServiceName

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());
}
Also used : ServiceName(jp.ossc.nimbus.core.ServiceName)

Example 17 with ServiceName

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());
}
Also used : ServiceName(jp.ossc.nimbus.core.ServiceName)

Example 18 with ServiceName

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");
    }
}
Also used : ServiceName(jp.ossc.nimbus.core.ServiceName) ServiceMetaData(jp.ossc.nimbus.core.ServiceMetaData)

Example 19 with ServiceName

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");
    }
}
Also used : ServiceName(jp.ossc.nimbus.core.ServiceName)

Example 20 with ServiceName

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());
}
Also used : ServiceName(jp.ossc.nimbus.core.ServiceName)

Aggregations

ServiceName (jp.ossc.nimbus.core.ServiceName)66 ServiceNameRef (jp.ossc.nimbus.core.ServiceNameRef)13 ServiceNameEditor (jp.ossc.nimbus.beans.ServiceNameEditor)12 DefaultInterceptorChainList (jp.ossc.nimbus.service.aop.DefaultInterceptorChainList)9 DefaultMethodInvocationContext (jp.ossc.nimbus.service.aop.DefaultMethodInvocationContext)8 Interceptor (jp.ossc.nimbus.service.aop.Interceptor)8 InvocationContext (jp.ossc.nimbus.service.aop.InvocationContext)8 FilterChain (javax.servlet.FilterChain)7 InterceptorChain (jp.ossc.nimbus.service.aop.InterceptorChain)7 Map (java.util.Map)6 Properties (java.util.Properties)6 DefaultInterceptorChain (jp.ossc.nimbus.service.aop.DefaultInterceptorChain)6 HashMap (java.util.HashMap)5 ServiceMetaData (jp.ossc.nimbus.core.ServiceMetaData)5 Invoker (jp.ossc.nimbus.service.aop.Invoker)5 Iterator (java.util.Iterator)4 Method (java.lang.reflect.Method)3 ServletConfig (javax.servlet.ServletConfig)3 DefaultThreadLocalInterceptorChain (jp.ossc.nimbus.service.aop.DefaultThreadLocalInterceptorChain)3 DefaultSemaphoreService (jp.ossc.nimbus.service.semaphore.DefaultSemaphoreService)3