geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsis...@apache.org
Subject svn commit: r380600 - in /geronimo/branches/1.0/modules/j2ee-schema/src: test-data/j2ee_1_3dtd/mdb-ejb-jar-20-GERONIMO-1649.xml test-data/j2ee_1_3dtd/mdb-ejb-jar-21-GERONIMO-1649.xml test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
Date Fri, 24 Feb 2006 06:29:22 GMT
Author: jsisson
Date: Thu Feb 23 22:29:21 2006
New Revision: 380600

URL: http://svn.apache.org/viewcvs?rev=380600&view=rev
Log:
GERONIMO-1649 - Test case for Invalid deployment descriptor error when deploying an EJB 2.0
MDB

Added:
    geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-20-GERONIMO-1649.xml
  (with props)
    geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-21-GERONIMO-1649.xml
  (with props)
Modified:
    geronimo/branches/1.0/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java

Added: geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-20-GERONIMO-1649.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-20-GERONIMO-1649.xml?rev=380600&view=auto
==============================================================================
--- geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-20-GERONIMO-1649.xml
(added)
+++ geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-20-GERONIMO-1649.xml
Thu Feb 23 22:29:21 2006
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Copyright 2003-2004 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.-->
+    
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar id="ejb-jar_1">
+
+   <description>Test EJB JAR for GERONIMO-1649</description>
+   <display-name>Test for GERONIMO-1649</display-name>
+
+   <enterprise-beans>
+
+      <!-- Message Driven Beans -->
+
+      <message-driven id="MessageDriven_1">
+         <description>Message driven bean 1</description>
+         <display-name>MDBean</display-name>
+
+         <ejb-name>SimpleStatelessSession</ejb-name>
+
+         <ejb-class>org.openejb.test.simple.slsb.SimpleStatelessSessionEJB</ejb-class>
+
+         <transaction-type>Container</transaction-type>
+         <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
+         <message-driven-destination>
+            <destination-type>javax.jms.Queue</destination-type>
+            <subscription-durability>Durable</subscription-durability>
+         </message-driven-destination>
+
+         <security-identity>
+            <run-as>
+               <role-name>rolename</role-name>
+            </run-as>
+         </security-identity>
+
+         <resource-ref id="ResRef_1">
+            <res-ref-name>jdbc/MYDS</res-ref-name>
+            <res-type>javax.sql.DataSource</res-type>
+            <res-auth>Container</res-auth>
+         </resource-ref>
+         <resource-ref id="ResRef_2">
+            <res-ref-name>jdbc/MYDS2</res-ref-name>
+            <res-type>javax.sql.DataSource</res-type>
+            <res-auth>Container</res-auth>
+         </resource-ref>
+         <resource-ref id="ResRef_3">
+            <res-ref-name>jdbc/MYDS3</res-ref-name>
+            <res-type>javax.sql.DataSource</res-type>
+            <res-auth>Container</res-auth>
+         </resource-ref>
+         <resource-ref id="ResRef_4">
+            <res-ref-name>jms/wpConnectionFactory</res-ref-name>
+            <res-type>javax.jms.QueueConnectionFactory</res-type>
+            <res-auth>Container</res-auth>
+         </resource-ref>
+
+      </message-driven>
+
+   </enterprise-beans>
+
+   <assembly-descriptor id="AssemblyDescriptor_1">
+
+      <security-role>
+         <description>A description</description>
+         <role-name>rolename</role-name>
+      </security-role>
+
+   <method-permission id="MethodPermission_1">
+      <description>A description</description>
+      <role-name>rolename</role-name>
+      <method id="MethodElement_1">
+         <description>A description</description>
+         <ejb-name>SimpleStatelessSession</ejb-name>
+         <method-name>*</method-name>
+      </method>
+   </method-permission>
+    
+   <container-transaction id="MethodTransaction_2">
+      <method id="MethodElement_2">
+         <ejb-name>SimpleStatelessSession</ejb-name>
+          <method-name>*</method-name>
+       </method>
+       <trans-attribute>NotSupported</trans-attribute>
+    </container-transaction>
+   </assembly-descriptor>
+
+</ejb-jar>

