geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r398267 - in /geronimo/branches/1.1/modules/upgrade/src: java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java test-data/ejb_pkgen_1.xml test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java
Date Sun, 30 Apr 2006 01:39:01 GMT
Author: djencks
Date: Sat Apr 29 18:39:00 2006
New Revision: 398267

URL: http://svn.apache.org/viewcvs?rev=398267&view=rev
Log:
object to gbeanName in gbeans

Added:
    geronimo/branches/1.1/modules/upgrade/src/test-data/ejb_pkgen_1.xml
Modified:
    geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java
    geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java

Modified: geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java?rev=398267&r1=398266&r2=398267&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java
(original)
+++ geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java
Sat Apr 29 18:39:00 2006
@@ -90,6 +90,7 @@
     private static final QName TYPE_QNAME = new QName("http://geronimo.apache.org/xml/ns/naming-1.1",
"type");
     private static final QName MODULE_QNAME = new QName("http://geronimo.apache.org/xml/ns/naming-1.1",
"module");
     private static final QName NAME_QNAME = new QName("http://geronimo.apache.org/xml/ns/naming-1.1",
"name");
+    private static final QName GBEAN_NAME_QNAME = new QName(null, "gbeanName");
 ;
 
     public static void upgrade(InputStream source, Writer target) throws IOException, XmlException
{
@@ -115,6 +116,7 @@
                 } else {
                     cleanRef(cursor);
                 }
+                checkInvalid(cursor);
             }
         }
 
@@ -122,6 +124,18 @@
         xmlOptions.setSavePrettyPrint();
         xmlObject.save(target, xmlOptions);
 
+    }
+
+    private static void checkInvalid(XmlCursor cursor) throws XmlException {
+        QName name = cursor.getName();
+        if (name != null) {
+            String localName = name.getLocalPart();
+            if ("gbean".equals(localName)) {
+                if (cursor.getAttributeText(GBEAN_NAME_QNAME) != null) {
+                    throw new XmlException("You must replace the gbeanName attribute manually:
" + cursor.getAttributeText(GBEAN_NAME_QNAME));
+                }
+            }
+        }
     }
 
     private static void cleanRef(XmlCursor cursor) throws XmlException {

Added: geronimo/branches/1.1/modules/upgrade/src/test-data/ejb_pkgen_1.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/upgrade/src/test-data/ejb_pkgen_1.xml?rev=398267&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/upgrade/src/test-data/ejb_pkgen_1.xml (added)
+++ geronimo/branches/1.1/modules/upgrade/src/test-data/ejb_pkgen_1.xml Sat Apr 29 18:39:00
2006
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
+             xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
+             xmlns:pk="http://tranql.codehaus.org/xml/ns/pkgen"
+             configId="ejb_unknownpk"
+             parentId="${pom.groupId}/jms/${pom.currentVersion}/car">
+  <module>
+    <ejb>ejb_unknownpk_ejb.jar</ejb>
+    <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar" configId="ejb">
+      <cmp-connection-factory>
+        <resource-link>jdbc/DB1</resource-link>
+      </cmp-connection-factory>
+      <enterprise-beans>
+        <entity>
+          <ejb-name>TestBeanEJB</ejb-name>
+          <table-name>UNKNOWNPK_TABLE1</table-name>
+          <cmp-field-mapping>
+            <cmp-field-name>accountNumber</cmp-field-name>
+            <table-column>ACCOUNTNUMBER</table-column>
+          </cmp-field-mapping>
+          <primkey-field>abc</primkey-field>
+          <key-generator xmlns="http://www.openejb.org/xml/ns/pkgen">
+            <custom-generator>
+              <generator-name>geronimo.server:name=CMPPKGenerator</generator-name>
+              <primary-key-class>java.lang.Integer</primary-key-class>
+            </custom-generator>
+          </key-generator>
+        </entity>
+      </enterprise-beans>
+
+      <gbean gbeanName="geronimo.server:name=CMPPKGenerator" class="org.openejb.entity.cmp.pkgenerator.SequenceTablePrimaryKeyGeneratorWrapper">
+        <reference name="TransactionContextManager">
+            <gbean-name>*:name=TransactionContextManager,*</gbean-name>
+        </reference>
+        <reference name="ManagedConnectionFactoryWrapper"><gbean-name>geronimo.server:J2EEApplication=null,J2EEServer=geronimo,JCAResource=geronimo-cts/database/${pom.currentVersion}/car,j2eeType=JCAManagedConnectionFactory,name=jdbc/DB1</gbean-name></reference>
+        <attribute name="tableName">CUSTOM_UNKNOWNPK_TABLE1</attribute>
+        <attribute name="sequenceName">ABC_SEQ</attribute>
+        <attribute name="batchSize">10</attribute>
+      </gbean>
+
+    </openejb-jar>
+  </module>
+</application>

Modified: geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java?rev=398267&r1=398266&r2=398267&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java
(original)
+++ geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java
Sat Apr 29 18:39:00 2006
@@ -31,6 +31,7 @@
 import junit.framework.TestCase;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
 import org.apache.geronimo.schema.SchemaConversionUtils;
 
 /**
@@ -58,6 +59,15 @@
 
     public void test5() throws Exception {
         test("assembly_1");
+    }
+
+    public void test6() throws Exception {
+        try {
+            test("ejb_pkgen_1");
+            fail();
+        } catch (XmlException e) {
+
+        }
     }
 
     private void test(String testName) throws Exception {



Mime
View raw message