You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2006/05/30 17:13:19 UTC
svn commit: r410301 - in /geronimo/trunk/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
Author: djencks
Date: Tue May 30 08:13:18 2006
New Revision: 410301
URL: http://svn.apache.org/viewvc?rev=410301&view=rev
Log:
GERONIMO-2068 deal with gbean-name elements in gbean references port from 1.1
Added:
geronimo/trunk/modules/upgrade/src/test-data/gbean_1.xml
- copied unchanged from r410129, geronimo/branches/1.1/modules/upgrade/src/test-data/gbean_1.xml
geronimo/trunk/modules/upgrade/src/test-data/gbean_1_result.xml
- copied unchanged from r410129, geronimo/branches/1.1/modules/upgrade/src/test-data/gbean_1_result.xml
Modified:
geronimo/trunk/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java
geronimo/trunk/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java
Modified: geronimo/trunk/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java?rev=410301&r1=410300&r2=410301&view=diff
==============================================================================
--- geronimo/trunk/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java (original)
+++ geronimo/trunk/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java Tue May 30 08:13:18 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) {
Modified: geronimo/trunk/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java?rev=410301&r1=410300&r2=410301&view=diff
==============================================================================
--- geronimo/trunk/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java (original)
+++ geronimo/trunk/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java Tue May 30 08:13:18 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 {