[jboss-svn-commits] JBL Code SVN: r21077 - in labs/jbossrules/trunk/drools-guvnor/src: test/java/org/drools/guvnor/server/files and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jul 17 00:05:53 EDT 2008


Author: michael.neale at jboss.com
Date: 2008-07-17 00:05:53 -0400 (Thu, 17 Jul 2008)
New Revision: 21077

Modified:
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/files/WebDAVImpl.java
   labs/jbossrules/trunk/drools-guvnor/src/test/java/org/drools/guvnor/server/files/WebDAVImplTest.java
Log:
webdav fixes

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/files/WebDAVImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/files/WebDAVImpl.java	2008-07-17 04:05:22 UTC (rev 21076)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/server/files/WebDAVImpl.java	2008-07-17 04:05:53 UTC (rev 21077)
@@ -102,11 +102,11 @@
 
                 AssetItem lazarus = pkg.loadAsset(resource[0]);
                 lazarus.archiveItem(false);
-                lazarus.checkin("<from webdav>");
+                //lazarus.checkin("<from webdav>");
             } else {
                 AssetItem asset = pkg.addAsset(resource[0], "");
                 asset.updateFormat(resource[1]);
-                asset.checkin("<from webdav>");
+                //asset.checkin("<from webdav>");
             }
 
         } else {
@@ -462,9 +462,9 @@
              asset.updateBinaryContentAttachment(content);
              //here we could save, or check in, depending on if enough time has passed to justify
              //a new version. Otherwise we will pollute the version history with lots of trivial versions.
-             if (shouldCreateNewVersion(asset.getLastModified())) {
-                 asset.checkin("");
-             }
+             //if (shouldCreateNewVersion(asset.getLastModified())) {
+                 asset.checkin("<content from webdav>");
+             //}
 
 
         } else {
@@ -474,15 +474,8 @@
     }
 
 
-    /**
-     * If enough time has passed, we should create a new version.
-     */
-    boolean shouldCreateNewVersion(Calendar lastModified) {
-        Calendar now = Calendar.getInstance();
-        int diff = 3600000; //1 hour
-        return (now.getTimeInMillis() - lastModified.getTimeInMillis()) > diff;
-    }
 
+
     String[] getPath(String uri) {
     	if (uri.equals("/")) {
     		return new String[0];

Modified: labs/jbossrules/trunk/drools-guvnor/src/test/java/org/drools/guvnor/server/files/WebDAVImplTest.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/test/java/org/drools/guvnor/server/files/WebDAVImplTest.java	2008-07-17 04:05:22 UTC (rev 21076)
+++ labs/jbossrules/trunk/drools-guvnor/src/test/java/org/drools/guvnor/server/files/WebDAVImplTest.java	2008-07-17 04:05:53 UTC (rev 21077)
@@ -310,15 +310,7 @@
 
 	}
 
-	public void testShouldCheckIn() throws Exception {
-		WebDAVImpl imp  = getImpl();
-		Calendar recently = Calendar.getInstance();
-		recently.setTimeInMillis(Calendar.getInstance().getTimeInMillis() - 1000);
-		assertFalse(imp.shouldCreateNewVersion(recently));
-		recently.setTimeInMillis(Calendar.getInstance().getTimeInMillis() - 86400001);
-		assertTrue(imp.shouldCreateNewVersion(recently));
 
-	}
 
 	public void testSetContent() throws Exception {
 		WebDAVImpl imp  = getImpl();
@@ -442,6 +434,13 @@
 			assertNotNull(e.getMessage());
 		}
 
+		assertFalse(imp.objectExists("/foo/webdav/snapshots/defaultPackage/new file"));
+		try {
+			imp.createResource("/foo/webdav/snapshots/defaultPackage/new file");
+			fail("can't touch this");
+		} catch (UnsupportedOperationException e) {
+			assertNotNull(e.getMessage());
+		}
 	}
 
 	private void createResourceTry(WebDAVImpl imp, String path) {




More information about the jboss-svn-commits mailing list