Author: deepal
Date: Thu Dec 20 21:32:43 2007
New Revision: 11623

Log:

getting all the test cases working 

Modified:
   
trunk/registry/modules/core/src/main/java/org/wso2/registry/RegistryConstants.java
   
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/AtomRegistry.java
   
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/RemoteRegistry.java
   
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/JettyBasedServerTest.java

Modified: 
trunk/registry/modules/core/src/main/java/org/wso2/registry/RegistryConstants.java
==============================================================================
--- 
trunk/registry/modules/core/src/main/java/org/wso2/registry/RegistryConstants.java
  (original)
+++ 
trunk/registry/modules/core/src/main/java/org/wso2/registry/RegistryConstants.java
  Thu Dec 20 21:32:43 2007
@@ -133,7 +133,7 @@
     public static final String RESOURCE_DETAILS_JSP = 
"/admin/resources_details.jsp";
     public static final String PATH_ATTR = "path";
 
-    public static final String URL_SEPARATER =";";
+    public static final String URL_SEPARATER ="_";
 
 
 }

Modified: 
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/AtomRegistry.java
==============================================================================
--- 
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/AtomRegistry.java
   (original)
+++ 
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/AtomRegistry.java
   Thu Dec 20 21:32:43 2007
@@ -22,9 +22,9 @@
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.*;
 import org.apache.abdera.parser.Parser;
+import org.apache.abdera.protocol.server.Provider;
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.ResponseContext;
-import org.apache.abdera.protocol.server.Provider;
 import org.apache.abdera.protocol.server.impl.AbstractProvider;
 import org.apache.abdera.protocol.server.impl.AbstractResponseContext;
 import org.apache.abdera.protocol.server.impl.BaseResponseContext;
@@ -46,7 +46,7 @@
 import java.util.List;
 import java.util.Properties;
 
-public class AtomRegistry extends AbstractProvider implements Provider{
+public class AtomRegistry extends AbstractProvider implements Provider {
 
     private Log log = LogFactory.getLog(AtomRegistry.class);
 
@@ -263,6 +263,7 @@
                         feed.setId("http://wso2.org/registry,atom:version";);
                         feed.setText(Messages.getMessage("resource.version", 
resourcePath));
                         feed.setTitle("Available versions for " + 
resourcePath);
+                        feed.setUpdated(new Date());
                         feed.addLink(request.getBaseUri() + "atom" + 
resourcePath);
                         //Versions will be added as entries
                         createEntriesFromStringArray(versions, 
request.getBaseUri().toString(),
@@ -420,19 +421,26 @@
         //if the resourse is deleted then there will be comment saying that 
the resource is
         // deleted
         if (resource.getState() == RegistryConstants.DELETED_STATE) {
-            feed.addSimpleExtension(new QName("state"),"Deleted");
+            feed.addSimpleExtension(new QName("state"), "Deleted");
         }
         feed.setId("http://wso2.org/registry:atom"; + resource.getId());
         feed.setText(resource.getDescription());
         feed.addAuthor(resource.getAuthorUserName());
         feed.setTitle(path);
-        feed.setUpdated(resource.getLastModified());
+        if (resource.getLastModified() != null) {
+            feed.setUpdated(resource.getLastModified());
+        } else {
+            feed.setUpdated(new Date());
+        }
         String href = baseURI + "atom" + path;
         feed.addLink(href);
         feed.addLink(href, "path");
 
         //if the content type is comment then the resource will contains ,
         // String array of comments
+        if (resource.isDirectory()) {
+            feed.addSimpleExtension(new QName("directory"), "true");
+        }
         if (exceuteQuery) {
             String values[] = (String[]) resource.getContent();
             for (int i = 0; i < values.length; i++) {
@@ -441,8 +449,8 @@
                 //adding child node as and setting the ref as path
                 entry.addLink(value, "queryResult");
                 feed.addEntry(entry);
-                return feed;
             }
+            return feed;
         } else {
             if ("comments".equals(resource.getMediaType())) {
                 String rel = "commentLink";
@@ -451,7 +459,6 @@
                 return feed;
             }
             if (resource.isDirectory()) {
-                feed.addSimpleExtension(new QName("directory"),"true");
                 String rel = "path";
                 createEntriesFromStringArray((String[]) resource.getContent(),
                         baseURI, abdera, rel, feed);
@@ -459,7 +466,7 @@
             } else {
                 //Now the resource is a actual resource , so need to send the 
content
                 //adding attribute to indicate the resource is not a directory
-                feed.addSimpleExtension(new QName("directory"),"false");
+                feed.addSimpleExtension(new QName("directory"), "false");
                 Object content = resource.getContent();
                 Entry entry = abdera.getFactory().newEntry();
                 String link = baseURI + "atom" + path;
@@ -656,6 +663,7 @@
         try {
             Factory factory = abdera.getFactory();
             Feed feed = factory.newFeed();
+            feed.setUpdated(new Date());
             feed.setId("http://wso2.org/registry:avarageRating";);
             feed.setTitle("Avarage Rating for the resource " + path);
             String nodeLink = baseUri + "atom" + path +
@@ -683,6 +691,7 @@
         try {
             Factory factory = abdera.getFactory();
             Feed feed = factory.newFeed();
+            feed.setUpdated(new Date());
             feed.setId("http://wso2.org/registry:Rating"; + path);
             feed.setTitle(userName + " ratings for " + path);
             feed.setText("" + registry.getRating(path, userName));
@@ -709,6 +718,7 @@
             Feed feed = factory.newFeed();
             Comment comments[] = registry.getComments(path);
             feed.setId("http://wso2.org/registry,Comments"; + path);
+            feed.setUpdated(new Date());
             feed.setTitle("comments for the resource " + path);
             for (Comment comment : comments) {
                 Entry entry = abdera.getFactory().newEntry();

Modified: 
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/RemoteRegistry.java
==============================================================================
--- 
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/RemoteRegistry.java
 (original)
+++ 
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/RemoteRegistry.java
 Thu Dec 20 21:32:43 2007
@@ -112,9 +112,9 @@
                 for (int i = 0; i < entries.size(); i++) {
                     Entry entry = (Entry) entries.get(i);
                     if (isQuery) {
-                        childNodes[i] = 
entry.getLink("queryResult").toString();
+                        childNodes[i] = 
entry.getLink("queryResult").getHref().toString();
                     } else {
-                        childNodes[i] = entry.getLink("path").toString();
+                        childNodes[i] = 
entry.getLink("path").getHref().toString();
                     }
 
                 }
@@ -207,7 +207,7 @@
             String[] versions = new String[entries.size()];
             for (int i = 0; i < entries.size(); i++) {
                 Entry entry = (Entry) entries.get(i);
-                versions[i] = entry.getLink("versionLink").toString();
+                versions[i] = 
entry.getLink("versionLink").getHref().toString();
             }
             return versions;
         }

Modified: 
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/JettyBasedServerTest.java
==============================================================================
--- 
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/JettyBasedServerTest.java
   (original)
+++ 
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/JettyBasedServerTest.java
   Thu Dec 20 21:32:43 2007
@@ -93,5 +93,4 @@
         }), "/*");
         server.start();
     }
-
 }

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

Reply via email to