incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmatth...@apache.org
Subject svn commit: r1357252 - in /incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src: main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/ main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/versions/ test/java/org/apache/isis/r...
Date Wed, 04 Jul 2012 13:28:41 GMT
Author: rmatthews
Date: Wed Jul  4 13:28:41 2012
New Revision: 1357252

URL: http://svn.apache.org/viewvc?rev=1357252&view=rev
Log:
ISIS-176 - The current user was not being set in the updated version, it was simply copying
the old user.

Modified:
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/WriteObjectCommand.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/versions/VersionCreator.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/versions/VersionCreatorDefault.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/test/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/file/server/FileServerTest.java

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/WriteObjectCommand.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/WriteObjectCommand.java?rev=1357252&r1=1357251&r2=1357252&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/WriteObjectCommand.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/WriteObjectCommand.java
Wed Jul  4 13:28:41 2012
@@ -91,7 +91,7 @@ class WriteObjectCommand implements Pers
 
         final Version currentVersion = adapter.getVersion();
         
-        final Version newVersion = mode.isUpdate() ? versionCreator.nextVersion(currentVersion)
: versionCreator.newVersion(user);
+        final Version newVersion = mode.isUpdate() ? versionCreator.nextVersion(currentVersion,
user) : versionCreator.newVersion(user);
         adapter.setVersion(newVersion);
         if (newVersion != null) {
             final String version = currentVersion == null ? null : versionCreator.versionString(currentVersion);

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/versions/VersionCreator.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/versions/VersionCreator.java?rev=1357252&r1=1357251&r2=1357252&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/versions/VersionCreator.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/versions/VersionCreator.java
Wed Jul  4 13:28:41 2012
@@ -30,5 +30,5 @@ public interface VersionCreator {
 
     Version newVersion(String user);
 
-    Version nextVersion(Version version);
+    Version nextVersion(Version version, final String user);
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/versions/VersionCreatorDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/versions/VersionCreatorDefault.java?rev=1357252&r1=1357251&r2=1357252&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/versions/VersionCreatorDefault.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/versions/VersionCreatorDefault.java
Wed Jul  4 13:28:41 2012
@@ -52,9 +52,8 @@ public class VersionCreatorDefault imple
     }
 
     @Override
-    public Version nextVersion(final Version version) {
+    public Version nextVersion(final Version version, final String user) {
         final long sequence = ((SerialNumberVersion) version).getSequence() + 1;
-        final String user = version.getUser();
         return new SerialNumberVersion(sequence, user, new Date());
     }
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/test/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/file/server/FileServerTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/test/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/file/server/FileServerTest.java?rev=1357252&r1=1357251&r2=1357252&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/test/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/file/server/FileServerTest.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/test/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/file/server/FileServerTest.java
Wed Jul  4 13:28:41 2012
@@ -64,6 +64,9 @@ public class FileServerTest {
         logFile1 = recreateFile("target/test/logs", "recovery0.log");
         logFile2 = recreateFile("target/test/logs", "recovery1.log");
 
+        final File dir = new File("target/test/org.domain.Class2");
+        dir.mkdirs();
+        
         server = new FileServerProcessor();
         server.startup();
 
@@ -142,13 +145,13 @@ public class FileServerTest {
 
     @Test
     public void writeUpdatesFilesUsingDataWriter() throws Exception {
-        final File file2 = new File("target/test/org.domain.Class", "1026.data");
+        final File file2 = new File("target/test/org.domain.Class2", "1026.data");
         final FileWriter fileWriter = new FileWriter(file2);
         final String originalData = "org.domain.Class 1026 21 {}";
         fileWriter.write(originalData);
         fileWriter.close();
 
-        final ServerConnection connection = new ServerConnection(IoUtils.asUtf8ByteStream("W\nUorg.domain.Class
1026 21 22 \n{data2}\n\n\n"), out);
+        final ServerConnection connection = new ServerConnection(IoUtils.asUtf8ByteStream("W\nUorg.domain.Class2
1026 21 22 \n{data2}\n\n\n"), out);
         server.process(connection);
 
         assertThat(out.toString(), is(equalTo("ok\n")));
@@ -208,12 +211,12 @@ public class FileServerTest {
 
     @Test
     public void copyOfReadTest() throws Exception {
-        final File file1 = new File("target/test/org.domain.Class", "2025.data");
+        final File file1 = new File("target/test/org.domain.Class2", "2025.data");
         final FileWriter fileWriter = new FileWriter(file1);
         fileWriter.write("type 1025 1\n{data1}");
         fileWriter.close();
 
-        final ServerConnection connection = new ServerConnection(IoUtils.asUtf8ByteStream("Rorg.domain.Class
2025\n\n"), out);
+        final ServerConnection connection = new ServerConnection(IoUtils.asUtf8ByteStream("Rorg.domain.Class2
2025\n\n"), out);
         server.process(connection);
 
         assertThat(out.toString(), is(equalTo("ok\n{data1}\n\n")));
@@ -221,7 +224,7 @@ public class FileServerTest {
 
     @Test
     public void ReadFailIfEndsEarly() throws Exception {
-        final ServerConnection connection = new ServerConnection(IoUtils.asUtf8ByteStream("Rorg.domain.Class
2025\n"), out);
+        final ServerConnection connection = new ServerConnection(IoUtils.asUtf8ByteStream("Rorg.domain.Class
2010\n"), out);
         server.process(connection);
 
         assertThat(out.toString(), is(containsString("stream ended prematurely while reading
end of command, aborting request")));
@@ -229,12 +232,12 @@ public class FileServerTest {
 
     @Test
     public void lookReadRenamed() throws Exception {
-        final File file1 = new File("target/test/org.domain.Class", "2025.data");
+        final File file1 = new File("target/test/org.domain.Class2", "2025.data");
         final FileWriter fileWriter = new FileWriter(file1);
         fileWriter.write("type 1025 1\n{data1}");
         fileWriter.close();
 
-        final ServerConnection connection = new ServerConnection(IoUtils.asUtf8ByteStream("Rorg.domain.Class
2025\n\n"), out);
+        final ServerConnection connection = new ServerConnection(IoUtils.asUtf8ByteStream("Rorg.domain.Class2
2025\n\n"), out);
         server.process(connection);
 
         assertThat(out.toString(), is(equalTo("ok\n{data1}\n\n")));
@@ -242,12 +245,12 @@ public class FileServerTest {
 
     @Test
     public void read2() throws Exception {
-        final File file1 = new File("target/test/org.domain.Class", "2025.data");
+        final File file1 = new File("target/test/org.domain.Class2", "2025.data");
         final FileWriter fileWriter = new FileWriter(file1);
         fileWriter.write("type 1025 1\n{data1}");
         fileWriter.close();
 
-        final ServerConnection connection = new ServerConnection(IoUtils.asUtf8ByteStream("Rorg.domain.Class
2025\n\n"), out);
+        final ServerConnection connection = new ServerConnection(IoUtils.asUtf8ByteStream("Rorg.domain.Class2
2025\n\n"), out);
         server.process(connection);
 
         assertThat(out.toString(), is(equalTo("ok\n{data1}\n\n")));
@@ -263,12 +266,13 @@ public class FileServerTest {
 
     @Test
     public void hasInstances() throws Exception {
-        final File file1 = new File("target/test/org.domain.Class", "2025.data");
+        final File file1 = new File("target/test/org.domain.Class2", "2025.data");
+     //   file1.getParentFile().mkdirs();
         final FileWriter fileWriter = new FileWriter(file1);
         fileWriter.write("type 1025 1\n{data1}");
         fileWriter.close();
 
-        final ServerConnection connection = new ServerConnection(IoUtils.asUtf8ByteStream("Iorg.domain.Class\n\n"),
out);
+        final ServerConnection connection = new ServerConnection(IoUtils.asUtf8ByteStream("Iorg.domain.Class2\n\n"),
out);
         server.process(connection);
 
         assertThat(out.toString(), is(equalTo("ok true\n")));



Mime
View raw message