You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by dc...@apache.org on 2010/04/16 16:19:33 UTC
svn commit: r934904 [1/2] - in
/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit:
./ bindings/ runtime/ runtime/suite/ sample/
Author: dcaruana
Date: Fri Apr 16 14:19:32 2010
New Revision: 934904
URL: http://svn.apache.org/viewvc?rev=934904&view=rev
Log:
Apply Chemistry code style.
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/SessionFactory.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AbstractBindingIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AbstractSimpleBindingIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AtomPubSimpleBindingIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/WebServicesSimpleBindingIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractSessionTest.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/Fixture.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/FixtureSessionParameter.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/FixtureSetup.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyAclCapabilityIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyContentStreamIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyCreateSessionIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyDiscoverIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyNavigationIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyObjectIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyRepositoryInfoIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyTypeIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/WriteObjectIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/suite/SuiteAtomPubIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/suite/SuiteWebServiceIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/AbstractSampleIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/AtomPubSampleIT.java
incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/WebServicesSampleIT.java
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/SessionFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/SessionFactory.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/SessionFactory.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/SessionFactory.java Fri Apr 16 14:19:32 2010
@@ -36,117 +36,115 @@ import org.apache.chemistry.opencmis.com
*/
public class SessionFactory {
- private static final String HOST = "localhost";
- private static final int PORT = 19080;
+ private static final String HOST = "localhost";
+ private static final int PORT = 19080;
- private static final String REPOSITORY_ID = "test";
- private static final String USER = "test";
- private static final String PASSWORD = "test";
-
- private static final String ATOMPUB_PATH = "/opencmis/atom";
- private static final String WEBSERVICES_PATH = "/opencmis/services/";
-
- /**
- * Returns the repository id of the test repository.
- */
- public static String getRepositoryId() {
- return REPOSITORY_ID;
- }
-
- /**
- * Returns the user that is logged in.
- */
- public static String getUsername() {
- return USER;
- }
-
- /**
- * Creates a new Session object that uses the AtomPub binding.
- */
- public static Session createAtomPubSession() {
- String url = "http://" + HOST + ":" + PORT + ATOMPUB_PATH;
-
- Map<String, String> parameters = new HashMap<String, String>();
-
- parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
-
- parameters.put(SessionParameter.ATOMPUB_URL, url);
- parameters.put(SessionParameter.REPOSITORY_ID, getRepositoryId());
-
- parameters.put(SessionParameter.USER, USER);
- parameters.put(SessionParameter.PASSWORD, PASSWORD);
-
- return SessionFactoryImpl.newInstance().createSession(parameters);
- }
-
- /**
- * Creates a new Session object that uses the Web Services binding.
- */
- public static Session createWebServicesSession() {
- String url = "http://" + HOST + ":" + PORT + WEBSERVICES_PATH;
-
- Map<String, String> parameters = new HashMap<String, String>();
-
- parameters.put(SessionParameter.BINDING_TYPE, BindingType.WEBSERVICES.value());
-
- parameters.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, url + "RepositoryService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, url + "NavigationService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, url + "ObjectService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, url + "VersioningService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, url + "DiscoveryService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, url
- + "RelationshipService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, url
- + "MultiFilingService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, url + "PolicyService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_ACL_SERVICE, url + "ACLService?wsdl");
-
- parameters.put(SessionParameter.REPOSITORY_ID, getRepositoryId());
- parameters.put(SessionParameter.USER, USER);
- parameters.put(SessionParameter.PASSWORD, PASSWORD);
-
- return SessionFactoryImpl.newInstance().createSession(parameters);
- }
-
- /**
- * Creates a new CmisProvider object that uses the AtomPub binding. For low-level tests only!
- */
- public static CmisBinding createAtomPubBinding() {
- String url = "http://" + HOST + ":" + PORT + ATOMPUB_PATH;
-
- Map<String, String> parameters = new HashMap<String, String>();
-
- parameters.put(SessionParameter.USER, USER);
- parameters.put(SessionParameter.PASSWORD, PASSWORD);
-
- parameters.put(SessionParameter.ATOMPUB_URL, url);
-
- return CmisBindingFactory.newInstance().createCmisAtomPubBinding(parameters);
- }
-
- /**
- * Creates a new CmisProvider object that uses the Web Services binding. For low-level tests only!
- */
- public static CmisBinding createWebServicesBinding() {
- String url = "http://" + HOST + ":" + PORT + WEBSERVICES_PATH;
-
- Map<String, String> parameters = new HashMap<String, String>();
-
- parameters.put(SessionParameter.USER, USER);
- parameters.put(SessionParameter.PASSWORD, PASSWORD);
-
- parameters.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, url + "RepositoryService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, url + "NavigationService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, url + "ObjectService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, url + "VersioningService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, url + "DiscoveryService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, url
- + "RelationshipService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, url
- + "MultiFilingService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, url + "PolicyService?wsdl");
- parameters.put(SessionParameter.WEBSERVICES_ACL_SERVICE, url + "ACLService?wsdl");
+ private static final String REPOSITORY_ID = "test";
+ private static final String USER = "test";
+ private static final String PASSWORD = "test";
+
+ private static final String ATOMPUB_PATH = "/opencmis/atom";
+ private static final String WEBSERVICES_PATH = "/opencmis/services/";
+
+ /**
+ * Returns the repository id of the test repository.
+ */
+ public static String getRepositoryId() {
+ return REPOSITORY_ID;
+ }
+
+ /**
+ * Returns the user that is logged in.
+ */
+ public static String getUsername() {
+ return USER;
+ }
+
+ /**
+ * Creates a new Session object that uses the AtomPub binding.
+ */
+ public static Session createAtomPubSession() {
+ String url = "http://" + HOST + ":" + PORT + ATOMPUB_PATH;
+
+ Map<String, String> parameters = new HashMap<String, String>();
+
+ parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
+
+ parameters.put(SessionParameter.ATOMPUB_URL, url);
+ parameters.put(SessionParameter.REPOSITORY_ID, getRepositoryId());
+
+ parameters.put(SessionParameter.USER, USER);
+ parameters.put(SessionParameter.PASSWORD, PASSWORD);
+
+ return SessionFactoryImpl.newInstance().createSession(parameters);
+ }
+
+ /**
+ * Creates a new Session object that uses the Web Services binding.
+ */
+ public static Session createWebServicesSession() {
+ String url = "http://" + HOST + ":" + PORT + WEBSERVICES_PATH;
+
+ Map<String, String> parameters = new HashMap<String, String>();
+
+ parameters.put(SessionParameter.BINDING_TYPE, BindingType.WEBSERVICES.value());
+
+ parameters.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, url + "RepositoryService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, url + "NavigationService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, url + "ObjectService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, url + "VersioningService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, url + "DiscoveryService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, url + "RelationshipService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, url + "MultiFilingService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, url + "PolicyService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_ACL_SERVICE, url + "ACLService?wsdl");
+
+ parameters.put(SessionParameter.REPOSITORY_ID, getRepositoryId());
+ parameters.put(SessionParameter.USER, USER);
+ parameters.put(SessionParameter.PASSWORD, PASSWORD);
+
+ return SessionFactoryImpl.newInstance().createSession(parameters);
+ }
+
+ /**
+ * Creates a new CmisProvider object that uses the AtomPub binding. For
+ * low-level tests only!
+ */
+ public static CmisBinding createAtomPubBinding() {
+ String url = "http://" + HOST + ":" + PORT + ATOMPUB_PATH;
+
+ Map<String, String> parameters = new HashMap<String, String>();
+
+ parameters.put(SessionParameter.USER, USER);
+ parameters.put(SessionParameter.PASSWORD, PASSWORD);
+
+ parameters.put(SessionParameter.ATOMPUB_URL, url);
+
+ return CmisBindingFactory.newInstance().createCmisAtomPubBinding(parameters);
+ }
+
+ /**
+ * Creates a new CmisProvider object that uses the Web Services binding. For
+ * low-level tests only!
+ */
+ public static CmisBinding createWebServicesBinding() {
+ String url = "http://" + HOST + ":" + PORT + WEBSERVICES_PATH;
+
+ Map<String, String> parameters = new HashMap<String, String>();
+
+ parameters.put(SessionParameter.USER, USER);
+ parameters.put(SessionParameter.PASSWORD, PASSWORD);
+
+ parameters.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, url + "RepositoryService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, url + "NavigationService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, url + "ObjectService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, url + "VersioningService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, url + "DiscoveryService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, url + "RelationshipService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, url + "MultiFilingService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, url + "PolicyService?wsdl");
+ parameters.put(SessionParameter.WEBSERVICES_ACL_SERVICE, url + "ACLService?wsdl");
- return CmisBindingFactory.newInstance().createCmisWebServicesBinding(parameters);
- }
+ return CmisBindingFactory.newInstance().createCmisWebServicesBinding(parameters);
+ }
}
\ No newline at end of file
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AbstractBindingIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AbstractBindingIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AbstractBindingIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AbstractBindingIT.java Fri Apr 16 14:19:32 2010
@@ -34,107 +34,104 @@ import org.junit.Before;
import org.junit.BeforeClass;
/**
- * Base class for binding layer tests. It makes sure that the provider object is only created once
- * and that there is a test folder.
+ * Base class for binding layer tests. It makes sure that the provider object is
+ * only created once and that there is a test folder.
*
* @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
*
*/
public abstract class AbstractBindingIT {
- public static String FOLDER_TYPE = "cmis:folder";
- public static String DOCUMENT_TYPE = "cmis:document";
+ public static String FOLDER_TYPE = "cmis:folder";
+ public static String DOCUMENT_TYPE = "cmis:document";
- private static CmisBinding binding;
- private static String fRepositoryId;
- private static String fTestFolderId;
-
- /**
- * Returns the id of test folder. Tests should only use this folder.
- */
- protected String getTestFolderId() {
- return fTestFolderId;
- }
-
- /**
- * Returns the current binding object.
- */
- protected static CmisBinding getBinding() {
- return binding;
- }
-
- /**
- * Returns a new binding object.
- */
- protected abstract CmisBinding createBinding();
-
- /**
- * Returns the repository id of the test repository.
- */
- protected abstract String getRepositoryId();
-
- @BeforeClass
- public static void setUpClass() {
- binding = null;
- }
-
- @Before
- public void setUpTest() {
- // only the first test creates the test environment
- if (binding == null) {
- System.out.println("Creating provider...");
-
- binding = createBinding();
- fRepositoryId = getRepositoryId();
- createTestFolder();
- }
- }
-
- @AfterClass
- public static void tearDownClass() {
- deleteTestFolder();
- binding = null;
- }
-
- /**
- * Creates a folder that will be used by all read-write tests.
- */
- private void createTestFolder() {
- System.out.println("Creating test folder...");
-
- // get root folder id
- RepositoryInfo ri = getBinding().getRepositoryService().getRepositoryInfo(fRepositoryId,
- null);
- assertNotNull(ri);
- assertNotNull(ri.getRootFolderId());
-
- String rootFolderId = ri.getRootFolderId();
-
- // set up properties
- List<PropertyData<?>> propertyList = new ArrayList<PropertyData<?>>();
- propertyList.add(getBinding().getObjectFactory().createPropertyStringData(
- PropertyIds.NAME, "provider-tests-" + System.currentTimeMillis()));
- propertyList.add(getBinding().getObjectFactory().createPropertyIdData(
- PropertyIds.OBJECT_TYPE_ID, FOLDER_TYPE));
-
- Properties properties = getBinding().getObjectFactory().createPropertiesData(propertyList);
-
- // create the folder
- fTestFolderId = getBinding().getObjectService().createFolder(fRepositoryId, properties,
- rootFolderId, null, null, null, null);
- }
-
- /**
- * Deletes the test folder.
- */
- private static void deleteTestFolder() {
- if (fTestFolderId == null) {
- return;
- }
-
- System.out.println("Deleting test folder...");
-
- // delete the whole tree
- getBinding().getObjectService().deleteTree(fRepositoryId, fTestFolderId, true,
- UnfileObject.DELETE, true, null);
- }
+ private static CmisBinding binding;
+ private static String fRepositoryId;
+ private static String fTestFolderId;
+
+ /**
+ * Returns the id of test folder. Tests should only use this folder.
+ */
+ protected String getTestFolderId() {
+ return fTestFolderId;
+ }
+
+ /**
+ * Returns the current binding object.
+ */
+ protected static CmisBinding getBinding() {
+ return binding;
+ }
+
+ /**
+ * Returns a new binding object.
+ */
+ protected abstract CmisBinding createBinding();
+
+ /**
+ * Returns the repository id of the test repository.
+ */
+ protected abstract String getRepositoryId();
+
+ @BeforeClass
+ public static void setUpClass() {
+ binding = null;
+ }
+
+ @Before
+ public void setUpTest() {
+ // only the first test creates the test environment
+ if (binding == null) {
+ System.out.println("Creating provider...");
+
+ binding = createBinding();
+ fRepositoryId = getRepositoryId();
+ createTestFolder();
+ }
+ }
+
+ @AfterClass
+ public static void tearDownClass() {
+ deleteTestFolder();
+ binding = null;
+ }
+
+ /**
+ * Creates a folder that will be used by all read-write tests.
+ */
+ private void createTestFolder() {
+ System.out.println("Creating test folder...");
+
+ // get root folder id
+ RepositoryInfo ri = getBinding().getRepositoryService().getRepositoryInfo(fRepositoryId, null);
+ assertNotNull(ri);
+ assertNotNull(ri.getRootFolderId());
+
+ String rootFolderId = ri.getRootFolderId();
+
+ // set up properties
+ List<PropertyData<?>> propertyList = new ArrayList<PropertyData<?>>();
+ propertyList.add(getBinding().getObjectFactory().createPropertyStringData(PropertyIds.NAME,
+ "provider-tests-" + System.currentTimeMillis()));
+ propertyList.add(getBinding().getObjectFactory().createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, FOLDER_TYPE));
+
+ Properties properties = getBinding().getObjectFactory().createPropertiesData(propertyList);
+
+ // create the folder
+ fTestFolderId = getBinding().getObjectService().createFolder(fRepositoryId, properties, rootFolderId, null,
+ null, null, null);
+ }
+
+ /**
+ * Deletes the test folder.
+ */
+ private static void deleteTestFolder() {
+ if (fTestFolderId == null) {
+ return;
+ }
+
+ System.out.println("Deleting test folder...");
+
+ // delete the whole tree
+ getBinding().getObjectService().deleteTree(fRepositoryId, fTestFolderId, true, UnfileObject.DELETE, true, null);
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AbstractSimpleBindingIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AbstractSimpleBindingIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AbstractSimpleBindingIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AbstractSimpleBindingIT.java Fri Apr 16 14:19:32 2010
@@ -37,56 +37,54 @@ import org.apache.chemistry.opencmis.com
import org.junit.Test;
/**
- * Really simple binding layer test. It just contains a few smoke tests to make sure that the
- * provider layer is working properly in the integration test environment.
+ * Really simple binding layer test. It just contains a few smoke tests to make
+ * sure that the provider layer is working properly in the integration test
+ * environment.
*
* @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
*
*/
public abstract class AbstractSimpleBindingIT extends AbstractBindingIT {
- @Test
- public void testRepositoryInfo() {
- RepositoryInfo ri = getBinding().getRepositoryService().getRepositoryInfo(
- getRepositoryId(), null);
- assertNotNull(ri);
-
- assertEquals(getRepositoryId(), ri.getId());
- assertNotNull(ri.getProductName());
- assertNotNull(ri.getRootFolderId());
- assertNotNull(ri.getCapabilities());
- }
-
- @Test
- public void testCreateDocument() {
- // set up properties
- List<PropertyData<?>> propertyList = new ArrayList<PropertyData<?>>();
- propertyList.add(getBinding().getObjectFactory().createPropertyStringData(
- PropertyIds.NAME, "testdoc.txt"));
- propertyList.add(getBinding().getObjectFactory().createPropertyIdData(
- PropertyIds.OBJECT_TYPE_ID, DOCUMENT_TYPE));
-
- Properties properties = getBinding().getObjectFactory().createPropertiesData(propertyList);
-
- // set up content
- byte[] content = "This is a test file!".getBytes();
-
- ContentStream contentStream = getBinding().getObjectFactory()
- .createContentStream("test", BigInteger.valueOf(content.length), "text/plain",
- new ByteArrayInputStream(content));
-
- // create document
- String docId = getBinding().getObjectService().createDocument(getRepositoryId(), properties,
- getTestFolderId(), contentStream, VersioningState.NONE, null, null, null, null);
- assertNotNull(docId);
-
- // get the document
- ObjectData object = getBinding().getObjectService().getObject(getRepositoryId(), docId, null,
- false, IncludeRelationships.NONE, null, false, false, null);
- assertNotNull(object);
- assertEquals(docId, object.getId());
-
- // delete the document
- getBinding().getObjectService().deleteObject(getRepositoryId(), docId, true, null);
- }
+ @Test
+ public void testRepositoryInfo() {
+ RepositoryInfo ri = getBinding().getRepositoryService().getRepositoryInfo(getRepositoryId(), null);
+ assertNotNull(ri);
+
+ assertEquals(getRepositoryId(), ri.getId());
+ assertNotNull(ri.getProductName());
+ assertNotNull(ri.getRootFolderId());
+ assertNotNull(ri.getCapabilities());
+ }
+
+ @Test
+ public void testCreateDocument() {
+ // set up properties
+ List<PropertyData<?>> propertyList = new ArrayList<PropertyData<?>>();
+ propertyList.add(getBinding().getObjectFactory().createPropertyStringData(PropertyIds.NAME, "testdoc.txt"));
+ propertyList.add(getBinding().getObjectFactory()
+ .createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, DOCUMENT_TYPE));
+
+ Properties properties = getBinding().getObjectFactory().createPropertiesData(propertyList);
+
+ // set up content
+ byte[] content = "This is a test file!".getBytes();
+
+ ContentStream contentStream = getBinding().getObjectFactory().createContentStream("test",
+ BigInteger.valueOf(content.length), "text/plain", new ByteArrayInputStream(content));
+
+ // create document
+ String docId = getBinding().getObjectService().createDocument(getRepositoryId(), properties, getTestFolderId(),
+ contentStream, VersioningState.NONE, null, null, null, null);
+ assertNotNull(docId);
+
+ // get the document
+ ObjectData object = getBinding().getObjectService().getObject(getRepositoryId(), docId, null, false,
+ IncludeRelationships.NONE, null, false, false, null);
+ assertNotNull(object);
+ assertEquals(docId, object.getId());
+
+ // delete the document
+ getBinding().getObjectService().deleteObject(getRepositoryId(), docId, true, null);
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AtomPubSimpleBindingIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AtomPubSimpleBindingIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AtomPubSimpleBindingIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/AtomPubSimpleBindingIT.java Fri Apr 16 14:19:32 2010
@@ -29,14 +29,14 @@ import org.apache.chemistry.opencmis.fit
*/
public class AtomPubSimpleBindingIT extends AbstractSimpleBindingIT {
- @Override
- protected CmisBinding createBinding() {
- return SessionFactory.createAtomPubBinding();
- }
+ @Override
+ protected CmisBinding createBinding() {
+ return SessionFactory.createAtomPubBinding();
+ }
- @Override
- protected String getRepositoryId() {
- return SessionFactory.getRepositoryId();
- }
+ @Override
+ protected String getRepositoryId() {
+ return SessionFactory.getRepositoryId();
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/WebServicesSimpleBindingIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/WebServicesSimpleBindingIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/WebServicesSimpleBindingIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/bindings/WebServicesSimpleBindingIT.java Fri Apr 16 14:19:32 2010
@@ -29,14 +29,14 @@ import org.apache.chemistry.opencmis.fit
*/
public class WebServicesSimpleBindingIT extends AbstractSimpleBindingIT {
- @Override
- protected CmisBinding createBinding() {
- return SessionFactory.createWebServicesBinding();
- }
+ @Override
+ protected CmisBinding createBinding() {
+ return SessionFactory.createWebServicesBinding();
+ }
- @Override
- protected String getRepositoryId() {
- return SessionFactory.getRepositoryId();
- }
+ @Override
+ protected String getRepositoryId() {
+ return SessionFactory.getRepositoryId();
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractSessionTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractSessionTest.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractSessionTest.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/AbstractSessionTest.java Fri Apr 16 14:19:32 2010
@@ -39,55 +39,54 @@ import org.junit.runners.model.Framework
*/
public abstract class AbstractSessionTest {
- protected Log log = LogFactory.getLog(this.getClass());
+ protected Log log = LogFactory.getLog(this.getClass());
- /**
- * trace each junit error
- */
- @Rule
- public MethodRule watch = new TestWatchman() {
- @Override
- public void failed(Throwable e, FrameworkMethod method) {
- super.failed(e, method);
- AbstractSessionTest.this.log.error(method.getName(), e);
- }
- };
-
- @BeforeClass
- public static void classSetup() {
- AbstractSessionTest.initializeLogging();
- Fixture.logHeader();
- }
-
- /**
- * Initialize logging support.
- */
- private static void initializeLogging() {
- Properties p = new Properties();
- try {
- p.load(AbstractSessionTest.class.getResourceAsStream("/log4j.properties"));
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
- PropertyConfigurator.configure(p);
- }
-
- /**
- * test session
- */
- protected Session session = null;
-
- @Before
- public void setUp() throws Exception {
- SessionFactory factory = Fixture.getSessionFactory();
- this.session = factory.createSession(Fixture.getParamter());
- Fixture.setUpTestData(this.session);
- }
-
- @After
- public void tearDown() throws Exception {
- Fixture.teardownTestData(this.session);
- }
+ /**
+ * trace each junit error
+ */
+ @Rule
+ public MethodRule watch = new TestWatchman() {
+ @Override
+ public void failed(Throwable e, FrameworkMethod method) {
+ super.failed(e, method);
+ AbstractSessionTest.this.log.error(method.getName(), e);
+ }
+ };
+
+ @BeforeClass
+ public static void classSetup() {
+ AbstractSessionTest.initializeLogging();
+ Fixture.logHeader();
+ }
+
+ /**
+ * Initialize logging support.
+ */
+ private static void initializeLogging() {
+ Properties p = new Properties();
+ try {
+ p.load(AbstractSessionTest.class.getResourceAsStream("/log4j.properties"));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ PropertyConfigurator.configure(p);
+ }
+
+ /**
+ * test session
+ */
+ protected Session session = null;
+
+ @Before
+ public void setUp() throws Exception {
+ SessionFactory factory = Fixture.getSessionFactory();
+ this.session = factory.createSession(Fixture.getParamter());
+ Fixture.setUpTestData(this.session);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ Fixture.teardownTestData(this.session);
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/Fixture.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/Fixture.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/Fixture.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/Fixture.java Fri Apr 16 14:19:32 2010
@@ -52,8 +52,7 @@ public class Fixture {
/*
* general
*/
- public static String TEST_ROOT_FOLDER_NAME = "fit_"
- + UUID.randomUUID().toString();
+ public static String TEST_ROOT_FOLDER_NAME = "fit_" + UUID.randomUUID().toString();
/*
* test data setup
@@ -110,8 +109,7 @@ public class Fixture {
public static void init() {
/* get optional path from system properties */
- String pathname = System
- .getProperty(FixtureSessionParameter.CONFIG_PATH);
+ String pathname = System.getProperty(FixtureSessionParameter.CONFIG_PATH);
pathname = (pathname != null) ? pathname.trim() : null;
Properties properties = null;
Map<String, String> sessionParameter = null;
@@ -125,8 +123,7 @@ public class Fixture {
properties.load(in);
} else {
// get default settings
- InputStream in = Fixture.class
- .getResourceAsStream(Fixture.CONNECTION_PATH);
+ InputStream in = Fixture.class.getResourceAsStream(Fixture.CONNECTION_PATH);
properties = new Properties();
properties.load(in);
}
@@ -143,10 +140,8 @@ public class Fixture {
Fixture.setParamter(sessionParameter);
/* load factory class */
- factoryClassName = sessionParameter
- .get(FixtureSessionParameter.SESSION_FACTORY);
- if (factoryClassName != null
- && !"".equalsIgnoreCase(factoryClassName)) {
+ factoryClassName = sessionParameter.get(FixtureSessionParameter.SESSION_FACTORY);
+ if (factoryClassName != null && !"".equalsIgnoreCase(factoryClassName)) {
Class<?> clazz = Class.forName(factoryClassName);
factory = (SessionFactory) clazz.newInstance();
} else {
@@ -178,20 +173,14 @@ public class Fixture {
/*
* log header only once
*/
- Fixture.log
- .info("---------------------------------------------------------------");
- Fixture.log
- .info("--- OpenCMIS FIT Test Suite (1) --------------------------------");
- Fixture.log
- .info("---------------------------------------------------------------");
- Fixture.log.info("config path (prop): "
- + System.getProperty(FixtureSessionParameter.CONFIG_PATH));
- Fixture.log.info("session factory: "
- + Fixture.getSessionFactory().getClass());
+ Fixture.log.info("---------------------------------------------------------------");
+ Fixture.log.info("--- OpenCMIS FIT Test Suite (1) --------------------------------");
+ Fixture.log.info("---------------------------------------------------------------");
+ Fixture.log.info("config path (prop): " + System.getProperty(FixtureSessionParameter.CONFIG_PATH));
+ Fixture.log.info("session factory: " + Fixture.getSessionFactory().getClass());
Fixture.log.info("session parameter: " + Fixture.getParamter());
- Fixture.log
- .info("---------------------------------------------------------------");
+ Fixture.log.info("---------------------------------------------------------------");
Fixture.isLogged = true;
}
@@ -200,10 +189,11 @@ public class Fixture {
public static void enableAtomPub() {
Fixture.CONNECTION_PATH = Fixture.CONNECTION_ATOM_PATH;
}
-
+
public static void enableWebServices() {
Fixture.CONNECTION_PATH = Fixture.CONNECTION_WS_PATH;
}
+
public static String getTestRootId() {
return Fixture.testData.getTestRootId();
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/FixtureSessionParameter.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/FixtureSessionParameter.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/FixtureSessionParameter.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/FixtureSessionParameter.java Fri Apr 16 14:19:32 2010
@@ -27,9 +27,9 @@ public interface FixtureSessionParameter
/**
* CONFIG_PATH is referenced in pom.xml! If you change here then change pom.
*/
- static final String CONFIG_PATH = "org.apache.chemistry.opencmis.fit.runtime.config.path";
+ static final String CONFIG_PATH = "org.apache.chemistry.opencmis.fit.runtime.config.path";
- static final String SESSION_FACTORY = "org.apache.chemistry.opencmis.fit.runtime.session.factory";
+ static final String SESSION_FACTORY = "org.apache.chemistry.opencmis.fit.runtime.session.factory";
static final String TEST_ROOT_FOLDER_ID = "org.apache.chemistry.opencmis.fit.runtime.root.folder.id";
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/FixtureSetup.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/FixtureSetup.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/FixtureSetup.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/FixtureSetup.java Fri Apr 16 14:19:32 2010
@@ -40,29 +40,24 @@ public class FixtureSetup {
private String repositoryId = null;
public void teardown() {
- this.binding.getObjectService().deleteTree(this.repositoryId,
- this.testRootFolderId, true, UnfileObject.DELETE, true, null);
+ this.binding.getObjectService().deleteTree(this.repositoryId, this.testRootFolderId, true, UnfileObject.DELETE,
+ true, null);
}
public void setup() {
- this.repositoryId = Fixture.getParamter().get(
- SessionParameter.REPOSITORY_ID);
+ this.repositoryId = Fixture.getParamter().get(SessionParameter.REPOSITORY_ID);
Assert.assertNotNull(this.repositoryId);
- this.binding = CmisBindingFactory.newInstance().createCmisBinding(
- Fixture.getParamter());
+ this.binding = CmisBindingFactory.newInstance().createCmisBinding(Fixture.getParamter());
Assert.assertNotNull(this.binding);
// root folder
- if (Fixture.getParamter().containsKey(
- FixtureSessionParameter.TEST_ROOT_FOLDER_ID)) {
+ if (Fixture.getParamter().containsKey(FixtureSessionParameter.TEST_ROOT_FOLDER_ID)) {
// test root folder
- this.rootFolderId = Fixture.getParamter().get(
- FixtureSessionParameter.TEST_ROOT_FOLDER_ID);
+ this.rootFolderId = Fixture.getParamter().get(FixtureSessionParameter.TEST_ROOT_FOLDER_ID);
Assert.assertNotNull(this.rootFolderId);
} else {
- RepositoryInfo rid = this.binding.getRepositoryService()
- .getRepositoryInfo(this.repositoryId, null);
+ RepositoryInfo rid = this.binding.getRepositoryService().getRepositoryInfo(this.repositoryId, null);
Assert.assertNotNull(rid);
this.rootFolderId = rid.getRootFolderId();
Assert.assertNotNull(this.rootFolderId);
@@ -76,22 +71,18 @@ public class FixtureSetup {
// create test root folder
List<PropertyData<?>> propList = new ArrayList<PropertyData<?>>();
- propList.add(this.binding.getObjectFactory().createPropertyStringData(
- PropertyIds.NAME, Fixture.TEST_ROOT_FOLDER_NAME));
- propList.add(this.binding.getObjectFactory().createPropertyIdData(
- PropertyIds.OBJECT_TYPE_ID, folderTypeId));
-
- Properties properties = this.binding.getObjectFactory()
- .createPropertiesData(propList);
-
- this.testRootFolderId = this.binding.getObjectService().createFolder(
- this.repositoryId, properties, this.rootFolderId, null, null,
- null, null);
+ propList.add(this.binding.getObjectFactory().createPropertyStringData(PropertyIds.NAME,
+ Fixture.TEST_ROOT_FOLDER_NAME));
+ propList.add(this.binding.getObjectFactory().createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, folderTypeId));
+
+ Properties properties = this.binding.getObjectFactory().createPropertiesData(propList);
+
+ this.testRootFolderId = this.binding.getObjectService().createFolder(this.repositoryId, properties,
+ this.rootFolderId, null, null, null, null);
Assert.assertNotNull(this.testRootFolderId);
- ObjectGenerator og = new ObjectGenerator(binding.getObjectFactory(),
- binding.getNavigationService(), binding.getObjectService(),
- this.repositoryId);
+ ObjectGenerator og = new ObjectGenerator(binding.getObjectFactory(), binding.getNavigationService(), binding
+ .getObjectService(), this.repositoryId);
og.setContentSizeInKB(10);
og.setDocumentTypeId(documentTypeId);
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyAclCapabilityIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyAclCapabilityIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyAclCapabilityIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyAclCapabilityIT.java Fri Apr 16 14:19:32 2010
@@ -33,42 +33,43 @@ import org.junit.Test;
public class ReadOnlyAclCapabilityIT extends AbstractSessionTest {
- private AclCapabilities aclCapabilities = null;
+ private AclCapabilities aclCapabilities = null;
- @Before
- public void setup() throws Exception {
- RepositoryInfo r = this.session.getRepositoryInfo();
- // capabilities
- RepositoryCapabilities repcap = r.getCapabilities();
- CapabilityAcl capacl = repcap.getAclCapability();
-
- if (capacl != CapabilityAcl.NONE) {
- // acl capabilities
- this.aclCapabilities = r.getAclCapabilities();
- }
-
- Assume.assumeNotNull(this.aclCapabilities);
- }
-
- @Test
- public void repositoryCapabilitiesAclPropagation() {
- AclPropagation aclprop = this.aclCapabilities.getAclPropagation();
- switch (aclprop) {
- case OBJECTONLY:
- break;
- case PROPAGATE:
- break;
- case REPOSITORYDETERMINED:
- break;
- default:
- Assert.fail("enumeration not supported");
- }
- }
-
- @Test
- public void repositoryCapabilitiesAclPermissionMapping() {
- PermissionMapping apm = this.aclCapabilities.getPermissionMapping().get(PermissionMapping.CAN_ADD_POLICY_OBJECT);
- List<String> aclps = apm.getPermissions();
- Assert.assertNotNull(aclps);
- }
+ @Before
+ public void setup() throws Exception {
+ RepositoryInfo r = this.session.getRepositoryInfo();
+ // capabilities
+ RepositoryCapabilities repcap = r.getCapabilities();
+ CapabilityAcl capacl = repcap.getAclCapability();
+
+ if (capacl != CapabilityAcl.NONE) {
+ // acl capabilities
+ this.aclCapabilities = r.getAclCapabilities();
+ }
+
+ Assume.assumeNotNull(this.aclCapabilities);
+ }
+
+ @Test
+ public void repositoryCapabilitiesAclPropagation() {
+ AclPropagation aclprop = this.aclCapabilities.getAclPropagation();
+ switch (aclprop) {
+ case OBJECTONLY:
+ break;
+ case PROPAGATE:
+ break;
+ case REPOSITORYDETERMINED:
+ break;
+ default:
+ Assert.fail("enumeration not supported");
+ }
+ }
+
+ @Test
+ public void repositoryCapabilitiesAclPermissionMapping() {
+ PermissionMapping apm = this.aclCapabilities.getPermissionMapping()
+ .get(PermissionMapping.CAN_ADD_POLICY_OBJECT);
+ List<String> aclps = apm.getPermissions();
+ Assert.assertNotNull(aclps);
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyContentStreamIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyContentStreamIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyContentStreamIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyContentStreamIT.java Fri Apr 16 14:19:32 2010
@@ -30,28 +30,27 @@ import org.junit.Test;
public class ReadOnlyContentStreamIT extends AbstractSessionTest {
- @Test
- public void readContentStream() throws IOException {
- String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/"
- + FixtureData.DOCUMENT1_NAME.toString();
- Document document = (Document) this.session.getObjectByPath(path);
- Assert.assertNotNull("document not found: " + path, document);
-
- ContentStream s = document.getContentStream();
-
- Assert.assertNotNull(s.getMimeType());
- s.getLength();
- s.getFileName();
-
- InputStream is = s.getStream();
- Assert.assertNotNull(is);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- baos.write(is.read());
- byte[] b = baos.toByteArray();
-
- Assert.assertNotNull(b);
- Assert.assertTrue(b.length > 0);
- }
+ @Test
+ public void readContentStream() throws IOException {
+ String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/" + FixtureData.DOCUMENT1_NAME.toString();
+ Document document = (Document) this.session.getObjectByPath(path);
+ Assert.assertNotNull("document not found: " + path, document);
+
+ ContentStream s = document.getContentStream();
+
+ Assert.assertNotNull(s.getMimeType());
+ s.getLength();
+ s.getFileName();
+
+ InputStream is = s.getStream();
+ Assert.assertNotNull(is);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ baos.write(is.read());
+ byte[] b = baos.toByteArray();
+
+ Assert.assertNotNull(b);
+ Assert.assertTrue(b.length > 0);
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyCreateSessionIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyCreateSessionIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyCreateSessionIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyCreateSessionIT.java Fri Apr 16 14:19:32 2010
@@ -36,49 +36,47 @@ import org.junit.Test;
*/
public class ReadOnlyCreateSessionIT {
- protected Log log = LogFactory.getLog(this.getClass());
+ protected Log log = LogFactory.getLog(this.getClass());
- @Before
- public void setup() {
- }
-
- @Test
- public void createDefaultSession() {
- SessionFactory factory = Fixture.getSessionFactory();
-
- Hashtable<String, String> parameter = new Hashtable<String, String>(Fixture.getParamter());
- parameter.remove(SessionParameter.SESSION_TYPE);
-
- Session s = factory.createSession(parameter);
- Assert.assertNotNull(s);
- }
-
- @Test
- public void createPersistentSession() {
- SessionFactory factory = Fixture.getSessionFactory();
-
- Hashtable<String, String> parameter = new Hashtable<String, String>(Fixture.getParamter());
- parameter.put(SessionParameter.SESSION_TYPE, SessionType.PERSISTENT.value());
-
- Session s = factory.createSession(parameter);
- Assert.assertNotNull(s);
- }
-
- @Test
- public void createTransientSession() {
- SessionFactory factory = Fixture.getSessionFactory();
-
- Hashtable<String, String> parameter = new Hashtable<String, String>(Fixture.getParamter());
- parameter.put(SessionParameter.SESSION_TYPE, SessionType.TRANSIENT.value());
-
- try {
- @SuppressWarnings("unused")
- Session s = factory.createSession(parameter);
- Assert
- .fail("CmisNotSupportedException expected, because Transient Session is not supported yet.");
- }
- catch (CmisNotSupportedException e) {
+ @Before
+ public void setup() {
+ }
- }
- }
+ @Test
+ public void createDefaultSession() {
+ SessionFactory factory = Fixture.getSessionFactory();
+
+ Hashtable<String, String> parameter = new Hashtable<String, String>(Fixture.getParamter());
+ parameter.remove(SessionParameter.SESSION_TYPE);
+
+ Session s = factory.createSession(parameter);
+ Assert.assertNotNull(s);
+ }
+
+ @Test
+ public void createPersistentSession() {
+ SessionFactory factory = Fixture.getSessionFactory();
+
+ Hashtable<String, String> parameter = new Hashtable<String, String>(Fixture.getParamter());
+ parameter.put(SessionParameter.SESSION_TYPE, SessionType.PERSISTENT.value());
+
+ Session s = factory.createSession(parameter);
+ Assert.assertNotNull(s);
+ }
+
+ @Test
+ public void createTransientSession() {
+ SessionFactory factory = Fixture.getSessionFactory();
+
+ Hashtable<String, String> parameter = new Hashtable<String, String>(Fixture.getParamter());
+ parameter.put(SessionParameter.SESSION_TYPE, SessionType.TRANSIENT.value());
+
+ try {
+ @SuppressWarnings("unused")
+ Session s = factory.createSession(parameter);
+ Assert.fail("CmisNotSupportedException expected, because Transient Session is not supported yet.");
+ } catch (CmisNotSupportedException e) {
+
+ }
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyDiscoverIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyDiscoverIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyDiscoverIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyDiscoverIT.java Fri Apr 16 14:19:32 2010
@@ -22,8 +22,7 @@ import java.util.List;
import junit.framework.Assert;
-import org.apache.chemistry.opencmis.client.api.QueryResult;
-//import org.apache.chemistry.opencmis.client.api.util.PagingList;
+import org.apache.chemistry.opencmis.client.api.QueryResult; //import org.apache.chemistry.opencmis.client.api.util.PagingList;
import org.apache.chemistry.opencmis.commons.enums.CapabilityChanges;
import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery;
import org.apache.commons.logging.Log;
@@ -32,42 +31,42 @@ import org.junit.Test;
public class ReadOnlyDiscoverIT extends AbstractSessionTest {
- private static Log log = LogFactory.getLog(ReadOnlyDiscoverIT.class);
+ private static Log log = LogFactory.getLog(ReadOnlyDiscoverIT.class);
- @Test
- public void query() {
- CapabilityQuery query = this.session.getRepositoryInfo().getCapabilities().getQueryCapability();
-
- switch (query) {
- case NONE:
- ReadOnlyDiscoverIT.log.info("queries not supported");
- break;
- default:
-// PagingList<QueryResult> resultSet = this.session.query(FixtureData.QUERY.toString(), false, 2);
-// Assert.assertNotNull(resultSet);
-// //Assert.assertFalse(resultSet.isEmpty());
-// for (List<QueryResult> lo : resultSet) {
-// for (QueryResult o : lo) {
-// Assert.assertNotNull(o);
-// }
-// }
-
- break;
- }
-
- }
-
- @Test
- public void changes() {
- CapabilityChanges changes = this.session.getRepositoryInfo().getCapabilities()
- .getChangesCapability();
-
- switch (changes) {
- case NONE:
- ReadOnlyDiscoverIT.log.info("changes not supported");
- break;
- default:
- break;
- }
- }
+ @Test
+ public void query() {
+ CapabilityQuery query = this.session.getRepositoryInfo().getCapabilities().getQueryCapability();
+
+ switch (query) {
+ case NONE:
+ ReadOnlyDiscoverIT.log.info("queries not supported");
+ break;
+ default:
+ // PagingList<QueryResult> resultSet =
+ // this.session.query(FixtureData.QUERY.toString(), false, 2);
+ // Assert.assertNotNull(resultSet);
+ // //Assert.assertFalse(resultSet.isEmpty());
+ // for (List<QueryResult> lo : resultSet) {
+ // for (QueryResult o : lo) {
+ // Assert.assertNotNull(o);
+ // }
+ // }
+
+ break;
+ }
+
+ }
+
+ @Test
+ public void changes() {
+ CapabilityChanges changes = this.session.getRepositoryInfo().getCapabilities().getChangesCapability();
+
+ switch (changes) {
+ case NONE:
+ ReadOnlyDiscoverIT.log.info("changes not supported");
+ break;
+ default:
+ break;
+ }
+ }
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyNavigationIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyNavigationIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyNavigationIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyNavigationIT.java Fri Apr 16 14:19:32 2010
@@ -25,8 +25,7 @@ import junit.framework.Assert;
import org.apache.chemistry.opencmis.client.api.CmisObject;
import org.apache.chemistry.opencmis.client.api.FileableCmisObject;
import org.apache.chemistry.opencmis.client.api.Folder;
-import org.apache.chemistry.opencmis.client.api.Tree;
-// import org.apache.chemistry.opencmis.client.api.util.PagingList;
+import org.apache.chemistry.opencmis.client.api.Tree; // import org.apache.chemistry.opencmis.client.api.util.PagingList;
import org.junit.Test;
public class ReadOnlyNavigationIT extends AbstractSessionTest {
@@ -37,15 +36,15 @@ public class ReadOnlyNavigationIT extend
Folder folder = (Folder) this.session.getObjectByPath(path);
Assert.assertNotNull("folder not found: " + path, folder);
-// PagingList<CmisObject> pl = folder.getChildren(1);
-// Assert.assertNotNull(pl);
-// // Assert.assertFalse(pl.isEmpty());
-//
-// for (List<CmisObject> cl : pl) {
-// for (CmisObject o : cl) {
-// Assert.assertNotNull(o);
-// }
-// }
+ // PagingList<CmisObject> pl = folder.getChildren(1);
+ // Assert.assertNotNull(pl);
+ // // Assert.assertFalse(pl.isEmpty());
+ //
+ // for (List<CmisObject> cl : pl) {
+ // for (CmisObject o : cl) {
+ // Assert.assertNotNull(o);
+ // }
+ // }
}
@Test
@@ -54,15 +53,15 @@ public class ReadOnlyNavigationIT extend
Folder folder = (Folder) this.session.getObjectByPath(path);
Assert.assertNotNull("folder not found: " + path, folder);
-// PagingList<CmisObject> pl = folder.getChildren(1000);
-// Assert.assertNotNull(pl);
-// // Assert.assertFalse(pl.isEmpty());
-//
-// for (List<CmisObject> cl : pl) {
-// for (CmisObject o : cl) {
-// Assert.assertNotNull(o);
-// }
-// }
+ // PagingList<CmisObject> pl = folder.getChildren(1000);
+ // Assert.assertNotNull(pl);
+ // // Assert.assertFalse(pl.isEmpty());
+ //
+ // for (List<CmisObject> cl : pl) {
+ // for (CmisObject o : cl) {
+ // Assert.assertNotNull(o);
+ // }
+ // }
}
@Test
@@ -71,18 +70,17 @@ public class ReadOnlyNavigationIT extend
Folder folder = (Folder) this.session.getObjectByPath(path);
Assert.assertNotNull("folder not found: " + path, folder);
-// PagingList<CmisObject> pl = folder.getChildren(2);
-// Assert.assertNotNull(pl);
-// // Assert.assertFalse(pl.isEmpty());
-//
-// for (List<CmisObject> cl : pl) {
-// for (CmisObject o : cl) {
-// Assert.assertNotNull(o);
-// }
-// }
+ // PagingList<CmisObject> pl = folder.getChildren(2);
+ // Assert.assertNotNull(pl);
+ // // Assert.assertFalse(pl.isEmpty());
+ //
+ // for (List<CmisObject> cl : pl) {
+ // for (CmisObject o : cl) {
+ // Assert.assertNotNull(o);
+ // }
+ // }
}
-
@Test
public void navigateDescendantsMin() {
String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME;
@@ -98,6 +96,7 @@ public class ReadOnlyNavigationIT extend
Assert.assertNotNull(o.getItem());
}
}
+
@Test
public void navigateDescendantsMax() {
String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME;
@@ -113,6 +112,7 @@ public class ReadOnlyNavigationIT extend
Assert.assertNotNull(o.getItem());
}
}
+
@Test
public void navigateDescendantsMed() {
String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME;
@@ -144,6 +144,7 @@ public class ReadOnlyNavigationIT extend
Assert.assertNotNull(o.getItem());
}
}
+
@Test
public void navigateTreeMin() {
String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME;
@@ -159,6 +160,7 @@ public class ReadOnlyNavigationIT extend
Assert.assertNotNull(o.getItem());
}
}
+
@Test
public void navigateTreeMax() {
String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME;
@@ -181,11 +183,11 @@ public class ReadOnlyNavigationIT extend
Folder folder = (Folder) this.session.getObjectByPath(path);
Assert.assertNotNull("folder not found: " + path, folder);
-// PagingList<CmisObject> pl = folder.getChildren(2);
-// Assert.assertNotNull(pl);
-// // Assert.assertFalse(pl.isEmpty());
-//
-// List<CmisObject> firstPage = pl.get(0);
-// Assert.assertNotNull(firstPage);
+ // PagingList<CmisObject> pl = folder.getChildren(2);
+ // Assert.assertNotNull(pl);
+ // // Assert.assertFalse(pl.isEmpty());
+ //
+ // List<CmisObject> firstPage = pl.get(0);
+ // Assert.assertNotNull(firstPage);
}
}
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyObjectIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyObjectIT.java?rev=934904&r1=934903&r2=934904&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyObjectIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyObjectIT.java Fri Apr 16 14:19:32 2010
@@ -40,253 +40,233 @@ import org.junit.Test;
*/
public class ReadOnlyObjectIT extends AbstractSessionTest {
- @Test
- public void verifyRoot() {
- Folder root = this.session.getRootFolder();
- Assert.assertNotNull(root);
-
- root.getName();
- Assert.assertNotNull(root.getId());
- Assert.assertNull(root.getFolderParent());
- Assert.assertNotNull(root.getType());
- Assert.assertEquals(FixtureData.FOLDER_TYPE_ID.toString(), root
- .getType().getId());
- }
-
- @Test
- public void readTestFolder() {
- String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME;
- Folder folder = (Folder) this.session.getObjectByPath(path);
- Assert.assertNotNull("folder not found: " + path, folder);
-
- Assert.assertEquals(Fixture.TEST_ROOT_FOLDER_NAME, folder.getName());
- Assert.assertNotNull(folder.getId());
- Assert.assertNotNull(folder.getFolderParent());
- Assert.assertNotNull(folder.getType());
- Assert.assertEquals(FixtureData.FOLDER_TYPE_ID.toString(), folder
- .getType().getId());
- Assert.assertNotNull(folder.getBaseType());
- Assert.assertEquals(ObjectType.FOLDER_BASETYPE_ID, folder.getBaseType()
- .getId());
-
- Assert.assertNotNull(folder.getCreatedBy());
- Assert.assertEquals(Fixture.getParamter().get(SessionParameter.USER),
- folder.getCreatedBy());
- Assert.assertNotNull(folder.getLastModifiedBy());
- Assert.assertEquals(Fixture.getParamter().get(SessionParameter.USER),
- folder.getLastModifiedBy());
- Assert.assertNotNull(folder.getLastModificationDate());
- Assert.assertNotNull(folder.getCreationDate());
-
- }
-
- @Test
- public void readTestDocument() {
- String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/"
- + FixtureData.DOCUMENT1_NAME;
- Document document = (Document) this.session.getObjectByPath(path);
- Assert.assertNotNull("document not found: " + path, document);
-
- Assert.assertNotNull(document.getId());
- Assert.assertNotNull(document.getBaseType());
- Assert.assertEquals(ObjectType.DOCUMENT_BASETYPE_ID, document
- .getBaseType().getId());
- Assert.assertEquals(FixtureData.DOCUMENT1_NAME.toString(), document
- .getName());
- Assert.assertNotNull(document.getType());
- Assert.assertEquals(FixtureData.DOCUMENT_TYPE_ID.toString(), document
- .getType().getId());
- }
-
- public void readDocumentDefaultProperties() {
- String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/"
- + FixtureData.DOCUMENT1_NAME;
- Document document = (Document) this.session.getObjectByPath(path);
- Assert.assertNotNull("document not found: " + path, document);
-
- Assert.assertNotNull(document.getCreatedBy());
- Assert.assertEquals(Fixture.getParamter().get(SessionParameter.USER),
- document.getCreatedBy());
- Assert.assertNotNull(document.getLastModifiedBy());
- Assert.assertEquals(Fixture.getParamter().get(SessionParameter.USER),
- document.getLastModifiedBy());
- Assert.assertNotNull(document.getLastModificationDate());
- Assert.assertNotNull(document.getCreationDate());
- }
-
- @Test
- public void readDocumentPropertiesWithFilter() {
- String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/"
- + FixtureData.DOCUMENT1_NAME;
- Document document = (Document) this.session.getObjectByPath(path);
- Assert.assertNotNull("document not found: " + path, document);
-
- List<Property<?>> l = document.getProperties();
- Assert.assertNotNull(l);
- Assert.assertEquals(false, l.isEmpty());
- Iterator<Property<?>> i = l.iterator();
- while (i.hasNext()) {
- Property<?> p = i.next();
- Object value = p.getFirstValue();
- PropertyType t = p.getType();
-
- Assert.assertNotNull(p);
- Assert.assertNotNull(t);
-
- switch (t) {
- case INTEGER:
- BigInteger n = (BigInteger) value;
- Assert.assertNotNull(n);
- break;
- case STRING:
- // String s = (String) value;
- // can be null Assert.assertNotNull(s);
- break;
- case BOOLEAN:
- Boolean b = (Boolean) value;
- Assert.assertNotNull(b);
- break;
- case DATETIME:
- Calendar c = (Calendar) value;
- Assert.assertNotNull(c);
- break;
- case DECIMAL:
- Number num = (Number) value;
- if (num instanceof Double) {
- Double d = (Double) num;
- Assert.assertNotNull(d);
- } else if (num instanceof Float) {
- Float f = (Float) num;
- Assert.assertNotNull(f);
- } else {
- Assert.fail("Number not supported: " + num.toString());
- }
- break;
- case HTML:
- String html = (String) value;
- Assert.assertNotNull(html);
- break;
- case ID:
- // String id = (String) value;
- // can be null Assert.assertNotNull(id);
- break;
- case URI:
- URI uri = (URI) value;
- Assert.assertNotNull(uri);
- break;
- default:
- Assert.fail("PropertyType not supported: " + t);
- }
- }
-
- }
-
- @Test
- public void readDocumentProperties() {
- String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/"
- + FixtureData.DOCUMENT1_NAME;
- Document document = (Document) this.session.getObjectByPath(path);
- Assert.assertNotNull("document not found: " + path, document);
-
- List<Property<?>> l = document.getProperties();
- Assert.assertNotNull(l);
- Assert.assertEquals(false, l.isEmpty());
- Iterator<Property<?>> i = l.iterator();
- while (i.hasNext()) {
- Property<?> p = i.next();
- Object value = p.getFirstValue();
- PropertyType t = p.getType();
-
- Assert.assertNotNull(p);
- Assert.assertNotNull(t);
-
- switch (t) {
- case INTEGER:
- BigInteger n = (BigInteger) value;
- Assert.assertNotNull(n);
- break;
- case STRING:
- // String s = (String) value;
- // can be null Assert.assertNotNull(s);
- break;
- case BOOLEAN:
- Boolean b = (Boolean) value;
- Assert.assertNotNull(b);
- break;
- case DATETIME:
- Calendar c = (Calendar) value;
- Assert.assertNotNull(c);
- break;
- case DECIMAL:
- Number num = (Number) value;
- if (num instanceof Double) {
- Double d = (Double) num;
- Assert.assertNotNull(d);
- } else if (num instanceof Float) {
- Float f = (Float) num;
- Assert.assertNotNull(f);
- } else {
- Assert.fail("Number not supported: " + num.toString());
- }
- break;
- case HTML:
- String html = (String) value;
- Assert.assertNotNull(html);
- break;
- case ID:
- // String id = (String) value;
- // can be null Assert.assertNotNull(id);
- break;
- case URI:
- URI uri = (URI) value;
- Assert.assertNotNull(uri);
- break;
- default:
- Assert.fail("PropertyType not supported: " + t);
- }
- }
- }
-
- @Test
- public void readSingleProperty() {
- String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/"
- + FixtureData.DOCUMENT1_NAME;
- Document document = (Document) this.session.getObjectByPath(path);
- Assert.assertNotNull("document not found: " + path, document);
-
- Property<String> p = document.getProperty(PropertyIds.OBJECT_ID);
- Assert.assertNotNull(p);
- String v1 = p.getFirstValue();
- Assert.assertNotNull(v1);
-
- String v2 = document.getPropertyValue(PropertyIds.OBJECT_ID);
- Assert.assertNotNull(v2);
- Assert.assertEquals(v1, v2);
-
- }
-
- @Test
- public void readMultiValueProperty() {
- String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/"
- + FixtureData.DOCUMENT1_NAME;
- Document document = (Document) this.session.getObjectByPath(path);
- Assert.assertNotNull("document not found: " + path, document);
-
- Property<String> p = document
- .getProperty(FixtureData.PROPERTY_NAME_STRING_MULTI_VALUED
- .toString());
- if (p != null) {
- Assert.assertTrue(p.isMultiValued());
- List<String> v1 = p.getValues();
- Assert.assertNotNull(v1);
- Assert.assertFalse(v1.isEmpty());
-
- List<String> v2 = document
- .getPropertyMultivalue(FixtureData.PROPERTY_NAME_STRING_MULTI_VALUED
- .toString());
- Assert.assertNotNull(v2);
- Assert.assertFalse(v2.isEmpty());
- Assert.assertEquals(v1, v2);
- }
- }
+ @Test
+ public void verifyRoot() {
+ Folder root = this.session.getRootFolder();
+ Assert.assertNotNull(root);
+
+ root.getName();
+ Assert.assertNotNull(root.getId());
+ Assert.assertNull(root.getFolderParent());
+ Assert.assertNotNull(root.getType());
+ Assert.assertEquals(FixtureData.FOLDER_TYPE_ID.toString(), root.getType().getId());
+ }
+
+ @Test
+ public void readTestFolder() {
+ String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME;
+ Folder folder = (Folder) this.session.getObjectByPath(path);
+ Assert.assertNotNull("folder not found: " + path, folder);
+
+ Assert.assertEquals(Fixture.TEST_ROOT_FOLDER_NAME, folder.getName());
+ Assert.assertNotNull(folder.getId());
+ Assert.assertNotNull(folder.getFolderParent());
+ Assert.assertNotNull(folder.getType());
+ Assert.assertEquals(FixtureData.FOLDER_TYPE_ID.toString(), folder.getType().getId());
+ Assert.assertNotNull(folder.getBaseType());
+ Assert.assertEquals(ObjectType.FOLDER_BASETYPE_ID, folder.getBaseType().getId());
+
+ Assert.assertNotNull(folder.getCreatedBy());
+ Assert.assertEquals(Fixture.getParamter().get(SessionParameter.USER), folder.getCreatedBy());
+ Assert.assertNotNull(folder.getLastModifiedBy());
+ Assert.assertEquals(Fixture.getParamter().get(SessionParameter.USER), folder.getLastModifiedBy());
+ Assert.assertNotNull(folder.getLastModificationDate());
+ Assert.assertNotNull(folder.getCreationDate());
+
+ }
+
+ @Test
+ public void readTestDocument() {
+ String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/" + FixtureData.DOCUMENT1_NAME;
+ Document document = (Document) this.session.getObjectByPath(path);
+ Assert.assertNotNull("document not found: " + path, document);
+
+ Assert.assertNotNull(document.getId());
+ Assert.assertNotNull(document.getBaseType());
+ Assert.assertEquals(ObjectType.DOCUMENT_BASETYPE_ID, document.getBaseType().getId());
+ Assert.assertEquals(FixtureData.DOCUMENT1_NAME.toString(), document.getName());
+ Assert.assertNotNull(document.getType());
+ Assert.assertEquals(FixtureData.DOCUMENT_TYPE_ID.toString(), document.getType().getId());
+ }
+
+ public void readDocumentDefaultProperties() {
+ String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/" + FixtureData.DOCUMENT1_NAME;
+ Document document = (Document) this.session.getObjectByPath(path);
+ Assert.assertNotNull("document not found: " + path, document);
+
+ Assert.assertNotNull(document.getCreatedBy());
+ Assert.assertEquals(Fixture.getParamter().get(SessionParameter.USER), document.getCreatedBy());
+ Assert.assertNotNull(document.getLastModifiedBy());
+ Assert.assertEquals(Fixture.getParamter().get(SessionParameter.USER), document.getLastModifiedBy());
+ Assert.assertNotNull(document.getLastModificationDate());
+ Assert.assertNotNull(document.getCreationDate());
+ }
+
+ @Test
+ public void readDocumentPropertiesWithFilter() {
+ String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/" + FixtureData.DOCUMENT1_NAME;
+ Document document = (Document) this.session.getObjectByPath(path);
+ Assert.assertNotNull("document not found: " + path, document);
+
+ List<Property<?>> l = document.getProperties();
+ Assert.assertNotNull(l);
+ Assert.assertEquals(false, l.isEmpty());
+ Iterator<Property<?>> i = l.iterator();
+ while (i.hasNext()) {
+ Property<?> p = i.next();
+ Object value = p.getFirstValue();
+ PropertyType t = p.getType();
+
+ Assert.assertNotNull(p);
+ Assert.assertNotNull(t);
+
+ switch (t) {
+ case INTEGER:
+ BigInteger n = (BigInteger) value;
+ Assert.assertNotNull(n);
+ break;
+ case STRING:
+ // String s = (String) value;
+ // can be null Assert.assertNotNull(s);
+ break;
+ case BOOLEAN:
+ Boolean b = (Boolean) value;
+ Assert.assertNotNull(b);
+ break;
+ case DATETIME:
+ Calendar c = (Calendar) value;
+ Assert.assertNotNull(c);
+ break;
+ case DECIMAL:
+ Number num = (Number) value;
+ if (num instanceof Double) {
+ Double d = (Double) num;
+ Assert.assertNotNull(d);
+ } else if (num instanceof Float) {
+ Float f = (Float) num;
+ Assert.assertNotNull(f);
+ } else {
+ Assert.fail("Number not supported: " + num.toString());
+ }
+ break;
+ case HTML:
+ String html = (String) value;
+ Assert.assertNotNull(html);
+ break;
+ case ID:
+ // String id = (String) value;
+ // can be null Assert.assertNotNull(id);
+ break;
+ case URI:
+ URI uri = (URI) value;
+ Assert.assertNotNull(uri);
+ break;
+ default:
+ Assert.fail("PropertyType not supported: " + t);
+ }
+ }
+
+ }
+
+ @Test
+ public void readDocumentProperties() {
+ String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/" + FixtureData.DOCUMENT1_NAME;
+ Document document = (Document) this.session.getObjectByPath(path);
+ Assert.assertNotNull("document not found: " + path, document);
+
+ List<Property<?>> l = document.getProperties();
+ Assert.assertNotNull(l);
+ Assert.assertEquals(false, l.isEmpty());
+ Iterator<Property<?>> i = l.iterator();
+ while (i.hasNext()) {
+ Property<?> p = i.next();
+ Object value = p.getFirstValue();
+ PropertyType t = p.getType();
+
+ Assert.assertNotNull(p);
+ Assert.assertNotNull(t);
+
+ switch (t) {
+ case INTEGER:
+ BigInteger n = (BigInteger) value;
+ Assert.assertNotNull(n);
+ break;
+ case STRING:
+ // String s = (String) value;
+ // can be null Assert.assertNotNull(s);
+ break;
+ case BOOLEAN:
+ Boolean b = (Boolean) value;
+ Assert.assertNotNull(b);
+ break;
+ case DATETIME:
+ Calendar c = (Calendar) value;
+ Assert.assertNotNull(c);
+ break;
+ case DECIMAL:
+ Number num = (Number) value;
+ if (num instanceof Double) {
+ Double d = (Double) num;
+ Assert.assertNotNull(d);
+ } else if (num instanceof Float) {
+ Float f = (Float) num;
+ Assert.assertNotNull(f);
+ } else {
+ Assert.fail("Number not supported: " + num.toString());
+ }
+ break;
+ case HTML:
+ String html = (String) value;
+ Assert.assertNotNull(html);
+ break;
+ case ID:
+ // String id = (String) value;
+ // can be null Assert.assertNotNull(id);
+ break;
+ case URI:
+ URI uri = (URI) value;
+ Assert.assertNotNull(uri);
+ break;
+ default:
+ Assert.fail("PropertyType not supported: " + t);
+ }
+ }
+ }
+
+ @Test
+ public void readSingleProperty() {
+ String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/" + FixtureData.DOCUMENT1_NAME;
+ Document document = (Document) this.session.getObjectByPath(path);
+ Assert.assertNotNull("document not found: " + path, document);
+
+ Property<String> p = document.getProperty(PropertyIds.OBJECT_ID);
+ Assert.assertNotNull(p);
+ String v1 = p.getFirstValue();
+ Assert.assertNotNull(v1);
+
+ String v2 = document.getPropertyValue(PropertyIds.OBJECT_ID);
+ Assert.assertNotNull(v2);
+ Assert.assertEquals(v1, v2);
+
+ }
+
+ @Test
+ public void readMultiValueProperty() {
+ String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/" + FixtureData.DOCUMENT1_NAME;
+ Document document = (Document) this.session.getObjectByPath(path);
+ Assert.assertNotNull("document not found: " + path, document);
+
+ Property<String> p = document.getProperty(FixtureData.PROPERTY_NAME_STRING_MULTI_VALUED.toString());
+ if (p != null) {
+ Assert.assertTrue(p.isMultiValued());
+ List<String> v1 = p.getValues();
+ Assert.assertNotNull(v1);
+ Assert.assertFalse(v1.isEmpty());
+
+ List<String> v2 = document.getPropertyMultivalue(FixtureData.PROPERTY_NAME_STRING_MULTI_VALUED.toString());
+ Assert.assertNotNull(v2);
+ Assert.assertFalse(v2.isEmpty());
+ Assert.assertEquals(v1, v2);
+ }
+ }
}