[Registry-dev] svn commit r14830 - in trunk/registry/modules/core/src: main/java/org/wso2/registry/lifecycle main/java/org/wso2/registry/servlet test/java/org/wso2/registry/jdbc

svn at wso2.org svn at wso2.org
Fri Mar 14 20:27:30 PDT 2008


Author: glen
Date: Fri Mar 14 20:27:24 2008
New Revision: 14830

Log:

A little cleanup.  Only one lifeycle "default" is needed, not a Lifeycle per state/phase....


Modified:
   trunk/registry/modules/core/src/main/java/org/wso2/registry/lifecycle/DefaultLifecycle.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/registry.xml
   trunk/registry/modules/core/src/test/java/org/wso2/registry/jdbc/LifeCycleTest.java

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/lifecycle/DefaultLifecycle.java
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/lifecycle/DefaultLifecycle.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/lifecycle/DefaultLifecycle.java	Fri Mar 14 20:27:24 2008
@@ -26,7 +26,6 @@
 
 import java.util.List;
 import java.util.ArrayList;
-import java.util.Collections;
 
 public class DefaultLifecycle extends Lifecycle {
 

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/registry.xml
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/registry.xml	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/registry.xml	Fri Mar 14 20:27:24 2008
@@ -55,10 +55,7 @@
         </filter>
     </handler>
 
-    <lifecycle name="created" class="org.wso2.registry.lifecycle.DefaultLifecycle"/>
-    <lifecycle name="developed" class="org.wso2.registry.lifecycle.DefaultLifecycle"/>
-    <lifecycle name="tested" class="org.wso2.registry.lifecycle.DefaultLifecycle"/>
-    <lifecycle name="deployed" class="org.wso2.registry.lifecycle.DefaultLifecycle"/>
+    <lifecycle name="default" class="org.wso2.registry.lifecycle.DefaultLifecycle"/>
 
     <!--<mediaTypeHandler>-->
         <!--<mediaType>application/vnd.apache.synapse</mediaType>-->

Modified: trunk/registry/modules/core/src/test/java/org/wso2/registry/jdbc/LifeCycleTest.java
==============================================================================
--- trunk/registry/modules/core/src/test/java/org/wso2/registry/jdbc/LifeCycleTest.java	(original)
+++ trunk/registry/modules/core/src/test/java/org/wso2/registry/jdbc/LifeCycleTest.java	Fri Mar 14 20:27:24 2008
@@ -19,9 +19,6 @@
 import junit.framework.TestCase;
 import org.wso2.registry.*;
 import org.wso2.registry.app.RegistryServer;
-import org.wso2.registry.lifecycle.DefaultLifecycle;
-import org.wso2.registry.jdbc.realm.InMemoryRegistryRealm;
-import org.wso2.registry.jdbc.realm.RegistryRealm;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -38,7 +35,7 @@
         try {
             if (registry == null) {
                 server.start();
-                 System.setProperty("in-memory" ,"false");
+                System.setProperty("in-memory", "false");
                 registry = (Registry)System.getProperties().get(RegistryConstants.REGISTRY);
             }
         } catch (Exception e) {
@@ -69,12 +66,12 @@
             }
         }
         assertTrue("comment '" + comment1 +
-                "' is not associated with the artifact /d12/r1", commentFound);
+                   "' is not associated with the artifact /d12/r1", commentFound);
 
         Resource commentsResource = registry.get("/d12/r1;comments");
         assertTrue("Comment collection resource should be a directory.",
-                commentsResource instanceof Collection);
-        comments = (Comment[]) commentsResource.getContent();
+                   commentsResource instanceof Collection);
+        comments = (Comment[])commentsResource.getContent();
 
         List commentTexts = new ArrayList();
         for (Comment comment : comments) {
@@ -83,15 +80,14 @@
         }
 
         assertTrue(comment1 + " is not associated for resource /d12/r1.",
-                commentTexts.contains(comment1));
+                   commentTexts.contains(comment1));
         assertTrue(comment2 + " is not associated for resource /d12/r1.",
-                commentTexts.contains(comment2));
+                   commentTexts.contains(comment2));
 
-        registry.associateLifeCycle("/d12/r1" , DefaultLifecycle.PHASE_CREATED);
-        registry.associateLifeCycle("/d12/r1" , DefaultLifecycle.PHASE_TESTED);
-        registry.associateLifeCycle("/d12/r1" , DefaultLifecycle.PHASE_DEVELOPED);
+        registry.associateLifeCycle("/d12/r1", "default");
+
+        registry.lifeCycleTransition("/d12/r1", "default", "promote");
 
-        registry.lifeCycleTransition("/d12/r1" ,"created" ,"promote");
         Resource resource = registry.get("/developed/d12/r1");
         assertNotNull(resource);
         assertNotNull(resource.getContent());
@@ -106,12 +102,12 @@
             }
         }
         assertTrue("comment '" + comment1 +
-                "' is not associated with the artifact /developed/d12/r1", commentFound);
+                   "' is not associated with the artifact /developed/d12/r1", commentFound);
 
         commentsResource = registry.get("/developed/d12/r1;comments");
         assertTrue("Comment collection resource should be a directory.",
-                commentsResource instanceof Collection);
-        comments = (Comment[]) commentsResource.getContent();
+                   commentsResource instanceof Collection);
+        comments = (Comment[])commentsResource.getContent();
 
         commentTexts = new ArrayList();
         for (Comment comment : comments) {
@@ -120,9 +116,9 @@
         }
 
         assertTrue(comment1 + " is not associated for resource /developed/d12/r1.",
-                commentTexts.contains(comment1));
+                   commentTexts.contains(comment1));
         assertTrue(comment2 + " is not associated for resource /developed/d12/r1.",
-                commentTexts.contains(comment2));
+                   commentTexts.contains(comment2));
 
     }
 }



More information about the Registry-dev mailing list