geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r566893 [1/2] - in /geronimo/server/trunk: maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ modules/geronimo-connector-builder/ modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector...
Date Fri, 17 Aug 2007 00:52:58 GMT
Author: djencks
Date: Thu Aug 16 17:52:52 2007
New Revision: 566893

URL: http://svn.apache.org/viewvc?view=rev&rev=566893
Log:
GERONIMO-3416, start on moving common bits of deployment test infrastructure into kernel test jar.  Might also fix GERONMO-3415

Added:
    geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/
    geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockConfigStore.java   (contents, props changed)
      - copied, changed from r565969, geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConfigStore.java
    geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockRepository.java   (with props)
    geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockWritableListableRepository.java   (with props)
Removed:
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConfigStore.java
Modified:
    geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/MavenConfigStore.java
    geronimo/server/trunk/modules/geronimo-connector-builder/pom.xml
    geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/pom.xml
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTestSupport.java
    geronimo/server/trunk/modules/geronimo-jetty6-builder/pom.xml
    geronimo/server/trunk/modules/geronimo-jetty6-builder/src/test/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilderTest.java
    geronimo/server/trunk/modules/geronimo-kernel/pom.xml
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/IOUtil.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NullConfigurationStore.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ArtifactResolver.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ListableRepository.java
    geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java
    geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java
    geronimo/server/trunk/modules/geronimo-service-builder/pom.xml
    geronimo/server/trunk/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
    geronimo/server/trunk/modules/geronimo-system/pom.xml
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/ExplicitDefaultArtifactResolver.java
    geronimo/server/trunk/modules/geronimo-system/src/test/java/org/apache/geronimo/system/plugin/PluginInstallerTest.java
    geronimo/server/trunk/modules/geronimo-tomcat6-builder/pom.xml
    geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java

Modified: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/MavenConfigStore.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/MavenConfigStore.java?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/MavenConfigStore.java (original)
+++ geronimo/server/trunk/maven-plugins/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/MavenConfigStore.java Thu Aug 16 17:52:52 2007
@@ -28,6 +28,7 @@
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.WritableListableRepository;
 import org.apache.geronimo.kernel.Kernel;
@@ -87,7 +88,7 @@
         targetFile.delete();
     }
 
