Search in sources :

Example 6 with ContextServiceImpl

use of org.glassfish.enterprise.concurrent.ContextServiceImpl in project Payara by payara.

the class ConcurrentRuntimeTest method testParseContextInfo_upperCase.

@Test
public void testParseContextInfo_upperCase() throws Exception {
    expect(contextServiceConfig.getJndiName()).andReturn("concurrent/ctxSrv").anyTimes();
    expect(contextServiceConfig.getContextInfo()).andReturn("CLASSLOADER, JNDI, SECURITY, WORKAREA").anyTimes();
    expect(contextServiceConfig.getContextInfoEnabled()).andReturn("true");
    replay(contextServiceConfig);
    ConcurrentRuntime concurrentRuntime = new ConcurrentRuntime();
    ResourceInfo resource = new ResourceInfo("test");
    ContextServiceImpl contextService = concurrentRuntime.getContextService(resource, contextServiceConfig);
    ContextSetupProviderImpl contextSetupProvider = (ContextSetupProviderImpl) contextService.getContextSetupProvider();
    assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "classloading"));
    assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "naming"));
    assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "security"));
    assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "workArea"));
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) ContextServiceImpl(org.glassfish.enterprise.concurrent.ContextServiceImpl) Test(org.junit.Test)

Example 7 with ContextServiceImpl

use of org.glassfish.enterprise.concurrent.ContextServiceImpl in project Payara by payara.

the class ConcurrentRuntimeTest method testParseContextInfo_lowerCase.

@Test
public void testParseContextInfo_lowerCase() throws Exception {
    expect(contextServiceConfig.getJndiName()).andReturn("concurrent/ctxSrv").anyTimes();
    expect(contextServiceConfig.getContextInfo()).andReturn("classloader, jndi, security, workarea").anyTimes();
    expect(contextServiceConfig.getContextInfoEnabled()).andReturn("true");
    replay(contextServiceConfig);
    ConcurrentRuntime concurrentRuntime = new ConcurrentRuntime();
    ResourceInfo resource = new ResourceInfo("test");
    ContextServiceImpl contextService = concurrentRuntime.getContextService(resource, contextServiceConfig);
    ContextSetupProviderImpl contextSetupProvider = (ContextSetupProviderImpl) contextService.getContextSetupProvider();
    assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "classloading"));
    assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "naming"));
    assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "security"));
    assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "workArea"));
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) ContextServiceImpl(org.glassfish.enterprise.concurrent.ContextServiceImpl) Test(org.junit.Test)

Example 8 with ContextServiceImpl

use of org.glassfish.enterprise.concurrent.ContextServiceImpl in project Payara by payara.

the class ConcurrentRuntimeTest method testParseContextInfo.

@Test
public void testParseContextInfo() throws Exception {
    expect(contextServiceConfig.getJndiName()).andReturn("concurrent/ctxSrv").anyTimes();
    expect(contextServiceConfig.getContextInfo()).andReturn("Classloader, JNDI, Security, WorkArea").anyTimes();
    expect(contextServiceConfig.getContextInfoEnabled()).andReturn("true");
    replay(contextServiceConfig);
    ConcurrentRuntime concurrentRuntime = new ConcurrentRuntime();
    ResourceInfo resource = new ResourceInfo("test");
    ContextServiceImpl contextService = concurrentRuntime.getContextService(resource, contextServiceConfig);
    ContextSetupProviderImpl contextSetupProvider = (ContextSetupProviderImpl) contextService.getContextSetupProvider();
    assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "classloading"));
    assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "naming"));
    assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "security"));
    assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "workArea"));
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) ContextServiceImpl(org.glassfish.enterprise.concurrent.ContextServiceImpl) Test(org.junit.Test)

Aggregations

ContextServiceImpl (org.glassfish.enterprise.concurrent.ContextServiceImpl)8 ResourceInfo (org.glassfish.resourcebase.resources.api.ResourceInfo)8 Test (org.junit.Test)8 ManagedThreadFactoryImpl (org.glassfish.enterprise.concurrent.ManagedThreadFactoryImpl)1 Ignore (org.junit.Ignore)1