Propchange: geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-20-GERONIMO-1649.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-20-GERONIMO-1649.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-20-GERONIMO-1649.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-21-GERONIMO-1649.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-21-GERONIMO-1649.xml?rev=380600&view=auto
==============================================================================
--- geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-21-GERONIMO-1649.xml
(added)
+++ geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-21-GERONIMO-1649.xml
Thu Feb 23 22:29:21 2006
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2003-2004 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<ejb-jar xsi:schemaLocation="http://java.sun.com/xml/ns/j2eehttp://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
version="2.1" id="ejb-jar_1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee">
+  <description>Test EJB JAR for GERONIMO-1649</description>
+  <display-name>Test for GERONIMO-1649</display-name>
+  <enterprise-beans>
+    <!--Message Driven Beans-->
+    <message-driven id="MessageDriven_1">
+      <description>Message driven bean 1</description>
+      <display-name>MDBean</display-name>
+      <ejb-name>SimpleStatelessSession</ejb-name>
+      <ejb-class>org.openejb.test.simple.slsb.SimpleStatelessSessionEJB</ejb-class>
+      <messaging-type>javax.jms.MessageListener</messaging-type>
+      <transaction-type>Container</transaction-type>
+      <activation-config>
+        <activation-config-property>
+          <activation-config-property-name>acknowledgeMode</activation-config-property-name>
+          <activation-config-property-value>Auto-acknowledge</activation-config-property-value>
+        </activation-config-property>
+        <activation-config-property>
+          <activation-config-property-name>destinationType</activation-config-property-name>
+          <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
+        </activation-config-property>
+        <activation-config-property>
+          <activation-config-property-name>subscriptionDurability</activation-config-property-name>
+          <activation-config-property-value>Durable</activation-config-property-value>
+        </activation-config-property>
+      </activation-config>
+      <resource-ref id="ResRef_1">
+        <res-ref-name>jdbc/MYDS</res-ref-name>
+        <res-type>javax.sql.DataSource</res-type>
+        <res-auth>Container</res-auth>
+      </resource-ref>
+      <resource-ref id="ResRef_2">
+        <res-ref-name>jdbc/MYDS2</res-ref-name>
+        <res-type>javax.sql.DataSource</res-type>
+        <res-auth>Container</res-auth>
+      </resource-ref>
+      <resource-ref id="ResRef_3">
+        <res-ref-name>jdbc/MYDS3</res-ref-name>
+        <res-type>javax.sql.DataSource</res-type>
+        <res-auth>Container</res-auth>
+      </resource-ref>
+      <resource-ref id="ResRef_4">
+        <res-ref-name>jms/wpConnectionFactory</res-ref-name>
+        <res-type>javax.jms.QueueConnectionFactory</res-type>
+        <res-auth>Container</res-auth>
+      </resource-ref>
+      <security-identity>
+        <run-as>
+          <role-name>rolename</role-name>
+        </run-as>
+      </security-identity>
+    </message-driven>
+  </enterprise-beans>
+  <assembly-descriptor id="AssemblyDescriptor_1">
+    <security-role>
+      <description>A description</description>
+      <role-name>rolename</role-name>
+    </security-role>
+    <method-permission id="MethodPermission_1">
+      <description>A description</description>
+      <role-name>rolename</role-name>
+      <method id="MethodElement_1">
+        <description>A description</description>
+        <ejb-name>SimpleStatelessSession</ejb-name>
+        <method-name>*</method-name>
+      </method>
+    </method-permission>
+    <container-transaction id="MethodTransaction_2">
+      <method id="MethodElement_2">
+        <ejb-name>SimpleStatelessSession</ejb-name>
+        <method-name>*</method-name>
+      </method>
+      <trans-attribute>NotSupported</trans-attribute>
+    </container-transaction>
+  </assembly-descriptor>
+</ejb-jar>

Propchange: geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-21-GERONIMO-1649.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-21-GERONIMO-1649.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/branches/1.0/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/mdb-ejb-jar-21-GERONIMO-1649.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/branches/1.0/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java?rev=380600&r1=380599&r2=380600&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
(original)
+++ geronimo/branches/1.0/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
Thu Feb 23 22:29:21 2006
@@ -17,7 +17,6 @@
 
 package org.apache.geronimo.schema;
 
-import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 import java.net.URL;
@@ -179,6 +178,35 @@
     public void testEJB20ToEJB21Transform() throws Exception {
         URL srcXml = classLoader.getResource("j2ee_1_3dtd/ejb-jar.xml");
         URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/ejb-jar-21.xml");
+        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
+        XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
+        SchemaConversionUtils.validateDD(expected);
+        xmlObject = SchemaConversionUtils.convertToEJBSchema(xmlObject);
+//        System.out.println(xmlObject.toString());
+//        System.out.println(expected.toString());
+        List problems = new ArrayList();
+        boolean ok = compareXmlObjects(xmlObject, expected, problems);
+        assertTrue("Differences: " + problems, ok);
+        //make sure trying to convert twice has no bad effects
+        XmlCursor cursor2 = xmlObject.newCursor();
+        try {
+            String schemaLocationURL = "http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd";
+            String version = "2.1";
+            assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.J2EE_NAMESPACE,
schemaLocationURL, version));
+        } finally {
+            cursor2.dispose();
+        }
+        boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
+        assertTrue("Differences after reconverting to schema: " + problems, ok2);
+        //do the whole transform twice...
+        xmlObject = SchemaConversionUtils.convertToEJBSchema(xmlObject);
+        boolean ok3 = compareXmlObjects(xmlObject, expected, problems);
+        assertTrue("Differences after reconverting to ejb schema: " + problems, ok3);
+    }
+
+    public void testMDB20ToEJB21TransformBugGERONIMO_1649() throws Exception {
+        URL srcXml = classLoader.getResource("j2ee_1_3dtd/mdb-ejb-jar-20-GERONIMO-1649.xml");
+        URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/mdb-ejb-jar-21-GERONIMO-1649.xml");
         XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
         XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
         SchemaConversionUtils.validateDD(expected);



Mime
View raw message