geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r410129 - in /geronimo/branches/1.1/modules/upgrade/src: java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java test-data/gbean_1.xml test-data/gbean_1_result.xml test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java
Date Mon, 29 May 2006 17:33:34 GMT
Author: djencks
Date: Mon May 29 10:33:33 2006
New Revision: 410129

URL: http://svn.apache.org/viewvc?rev=410129&view=rev
Log:
GERONIMO-2068 deal with gbean-name elements in gbean references

Added:
    geronimo/branches/1.1/modules/upgrade/src/test-data/gbean_1.xml
    geronimo/branches/1.1/modules/upgrade/src/test-data/gbean_1_result.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/viewvc/geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java?rev=410129&r1=410128&r2=410129&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
Mon May 29 10:33:33 2006
@@ -90,6 +90,7 @@
     private static final QName ARTIFACT_QNAME = new QName("http://geronimo.apache.org/xml/ns/naming-1.1",
"artifactId");
     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 NAME_QNAME2 = new QName("http://geronimo.apache.org/xml/ns/deployment-1.1",
"name");
     private static final QName GBEAN_NAME_QNAME = new QName(null, "gbeanName");
 
     public void upgrade(InputStream source, Writer target) throws IOException, XmlException
{
@@ -190,14 +191,7 @@
                 } else if ("ejb-link".equals(localName)) {
                     break;
                 } else if ("target-name".equals(localName)) {
-                    String targetNameString = cursor.getTextValue();
-                    cursor.removeXml();
-                    ObjectName targetName;
-                    try {
-                        targetName = ObjectName.getInstance(targetNameString);
-                    } catch (MalformedObjectNameException e) {
-                        throw new XmlException("Invalid object name: " + targetNameString);
-                    }
+                    ObjectName targetName = extractObjectName(cursor);
                     name = targetName.getKeyProperty("name");
                     application = targetName.getKeyProperty("J2EEApplication");
                     if ("null".equals(application)) {
@@ -241,7 +235,24 @@
                 cursor.insertElementWithText(NAME_QNAME, name);
                 cursor.toNextToken();
             }
+        } else if ("gbean-name".equals(localName)) {
+            ObjectName targetName = extractObjectName(cursor);
+            String name = targetName.getKeyProperty("name");
+            cursor.insertComment("CHECK THAT THE TARGET GBEAN IS IN THE ANCESTOR SET OF THIS
MODULE AND THAT THE NAME UNIQUELY IDENTIFIES IT");
+            cursor.insertElementWithText(NAME_QNAME2, name);
+        }
+    }
+
+    private static ObjectName extractObjectName(XmlCursor cursor) throws XmlException {
+        String targetNameString = cursor.getTextValue();
+        cursor.removeXml();
+        ObjectName targetName;
+        try {
+            targetName = ObjectName.getInstance(targetNameString);
+        } catch (MalformedObjectNameException e) {
+            throw new XmlException("Invalid object name: " + targetNameString);
         }
+        return targetName;
     }
 
     private static String getLocalName(XmlCursor cursor) {

Added: geronimo/branches/1.1/modules/upgrade/src/test-data/gbean_1.xml
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/upgrade/src/test-data/gbean_1.xml?rev=410129&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/upgrade/src/test-data/gbean_1.xml (added)
+++ geronimo/branches/1.1/modules/upgrade/src/test-data/gbean_1.xml Mon May 29 10:33:33 2006
@@ -0,0 +1,41 @@
+<?xml version="1.0" ?>
+
+<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
+  configId="hello"
+  parentId="geronimo/j2ee-security/1.0.1-SNAPSHOT/car">
+
+
+    <gbean name="hello-realm" class="org.apache.geronimo.security.realm.GenericSecurityRealm">
+        <attribute name="realmName">hello-realm</attribute>
+        <reference name="LoginModuleConfiguration">
+            <name>hello-login-chain</name>
+        </reference>
+        <reference name="ServerInfo">
+            <gbean-name>geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-system/1.0.1-SNAPSHOT/car,J2EEServer=geronimo,j2eeType=GBean,name=ServerInfo</gbean-name>
+        </reference>
+        <reference name="LoginService">
+            <gbean-name>geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-security/1.0.1-SNAPSHOT/car,J2EEServer=geronimo,j2eeType=JaasLoginService,name=JaasLoginService</gbean-name>
+        </reference>
+    </gbean>
+
+
+    <gbean name="hello-login-chain" class="org.apache.geronimo.security.jaas.JaasLoginModuleUse">
+        <attribute name="controlFlag">REQUIRED</attribute>
+        <reference name="LoginModule">
+            <name>hello-login</name>
+        </reference>
+    </gbean>
+
+
+    <gbean name="hello-login" class="org.apache.geronimo.security.jaas.LoginModuleGBean">
+        <attribute name="loginModuleClass">foo.auth.LoginModule</attribute>
+        <attribute name="serverSide">true</attribute>
+        <attribute name="options">
+            usersURI=var/security/demo_users.properties
+            groupsURI=var/security/demo_groups.properties
+        </attribute>
+        <attribute name="loginDomainName">hello-realm</attribute>
+    </gbean>
+
+
+</application>

Added: geronimo/branches/1.1/modules/upgrade/src/test-data/gbean_1_result.xml
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/upgrade/src/test-data/gbean_1_result.xml?rev=410129&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/upgrade/src/test-data/gbean_1_result.xml (added)
+++ geronimo/branches/1.1/modules/upgrade/src/test-data/gbean_1_result.xml Mon May 29 10:33:33
2006
@@ -0,0 +1,49 @@
+<?xml version="1.0" ?>
+
+<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.1">
+  <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
+    <dep:moduleId>
+      <dep:groupId>default</dep:groupId>
+      <dep:artifactId>hello</dep:artifactId>
+      <dep:version>1-default</dep:version>
+      <dep:type>car</dep:type>
+    </dep:moduleId>
+    <dep:dependencies>
+      <dep:dependency>
+        <dep:groupId>geronimo</dep:groupId>
+        <dep:artifactId>j2ee-security</dep:artifactId>
+        <dep:version>1.0.1-SNAPSHOT</dep:version>
+        <dep:type>car</dep:type>
+      </dep:dependency>
+    </dep:dependencies>
+    <dep:hidden-classes/>
+    <dep:non-overridable-classes/>
+  </dep:environment>
+  <gbean name="hello-realm" class="org.apache.geronimo.security.realm.GenericSecurityRealm">
+    <attribute name="realmName">hello-realm</attribute>
+    <reference name="LoginModuleConfiguration">
+      <name>hello-login-chain</name>
+    </reference>
+    <reference name="ServerInfo">
+      <!--CHECK THAT THE TARGET GBEAN IS IN THE ANCESTOR SET OF THIS MODULE AND THAT THE
NAME UNIQUELY IDENTIFIES IT-->
+      <dep:name xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">ServerInfo</dep:name>
+    </reference>
+    <reference name="LoginService">
+      <!--CHECK THAT THE TARGET GBEAN IS IN THE ANCESTOR SET OF THIS MODULE AND THAT THE
NAME UNIQUELY IDENTIFIES IT-->
+      <dep:name xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">JaasLoginService</dep:name>
+    </reference>
+  </gbean>
+  <gbean name="hello-login-chain" class="org.apache.geronimo.security.jaas.JaasLoginModuleUse">
+    <attribute name="controlFlag">REQUIRED</attribute>
+    <reference name="LoginModule">
+      <name>hello-login</name>
+    </reference>
+  </gbean>
+  <gbean name="hello-login" class="org.apache.geronimo.security.jaas.LoginModuleGBean">
+    <attribute name="loginModuleClass">foo.auth.LoginModule</attribute>
+    <attribute name="serverSide">true</attribute>
+    <attribute name="options">usersURI=var/security/demo_users.properties
+            groupsURI=var/security/demo_groups.properties</attribute>
+    <attribute name="loginDomainName">hello-realm</attribute>
+  </gbean>
+</application>

Modified: geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java?rev=410129&r1=410128&r2=410129&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
Mon May 29 10:33:33 2006
@@ -34,7 +34,7 @@
 import org.apache.xmlbeans.XmlException;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class Upgrade1_0To1_1Test extends TestCase {
 
@@ -71,6 +71,10 @@
 
     public void test7() throws Exception {
         test("servlet_1");
+    }
+
+    public void test8() throws Exception {
+        test("gbean_1");
     }
 
     private void test(String testName) throws Exception {



Mime
View raw message