geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject cvs commit: incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment WebAppDConfigTest.java
Date Sun, 25 Jan 2004 01:53:17 GMT
jboynes     2004/01/24 17:53:17

  Modified:    modules/deployment/src/java/org/apache/geronimo/deployment/plugin/j2ee
                        ENCHelper.java
               modules/jetty/src/test-resources/deployables/war1/WEB-INF
                        web.xml
               modules/jetty/src/test/org/apache/geronimo/jetty/deployment
                        WebAppDConfigTest.java
  Log:
  Tests for ejb-ref and ejb-local-ref
  
  Revision  Changes    Path
  1.4       +5 -2      incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/j2ee/ENCHelper.java
  
  Index: ENCHelper.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/j2ee/ENCHelper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ENCHelper.java	25 Jan 2004 01:08:25 -0000	1.3
  +++ ENCHelper.java	25 Jan 2004 01:53:17 -0000	1.4
  @@ -81,7 +81,10 @@
    */
   public class ENCHelper {
       public static final String[] ENC_XPATHS = {
  -        "ejb-ref/ejb-ref-name"
  +        "ejb-ref/ejb-ref-name",
  +        "ejb-local-ref/ejb-ref-name",
  +        "service-ref/service-ref-name",
  +        "resource-ref/res-ref-name",
       };
   
       private final DDBean ddBean;
  
  
  
  1.4       +12 -0     incubator-geronimo/modules/jetty/src/test-resources/deployables/war1/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/test-resources/deployables/war1/WEB-INF/web.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- web.xml	25 Jan 2004 01:08:25 -0000	1.3
  +++ web.xml	25 Jan 2004 01:53:17 -0000	1.4
  @@ -19,8 +19,20 @@
           <home>some.package.FakeHome</home>
           <remote>some.package.Fake</remote>
       </ejb-ref>
  +    <ejb-ref>
  +        <ejb-ref-name>another-ejb-ref</ejb-ref-name>
  +        <ejb-ref-type>Entity</ejb-ref-type>
  +        <home>some.package.FakeHome</home>
  +        <remote>some.package.Fake</remote>
  +    </ejb-ref>
       <ejb-local-ref>
           <ejb-ref-name>fake-ejb-local-ref</ejb-ref-name>
  +        <ejb-ref-type>Entity</ejb-ref-type>
  +        <local-home>some.package.FakeLocalHome</local-home>
  +        <local>some.package.FakeLocal</local>
  +    </ejb-local-ref>
  +    <ejb-local-ref>
  +        <ejb-ref-name>another-ejb-local-ref</ejb-ref-name>
           <ejb-ref-type>Entity</ejb-ref-type>
           <local-home>some.package.FakeLocalHome</local-home>
           <local>some.package.FakeLocal</local>
  
  
  
  1.3       +46 -39    incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/WebAppDConfigTest.java
  
  Index: WebAppDConfigTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/WebAppDConfigTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WebAppDConfigTest.java	25 Jan 2004 01:08:25 -0000	1.2
  +++ WebAppDConfigTest.java	25 Jan 2004 01:53:17 -0000	1.3
  @@ -65,17 +65,17 @@
   import org.apache.geronimo.deployment.plugin.j2ee.URIRefConfigBean;
   
   /**
  - * 
  - * 
  + *
  + *
    * @version $Revision$ $Date$
    */
   public class WebAppDConfigTest extends DeployerTestCase {
       private DeploymentConfiguration config;
       private WebDeployable deployable;
  +    private DDBeanRoot ddBeanRoot;
  +    private WebAppDConfigRoot configRoot;
   
       public void testWebAppRoot() throws Exception {
  -        DDBeanRoot ddBeanRoot = deployable.getDDBeanRoot();
  -        WebAppDConfigRoot configRoot = (WebAppDConfigRoot) config.getDConfigBeanRoot(ddBeanRoot);
           assertNotNull(configRoot);
           assertTrue(Arrays.equals(new String[]{"web-app"}, configRoot.getXpaths()));
           assertNotNull(configRoot.getDConfigBean(ddBeanRoot.getChildBean("web-app")[0]));
  @@ -83,50 +83,57 @@
       }
   
       public void testWebApp() throws Exception {
  -        DDBeanRoot ddBeanRoot = deployable.getDDBeanRoot();
  -        WebAppDConfigRoot configRoot = (WebAppDConfigRoot) config.getDConfigBeanRoot(ddBeanRoot);
  -        WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBeanRoot.getChildBean("web-app")[0]);
  +        DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
  +        WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
           assertNotNull(webApp);
  +        String[] xpaths = webApp.getXpaths();
  +        assertTrue(Arrays.equals(
  +                new String[]{"ejb-ref/ejb-ref-name", "ejb-local-ref/ejb-ref-name", "service-ref/service-ref-name",
"resource-ref/res-ref-name", },
  +                xpaths)
  +        );
       }
   
  -    public void testEncRef() throws Exception {
  -        DDBeanRoot ddBeanRoot = deployable.getDDBeanRoot();
  -        WebAppDConfigRoot configRoot = (WebAppDConfigRoot) config.getDConfigBeanRoot(ddBeanRoot);
  -
  -        DDBean[] ddBeans;
  -        DConfigBean dcBean;
  -
  -        ddBeans = ddBeanRoot.getChildBean("web-app/ejb-ref/ejb-ref-name");
  -        assertNotNull(ddBeans);
  -        assertEquals(1, ddBeans.length);
  +    public void testEJBRef() throws Exception {
  +        DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
  +        WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
  +        DDBean[] ddBeans = ddBean.getChildBean("ejb-ref/ejb-ref-name");
  +        assertEquals(2, ddBeans.length);
           assertEquals("fake-ejb-ref", ddBeans[0].getText());
  -        dcBean = configRoot.getDConfigBean(ddBeans[0]);
  -//        assertNotNull(dcBean);
  -//        assertTrue(dcBean instanceof URIRefConfigBean);
  -//        ((URIRefConfigBean)dcBean).setTargetURI("blah-ejb-ref");
  -//        dcBean = configRoot.getDConfigBean(ddBeans[0]);
  -//        assertNotNull(dcBean);
  -//        assertTrue(dcBean instanceof URIRefConfigBean);
  -//        assertEquals("blah-ejb-ref", ((URIRefConfigBean)dcBean).getTargetURI());
  -//
  -//        ddBeans = ddBeanRoot.getChildBean("web-app/ejb-local-ref/ejb-ref-name");
  -//        assertNotNull(ddBeans);
  -//        assertEquals(1, ddBeans.length);
  -//        assertEquals("fake-ejb-local-ref", ddBeans[0].getText());
  -//        dcBean = configRoot.getDConfigBean(ddBeans[0]);
  -//        assertNotNull(dcBean);
  -//        assertTrue(dcBean instanceof URIRefConfigBean);
  -//        ((URIRefConfigBean)dcBean).setTargetURI("blah-ejb-local-ref");
  -//        dcBean = configRoot.getDConfigBean(ddBeans[0]);
  -//        assertNotNull(dcBean);
  -//        assertTrue(dcBean instanceof URIRefConfigBean);
  -//        assertEquals("blah-ejb-local-ref", ((URIRefConfigBean)dcBean).getTargetURI());
  +        assertEquals("another-ejb-ref", ddBeans[1].getText());
  +
  +        URIRefConfigBean ejbRef0 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[0]);
  +        URIRefConfigBean ejbRef1 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[1]);
  +        assertNotNull(ejbRef0);
  +        assertEquals(ddBeans[0],ejbRef0.getDDBean());
  +        assertNotNull(ejbRef1);
  +        assertEquals(ddBeans[1],ejbRef1.getDDBean());
  +        assertTrue(ejbRef0 != ejbRef1);
  +    }
  +
  +    public void testEJBLocalRef() throws Exception {
  +        DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
  +        WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
  +        DDBean[] ddBeans = ddBean.getChildBean("ejb-local-ref/ejb-ref-name");
  +        assertEquals(2, ddBeans.length);
  +        assertEquals("fake-ejb-local-ref", ddBeans[0].getText());
  +        assertEquals("another-ejb-local-ref", ddBeans[1].getText());
  +
  +        URIRefConfigBean ejbRef0 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[0]);
  +        URIRefConfigBean ejbRef1 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[1]);
  +        assertNotNull(ejbRef0);
  +        assertEquals(ddBeans[0],ejbRef0.getDDBean());
  +        assertNotNull(ejbRef1);
  +        assertEquals(ddBeans[1],ejbRef1.getDDBean());
  +        assertTrue(ejbRef0 != ejbRef1);
       }
   
       protected void setUp() throws Exception {
           super.setUp();
           deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
           config = manager.createConfiguration(deployable);
  +
  +        ddBeanRoot = deployable.getDDBeanRoot();
  +        configRoot = (WebAppDConfigRoot) config.getDConfigBeanRoot(ddBeanRoot);
       }
   
       protected void tearDown() throws Exception {
  
  
  

Mime
View raw message