-    public List listConfigurations() {
+    public List<ConfigurationInfo> listConfigurations() {
         throw new UnsupportedOperationException();
     }
 

Modified: geronimo/server/trunk/modules/geronimo-connector-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector-builder/pom.xml?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector-builder/pom.xml (original)
+++ geronimo/server/trunk/modules/geronimo-connector-builder/pom.xml Thu Aug 16 17:52:52 2007
@@ -64,10 +64,13 @@
         </dependency>
         
         <dependency>
-            <groupId>org.tranql</groupId>
-            <artifactId>tranql</artifactId>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+            <version>${version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
         </dependency>
-        
+
     </dependencies>
     
     <build>

Modified: geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java (original)
+++ geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java Thu Aug 16 17:52:52 2007
@@ -18,16 +18,13 @@
 package org.apache.geronimo.connector.deployment;
 
 import java.io.File;
-import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.sql.Connection;
 import java.sql.Statement;
 import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -45,7 +42,6 @@
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.deployment.ActivationSpecInfoLocator;
 import org.apache.geronimo.j2ee.deployment.EARConfigBuilder;
 import org.apache.geronimo.j2ee.deployment.EARContext;
@@ -63,10 +59,9 @@
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.EditableConfigurationManager;
 import org.apache.geronimo.kernel.config.EditableKernelConfigurationManager;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.kernel.config.NoSuchConfigException;
-import org.apache.geronimo.kernel.config.NullConfigurationStore;
 import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.mock.MockConfigStore;
+import org.apache.geronimo.kernel.mock.MockRepository;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactManager;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
@@ -74,11 +69,10 @@
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.ImportType;
-import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.repository.ListableRepository;
 import org.apache.geronimo.system.serverinfo.BasicServerInfo;
 import org.apache.geronimo.testsupport.TestSupport;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManagerGBean;
-import org.tranql.sql.jdbc.JDBCUtil;
 
 /**
  * @version $Rev:385232 $ $Date$
@@ -93,19 +87,7 @@
     private int defaultidleTimeoutMinutes = 15;
     private Environment defaultEnvironment;
     private ConfigurationStore configurationStore = new MockConfigStore();
-    private Repository repository = new Repository() {
-        public boolean contains(Artifact artifact) {
-            return false;
-        }
-
-        public File getLocation(Artifact artifact) {
-            return null;
-        }
-
-        public LinkedHashSet getDependencies(Artifact artifact) {
-            return new LinkedHashSet();
-        }
-    };
+    private MockRepository repository;
 
     private ActivationSpecInfoLocator activationSpecInfoLocator = new ActivationSpecInfoLocator() {
 
@@ -145,7 +127,7 @@
                     null,
                     null,
                     new AbstractNameQuery(serverName, J2EEServerImpl.GBEAN_INFO.getInterfaces()),
-                    null,
+                    Collections.singleton(repository),
                     null,
                     null,
                     new ConnectorModuleBuilder(defaultEnvironment, defaultMaxSize, defaultMinSize, defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes, defaultXATransactionCaching, defaultXAThreadCaching, Collections.singleton(serviceBuilder)),
@@ -159,7 +141,7 @@
             ConfigurationData configData = null;
             DeploymentContext context = null;
             ArtifactManager artifactManager = new DefaultArtifactManager();
-            ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, Collections.EMPTY_SET, null);
+            ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, Collections.singleton(repository), null);
 
             try {
                 File planFile = new File(BASEDIR, "src/test/data/data/external-application-plan.xml");
@@ -393,9 +375,8 @@
             configurationManager.loadConfiguration(configurationData);
             Configuration configuration = configurationManager.getConfiguration(configurationId);
             configurationManager.startConfiguration(configurationId);
-            Set gb = configuration.getGBeans().keySet();
-            for (Iterator iterator = gb.iterator(); iterator.hasNext();) {
-                AbstractName name = (AbstractName) iterator.next();
+            Set<AbstractName> gb = configuration.getGBeans().keySet();
+            for (AbstractName name : gb) {
                 if (State.RUNNING_INDEX != kernel.getGBeanState(name)) {
                     log.debug("Not running: " + name);
                 }
@@ -491,15 +472,16 @@
             configurationManager.unloadConfiguration(configurationId);
         } finally {
             if (ds != null) {
-                Connection connection = null;
-                Statement statement = null;
+                Connection connection =  ds.getConnection();
                 try {
-                    connection = ds.getConnection();
-                    statement = connection.createStatement();
-                    statement.execute("SHUTDOWN");
+                    Statement statement = connection.createStatement();
+                    try {
+                        statement.execute("SHUTDOWN");
+                    } finally {
+                        statement.close();
+                    }
                 } finally {
-                    JDBCUtil.close(statement);
-                    JDBCUtil.close(connection);
+                    connection.close();
                 }
             }
 
@@ -537,6 +519,8 @@
 //        bootstrap.addGBean(configurationManagerData);
         bootstrap.addGBean("ServerInfo", BasicServerInfo.GBEAN_INFO).setAttribute("baseDirectory", ".");
 
+        AbstractName repositoryName = bootstrap.addGBean("Repository", MockRepository.GBEAN_INFO).getAbstractName();
+
         AbstractName configStoreName = bootstrap.addGBean("MockConfigurationStore", MockConfigStore.GBEAN_INFO).getAbstractName();
 
         GBeanData artifactManagerData = bootstrap.addGBean("ArtifactManager", DefaultArtifactManager.GBEAN_INFO);
@@ -548,6 +532,7 @@
         configurationManagerData.setReferencePattern("ArtifactManager", artifactManagerData.getAbstractName());
         configurationManagerData.setReferencePattern("ArtifactResolver", artifactResolverData.getAbstractName());
         configurationManagerData.setReferencePattern("Stores", configStoreName);
+        configurationManagerData.setReferencePattern("Repositories", repositoryName);
         bootstrap.addGBean(configurationManagerData);
 
         GBeanData serverData = bootstrap.addGBean("geronimo", J2EEServerImpl.GBEAN_INFO);
@@ -557,10 +542,16 @@
 
         // add fake TransactionManager so refs will resolve
         GBeanData tm = bootstrap.addGBean("TransactionManager", GeronimoTransactionManagerGBean.GBEAN_INFO);
-        tm.setAttribute("defaultTransactionTimeoutSeconds", new Integer(10));
+        tm.setAttribute("defaultTransactionTimeoutSeconds", 10);
 
         ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, getClass().getClassLoader());
 
+        repository = (MockRepository) kernel.getGBean(repositoryName);
+        Set<Artifact> repo = repository.getRepo();
+        repo.add(Artifact.create("org.apache.geronimo.tests/test/1/car"));
+        repo.add(bootId);
+
+
         configurationManager = ConfigurationUtil.getEditableConfigurationManager(kernel);
 //        configurationManager.getConfiguration(bootstrap.getId());
         ConfigurationStore configStore = (ConfigurationStore) kernel.getGBean(configStoreName);
@@ -592,60 +583,4 @@
         }
     }
 
-    public static class MockConfigStore extends NullConfigurationStore {
-        private Map configs = new HashMap();
-
-        URL baseURL;
-
-        public MockConfigStore() {
-        }
-
-        public MockConfigStore(URL baseURL) {
-            this.baseURL = baseURL;
-        }
-
-        public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException {
-            configs.put(configurationData.getId(), configurationData);
-        }
-
-        public void uninstall(Artifact configID) throws NoSuchConfigException, IOException {
-            configs.remove(configID);
-        }
-
-        public ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
-            if (configs.containsKey(configId)) {
-                ConfigurationData configurationData = (ConfigurationData) configs.get(configId);
-                configurationData.setConfigurationStore(this);
-                return configurationData;
-            } else {
-                ConfigurationData configurationData = new ConfigurationData(configId, naming);
-                configurationData.setConfigurationStore(this);
-                return configurationData;
-            }
-        }
-
-        public boolean containsConfiguration(Artifact configID) {
-            return true;
-        }
-
-        public File createNewConfigurationDir(Artifact configId) {
-            try {
-                return DeploymentUtil.createTempDir();
-            } catch (IOException e) {
-                return null;
-            }
-        }
-
-        public Set resolve(Artifact configId, String moduleName, String pattern) throws NoSuchConfigException, MalformedURLException {
-            return Collections.singleton(baseURL);
-        }
-
-        public final static GBeanInfo GBEAN_INFO;
-
-        static {
-            GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(MockConfigStore.class, NameFactory.CONFIGURATION_STORE);
-            infoBuilder.addInterface(ConfigurationStore.class);
-            GBEAN_INFO = infoBuilder.getBeanInfo();
-        }
-    }
 }

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/pom.xml?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/pom.xml (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/pom.xml Thu Aug 16 17:52:52 2007
@@ -86,6 +86,15 @@
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-servlet_2.5_spec</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+            <version>${version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
 
     <build>

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Thu Aug 16 17:52:52 2007
@@ -110,7 +110,7 @@
     private final static QName APPLICATION_QNAME = GerApplicationDocument.type.getDocumentElementName();
 
     private final ConfigurationManager configurationManager;
-    private final Collection<Repository> repositories;
+    private final Collection<? extends Repository> repositories;
     private final SingleElementCollection ejbConfigBuilder;
     private final SingleElementCollection webConfigBuilder;
     private final SingleElementCollection connectorConfigBuilder;
@@ -128,7 +128,7 @@
     private final AbstractNameQuery nonTransactionalTimerObjectName;
     private final AbstractNameQuery corbaGBeanObjectName;
     private final Naming naming;
-    private final Collection<ArtifactResolver> artifactResolvers;
+    private final Collection<? extends ArtifactResolver> artifactResolvers;
 
     public EARConfigBuilder(Environment defaultEnvironment,
             AbstractNameQuery transactionManagerAbstractName,
@@ -137,7 +137,7 @@
             AbstractNameQuery nonTransactionalTimerAbstractName,
             AbstractNameQuery corbaGBeanAbstractName,
             AbstractNameQuery serverName,
-            Collection<Repository> repositories,
+            Collection<? extends Repository> repositories,
             Collection ejbConfigBuilder,
             Collection webConfigBuilder,
             Collection connectorConfigBuilder,
@@ -146,7 +146,7 @@
             Collection securityBuilders,
             Collection serviceBuilders,
             Collection<ModuleBuilderExtension> persistenceUnitBuilders,
-            Collection<ArtifactResolver> artifactResolvers,
+            Collection<? extends ArtifactResolver> artifactResolvers,
             Kernel kernel) {
         this(defaultEnvironment,
                 transactionManagerAbstractName,
@@ -175,7 +175,7 @@
             AbstractNameQuery nonTransactionalTimerAbstractName,
             AbstractNameQuery corbaGBeanAbstractName,
             AbstractNameQuery serverName,
-            Collection<Repository> repositories,
+            Collection<? extends Repository> repositories,
             ModuleBuilder ejbConfigBuilder,
             ModuleBuilder webConfigBuilder,
             ModuleBuilder connectorConfigBuilder,
@@ -185,7 +185,7 @@
             NamespaceDrivenBuilder serviceBuilder,
             ModuleBuilderExtension persistenceUnitBuilder,
             Naming naming,
-            Collection<ArtifactResolver> artifactResolvers) {
+            Collection<? extends ArtifactResolver> artifactResolvers) {
         this(defaultEnvironment,
                 transactionManagerAbstractName,
                 connectionTrackerAbstractName,
@@ -215,7 +215,7 @@
              AbstractNameQuery corbaGBeanAbstractName,
              AbstractNameQuery serverName,
              ConfigurationManager configurationManager,
-             Collection<Repository> repositories,
+             Collection<? extends Repository> repositories,
              SingleElementCollection ejbConfigBuilder,
              SingleElementCollection webConfigBuilder,
              SingleElementCollection connectorConfigBuilder,
@@ -225,7 +225,7 @@
              Collection serviceBuilders,
              Collection<ModuleBuilderExtension> persistenceUnitBuilders,
              Naming naming,
-             Collection<ArtifactResolver> artifactResolvers) {
+             Collection<? extends ArtifactResolver> artifactResolvers) {
         this.configurationManager = configurationManager;
         this.repositories = repositories;
         this.defaultEnvironment = defaultEnvironment;

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTestSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTestSupport.java?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTestSupport.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTestSupport.java Thu Aug 16 17:52:52 2007
@@ -16,9 +16,11 @@
  */
 package org.apache.geronimo.j2ee.deployment;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
-import java.util.Collection;
+import java.util.Set;
+import java.util.HashSet;
 import java.util.jar.JarFile;
 
 import org.apache.geronimo.common.DeploymentException;
@@ -33,6 +35,8 @@
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.mock.MockConfigStore;
+import org.apache.geronimo.kernel.mock.MockRepository;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactManager;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
@@ -40,6 +44,7 @@
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.kernel.repository.ListableRepository;
 import org.apache.geronimo.testsupport.TestSupport;
 
 /**
@@ -58,8 +63,6 @@
     
     protected static ArtifactManager artifactManager = new DefaultArtifactManager();
     
-    protected static ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, Collections.EMPTY_SET, null);
-    
     protected static MockEJBConfigBuilder ejbConfigBuilder = new MockEJBConfigBuilder();
     
     protected static MockWARConfigBuilder webConfigBuilder = new MockWARConfigBuilder();
@@ -116,11 +119,15 @@
     
     protected final AbstractNameQuery corbaGBeanAbstractNameQuery = new AbstractNameQuery(serverName, null);
 
-    protected Collection<ArtifactResolver> artifactResolvers = null;
+    private ListableRepository repository;
+    protected ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, Collections.singleton(repository), null);
+    protected Collection<? extends ArtifactResolver> artifactResolvers = Collections.singleton(new DefaultArtifactResolver(artifactManager, repository));
 
     protected void setUp() throws Exception {
         super.setUp();
-        
+        Set<Artifact> repo = new HashSet<Artifact>();
+        repo.add(Artifact.create("org.apache.geronimo.tests/test/1/car"));
+        repository = new MockRepository(repo);
         defaultParentId = new Environment();
         defaultParentId.addDependency(new Artifact("org.apache.geronimo.tests", "test", "1", "car"), ImportType.ALL);
     }
@@ -136,7 +143,7 @@
                     nonTransactionalTimerAbstractNameQuery,
                     corbaGBeanAbstractNameQuery,
                     null,
-                    null,
+                    Collections.singleton(repository),
                     ejbConfigBuilder,
                     webConfigBuilder,
                     connectorConfigBuilder,
@@ -439,4 +446,5 @@
             module.close();
         }
     }
+
 }

Modified: geronimo/server/trunk/modules/geronimo-jetty6-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty6-builder/pom.xml?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty6-builder/pom.xml (original)
+++ geronimo/server/trunk/modules/geronimo-jetty6-builder/pom.xml Thu Aug 16 17:52:52 2007
@@ -51,6 +51,14 @@
             <artifactId>asm</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+            <version>${version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
     
     <build>

Modified: geronimo/server/trunk/modules/geronimo-jetty6-builder/src/test/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty6-builder/src/test/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilderTest.java?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty6-builder/src/test/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/server/trunk/modules/geronimo-jetty6-builder/src/test/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilderTest.java Thu Aug 16 17:52:52 2007
@@ -56,6 +56,7 @@
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.mock.MockConfigStore;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -294,61 +295,4 @@
         super.tearDown();
     }
 
-
-    public static class MockConfigStore extends NullConfigurationStore {
-        private Map configs = new HashMap();
-
-        URL baseURL;
-
-        public MockConfigStore() {
-        }
-
-        public MockConfigStore(URL baseURL) {
-            this.baseURL = baseURL;
-        }
-
-        public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException {
-            configs.put(configurationData.getId(), configurationData);
-        }
-
-        public void uninstall(Artifact configID) throws NoSuchConfigException, IOException {
-            configs.remove(configID);
-        }
-
-        public ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
-            if (configs.containsKey(configId)) {
-                ConfigurationData configurationData = (ConfigurationData) configs.get(configId);
-                configurationData.setConfigurationStore(this);
-                return configurationData;
-            } else {
-                ConfigurationData configurationData = new ConfigurationData(configId, naming);
-                configurationData.setConfigurationStore(this);
-                return configurationData;
-            }
-        }
-
-        public boolean containsConfiguration(Artifact configID) {
-            return true;
-        }
-
-        public File createNewConfigurationDir(Artifact configId) {
-            try {
-                return DeploymentUtil.createTempDir();
-            } catch (IOException e) {
-                return null;
-            }
-        }
-
-        public Set resolve(Artifact configId, String moduleName, String pattern) throws NoSuchConfigException, MalformedURLException {
-            return Collections.singleton(baseURL);
-        }
-
-        public final static GBeanInfo GBEAN_INFO;
-
-        static {
-            GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(MockConfigStore.class, NameFactory.CONFIGURATION_STORE);
-            infoBuilder.addInterface(ConfigurationStore.class);
-            GBEAN_INFO = infoBuilder.getBeanInfo();
-        }
-    }
 }

Modified: geronimo/server/trunk/modules/geronimo-kernel/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/pom.xml?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/pom.xml (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/pom.xml Thu Aug 16 17:52:52 2007
@@ -108,6 +108,74 @@
                     </dependency>
                 </dependencies>
             </plugin>
+
+            <plugin>
+              <artifactId>maven-remote-resources-plugin</artifactId>
+              <executions>
+                <execution>
+                  <goals>
+                    <goal>process</goal>
+                  </goals>
+                  <configuration>
+                    <resourceBundles>
+                      <resourceBundle>org.apache:apache-jar-resource-bundle:1.0</resourceBundle>
+                    </resourceBundles>
+                  </configuration>
+                </execution>
+              </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.geronimo.genesis.plugins</groupId>
+                <artifactId>tools-maven-plugin</artifactId>
+
+                <!-- Tools includes custom packagings, install as extension to pick them up -->
+                <extensions>true</extensions>
+
+                <executions>
+                    <!--<execution>-->
+                        <!--<id>install-legal-files</id>-->
+                        <!--<phase>generate-resources</phase>-->
+                        <!--<goals>-->
+                            <!--<goal>copy-legal-files</goal>-->
+                        <!--</goals>-->
+                        <!--<configuration>-->
+                            <!--<strict>true</strict>-->
+                        <!--</configuration>-->
+                    <!--</execution>-->
+
+                    <execution>
+                        <id>verify-legal-files</id>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>verify-legal-files</goal>
+                        </goals>
+                        <configuration>
+                            <!-- Fail the build if no legal files were found -->
+                            <strict>false</strict>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>2.1</version>
+                <configuration>
+                    <archive>
+                        <!-- Do not include META-INF/maven to avoid long file problems on windows -->
+                        <addMavenDescriptor>false</addMavenDescriptor>
+                    </archive>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <!-- Build *test.jar files for modules -->
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
     

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationStore.java?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationStore.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationStore.java Thu Aug 16 17:52:52 2007
@@ -21,6 +21,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.List;
 import java.util.Set;
 
@@ -116,7 +117,7 @@
      * @return a List (with entries of type ConfigurationInfo) of all the
      *         configurations contained in this configuration store
      */
-    List listConfigurations();
+    List<ConfigurationInfo> listConfigurations();
 
     /**
      * Creates an empty directory for a new configuration with the specified configId
@@ -144,7 +145,7 @@
      *
      * @return a Set (with entries of type URL) of the matching locations
      */
-    Set resolve(Artifact configId, String moduleName, String path) throws NoSuchConfigException, MalformedURLException;
+    Set<URL> resolve(Artifact configId, String moduleName, String path) throws NoSuchConfigException, MalformedURLException;
 
     /**
      * Exports a configuration as a ZIP file.

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/IOUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/IOUtil.java?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/IOUtil.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/IOUtil.java Thu Aug 16 17:52:52 2007
@@ -184,24 +184,23 @@
         }
     }
 
-    public static Set search(File root, String pattern) throws MalformedURLException {
+    public static Set<URL> search(File root, String pattern) throws MalformedURLException {
         if (root.isDirectory()) {
             if (!SelectorUtils.hasWildcards(pattern)) {
                 File match = new File(root, pattern);
                 if (match.exists() && match.canRead()) {
                     return Collections.singleton( new URL( "file:" + match.toURI().normalize().getPath() ) );
                 } else {
-                    return Collections.EMPTY_SET;
+                    return Collections.emptySet();
                 }
             } else {
-                Set matches = new LinkedHashSet();
-                Map files = listAllFileNames(root);
-                for (Iterator iterator = files.entrySet().iterator(); iterator.hasNext();) {
-                    Map.Entry entry = (Map.Entry) iterator.next();
-                    String fileName = (String) entry.getKey();
+                Set<URL> matches = new LinkedHashSet<URL>();
+                Map<String, File> files = listAllFileNames(root);
+                for (Map.Entry<String, File> entry : files.entrySet()) {
+                    String fileName = entry.getKey();
                     if (SelectorUtils.matchPath(pattern, fileName)) {
-                        File file = (File) entry.getValue();
-                        matches.add( new URL( "file:" + file.toURI().normalize().getPath() ) );
+                        File file = entry.getValue();
+                        matches.add(new URL("file:" + file.toURI().normalize().getPath()));
                     }
                 }
                 return matches;
@@ -217,10 +216,10 @@
                         URL match = new URL(baseURL, entry.getName());
                         return Collections.singleton(match);
                     } else {
-                        return Collections.EMPTY_SET;
+                        return Collections.emptySet();
                     }
                 } else {
-                    Set matches = new LinkedHashSet();
+                    Set<URL> matches = new LinkedHashSet<URL>();
                     Enumeration entries = jarFile.entries();
                     while (entries.hasMoreElements()) {
                         ZipEntry entry = (ZipEntry) entries.nextElement();
@@ -235,25 +234,24 @@
             } catch (MalformedURLException e) {
                 throw e;
             } catch (IOException e) {
-                return Collections.EMPTY_SET;
+                return Collections.emptySet();
             } finally {
                 close(jarFile);
             }
         }
     }
 
-    public static Map listAllFileNames(File base) {
+    public static Map<String, File> listAllFileNames(File base) {
         return listAllFileNames(base, "");
     }
 
-    private static Map listAllFileNames(File base, String prefix) {
+    private static Map<String, File> listAllFileNames(File base, String prefix) {
         if (!base.canRead() || !base.isDirectory()) {
             throw new IllegalArgumentException(base.getAbsolutePath());
         }
-        Map map = new LinkedHashMap();
+        Map<String, File> map = new LinkedHashMap<String, File>();
         File[] hits = base.listFiles();
-        for (int i = 0; i < hits.length; i++) {
-            File hit = hits[i];
+        for (File hit : hits) {
             if (hit.canRead()) {
                 if (hit.isDirectory()) {
                     map.putAll(listAllFileNames(hit, prefix.equals("") ? hit.getName() : prefix + "/" + hit.getName()));

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NullConfigurationStore.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NullConfigurationStore.java?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NullConfigurationStore.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NullConfigurationStore.java Thu Aug 16 17:52:52 2007
@@ -25,6 +25,7 @@
 import java.util.List;
 import java.util.Set;
 import java.net.MalformedURLException;
+import java.net.URL;
 
 /**
  * A non-functional configuration store that can be extended to be useful.
@@ -58,7 +59,7 @@
         return null;
     }
 
-    public List listConfigurations() {
+    public List<ConfigurationInfo> listConfigurations() {
         return null;
     }
 
@@ -66,7 +67,7 @@
         return null;
     }
 
-    public Set resolve(Artifact configId, String moduleName, String path) throws NoSuchConfigException, MalformedURLException {
+    public Set<URL> resolve(Artifact configId, String moduleName, String path) throws NoSuchConfigException, MalformedURLException {
         return null;
     }
 

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ArtifactResolver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ArtifactResolver.java?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ArtifactResolver.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ArtifactResolver.java Thu Aug 16 17:52:52 2007
@@ -19,6 +19,8 @@
 import java.util.Collection;
 import java.util.LinkedHashSet;
 
+import org.apache.geronimo.kernel.config.Configuration;
+
 /**
  * @version $Rev$ $Date$
  */
@@ -30,12 +32,11 @@
      * with reasonable default values that hopefully do not conflict with anything
      * that's already deployed.
      *
-     * @param source       The artifact to complete (normally partially-populated)
-     * @param defaultType  The type to use for the resulting artifact if the source
-     *                     artifact doesn't have a type set
-     *
-     * @return If the source artifact is fully populated (e.g. artifact.isResolved()
-     *         == true) then it will be returned.  Otherwise a new fully-populated
+     * @param source      The artifact to complete (normally partially-resolved)
+     * @param defaultType The type to use for the resulting artifact if the source
+     *                    artifact doesn't have a type set
+     * @return If the source artifact is fully resolved (e.g. artifact.isResolved()
+     *         == true) then it will be returned.  Otherwise a new fully-resolved
      *         artifact is returned.
      */
     Artifact generateArtifact(Artifact source, String defaultType);
@@ -45,6 +46,10 @@
      * may be partially-populated).  Preference is given to artifacts that are already
      * loaded, to reduce duplication.  If nothing can be found that's an error,
      * because something depends on this.
+     *
+     * @param source incompletely resolved Artifact
+     * @return completely resolved Artifact matching the source
+     * @throws MissingDependencyException if no matching Artifact can be found.
      */
     Artifact resolveInClassLoader(Artifact source) throws MissingDependencyException;
 
@@ -54,9 +59,12 @@
      * loaded, or that exist in the parent configurations, to reduce duplication.  If
      * nothing can be found that's an error, because something depends on this.
      *
+     * @param source               incompletely resolved Artifact
      * @param parentConfigurations A Collection with entries of type Configuration
+     * @return completely resolved Artifact matching the source
+     * @throws MissingDependencyException if no matching Artifact can be found.
      */
-    Artifact resolveInClassLoader(Artifact source, Collection parentConfigurations) throws MissingDependencyException;
+    Artifact resolveInClassLoader(Artifact source, Collection<Configuration> parentConfigurations) throws MissingDependencyException;
 
     /**
      * Used to search for existing artifacts that match the supplied artifact (which
@@ -64,10 +72,12 @@
      * loaded, to reduce duplication.  If nothing can be found that's an error,
      * because something depends on this.
      *
+     * @param sources incompletely resolved Artifact
      * @return A sorted set ordered in the same way the input was ordered, with
      *         entries of type Artifact
+     * @throws MissingDependencyException if no matching Artifact can be found.
      */
-    LinkedHashSet resolveInClassLoader(Collection artifacts) throws MissingDependencyException;
+    LinkedHashSet<Artifact> resolveInClassLoader(Collection<Artifact> sources) throws MissingDependencyException;
 
     /**
      * Used to search for existing artifacts that match the supplied artifact (which
@@ -75,28 +85,32 @@
      * loaded, or that exist in the parent configurations, to reduce duplication.  If
      * nothing can be found that's an error, because something depends on this.
      *
-     * @param parentConfigurations A Collection with entries of type Configuration
-     *
+     * @param sources incompletely resolved Artifacts to match
+     * @param parentConfigurations Configurations to search in
      * @return A sorted set ordered in the same way the input was ordered, with
      *         entries of type Artifact
+     * @throws MissingDependencyException if no matching Artifact can be found.
      */
-    LinkedHashSet resolveInClassLoader(Collection artifacts, Collection parentConfigurations) throws MissingDependencyException;
+    LinkedHashSet<Artifact> resolveInClassLoader(Collection<Artifact> sources, Collection<Configuration> parentConfigurations) throws MissingDependencyException;
 
     /**
      * Used to search for existing artifacts in the server that match the supplied
      * artifact (which may be partially-populated).  This method expects either no
      * results or one result (multiple matches is an error).
      *
+     * @param artifact incompletely resolved artifact to match
      * @return A matching artifact, or null of there were no matches
+     * @throws MultipleMatchesException if there is more than one match
      */
     Artifact queryArtifact(Artifact artifact) throws MultipleMatchesException;
 
     /**
      * Used to search for existing artifacts in the server that match the supplied
      * artifact (which may be partially-populated).
-     *
+     * <p/>
      * TODO: The artifacts should be sorted ascending by type then group then artifact then version
      *
+     * @param artifact the Artifact to match.
      * @return The matching artifacts, which may be 0, 1, or many
      */
     Artifact[] queryArtifacts(Artifact artifact);

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java Thu Aug 16 17:52:52 2007
@@ -18,11 +18,10 @@
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.LinkedHashSet;
+import java.util.Map;
 import java.util.SortedSet;
 import java.util.TreeSet;
-import java.util.Map;
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
@@ -33,25 +32,25 @@
  */
 public class DefaultArtifactResolver implements ArtifactResolver {
     private final ArtifactManager artifactManager;
-    private final Collection repositories;
-    private final Map explicitResolution;
+    private final Collection<? extends ListableRepository> repositories;
+    private final Map<Artifact, Artifact> explicitResolution;
 
     public DefaultArtifactResolver(ArtifactManager artifactManager, ListableRepository repository) {
         this.artifactManager = artifactManager;
         this.repositories = Collections.singleton(repository);
-        this.explicitResolution = Collections.EMPTY_MAP;
+        this.explicitResolution = Collections.emptyMap();
     }
 
-    public DefaultArtifactResolver(ArtifactManager artifactManager, Collection repositories, Map explicitResolution) {
+    public DefaultArtifactResolver(ArtifactManager artifactManager, Collection<? extends ListableRepository> repositories, Map<Artifact, Artifact> explicitResolution) {
         this.artifactManager = artifactManager;
         this.repositories = repositories;
-        this.explicitResolution = explicitResolution == null? Collections.EMPTY_MAP: explicitResolution;
+        this.explicitResolution = explicitResolution == null? Collections.<Artifact, Artifact>emptyMap(): explicitResolution;
     }
 
 
     public Artifact generateArtifact(Artifact source, String defaultType) {
         if(source.isResolved()) {
-            Artifact deAliased = (Artifact) explicitResolution.get(source);
+            Artifact deAliased = explicitResolution.get(source);
             if (deAliased !=  null) {
                 return deAliased;
             }
@@ -74,22 +73,20 @@
     }
 
     public Artifact[] queryArtifacts(Artifact artifact) {
-        LinkedHashSet set = new LinkedHashSet();
-        for (Iterator iterator = repositories.iterator(); iterator.hasNext();) {
-            ListableRepository repository = (ListableRepository) iterator.next();
+        LinkedHashSet<Artifact> set = new LinkedHashSet<Artifact>();
+        for (ListableRepository repository : repositories) {
             set.addAll(repository.list(artifact));
         }
-        return (Artifact[]) set.toArray(new Artifact[set.size()]);
+        return set.toArray(new Artifact[set.size()]);
     }
 
-    public LinkedHashSet resolveInClassLoader(Collection artifacts) throws MissingDependencyException {
-        return resolveInClassLoader(artifacts, Collections.EMPTY_SET);
+    public LinkedHashSet<Artifact> resolveInClassLoader(Collection<Artifact> artifacts) throws MissingDependencyException {
+        return resolveInClassLoader(artifacts, Collections.<Configuration>emptySet());
     }
 
-    public LinkedHashSet resolveInClassLoader(Collection artifacts, Collection parentConfigurations) throws MissingDependencyException {
-        LinkedHashSet resolvedArtifacts = new LinkedHashSet();
-        for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
-            Artifact artifact = (Artifact) iterator.next();
+    public LinkedHashSet<Artifact> resolveInClassLoader(Collection<Artifact> artifacts, Collection<Configuration> parentConfigurations) throws MissingDependencyException {
+        LinkedHashSet<Artifact> resolvedArtifacts = new LinkedHashSet<Artifact>();
+        for (Artifact artifact : artifacts) {
             if (!artifact.isResolved()) {
                 artifact = resolveInClassLoader(artifact, parentConfigurations);
             }
@@ -99,14 +96,14 @@
     }
 
     public Artifact resolveInClassLoader(Artifact source) throws MissingDependencyException {
-        return resolveInClassLoader(source, Collections.EMPTY_SET);
+        return resolveInClassLoader(source, Collections.<Configuration>emptySet());
     }
 
-    public Artifact resolveInClassLoader(Artifact source, Collection parentConfigurations) throws MissingDependencyException {
+    public Artifact resolveInClassLoader(Artifact source, Collection<Configuration> parentConfigurations) throws MissingDependencyException {
         // Some tests break if we acntually try to search for fully-resolved artifacts
-        if(source.isResolved()) {
-            return source;
-        }
+//        if(source.isResolved()) {
+//            return source;
+//        }
 //        if (artifact.getType() == null) {
 //            throw new IllegalArgumentException("Type not set " + artifact);
 //        }
@@ -126,12 +123,15 @@
         return working;
     }
 
-    private Artifact resolveVersion(Collection parentConfigurations, Artifact working) {
+    private Artifact resolveVersion(Collection<Configuration> parentConfigurations, Artifact working) {
         //see if there is an explicit resolution for this artifact.
-        Artifact deAliased = (Artifact) explicitResolution.get(working);
+        Artifact deAliased = explicitResolution.get(working);
         if (deAliased != null) {
             working = deAliased;
         }
+        if (working.isResolved()) {
+            return working;
+        }
         SortedSet existingArtifacts;
         if (artifactManager != null) {
             existingArtifacts = artifactManager.getLoadedArtifacts(working);
@@ -147,9 +147,8 @@
 
         // if we have no existing loaded artifacts grab the highest version from the repository
         if (existingArtifacts.size() == 0) {
-            SortedSet list = new TreeSet();
-            for (Iterator iterator = repositories.iterator(); iterator.hasNext();) {
-                ListableRepository repository = (ListableRepository) iterator.next();
+            SortedSet<Artifact> list = new TreeSet<Artifact>();
+            for (ListableRepository repository : repositories) {
                 list.addAll(repository.list(working));
             }
 
@@ -160,7 +159,7 @@
                     return null;
                 }
             }
-            return (Artifact) list.last();
+            return list.last();
         }
 
         // more than one version of the artifact was loaded...
@@ -175,9 +174,8 @@
         return (Artifact) existingArtifacts.last();
     }
 
-    private Artifact searchParents(Collection parentConfigurations, Artifact working) {
-        for (Iterator iterator = parentConfigurations.iterator(); iterator.hasNext();) {
-            Configuration configuration = (Configuration) iterator.next();
+    private Artifact searchParents(Collection<Configuration> parentConfigurations, Artifact working) {
+        for (Configuration configuration : parentConfigurations) {
 
             // check if this parent matches the groupId, artifactId, and type
             if (matches(configuration.getId(), working)) {
@@ -215,9 +213,8 @@
         return null;
     }
 
-    private Artifact getArtifactVersion(Collection artifacts, Artifact query) {
-        for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
-            Artifact artifact = (Artifact) iterator.next();
+    private Artifact getArtifactVersion(Collection<Artifact> artifacts, Artifact query) {
+        for (Artifact artifact : artifacts) {
             if (matches(artifact, query)) {
                 return artifact;
             }

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ListableRepository.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ListableRepository.java?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ListableRepository.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ListableRepository.java Thu Aug 16 17:52:52 2007
@@ -29,14 +29,17 @@
     /**
      * Gets a set (with entries of type Artifact) of all the items available
      * in the repository.
+     * @return sorted list of artifacts in the repository
      */
-    public SortedSet list();
+    public SortedSet<Artifact> list();
 
     /**
      * Gets a set (with entries of type Artifact) of all the available items
      * matching the specified artifact, which is normally not fully resolved
      * (so the results all match whatever fields are specified on the argument
      * Artifact).
+     * @param query match for repository
+     * @return sorted list of artifacts in the repository that match the query.
      */
-    public SortedSet list(Artifact query);
+    public SortedSet<Artifact> list(Artifact query);
 }

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java Thu Aug 16 17:52:52 2007
@@ -16,19 +16,12 @@
  */
 package org.apache.geronimo.kernel.config;
 
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
+
 import junit.framework.TestCase;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
@@ -39,6 +32,8 @@
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.mock.MockConfigStore;
+import org.apache.geronimo.kernel.mock.MockRepository;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactManager;
 import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
@@ -57,13 +52,13 @@
     private Artifact artifact2;
     private Artifact artifact3;
     private Artifact artifact3NoVersion;
-    private Map configurations = new HashMap();
+    private Map<Artifact, ConfigurationData> configurations = new HashMap<Artifact, ConfigurationData>();
     private ConfigurationManager configurationManager;
     private AbstractName gbean1;
     private AbstractName gbean2;
     private AbstractName gbean3;
     private AbstractName gbean3newer;
-    private TestConfigStore configStore;
+    private ConfigurationStore configStore = new MockConfigStore();
 
     public void testLoad() throws Exception {
         configurationManager.loadConfiguration(artifact3);
@@ -445,10 +440,8 @@
         Configuration configuration2 = configurationManager.getConfiguration(artifact2);
         Configuration configuration3 = configurationManager.getConfiguration(artifact3);
 
-        Environment environment = new Environment();
-        environment.setConfigId(artifact1);
-        ConfigurationData configurationData1 = new ConfigurationData(environment, kernel.getNaming());
-        configurationData1.setConfigurationStore(configStore);
+        ConfigurationData configurationData1 = new ConfigurationData(artifact1, kernel.getNaming());
+        configStore.install(configurationData1);
         GBeanData gbeanData = configurationData1.addGBean("gbean1", TestBean.getGBeanInfo());
         gbeanData.setReferencePattern("nonExistantReference", new AbstractNameQuery("some.non.existant.Clazz"));
         configurations.put(artifact1, configurationData1);
@@ -657,7 +650,7 @@
         assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean3newer)) ;
     }
 
-    private static final Set shouldFail = new HashSet();
+    private static final Set<String> shouldFail = new HashSet<String>();
     private static void checkFail(String objectName) {
         if (shouldFail.contains(objectName)) {
             throw new RuntimeException("FAILING");
@@ -678,8 +671,7 @@
         assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(artifactManagerData.getAbstractName()));
         ArtifactManager artifactManager = (ArtifactManager) kernel.getGBean(artifactManagerData.getAbstractName());
 
-        configStore = new TestConfigStore();
-        TestRepository testRepository = new TestRepository();
+        ListableRepository testRepository = new MockRepository(configurations.keySet());
         DefaultArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, testRepository);
 
         artifact1 = new Artifact("test", "1", "1.1", "bar");
@@ -688,10 +680,7 @@
         // As if it was deployed with no version, now its version is a timestamp
         artifact3NoVersion = new Artifact(artifact3.getGroupId(), artifact3.getArtifactId(), new Version(Long.toString(System.currentTimeMillis())), artifact3.getType());
 
-        Environment e1 = new Environment();
-        e1.setConfigId(artifact1);
-        ConfigurationData configurationData1 = new ConfigurationData(e1, kernel.getNaming());
-        configurationData1.setConfigurationStore(configStore);
+        ConfigurationData configurationData1 = configStore.loadConfiguration(artifact1);
         gbean1 = configurationData1.addGBean("gbean1", TestBean.getGBeanInfo()).getAbstractName();
         configurations.put(artifact1, configurationData1);
 
@@ -700,7 +689,7 @@
         e2.addDependency(new Artifact("test", "1", (Version) null, "bar"), ImportType.ALL);
         ConfigurationData configurationData2 = new ConfigurationData(e2, kernel.getNaming());
         gbean2 = configurationData2.addGBean("gbean2", TestBean.getGBeanInfo()).getAbstractName();
-        configurationData2.setConfigurationStore(configStore);
+        configStore.install(configurationData2);
         configurations.put(artifact2, configurationData2);
 
         { // Make it obvious if these temp variables are reused
@@ -709,7 +698,7 @@
             e3.addDependency(new Artifact("test", "2", (Version) null, "bar"), ImportType.ALL);
             ConfigurationData configurationData3 = new ConfigurationData(e3, kernel.getNaming());
             gbean3 = configurationData3.addGBean("gbean3", TestBean.getGBeanInfo()).getAbstractName();
-            configurationData3.setConfigurationStore(configStore);
+            configStore.install(configurationData3);
             configurations.put(artifact3, configurationData3);
         }
 
@@ -719,7 +708,7 @@
             e3newer.addDependency(new Artifact("test", "2", (Version) null, "bar"), ImportType.ALL);
             ConfigurationData configurationData3newer = new ConfigurationData(e3newer, kernel.getNaming());
             gbean3newer = configurationData3newer.addGBean("gbean3", TestBean.getGBeanInfo()).getAbstractName();
-            configurationData3newer.setConfigurationStore(configStore);
+            configStore.install(configurationData3newer);
             configurations.put(artifact3NoVersion, configurationData3newer);
         }
 
@@ -740,68 +729,10 @@
         super.tearDown();
     }
 
-    private class TestConfigStore extends NullConfigurationStore {
-        public ConfigurationData loadConfiguration(Artifact configId) throws IOException, InvalidConfigException, NoSuchConfigException {
-            return (ConfigurationData) configurations.get(configId);
-        }
-
-        public boolean containsConfiguration(Artifact configId) {
-            return configurations.containsKey(configId);
-        }
-
-        public String getObjectName() {
-            throw new UnsupportedOperationException();
-        }
-
-        public AbstractName getAbstractName() {
-            throw new UnsupportedOperationException();
-        }
-
-        public List listConfigurations() {
-            throw new UnsupportedOperationException();
-        }
-
-        public File createNewConfigurationDir(Artifact configId) throws ConfigurationAlreadyExistsException {
-            throw new UnsupportedOperationException();
-        }
-
-        public Set resolve(Artifact configId, String moduleName, String pattern) throws NoSuchConfigException, MalformedURLException {
-            throw new UnsupportedOperationException();
-        }
-    }
 
     private GBeanData buildGBeanData(String key, String value, GBeanInfo info) {
         AbstractName abstractName = kernel.getNaming().createRootName(new Artifact("test", "foo", "1", "car"), value, key);
         return new GBeanData(abstractName, info);
-    }
-
-    private class TestRepository implements ListableRepository {
-        public SortedSet list() {
-            return new TreeSet(configurations.keySet());
-        }
-
-        public SortedSet list(Artifact query) {
-            TreeSet artifacts = new TreeSet();
-            for (Iterator iterator = configurations.keySet().iterator(); iterator.hasNext();) {
-                Artifact artifact = (Artifact) iterator.next();
-                if (query.matches(artifact)) {
-                    artifacts.add(artifact);
-                }
-            }
-            return artifacts;
-        }
-
-        public boolean contains(Artifact artifact) {
-            return configurations.containsKey(artifact);
-        }
-
-        public File getLocation(Artifact artifact) {
-            throw new UnsupportedOperationException();
-        }
-
-        public LinkedHashSet getDependencies(Artifact artifact) {
-            return new LinkedHashSet();
-        }
     }
 
     public static class TestBean {

Copied: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockConfigStore.java (from r565969, geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConfigStore.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockConfigStore.java?view=diff&rev=566893&p1=geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConfigStore.java&r1=565969&p2=geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockConfigStore.java&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConfigStore.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockConfigStore.java Thu Aug 16 17:52:52 2007
@@ -14,9 +14,8 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.geronimo.j2ee.deployment;
+package org.apache.geronimo.kernel.mock;
 
-import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.ConfigurationData;
@@ -24,11 +23,15 @@
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.config.NullConfigurationStore;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
 
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -43,21 +46,35 @@
 {
     protected static final Naming naming = new Jsr77Naming();
     
-    protected final Map locations = new HashMap();
+    protected final Map<Artifact, File> locations = new HashMap<Artifact, File>();
+    private Map<Artifact, ConfigurationData> configs = new HashMap<Artifact, ConfigurationData>();
 
-    public ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
-        ConfigurationData configurationData = new ConfigurationData(configId, naming);
+    public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException {
+        configs.put(configurationData.getId(), configurationData);
         configurationData.setConfigurationStore(this);
-        return configurationData;
+    }
+
+    public void uninstall(Artifact configID) throws NoSuchConfigException, IOException {
+        configs.remove(configID);
+    }
+
+    public ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
+        if (configs.containsKey(configId)) {
+            return configs.get(configId);
+        } else {
+            ConfigurationData configurationData = new ConfigurationData(configId, naming);
+            install(configurationData);
+            return configurationData;
+        }
     }
 
     public boolean containsConfiguration(Artifact configID) {
-        return true;
+        return configs.containsKey(configID);
     }
 
     public File createNewConfigurationDir(Artifact configId) {
         try {
-            File file = DeploymentUtil.createTempDir();
+            File file = createTempDir();
             locations.put(configId, file);
             return file;
         } catch (IOException e) {
@@ -65,12 +82,26 @@
         }
     }
 
-    public Set resolve(Artifact configId, String moduleName, String pattern) throws NoSuchConfigException, MalformedURLException {
-        File file = (File) locations.get(configId);
+    public Set<URL> resolve(Artifact configId, String moduleName, String pattern) throws NoSuchConfigException, MalformedURLException {
+        File file = locations.get(configId);
         if (file == null) {
             throw new NoSuchConfigException(configId);
         }
-        Set matches = IOUtil.search(file, pattern);
-        return matches;
+        return IOUtil.search(file, pattern);
+    }
+
+    private static File createTempDir() throws IOException {
+        File tempDir = File.createTempFile("geronimo-deploymentUtil", ".tmpdir");
+        tempDir.delete();
+        tempDir.mkdirs();
+        return tempDir;
+    }
+
+    public final static GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(MockConfigStore.class, "ConfigurationStore");
+        infoBuilder.addInterface(ConfigurationStore.class);
+        GBEAN_INFO = infoBuilder.getBeanInfo();
     }
 }

Propchange: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockConfigStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockConfigStore.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockConfigStore.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockRepository.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockRepository.java?view=auto&rev=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockRepository.java (added)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockRepository.java Thu Aug 16 17:52:52 2007
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.geronimo.kernel.mock;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.LinkedHashSet;
+import java.util.TreeSet;
+import java.io.File;
+
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.ListableRepository;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MockRepository implements ListableRepository {
+
+    private final Set<Artifact> repo;
+
+
+    public MockRepository() {
+        this(new HashSet<Artifact>());
+    }
+
+    public MockRepository(Set<Artifact> repo) {
+        this.repo = repo;
+    }
+
+    public Set<Artifact> getRepo() {
+        return repo;
+    }
+
+    public boolean contains(Artifact artifact) {
+        return repo.contains(artifact);
+    }
+
+    public File getLocation(Artifact artifact) {
+        return new File(".");
+    }
+
+    public LinkedHashSet getDependencies(Artifact artifact) {
+        return new LinkedHashSet();
+    }
+
+    public SortedSet<Artifact> list() {
+        return new TreeSet<Artifact>(repo);
+    }
+
+    public SortedSet<Artifact> list(Artifact query) {
+        SortedSet<Artifact> set = new TreeSet<Artifact>();
+        if (!repo.isEmpty()) {
+            for (Artifact artifact : repo) {
+                if (query.matches(artifact)) {
+                    set.add(artifact);
+                }
+            }
+        } else
+        if (query.getGroupId() != null && query.getArtifactId() != null && query.getVersion() != null && query.getType() == null) {
+            set.add(new Artifact(query.getGroupId(), query.getArtifactId(), query.getVersion(), "jar"));
+        } else if (query.isResolved()) {
+            set.add(query);
+        }
+        return set;
+    }
+    public final static GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(MockRepository.class, "Repository");
+        infoBuilder.addInterface(ListableRepository.class);
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+}
+

Propchange: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockRepository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockRepository.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockRepository.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockWritableListableRepository.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockWritableListableRepository.java?view=auto&rev=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockWritableListableRepository.java (added)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockWritableListableRepository.java Thu Aug 16 17:52:52 2007
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.geronimo.kernel.mock;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.geronimo.kernel.repository.WritableListableRepository;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.FileWriteMonitor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MockWritableListableRepository extends MockRepository implements WritableListableRepository {
+    public void copyToRepository(File source, Artifact destination, FileWriteMonitor monitor) throws IOException {
+    }
+
+    public void copyToRepository(InputStream source, int size, Artifact destination, FileWriteMonitor monitor) throws IOException {
+    }
+}

Propchange: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockWritableListableRepository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockWritableListableRepository.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockWritableListableRepository.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java Thu Aug 16 17:52:52 2007
@@ -16,27 +16,18 @@
  */
 package org.apache.geronimo.kernel.repository;
 
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
+
 import junit.framework.TestCase;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationResolver;
-import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.kernel.config.NoSuchConfigException;
-import org.apache.geronimo.kernel.config.NullConfigurationStore;
+import org.apache.geronimo.kernel.mock.MockConfigStore;
+import org.apache.geronimo.kernel.mock.MockRepository;
 
 /**
  * @version $Rev$ $Date$
@@ -49,7 +40,7 @@
 
     public void testSelectHighestFromRepo() throws Exception {
         ArtifactManager artifactManager = new DefaultArtifactManager();
-        MockRepository mockRepository = new MockRepository();
+        MockRepository mockRepository = getRepo();
         ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, mockRepository);
 
         Artifact unresolvedArtifact = new Artifact("version", "version", (Version) null, "jar");
@@ -57,11 +48,19 @@
         assertEquals(version3, artifact);
     }
 
+    private MockRepository getRepo() {
+        Set<Artifact> repo = new HashSet<Artifact>();
+        repo.add(version1);
+        repo.add(version2);
+        repo.add(version3);
+        return new MockRepository(repo);
+    }
+
     public void testAlreadyLoaded() throws Exception {
         ArtifactManager artifactManager = new DefaultArtifactManager();
         artifactManager.loadArtifacts(loader, Collections.singleton(version2));
 
-        MockRepository mockRepository = new MockRepository();
+        MockRepository mockRepository = getRepo();
         ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, mockRepository);
 
         Artifact unresolvedArtifact = new Artifact("version", "version", (Version) null, "jar");
@@ -71,12 +70,12 @@
 
     public void testMultipleSelected() throws Exception {
         ArtifactManager artifactManager = new DefaultArtifactManager();
-        Set loaded = new HashSet();
+        Set<Artifact> loaded = new HashSet<Artifact>();
         loaded.add(version1);
         loaded.add(version2);
         artifactManager.loadArtifacts(loader, loaded);
 
-        MockRepository mockRepository = new MockRepository();
+        MockRepository mockRepository = getRepo();
         ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, mockRepository);
 
         Artifact unresolvedArtifact = new Artifact("version", "version", (Version) null, "jar");
@@ -85,10 +84,10 @@
     }
 
     public void testParentLoaded() throws Exception {
-        MockRepository mockRepository = new MockRepository();
+        MockRepository mockRepository = getRepo();
 
         ArtifactManager artifactManager = new DefaultArtifactManager();
-        Set loaded = new HashSet();
+        Set<Artifact> loaded = new HashSet<Artifact>();
         loaded.add(version1);
         loaded.add(version2);
         artifactManager.loadArtifacts(loader, loaded);
@@ -101,7 +100,7 @@
         environment.addDependency(version1, ImportType.CLASSES);
 
         ConfigurationData parentConfigurationData = new ConfigurationData(environment, new Jsr77Naming());
-        parentConfigurationData.setConfigurationStore(new MockConfigStore(new File("foo").toURL()));
+        parentConfigurationData.setConfigurationStore(new MockConfigStore());
 
         ConfigurationResolver configurationResolver = new ConfigurationResolver(parentConfigurationData,
                 Collections.singleton(mockRepository),
@@ -112,7 +111,7 @@
                 configurationResolver,
                 null);
 
-        LinkedHashSet parents = new LinkedHashSet();
+        LinkedHashSet<Configuration> parents = new LinkedHashSet<Configuration>();
         parents.add(parent);
 
         Artifact unresolvedArtifact = new Artifact("version", "version", (Version) null, "jar");
@@ -120,62 +119,4 @@
         assertEquals(version1, artifact);
     }
 
-    private class MockRepository implements ListableRepository {
-        public SortedSet list() {
-            throw new UnsupportedOperationException();
-        }
-
-        public SortedSet list(Artifact query) {
-            TreeSet set = new TreeSet();
-            set.add(version1);
-            set.add(version2);
-            set.add(version3);
-            return set;
-        }
-
-        public boolean contains(Artifact artifact) {
-            return true;
-        }
-
-        public File getLocation(Artifact artifact) {
-            return new File(".");
-        }
-
-        public LinkedHashSet getDependencies(Artifact artifact) {
-            return new LinkedHashSet();
-        }
-    }
-
-    public static class MockConfigStore extends NullConfigurationStore {
-        URL baseURL;
-
-        public MockConfigStore() {
-        }
-
-        public MockConfigStore(URL baseURL) {
-            this.baseURL = baseURL;
-        }
-
-        public ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
-            ConfigurationData configurationData = new ConfigurationData(configId, new Jsr77Naming());
-            configurationData.setConfigurationStore(this);
-            return configurationData;
-        }
-
-        public boolean containsConfiguration(Artifact configID) {
-            return true;
-        }
-
-        public Set resolve(Artifact configId, String moduleName, String pattern) throws NoSuchConfigException, MalformedURLException {
-            return Collections.singleton(baseURL);
-        }
-
-        public final static GBeanInfo GBEAN_INFO;
-
-        static {
-            GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(MockConfigStore.class, "ConfigurationStore");
-            infoBuilder.addInterface(ConfigurationStore.class);
-            GBEAN_INFO = infoBuilder.getBeanInfo();
-        }
-    }
 }

Modified: geronimo/server/trunk/modules/geronimo-service-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-service-builder/pom.xml?view=diff&rev=566893&r1=566892&r2=566893
==============================================================================
--- geronimo/server/trunk/modules/geronimo-service-builder/pom.xml (original)
+++ geronimo/server/trunk/modules/geronimo-service-builder/pom.xml Thu Aug 16 17:52:52 2007
@@ -47,6 +47,14 @@
             <version>${version}</version>
         </dependency>
         
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+            <version>${version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
     
     <build>



Mime
View raw message