[jboss-jira] [JBoss JIRA] Commented: (JBAS-8835) org.jboss.test.web.test.NamingServletUnitTestCase

Daniel Bevenius (JIRA) jira-events at lists.jboss.org
Tue May 24 10:28:01 EDT 2011


    [ https://issues.jboss.org/browse/JBAS-8835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603959#comment-12603959 ] 

Daniel Bevenius commented on JBAS-8835:
---------------------------------------

I've looked into this issue and code for _testAppContextRoot_ looks like this:
{code:java}
public void testAppContextRoot() throws Exception
{
    // since this is a standalone deployment, the module functions as an app (EE.5.2.2)
    String result = get("/naming/servlet?name=java:app/naming!ROOT");
    fail("FIXME: don't know what to expect " + result);
{code}
Looking at the EE spec I found this in section _EE.5.15_:
{quote}
A component may access the name of the current application using the pre-defined JNDI name java:app/AppName.
{quote}
So I've updated the test like this:
{code:java}
public void testAppContextRoot() throws Exception
{
    // since this is a standalone deployment, the module functions as an app (EE.5.2.2)
    String result = get("/naming/servlet?name=java:app/AppName");
    assertEquals("naming", result);
}
{code}

The code for _testGlobalContextRoot_ currently look like this:
{code:java}
public void testGlobalContextRoot() throws Exception
{
    String result = get("/naming/servlet?name=java:global/naming!ROOT");
    fail("FIXME: don't know what to expect " + result);
}
{code}
I'm not sure either what the expected result should be here but my suggestion if this:
{code:java}
public void testGlobalContextRoot() throws Exception
{
    // since this is a standalone deployment, no app-name is needed
    String result = get("/naming/servlet?name=java:global/naming");
    assertNotNull(result);
}
{code}
Perhaps we could bind something into the global context and then assert that it can be retrieved. 


> org.jboss.test.web.test.NamingServletUnitTestCase
> -------------------------------------------------
>
>                 Key: JBAS-8835
>                 URL: https://issues.jboss.org/browse/JBAS-8835
>             Project: Legacy JBoss Application Server 6 
>          Issue Type: Sub-task
>      Security Level: Public(Everyone can see) 
>          Components: Test Suite
>            Reporter: Shelly McGowan
>            Assignee: Shelly McGowan
>             Fix For: 6.1.0
>
>
> org.jboss.test.web.test.NamingServletUnitTestCase.testAppContextRoot
> org.jboss.test.web.test.NamingServletUnitTestCase.testGlobalContextRoot
> junit.framework.AssertionFailedError: FIXME: don't know what to expect naming!ROOT not bound

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list