[jboss-svn-commits] JBL Code SVN: r21076 - in labs/jbossrules/trunk/drools-repository/src: main/java/org/drools/repository/remoteapi and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jul 17 00:05:22 EDT 2008
Author: michael.neale at jboss.com
Date: 2008-07-17 00:05:22 -0400 (Thu, 17 Jul 2008)
New Revision: 21076
Modified:
labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java
labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/remoteapi/Response.java
labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/remoteapi/RestAPI.java
labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/RulesRepositoryTest.java
labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/remoteapi/RestAPITest.java
Log:
fixed for webdav and rest API
Modified: labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java 2008-07-17 03:47:26 UTC (rev 21075)
+++ labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java 2008-07-17 04:05:22 UTC (rev 21076)
@@ -392,7 +392,9 @@
public boolean containsSnapshot(String packageName, String snapshotName) {
try {
- Node n = this.getAreaNode( PACKAGE_SNAPSHOT_AREA ).getNode( packageName );
+ Node areaNode = this.getAreaNode(PACKAGE_SNAPSHOT_AREA );
+ if (!areaNode.hasNode(packageName)) return false;
+ Node n = areaNode.getNode( packageName );
return n.hasNode(snapshotName);
} catch (RepositoryException e) {
log.error(e);
Modified: labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/remoteapi/Response.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/remoteapi/Response.java 2008-07-17 03:47:26 UTC (rev 21075)
+++ labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/remoteapi/Response.java 2008-07-17 04:05:22 UTC (rev 21076)
@@ -17,7 +17,11 @@
public static class Text extends Response {
String data;
+ public Text() {}
+ public Text(String s) {
+ this.data = s;
+ }
@Override
public void writeData(OutputStream out) throws IOException {
out.write(data.getBytes());
Modified: labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/remoteapi/RestAPI.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/remoteapi/RestAPI.java 2008-07-17 03:47:26 UTC (rev 21075)
+++ labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/remoteapi/RestAPI.java 2008-07-17 04:05:22 UTC (rev 21076)
@@ -57,6 +57,7 @@
*/
public Response get(String path) throws UnsupportedEncodingException {
String[] bits = split(path);
+ if (bits.length == 1) return new Response.Text("Not a valid URL");
if (bits[0].equals("packages")) {
String pkgName = bits[1];
if (bits.length == 2) {
Modified: labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/RulesRepositoryTest.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/RulesRepositoryTest.java 2008-07-17 03:47:26 UTC (rev 21075)
+++ labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/RulesRepositoryTest.java 2008-07-17 04:05:22 UTC (rev 21076)
@@ -541,6 +541,8 @@
assertFalse(repo.containsSnapshot("testCategoriesAndSnapshots", "SNAP XXXX"));
+ assertFalse(repo.containsSnapshot("gooberWhhewasssllllelelelelele", "SNAP"));
+
}
public void testMoveRulePackage() throws Exception {
Modified: labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/remoteapi/RestAPITest.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/remoteapi/RestAPITest.java 2008-07-17 03:47:26 UTC (rev 21075)
+++ labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/remoteapi/RestAPITest.java 2008-07-17 04:05:22 UTC (rev 21076)
@@ -171,10 +171,15 @@
d = new String(out.toByteArray());
assertEquals("this is content", d);
+ res = api.get("packages");
+ res = api.get("packages?version=all");
+ res = api.get("snapshots");
+ res = api.get("snapshots?version=all");
+
}
public void testPost() throws Exception {
More information about the jboss-svn-commits
mailing list