geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r693766 - in /geronimo/gshell/trunk/gshell-support/gshell-artifact/src: main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java test/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest.java
Date Wed, 10 Sep 2008 10:04:28 GMT
Author: jdillon
Date: Wed Sep 10 03:04:27 2008
New Revision: 693766

URL: http://svn.apache.org/viewvc?rev=693766&view=rev
Log:
Get the damn ArtifactManager loaded

Modified:
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest.java

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java?rev=693766&r1=693765&r2=693766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java
Wed Sep 10 03:04:27 2008
@@ -46,11 +46,17 @@
     public void init() throws Exception {
         DefaultContainerConfiguration config = new DefaultContainerConfiguration();
 
-        ClassWorld classWorld = new ClassWorld();
-        config.setClassWorld(classWorld);
-
-        ClassRealm classRealm = classWorld.newRealm("gshell.artifact", getClass().getClassLoader());
-        config.setRealm(classRealm);
+        // When running under ClassWorlds already, then set the containers realm to the current
realm
+        ClassLoader cl = getClass().getClassLoader();
+        if (cl instanceof ClassRealm) {
+            config.setRealm((ClassRealm)cl);
+        }
+        else {
+            // Else, when testing, setup a new realm
+            ClassWorld classWorld = new ClassWorld();
+            ClassRealm classRealm = classWorld.newRealm("testing", getClass().getClassLoader());
+            config.setRealm(classRealm);
+        }
 
         container = new DefaultPlexusContainer(config);
 
@@ -58,10 +64,6 @@
     }
     
     public Object getObject() throws Exception {
-        if (container == null) {
-            container = new DefaultPlexusContainer();
-        }
-
         Object target = container.lookup(ArtifactManager.class);
 
         log.debug("Using ArtifactManager: {}", target);

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest.java?rev=693766&r1=693765&r2=693766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest.java
Wed Sep 10 03:04:27 2008
@@ -19,8 +19,6 @@
 
 package org.apache.geronimo.gshell.artifact;
 
-import org.apache.geronimo.gshell.spring.SpringTestSupport;
-
 /**
  * Unit tests for the {@link ArtifactManagerFactory} class.
  *



Mime
View raw message