chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1486037 [3/3] - in /chemistry/opencmis/branches/inmemory-refactoring/src: main/java/org/apache/chemistry/opencmis/inmemory/ main/java/org/apache/chemistry/opencmis/inmemory/query/ main/java/org/apache/chemistry/opencmis/inmemory/server/ ma...
Date Fri, 24 May 2013 12:48:22 GMT
Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java
(original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java
Fri May 24 12:48:21 2013
@@ -34,7 +34,7 @@ import org.apache.chemistry.opencmis.inm
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.DocumentVersion;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.VersionedDocument;
 
-public class VersionedDocumentImpl extends AbstractMultiFilingImpl implements VersionedDocument
{
+public class VersionedDocumentImpl extends FilingImpl implements VersionedDocument {
 
     private boolean fIsCheckedOut;
     private String fCheckedOutUser;
@@ -46,7 +46,8 @@ public class VersionedDocumentImpl exten
         fIsCheckedOut = false;
     }
 
-    public DocumentVersion addVersion(ContentStream content, VersioningState verState, String
user) {
+    @Override
+	public DocumentVersion addVersion(ContentStream content, VersioningState verState, String
user) {
 
         if (isCheckedOut()) {
             throw new CmisConstraintException("Cannot add a version to document, document
is checked out.");
@@ -65,7 +66,8 @@ public class VersionedDocumentImpl exten
         return ver;
     }
 
-    public boolean deleteVersion(DocumentVersion version) {
+    @Override
+	public boolean deleteVersion(DocumentVersion version) {
         if (fIsCheckedOut) {
             // Note: Do not throw an exception here if the document is
             // checked-out. In AtomPub binding cancelCheckout
@@ -85,11 +87,13 @@ public class VersionedDocumentImpl exten
         return !fVersions.isEmpty();
     }
 
-    public void cancelCheckOut(String user) {
+    @Override
+	public void cancelCheckOut(String user) {
         cancelCheckOut(true);
     }
 
-    public void checkIn(boolean isMajor, Properties properties, ContentStream content, String
checkinComment,
+    @Override
+	public void checkIn(boolean isMajor, Properties properties, ContentStream content, String
checkinComment,
             List<String> policyIds, String user) {
         if (fIsCheckedOut) {
             if (fCheckedOutUser.equals(user)) {
@@ -119,7 +123,8 @@ public class VersionedDocumentImpl exten
         }
     }
 
-    public DocumentVersion checkOut(ContentStream content, String user) {
+    @Override
+	public DocumentVersion checkOut(ContentStream content, String user) {
         if (fIsCheckedOut) {
             throw new CmisConstraintException("Error: Can't checkout, Document " + getId()
+ " is already checked out.");
         }
@@ -130,11 +135,13 @@ public class VersionedDocumentImpl exten
         return pwc;
     }
 
-    public List<DocumentVersion> getAllVersions() {
+    @Override
+	public List<DocumentVersion> getAllVersions() {
         return fVersions;
     }
 
-    public DocumentVersion getLatestVersion(boolean major) {
+    @Override
+	public DocumentVersion getLatestVersion(boolean major) {
 
         DocumentVersion latest = null;
         if (fVersions.size() == 0)
@@ -152,15 +159,18 @@ public class VersionedDocumentImpl exten
         return latest;
     }
 
-    public boolean isCheckedOut() {
+    @Override
+	public boolean isCheckedOut() {
         return fIsCheckedOut;
     }
 
-    public String getCheckedOutBy() {
+    @Override
+	public String getCheckedOutBy() {
         return fCheckedOutUser;
     }
 
-    public DocumentVersion getPwc() {
+    @Override
+	public DocumentVersion getPwc() {
         for (DocumentVersion ver : fVersions) {
             if (ver.isPwc()) {
                 return ver;

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java
(original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java
Fri May 24 12:48:21 2013
@@ -54,7 +54,8 @@ public class DefaultTypeSystemCreator im
      * in the public interface of this class we return the singleton containing
      * the required types for testing
      */
-    public List<TypeDefinition> createTypesList() {
+    @Override
+	public List<TypeDefinition> createTypesList() {
         return singletonTypes;
     }
 

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyUtil.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyUtil.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyUtil.java
(original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyUtil.java
Fri May 24 12:48:21 2013
@@ -147,7 +147,7 @@ public class PropertyUtil {
         if (folder != null) {
             // not supported: ALLOWED_CHILD_OBJECT_TYPE_IDS
             if (propertyId.equals(PropertyIds.PARENT_ID)) {
-                return folder.getParent() == null ? null : folder.getParent().getId();
+                return folder.getParentId();
             }
 
             if (propertyId.equals(PropertyIds.PATH)) {

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/AclPermissionsTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/AclPermissionsTest.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/AclPermissionsTest.java
(original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/AclPermissionsTest.java
Fri May 24 12:48:21 2013
@@ -1,5 +1,6 @@
 package org.apache.chemistry.opencmis.inmemory;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -12,8 +13,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import junit.framework.Assert;
-
 import org.apache.chemistry.opencmis.commons.PropertyIds;
 import org.apache.chemistry.opencmis.commons.data.Ace;
 import org.apache.chemistry.opencmis.commons.data.Acl;
@@ -40,11 +39,11 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.ObjectStore;
 import org.apache.chemistry.opencmis.inmemory.storedobj.impl.InMemoryAce;
 import org.apache.chemistry.opencmis.server.support.query.CalendarHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class AclPermissionsTest extends AbstractServiceTest  {
 
@@ -230,7 +229,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions)");
+			fail("TestUser has no permissions)");
 		
 		switchCallContext("Reader");
 		ObjectInFolderList list = fNavSvc.getChildren(fRepositoryId, folderId, null, null, false,
IncludeRelationships.NONE, null, null,
@@ -248,7 +247,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions)");
+			fail("TestUser has no permissions)");
 		
 		switchCallContext("Reader");
 		List<ObjectInFolderContainer> list2 = fNavSvc.getDescendants(fRepositoryId, folderId,
MINUS_ONE, null, null, null, null, null, null);
@@ -265,7 +264,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions)");
+			fail("TestUser has no permissions)");
 		
 		switchCallContext("Reader");
 		List<ObjectInFolderContainer> list3 = fNavSvc.getFolderTree(fRepositoryId, folderId,
BigInteger.ONE, null, null, null, null, null, null);
@@ -281,7 +280,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions)");
+			fail("TestUser has no permissions)");
 		
 		switchCallContext("Reader");
 		List<ObjectParentData> list4 = fNavSvc.getObjectParents(fRepositoryId, folderId,
null, null, null, null, null, null);
@@ -297,7 +296,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions)");
+			fail("TestUser has no permissions)");
 		
 		switchCallContext("Reader");
 		ObjectData list5 = fNavSvc.getFolderParent(fRepositoryId, folderId, null, null);
@@ -314,7 +313,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions)");
+			fail("TestUser has no permissions)");
 		
 		switchCallContext("Reader");
 		ObjectList list6 = fNavSvc.getCheckedOutDocs(fRepositoryId, folderId, null, null, null,
IncludeRelationships.NONE, 
@@ -365,7 +364,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions to get acl of folder");
+			fail("TestUser has no permissions to get acl of folder");
 		
 		switchCallContext("Reader");
 		Acl acl = fAclSvc.getAcl(fRepositoryId, folderId, null, null);
@@ -382,7 +381,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions to get acl of doc)");
+			fail("TestUser has no permissions to get acl of doc)");
 		
 		switchCallContext("Reader");
 		Acl docAcl = fAclSvc.getAcl(fRepositoryId, docId, true, null);
@@ -399,7 +398,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions)");
+			fail("TestUser has no permissions)");
 		
 //		switchCallContext("Writer");
         switchCallContext("TestAdmin");
@@ -448,7 +447,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions to create a document");
+			fail("TestUser has no permissions to create a document");
 		
 		exceptionThrown = false;
 		try
@@ -460,7 +459,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions to create a folder");
+			fail("TestUser has no permissions to create a folder");
 		
 		/*
 		exceptionThrown = false;
@@ -474,7 +473,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions to create a relationship: missing read permission
for source id");
+			fail("TestUser has no permissions to create a relationship: missing read permission for
source id");
 		
 		exceptionThrown = false;
 		Properties properties = createRelationshipProperties( fRootFolderId, folderId);
@@ -487,7 +486,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions to create a relationship: missing read permission
for destination");
+			fail("TestUser has no permissions to create a relationship: missing read permission for
destination");
 		*/
 		
 		exceptionThrown = false;
@@ -500,7 +499,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions to get properties of the folder");
+			fail("TestUser has no permissions to get properties of the folder");
 		
 		exceptionThrown = false;
 		try
@@ -512,7 +511,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions to get properties of the document");
+			fail("TestUser has no permissions to get properties of the document");
 		
 		exceptionThrown = false;
 		try
@@ -525,7 +524,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions to get renditions of the document");
+			fail("TestUser has no permissions to get renditions of the document");
 		
 		exceptionThrown = false;
 		try
@@ -538,7 +537,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions to get contentStream of the document");
+			fail("TestUser has no permissions to get contentStream of the document");
 		
 		switchCallContext("Reader");
 		exceptionThrown = false;
@@ -553,7 +552,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Reader has no permissions to update properties of the document");
+			fail("Reader has no permissions to update properties of the document");
 		
 		exceptionThrown = false;
 		properties = createDocumentProperties( "name", "typeId");
@@ -567,7 +566,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Reader has no permissions to update properties of the document");
+			fail("Reader has no permissions to update properties of the document");
 		
 		exceptionThrown = false;
 		try
@@ -580,7 +579,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Reader has no permissions to move document");
+			fail("Reader has no permissions to move document");
 		
 		switchCallContext("Writer");
 		exceptionThrown = false;
@@ -594,7 +593,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Writer has no permissions to move document to admin folder");
+			fail("Writer has no permissions to move document to admin folder");
 		
 		switchCallContext("Reader");
 		exceptionThrown = false;
@@ -607,7 +606,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Reader has no permissions to delete document ");
+			fail("Reader has no permissions to delete document ");
 		
 		exceptionThrown = false;
 		try
@@ -619,7 +618,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Reader has no permissions to delete admin folder ");
+			fail("Reader has no permissions to delete admin folder ");
 		
 		exceptionThrown = false;
 		try
@@ -632,7 +631,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Reader has no permissions to set content ");
+			fail("Reader has no permissions to set content ");
 		
 		exceptionThrown = false;
 		try
@@ -645,7 +644,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Reader has no permissions to delete content ");
+			fail("Reader has no permissions to delete content ");
 		
 		exceptionThrown = false;
 		try
@@ -658,7 +657,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Reader has no permissions to delete tree ");
+			fail("Reader has no permissions to delete tree ");
 	}
 	
 	@Test
@@ -686,7 +685,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permissions at the document to add a parent");
+			fail("TestUser has no permissions at the document to add a parent");
 		
 		exceptionThrown = false;
 		switchCallContext("Reader");  // has no permission at the folder
@@ -700,7 +699,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Reader has no permission at the folder to add a parent");
+			fail("Reader has no permission at the folder to add a parent");
 		
 		switchCallContext("TestAdmin");
 		fMultiSvc.addObjectToFolder(fRepositoryId, docId, noReadFolderId, true, null);
@@ -717,7 +716,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Reader has no permission at the folder to remove a parent");
+			fail("Reader has no permission at the folder to remove a parent");
 		
 		switchCallContext("TestUser"); 
 		try
@@ -730,7 +729,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permission at the object to remove a parent");
+			fail("TestUser has no permission at the object to remove a parent");
 	}
 	
 	@Test
@@ -755,7 +754,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permission to checkout)");
+			fail("TestUser has no permission to checkout)");
 		
 		// Reader has only read permission
 		switchCallContext("Reader");
@@ -770,7 +769,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Reader has not enough permission to checkout)");
+			fail("Reader has not enough permission to checkout)");
 		
 		// checkout
 		switchCallContext("TestAdmin");
@@ -795,7 +794,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permission to cancelCheckOut)");
+			fail("TestUser has no permission to cancelCheckOut)");
 		switchCallContext("TestAdmin");
 		fAclSvc.applyAcl(fRepositoryId, docId, testUserAcl, null, AclPropagation.OBJECTONLY, null);
 		switchCallContext("TestUser");
@@ -820,7 +819,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Reader has not enough permission to cancelCheckOut)");
+			fail("Reader has not enough permission to cancelCheckOut)");
 		switchCallContext("TestAdmin");
 		fAclSvc.applyAcl(fRepositoryId, docId, readWriteAcl, null, AclPropagation.OBJECTONLY, null);
 		switchCallContext("Writer");
@@ -848,7 +847,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has no permission to checkIn)");
+			fail("TestUser has no permission to checkIn)");
 		switchCallContext("TestAdmin");
 		fAclSvc.applyAcl(fRepositoryId, docId, testUserAcl, null, AclPropagation.OBJECTONLY, null);
 		switchCallContext("TestUser");
@@ -878,7 +877,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("Writer has not enough permission to checkIn)");
+			fail("Writer has not enough permission to checkIn)");
 		switchCallContext("TestAdmin");
 		fAclSvc.applyAcl(fRepositoryId, docId, readWriteAcl, null, AclPropagation.OBJECTONLY, null);
 		switchCallContext("Writer");
@@ -899,7 +898,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has not enough permission to getObjectOfLatestVersion)");
+			fail("TestUser has not enough permission to getObjectOfLatestVersion)");
 		
 		exceptionThrown = false;
 		try
@@ -912,7 +911,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has not enough permission to getAllVersions)");
+			fail("TestUser has not enough permission to getAllVersions)");
 
 
 		exceptionThrown = false;
@@ -926,7 +925,7 @@ public class AclPermissionsTest extends 
 			exceptionThrown = true;
 		}
 		if (!exceptionThrown)
-			Assert.fail("TestUser has not enough permission to getAllVersions)");
+			fail("TestUser has not enough permission to getAllVersions)");
 	}
 	
 		
@@ -1009,7 +1008,7 @@ public class AclPermissionsTest extends 
 				IncludeRelationships.NONE, null, MINUS_ONE, MINUS_ONE, null);
 		List<String> docIds2 = new ArrayList<String>(1);
 		docIds2.add(docId2);
-		Assert.assertEquals(BigInteger.valueOf(1L), objectList2.getNumItems());
+		assertEquals(BigInteger.valueOf(1L), objectList2.getNumItems());
 		
 		// multi filing, get object parents
 		switchCallContext("TestAdmin");
@@ -1021,8 +1020,8 @@ public class AclPermissionsTest extends 
 		
 		switchCallContext("TestUser");  // second parent is not visible
 		List<ObjectParentData> objectParentData = fNavSvc.getObjectParents(fRepositoryId,
docId3, null, null, null, null, true, null);
-		Assert.assertEquals(1, objectParentData.size());
-		Assert.assertEquals(folderId2, objectParentData.get(0).getObject().getId());
+		assertEquals(1, objectParentData.size());
+		assertEquals(folderId2, objectParentData.get(0).getObject().getId());
         LOG.debug("...stop test checkVisibleObjects()");
 	}
 		

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/DiscoveryServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/DiscoveryServiceTest.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/DiscoveryServiceTest.java
(original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/DiscoveryServiceTest.java
Fri May 24 12:48:21 2013
@@ -49,7 +49,8 @@ public class DiscoveryServiceTest extend
         super.setUp();
     }
 
-    @After
+    @Override
+	@After
     public void tearDown() {
         super.tearDown();
     }

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java
(original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java
Fri May 24 12:48:21 2013
@@ -22,9 +22,9 @@ import java.util.List;
 
 import junit.framework.TestCase;
 
+import org.apache.chemistry.opencmis.inmemory.storedobj.api.Fileable;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Filing;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Folder;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.ObjectStore;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoredObject;
 import org.apache.chemistry.opencmis.inmemory.storedobj.impl.FolderImpl;
 import org.apache.chemistry.opencmis.inmemory.storedobj.impl.ObjectStoreImpl;
@@ -41,7 +41,7 @@ import org.junit.Test;
  */
 public class FolderTest extends TestCase {
 
-    private ObjectStore fStore;
+    private ObjectStoreImpl fStore;
     private FolderImpl fRoot;
     private FolderImpl f1;
     private FolderImpl f2;
@@ -51,25 +51,25 @@ public class FolderTest extends TestCase
     private static final String TEST_REPOSITORY_ID = "TestRepositoryId";
     private static final String USER = "user";
 
-    @Before
+    @Override
+	@Before
     protected void setUp() throws Exception {
         fStore = new ObjectStoreImpl(TEST_REPOSITORY_ID);
         createFolders();
     }
 
     @Test
-    public void testCreatAndGetFolders() {
+    public void testCreateAndGetFolders() {
         try {
-            Folder childFolder = createFolder("Folder 1");
-            fRoot.addChildFolder(childFolder);
+            createFolder("Folder 1", fRoot);
             fail("Should throw exception if folder already exists.");
         } catch (Exception e) {
         }
         assertEquals(f1.getName(), "Folder 1");
         assertEquals(f11.getName(), "Folder 1.1");
-        assertNull(fRoot.getParent());
-        assertEquals(fRoot, f1.getParent());
-        assertEquals(f1, f11.getParent());
+        assertNull(fRoot.getParentId());
+        assertEquals(fRoot.getId(), f1.getParentId());
+        assertEquals(f1.getId(), f11.getParentId());
         assertEquals(Filing.PATH_SEPARATOR, fRoot.getPath());
         assertEquals("/Folder 1", f1.getPath());
         assertEquals("/Folder 1/Folder 1.1", f11.getPath());
@@ -79,11 +79,11 @@ public class FolderTest extends TestCase
         assertEquals(f1, fTest);
         fTest = fStore.getObjectByPath("/Folder 1/Folder 1.1", USER);
         assertEquals(f11, fTest);
-        List<? extends StoredObject> subFolders = fRoot.getChildren(-1, -1, "user").getChildren();
+        List<Fileable> subFolders = fStore.getChildren(fRoot, -1, -1, "user").getChildren();
         assertEquals(4, subFolders.size());
-        subFolders = f2.getChildren(-1, -1, "user").getChildren();
+        subFolders = fStore.getChildren(f2, -1, -1, "user").getChildren();
         assertEquals(0, subFolders.size());
-        subFolders = f1.getChildren(-1, -1, "user").getChildren();
+        subFolders = fStore.getChildren(f1, -1, -1, "user").getChildren();
         assertEquals(1, subFolders.size());
     }
 
@@ -92,38 +92,33 @@ public class FolderTest extends TestCase
         // rename top level folder
         String newName = "Folder B";
         String oldPath = f2.getPath();
-        f2.rename(newName);
+        fStore.rename(f2, newName);
         assertEquals(f2.getName(), newName);
         assertEquals(f2.getPath(), Filing.PATH_SEPARATOR + newName);
         assertNull(fStore.getObjectByPath(oldPath, USER));
         assertEquals(f2, fStore.getObjectByPath(Filing.PATH_SEPARATOR + newName, USER));
         try {
-            f2.rename("Folder 3");
+            fStore.rename(f2, "Folder 3");
             fail("Should not allow to rename a folder to an existing name");
         } catch (Exception e) {
         }
 
         // rename sub folder
         oldPath = f11.getPath();
-        f11.rename(newName);
+        fStore.rename(f11, newName);
         assertEquals(f11.getName(), newName);
         assertEquals(f11.getPath(), "/Folder 1/Folder B");
         assertNull(fStore.getObjectByPath(oldPath, USER));
         assertEquals(f11, fStore.getObjectByPath("/Folder 1/Folder B", USER));
         try {
-            f2.rename(newName);
+            fStore.rename(f2, newName);
             fail("Should not allow to rename a folder to an existing name");
         } catch (Exception e) {
         }
-        try {
-            f2.rename("illegal/name");
-            fail("Should not allow to rename a folder to a name with illegal name");
-        } catch (Exception e) {
-        }
 
         // rename root folder
         try {
-            fRoot.rename("abc");
+            fStore.rename(fRoot, "abc");
             fail("Should not be possible to rename root folder");
         } catch (Exception e) {
         }
@@ -132,16 +127,16 @@ public class FolderTest extends TestCase
     @Test
     public void testMoveFolder() {
         String oldPath = f1.getPath();
-        Folder f1Parent = f1.getParent();
-        f1.move(f1Parent, f3);
+        Folder f1Parent = fRoot;
+        fStore.move(f1, f1Parent, f3);
         assertNull(fStore.getObjectByPath(oldPath, USER));
         assertEquals(f1.getPath(), "/Folder 3/Folder 1");
         assertEquals(f1, fStore.getObjectByPath("/Folder 3/Folder 1", USER));
 
-        f2.rename("Folder 1");
+        fStore.rename(f2, "Folder 1");
         try {
-            Folder f2Parent = f2.getParent();
-            f2.move(f2Parent, f3);
+            Folder f2Parent = fRoot;
+            fStore.move(f2, f2Parent, f3);
             fail("Should not be possible to move folder to a folder that has a child with
same name");
         } catch (Exception e) {
         }
@@ -162,28 +157,23 @@ public class FolderTest extends TestCase
 
     private void createFolders() {
         fRoot = (FolderImpl) fStore.getRootFolder();
-        f1 = (FolderImpl) createFolder("Folder 1");
-        fRoot.addChildFolder(f1);
+        f1 = (FolderImpl) createFolder("Folder 1", fRoot);
         f1.persist();
 
-        f2 = (FolderImpl) createFolder("Folder 2");
-        fRoot.addChildFolder(f2);
+        f2 = (FolderImpl) createFolder("Folder 2", fRoot);
         f2.persist();
 
-        f3 = (FolderImpl) createFolder("Folder 3");
-        fRoot.addChildFolder(f3);
+        f3 = (FolderImpl) createFolder("Folder 3", fRoot);
         f3.persist();
 
-        f4 = (FolderImpl) createFolder("Folder 4");
-        fRoot.addChildFolder(f4);
+        f4 = (FolderImpl) createFolder("Folder 4", fRoot);
         f4.persist();
 
-        f11 = (FolderImpl) createFolder("Folder 1.1");
-        f1.addChildFolder(f11);
+        f11 = (FolderImpl) createFolder("Folder 1.1", f1);
         f11.persist();
     }
     
-    private Folder createFolder(String name) {
-    	return fStore.createFolder(name, null, "user", null, null, null, null);    	
+    private Folder createFolder(String name, Folder parent) {
+    	return fStore.createFolder(name, null, "user", parent, null, null, null);    	
     }
 }

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
(original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
Fri May 24 12:48:21 2013
@@ -204,7 +204,7 @@ public class ObjectServiceTest extends A
         }
 
         try {
-            createDocumentNoCatch("/(%#$���������",
fRootFolderId, DOCUMENT_TYPE_ID, VersioningState.NONE, false);
+            createDocumentNoCatch("/(%#$aöÜ", fRootFolderId, DOCUMENT_TYPE_ID, VersioningState.NONE,
false);
             fail("Document creation with ilegal name should fail.");
         } catch (Exception e) {
             assertTrue(e instanceof CmisInvalidArgumentException);
@@ -236,7 +236,7 @@ public class ObjectServiceTest extends A
         }
 
         try {
-            createFolderNoCatch("/(%#$���������",
fRootFolderId, FOLDER_TYPE_ID);
+            createFolderNoCatch("/(%#$���������������������������",
fRootFolderId, FOLDER_TYPE_ID);
             fail("Folder creation with ilegal name should fail.");
         } catch (Exception e) {
             assertTrue(e instanceof CmisInvalidArgumentException);
@@ -658,6 +658,7 @@ public class ObjectServiceTest extends A
 
     @Test
     public void testUpdateProperties() {
+        // TODO add test rename root folder and non root folder (must be a folder)
         log.info("starting testUpdateProperties() ...");
         String oldChangeToken, newChangeToken;
         String id = createDocumentWithCustomType(MY_CUSTOM_NAME, fRootFolderId, false);
@@ -792,6 +793,17 @@ public class ObjectServiceTest extends A
             } catch (Exception e) {
                 assertTrue(e instanceof CmisNameConstraintViolationException);
             }
+            
+            // test an invalid name
+            properties = new ArrayList<PropertyData<?>>();
+            properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, "Invalid/Name"));
+            newProps = fFactory.createPropertiesData(properties);
+            try {
+                fObjSvc.updateProperties(fRepositoryId, idHolder, changeTokenHolder, newProps,
null);
+                fail("Update with an invalid name should fail.");
+            } catch (Exception e) {
+                assertTrue(e instanceof CmisInvalidArgumentException);
+            }
 
         } catch (Exception e) {
             fail("getObject() failed with exception: " + e);
@@ -911,10 +923,10 @@ public class ObjectServiceTest extends A
             log.info("starting testGetObjectByPath() with specal chars...");
             log.info("  creating object");
 
-            String docID = createDocument("H������nschen",
fRootFolderId, false);
+            String docID = createDocument("Hänschen", fRootFolderId, false);
             log.info("  getting object by path with special chars");
             try {
-                ObjectData res = fObjSvc.getObjectByPath(fRepositoryId, "/H������nschen",
"*", false, IncludeRelationships.NONE, null, false,
+                ObjectData res = fObjSvc.getObjectByPath(fRepositoryId, "/Hänschen", "*",
false, IncludeRelationships.NONE, null, false,
                         false, null);
                 assertNotNull(res);
                assertNotNull(res.getId());
@@ -1494,19 +1506,7 @@ public class ObjectServiceTest extends A
     }
 
     private void moveObjectTest(boolean isFolder) {
-        final String propertyFilter = PropertyIds.OBJECT_ID + "," + PropertyIds.NAME; //
+
-        // ","
-        // +
-        // PropertyIds
-        // .
-        // CMIS_OBJECT_TYPE_ID
-        // +
-        // ","
-        // +
-        // PropertyIds
-        // .
-        // CMIS_BASE_TYPE_ID
-        // ;
+        final String propertyFilter = PropertyIds.OBJECT_ID + "," + PropertyIds.NAME; 
         String rootFolderId = createFolder();
         ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepSvc, fRepositoryId,
                 ObjectGenerator.CONTENT_KIND.LoremIpsumText);
@@ -1683,7 +1683,8 @@ public class ObjectServiceTest extends A
          *
          * @return typesMap map filled with created types
          */
-        public List<TypeDefinition> createTypesList() {
+        @Override
+		public List<TypeDefinition> createTypesList() {
             List<TypeDefinition> typesList = new LinkedList<TypeDefinition>();
             InMemoryDocumentTypeDefinition cmisDocumentType = new InMemoryDocumentTypeDefinition(TEST_DOCUMENT_TYPE_ID,
                     "My Document Type", InMemoryDocumentTypeDefinition.getRootDocumentType());

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/PolicyTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/PolicyTest.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/PolicyTest.java
(original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/PolicyTest.java
Fri May 24 12:48:21 2013
@@ -55,14 +55,16 @@ public class PolicyTest extends Abstract
 
     private String polId;
 
-    @Before
+    @Override
+	@Before
     public void setUp() {
         super.setTypeCreatorClass(ObjectTestTypeSystemCreator.class.getName());
         super.setUp();
         createPolicy();
     }
 
-    @After
+    @Override
+	@After
     public void tearDown() {
         super.tearDown();
     }

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java
(original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java
Fri May 24 12:48:21 2013
@@ -82,7 +82,8 @@ public class UnitTestTypeSystemCreator i
      * in the public interface of this class we return the singleton containing
      * the required types for testing
      */
-    public List<TypeDefinition> createTypesList() {
+    @Override
+	public List<TypeDefinition> createTypesList() {
         return singletonTypes;
     }
 

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/VersionTestTypeSystemCreator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/VersionTestTypeSystemCreator.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/VersionTestTypeSystemCreator.java
(original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/VersionTestTypeSystemCreator.java
Fri May 24 12:48:21 2013
@@ -39,7 +39,8 @@ public class VersionTestTypeSystemCreato
      * in the public interface of this class we return the singleton containing
      * the required types for testing
      */
-    public List<TypeDefinition> createTypesList() {
+    @Override
+	public List<TypeDefinition> createTypesList() {
         return singletonTypes;
     }
 

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryConditionProcessor.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryConditionProcessor.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryConditionProcessor.java
(original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryConditionProcessor.java
Fri May 24 12:48:21 2013
@@ -175,7 +175,8 @@ public abstract class AbstractQueryCondi
     protected abstract void onTextPhrase(String phrase);
 
     // Base interface called from query parser
-    public Boolean walkPredicate(Tree whereNode) {
+    @Override
+	public Boolean walkPredicate(Tree whereNode) {
         if (null != whereNode) {
             onStartProcessing(whereNode);
             evalWhereNode(whereNode);



Mime
View raw message