geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r350297 - in /geronimo/trunk/modules/service-builder/src: java/org/apache/geronimo/deployment/service/ test-resources/services/ test/org/apache/geronimo/deployment/service/
Date Thu, 01 Dec 2005 19:02:46 GMT
Author: djencks
Date: Thu Dec  1 11:02:41 2005
New Revision: 350297

URL: http://svn.apache.org/viewcvs?rev=350297&view=rev
Log:
GERONIMO-1263 trim bits of dependency uris

Modified:
    geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
    geronimo/trunk/modules/service-builder/src/test-resources/services/plan1.xml
    geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ConfigPlanTest.java
    geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java

Modified: geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?rev=350297&r1=350296&r2=350297&view=diff
==============================================================================
--- geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
(original)
+++ geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
Thu Dec  1 11:02:41 2005
@@ -412,20 +412,20 @@
         URI uri;
         if (dep.isSetUri()) {
             try {
-                uri = new URI(dep.getUri());
+                uri = new URI(dep.getUri().trim());
             } catch (URISyntaxException e) {
-                throw new DeploymentException("Invalid dependency URI " + dep.getUri(), e);
+                throw new DeploymentException("Invalid dependency URI " + dep.getUri().trim(),
e);
             }
         } else {
-            String groupId = dep.getGroupId();
-            String type = dep.isSetType() ? dep.getType() : "jar";
-            String artifactId = dep.getArtifactId();
-            String version = dep.getVersion();
+            String groupId = dep.getGroupId().trim();
+            String type = dep.isSetType() ? dep.getType().trim() : "jar";
+            String artifactId = dep.getArtifactId().trim();
+            String version = dep.getVersion().trim();
             String id = groupId + "/" + artifactId + "/" + version + "/" + type;
             try {
                 uri = new URI(id);
             } catch (URISyntaxException e) {
-                throw new DeploymentException("Unable to construct URI for groupId=" + dep.getGroupId()
+ ", artifactId=" + dep.getArtifactId() + ", version=" + dep.getVersion(), e);
+                throw new DeploymentException("Unable to construct URI for groupId=" + groupId
+ ", artifactId=" + artifactId + ", version=" + version + ", type=" + type, e);
             }
         }
         return uri;

Modified: geronimo/trunk/modules/service-builder/src/test-resources/services/plan1.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/service-builder/src/test-resources/services/plan1.xml?rev=350297&r1=350296&r2=350297&view=diff
==============================================================================
--- geronimo/trunk/modules/service-builder/src/test-resources/services/plan1.xml (original)
+++ geronimo/trunk/modules/service-builder/src/test-resources/services/plan1.xml Thu Dec 
1 11:02:41 2005
@@ -21,12 +21,45 @@
     xmlns="http://geronimo.apache.org/xml/ns/deployment-1.0"
     configId="test/plan1"
     >
+    <import>
+        <groupId>geronimo</groupId>
+        <type>car</type>
+        <artifactId>foo4</artifactId>
+        <version>DEV</version>
+    </import>
+
+    <import>
+        <uri>geronimo/foo5/DEV/car</uri>
+    </import>
+
     <dependency>
         <groupId>geronimo</groupId>
-        <artifactId>geronimo-kernel</artifactId>
+        <artifactId>foo1</artifactId>
         <version>DEV</version>
     </dependency>
 
+    <dependency>
+        <groupId>
+           geronimo
+        </groupId>
+        <artifactId>
+            foo2
+        </artifactId>
+        <version>
+            DEV
+        </version>
+    </dependency>
+
+    <dependency>
+        <uri>geronimo/foo3/DEV</uri>
+    </dependency>
+
+    <dependency>
+        <uri>
+           geronimo/foo4/DEV
+        </uri>
+    </dependency>
+
     <gbean gbeanName="geronimo.test:name=MyMockGMBean" class="org.apache.geronimo.deployment.MockGBean">
         <attribute name="value">1234</attribute>
         <attribute name="intValue">1234</attribute>
@@ -42,6 +75,8 @@
                 </ns:bean-property>
             </ns:javabean>
         </xml-attribute>
-        <reference name="MockEndpoint"><gbean-name>geronimo.test:name=MyMockGMBean</gbean-name></reference>
+        <reference name="MockEndpoint">
+            <gbean-name>geronimo.test:name=MyMockGMBean</gbean-name>
+        </reference>
     </gbean>
 </configuration>

Modified: geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ConfigPlanTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ConfigPlanTest.java?rev=350297&r1=350296&r2=350297&view=diff
==============================================================================
--- geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ConfigPlanTest.java
(original)
+++ geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ConfigPlanTest.java
Thu Dec  1 11:02:41 2005
@@ -30,8 +30,8 @@
 import junit.framework.TestCase;
 
 /**
- * 
- * 
+ *
+ *
  * @version $Rev$ $Date$
  */
 public class ConfigPlanTest extends TestCase {
@@ -43,7 +43,7 @@
         assertEquals("test/plan1", configuration.getConfigId());
 
         DependencyType[] dependencies = configuration.getDependencyArray();
-        assertEquals(1, dependencies.length);
+        assertEquals(4, dependencies.length);
         assertEquals("geronimo", dependencies[0].getGroupId());
         assertEquals("geronimo-kernel", dependencies[0].getArtifactId());
         assertEquals("DEV", dependencies[0].getVersion());

Modified: geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java?rev=350297&r1=350296&r2=350297&view=diff
==============================================================================
--- geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
(original)
+++ geronimo/trunk/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
Thu Dec  1 11:02:41 2005
@@ -18,6 +18,7 @@
 
 import java.net.URI;
 import java.net.URL;
+import java.net.MalformedURLException;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
@@ -31,6 +32,7 @@
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.FooBarBean;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
@@ -53,7 +55,7 @@
         referenceCollection.add(javaBeanXmlAttributeBuilder);
         new ServiceConfigBuilder(parentIdArray, null, referenceCollection, null, null);
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
-        URL plan1 = cl.getResource("services/plan1.xml");
+        final URL plan1 = cl.getResource("services/plan1.xml");
         ConfigurationDocument doc = ConfigurationDocument.Factory.parse(plan1);
         ConfigurationType plan = doc.getConfiguration();
         File outFile = File.createTempFile("foo", "bar");
@@ -64,12 +66,22 @@
         try {
             DeploymentContext context = new DeploymentContext(outFile, URI.create("foo/bar"),
ConfigurationModuleType.SERVICE, parentId, "domain", "server", null);
             J2eeContext j2eeContext = new J2eeContextImpl("domain", "server", "null", "test",
"configtest", "foo", NameFactory.J2EE_MODULE);
+            ServiceConfigBuilder.addDependencies(context, plan.getDependencyArray(), new
Repository() {
+
+                public boolean hasURI(URI uri) {
+                    return true;
+                }
+
+                public URL getURL(URI uri) throws MalformedURLException {
+                    return plan1;
+                }
+            });
             GbeanType[] gbeans = plan.getGbeanArray();
             ServiceConfigBuilder.addGBeans(gbeans, cl, j2eeContext, context);
             Set beanDatas = context.listGBeans(new ObjectName("*:*"));
             assertEquals(1, beanDatas.size());
             ObjectName beanName = (ObjectName) beanDatas.iterator().next();
-            GBeanData data = context.getGBeanInstance(beanName); 
+            GBeanData data = context.getGBeanInstance(beanName);
             FooBarBean fooBarBean = (FooBarBean) data.getAttribute("fooBarBean");
             assertNotNull(fooBarBean);
             assertEquals("foo", fooBarBean.getFoo());



Mime
View raw message