geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1491815 - in /geronimo/specs/trunk/geronimo-j2ee-deployment_1.1_spec/src/test/java/javax/enterprise/deploy: shared/factories/DeploymentFactoryManagerTest.java spi/factories/MockDeploymentFactory.java
Date Tue, 11 Jun 2013 14:44:12 GMT
Author: gawor
Date: Tue Jun 11 14:44:11 2013
New Revision: 1491815

URL: http://svn.apache.org/r1491815
Log:
fix test so it doesn't rely on a particular test method execution order

Modified:
    geronimo/specs/trunk/geronimo-j2ee-deployment_1.1_spec/src/test/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManagerTest.java
    geronimo/specs/trunk/geronimo-j2ee-deployment_1.1_spec/src/test/java/javax/enterprise/deploy/spi/factories/MockDeploymentFactory.java

Modified: geronimo/specs/trunk/geronimo-j2ee-deployment_1.1_spec/src/test/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManagerTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-j2ee-deployment_1.1_spec/src/test/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManagerTest.java?rev=1491815&r1=1491814&r2=1491815&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-j2ee-deployment_1.1_spec/src/test/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManagerTest.java
(original)
+++ geronimo/specs/trunk/geronimo-j2ee-deployment_1.1_spec/src/test/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManagerTest.java
Tue Jun 11 14:44:11 2013
@@ -40,6 +40,7 @@ import javax.enterprise.deploy.spi.facto
  */
 public class DeploymentFactoryManagerTest extends TestCase {
     private DeploymentFactoryManager factoryManager;
+    private MockDeploymentFactory mockFactory = new MockDeploymentFactory("deployer");
 
     protected void setUp() throws Exception {
         super.setUp();
@@ -100,7 +101,7 @@ public class DeploymentFactoryManagerTes
     public void testRegisterDeploymentFactory() {
         int initialNumberOfFactories = factoryManager.getDeploymentFactories().length;
 
-        DeploymentFactory factory = new MockDeploymentFactory();
+        DeploymentFactory factory = new MockDeploymentFactory("foo");
         factoryManager.registerDeploymentFactory(factory);
 
         int expectedNumberOfFactories = initialNumberOfFactories + 1;
@@ -145,10 +146,12 @@ public class DeploymentFactoryManagerTes
     }
 
     private void ensureFactoryRegistered() {
-        int numberOfFactories = factoryManager.getDeploymentFactories().length;
-        if(numberOfFactories == 0) {
-            factoryManager.registerDeploymentFactory(new MockDeploymentFactory());
+        DeploymentFactory[] factories = factoryManager.getDeploymentFactories();
+        for (int i = 0; i < factories.length; i++) {
+            if (factories[i] == mockFactory) {
+                return;
+            }
         }
-        assertTrue("We should have a registered DeploymentFactory", numberOfFactories >
0);
+        factoryManager.registerDeploymentFactory(new MockDeploymentFactory("deployer"));
     }
 }

Modified: geronimo/specs/trunk/geronimo-j2ee-deployment_1.1_spec/src/test/java/javax/enterprise/deploy/spi/factories/MockDeploymentFactory.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-j2ee-deployment_1.1_spec/src/test/java/javax/enterprise/deploy/spi/factories/MockDeploymentFactory.java?rev=1491815&r1=1491814&r2=1491815&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-j2ee-deployment_1.1_spec/src/test/java/javax/enterprise/deploy/spi/factories/MockDeploymentFactory.java
(original)
+++ geronimo/specs/trunk/geronimo-j2ee-deployment_1.1_spec/src/test/java/javax/enterprise/deploy/spi/factories/MockDeploymentFactory.java
Tue Jun 11 14:44:11 2013
@@ -33,9 +33,15 @@ import javax.enterprise.deploy.spi.excep
  * @version $Rev$ $Date$
  */
 public class MockDeploymentFactory implements DeploymentFactory {
+
+    private String scheme;
+
+    public MockDeploymentFactory(String scheme) {
+        this.scheme = scheme;
+    }
+
     public boolean handlesURI(String uri) {
-        // for the moment we accept all uri's
-        return true;
+        return uri != null && uri.startsWith(scheme);
     }
 
     public DeploymentManager getDeploymentManager(String uri, String username, String password)
throws DeploymentManagerCreationException {



Mime
View raw message