Author: deepal
Date: Tue Jan 29 02:09:24 2008
New Revision: 13128

Log:

fixing REGISTRY-102

Modified:
   
branches/registry/1_0/modules/core/src/main/java/org/wso2/registry/jdbc/mediatypes/builtin/DefaultMediaTypeHandler.java
   
branches/registry/1_0/modules/core/src/test/java/org/wso2/registry/app/RatingTest.java
   
branches/registry/1_0/modules/core/src/test/java/org/wso2/registry/jdbc/JDBCRegistryTest.java
   
branches/registry/1_0/modules/core/src/test/java/org/wso2/registry/jdbc/VersionHandlingTest.java

Modified: 
branches/registry/1_0/modules/core/src/main/java/org/wso2/registry/jdbc/mediatypes/builtin/DefaultMediaTypeHandler.java
==============================================================================
--- 
branches/registry/1_0/modules/core/src/main/java/org/wso2/registry/jdbc/mediatypes/builtin/DefaultMediaTypeHandler.java
     (original)
+++ 
branches/registry/1_0/modules/core/src/main/java/org/wso2/registry/jdbc/mediatypes/builtin/DefaultMediaTypeHandler.java
     Tue Jan 29 02:09:24 2008
@@ -136,7 +136,17 @@
                 resource.setState(RegistryConstants.ACTIVE_STATE);
                 resource.setLastUpdaterUserName(userID);
                 resourceDAO.update(path, resource, conn);
-
+                if (resource.isDirectory()) {
+                    if (!a.isDirectory()) {
+                        throw new RegistryException("Trying to add a 
collection while a " +
+                                "resource with the same name exist in the 
system");
+                    }
+                } else {
+                    if (a.isDirectory()) {
+                        throw new RegistryException("Trying to add a resource 
while a " +
+                                "collection with the same name exist in the 
system");
+                    }
+                }
                 if (resource.isContentModified() ||
                     a.getState() == RegistryConstants.DELETED_STATE) {
                     resourceDAO.addResourceVersion(resource, conn);

Modified: 
branches/registry/1_0/modules/core/src/test/java/org/wso2/registry/app/RatingTest.java
==============================================================================
--- 
branches/registry/1_0/modules/core/src/test/java/org/wso2/registry/app/RatingTest.java
      (original)
+++ 
branches/registry/1_0/modules/core/src/test/java/org/wso2/registry/app/RatingTest.java
      Tue Jan 29 02:09:24 2008
@@ -53,7 +53,7 @@
             byte[] r1content = "R2 content".getBytes();
             r1.setContent(r1content);
 
-            registry.put("/d16/d17", r1);
+            registry.put("/d16/d18", r1);
 
         } catch (
                 RegistryException e) {
@@ -61,21 +61,21 @@
         }
 
         try {
-            registry.rateResource("/d16/d17", 4);
+            registry.rateResource("/d16/d18", 4);
         } catch (RegistryException e) {
-            fail("Couldn't rate the resource /d16/d17");
+            fail("Couldn't rate the resource /d16/d18");
         }
 
         float rating = 0;
         try {
-            rating = registry.getAverageRating("/d16/d17");
+            rating = registry.getAverageRating("/d16/d18");
 
         } catch (RegistryException e) {
-            fail("Couldn't get the rating of the resource /d16/d17");
+            fail("Couldn't get the rating of the resource /d16/d18");
         }
 
         //System.out.println("Start rating:" + rating);
-        assertEquals("Rating of the resource /d16/d17 should be 5.", rating, 
(float)4.0,
+        assertEquals("Rating of the resource /d16/d18 should be 5.", rating, 
(float)4.0,
                      (float)0.01);
 
         /* try {

Modified: 
branches/registry/1_0/modules/core/src/test/java/org/wso2/registry/jdbc/JDBCRegistryTest.java
==============================================================================
--- 
branches/registry/1_0/modules/core/src/test/java/org/wso2/registry/jdbc/JDBCRegistryTest.java
       (original)
+++ 
branches/registry/1_0/modules/core/src/test/java/org/wso2/registry/jdbc/JDBCRegistryTest.java
       Tue Jan 29 02:09:24 2008
@@ -55,6 +55,7 @@
         r1.setContent(str.getBytes());
         registry.put("/c1/c2/c3/c4/r1", r1);
         r1 = new Resource();
+        r1.setDirectory(true);
         r1.setDescription("This is test discription");
         r1.setProperty("p1", "value1");
         registry.put("/c1/c2/c3", r1);

Modified: 
branches/registry/1_0/modules/core/src/test/java/org/wso2/registry/jdbc/VersionHandlingTest.java
==============================================================================
--- 
branches/registry/1_0/modules/core/src/test/java/org/wso2/registry/jdbc/VersionHandlingTest.java
    (original)
+++ 
branches/registry/1_0/modules/core/src/test/java/org/wso2/registry/jdbc/VersionHandlingTest.java
    Tue Jan 29 02:09:24 2008
@@ -103,7 +103,7 @@
 
         Resource wsas = new Resource();
         wsas.setContent("testWSAS".getBytes());
-        registry.put("/wso2/wsas", wsas);
+        registry.put("/wso2/wsa", wsas);
 
         Resource myMashup = registry.get("/wso2/mashup");
         String content = new String((byte[])myMashup.getContent());

_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev

Reply via email to