Search in sources :

Example 51 with ResourceInfo

use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.

the class ContextServiceDeployer method deployResource.

@Override
public void deployResource(Object resource) throws Exception {
    ContextService contextServiceResource = (ContextService) resource;
    ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(contextServiceResource);
    deployResource(resource, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) ContextService(org.glassfish.concurrent.config.ContextService)

Example 52 with ResourceInfo

use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.

the class ConcurrentRuntimeTest method testParseContextInfo_disabled.

@Test
public void testParseContextInfo_disabled() throws Exception {
    expect(contextServiceConfig.getJndiName()).andReturn("concurrent/ctxSrv").anyTimes();
    expect(contextServiceConfig.getContextInfo()).andReturn("Classloader, JNDI, Security, WorkArea").anyTimes();
    expect(contextServiceConfig.getContextInfoEnabled()).andReturn("false");
    replay(contextServiceConfig);
    ConcurrentRuntime concurrentRuntime = new ConcurrentRuntime();
    ResourceInfo resource = new ResourceInfo("test");
    ContextServiceImpl contextService = concurrentRuntime.getContextService(resource, contextServiceConfig);
    ContextSetupProviderImpl contextSetupProvider = (ContextSetupProviderImpl) contextService.getContextSetupProvider();
    assertFalse((Boolean) Util.getdFieldValue(contextSetupProvider, "classloading"));
    assertFalse((Boolean) Util.getdFieldValue(contextSetupProvider, "naming"));
    assertFalse((Boolean) Util.getdFieldValue(contextSetupProvider, "security"));
    assertFalse((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 53 with ResourceInfo

use of org.glassfish.resourcebase.resources.api.ResourceInfo in project Payara by payara.

the class ConcurrentRuntimeTest method testParseContextInfo_invalid.

@Test
public void testParseContextInfo_invalid() throws Exception {
    expect(contextServiceConfig.getJndiName()).andReturn("concurrent/ctxSrv").anyTimes();
    expect(contextServiceConfig.getContextInfo()).andReturn("JNDI, blah, beh, JNDI, WorkArea, 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();
    assertFalse((Boolean) Util.getdFieldValue(contextSetupProvider, "classloading"));
    assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "naming"));
    assertFalse((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 54 with ResourceInfo

use of org.glassfish.resourcebase.resources.api.ResourceInfo 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 55 with ResourceInfo

use of org.glassfish.resourcebase.resources.api.ResourceInfo 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)

Aggregations

ResourceInfo (org.glassfish.resourcebase.resources.api.ResourceInfo)81 PoolInfo (org.glassfish.resourcebase.resources.api.PoolInfo)15 NamingException (javax.naming.NamingException)14 JdbcResource (org.glassfish.jdbc.config.JdbcResource)9 Test (org.junit.Test)9 ContextServiceImpl (org.glassfish.enterprise.concurrent.ContextServiceImpl)8 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)7 ConnectorResource (org.glassfish.connectors.config.ConnectorResource)6 RefAddr (javax.naming.RefAddr)5 SerializableObjectRefAddr (org.glassfish.resources.naming.SerializableObjectRefAddr)5 Resources (com.sun.enterprise.config.serverbeans.Resources)4 ResourceException (javax.resource.ResourceException)4 ContextService (org.glassfish.concurrent.config.ContextService)4 ManagedThreadFactory (org.glassfish.concurrent.config.ManagedThreadFactory)4 AdminObjectResource (org.glassfish.connectors.config.AdminObjectResource)4 CustomResource (org.glassfish.resources.config.CustomResource)4 MailResource (org.glassfish.resources.javamail.config.MailResource)4 ManagedConnectionFactory (javax.resource.spi.ManagedConnectionFactory)3 ManagedExecutorService (org.glassfish.concurrent.config.ManagedExecutorService)3 ManagedScheduledExecutorService (org.glassfish.concurrent.config.ManagedScheduledExecutorService)3