CMIS-784: Unit tests: New server env. for 1.1 browser binding. Tests run as non-admin user (applied patch, with some modifications).
git-svn-id: https://svn.apache.org/repos/asf/chemistry/objectivecmis/branches/browser-binding@1588364 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ObjectiveCMISTests/CMISBaseTest.m b/ObjectiveCMISTests/CMISBaseTest.m
index ae1cd52..943a1b8 100644
--- a/ObjectiveCMISTests/CMISBaseTest.m
+++ b/ObjectiveCMISTests/CMISBaseTest.m
@@ -45,6 +45,14 @@
XCTAssertNotNil(environmentArray, @"environmentArray is nil!");
for (NSDictionary *envDict in environmentArray) {
+ NSString *summary = envDict[@"summary"];
+ NSNumber *disabled = envDict[@"disabled"];
+ if ([disabled boolValue])
+ {
+ CMISLogDebug(@">------------------- Skipping test against %@ -------------------<", summary);
+ continue;
+ }
+
NSString *binding = [envDict valueForKey:@"binding"];
NSString *url = [envDict valueForKey:@"url"];
NSString *repositoryId = [envDict valueForKey:@"repositoryId"];
@@ -63,7 +71,7 @@
extraSessionParameters:extraSessionParameters completionBlock:^{
self.testCompleted = NO;
- CMISLogDebug(@">------------------- Running test against %@ -------------------<", url);
+ CMISLogDebug(@">------------------- Running test against %@ -------------------<", summary);
testBlock();
}];
@@ -113,11 +121,17 @@
self.session = session;
XCTAssertTrue(self.session.isAuthenticated, @"Session should be authenticated");
[self.session retrieveRootFolderWithCompletionBlock:^(CMISFolder *rootFolder, NSError *error) {
- self.rootFolder = rootFolder;
XCTAssertNil(error, @"Error while retrieving root folder: %@", [error description]);
- XCTAssertNotNil(self.rootFolder, @"rootFolder object should not be nil");
-
- completionBlock();
+ XCTAssertNotNil(rootFolder, @"rootFolder object should not be nil");
+ if (rootFolder)
+ {
+ [self.session retrieveObjectByPath:@"/ios-test" completionBlock:^(CMISObject *object, NSError *error) {
+ self.rootFolder = (CMISFolder *)object;
+ XCTAssertNil(error, @"Error while retrieving root folder: %@", [error description]);
+ XCTAssertNotNil(self.rootFolder, @"/ios-test rootFolder object should not be nil");
+ completionBlock();
+ }];
+ }
}];
}
}];
diff --git a/ObjectiveCMISTests/ObjectiveCMISTests.m b/ObjectiveCMISTests/ObjectiveCMISTests.m
index 2dfd098..1165392 100644
--- a/ObjectiveCMISTests/ObjectiveCMISTests.m
+++ b/ObjectiveCMISTests/ObjectiveCMISTests.m
@@ -1055,7 +1055,7 @@
{
[self runTest:^ {
// Use a document that has spaces in them (should be correctly encoded)
- NSString *path = [NSString stringWithFormat:@"%@ios-test/activiti logo big.png", self.rootFolder.path];
+ NSString *path = [NSString stringWithFormat:@"%@/activiti logo big.png", self.rootFolder.path];
[self.session retrieveObjectByPath:path completionBlock:^(CMISObject *object, NSError *error) {
CMISDocument *document = (CMISDocument *)object;
XCTAssertNil(error, @"Error while retrieving object with path %@", path);
@@ -1665,7 +1665,7 @@
{
[self runTest:^ {
// Fetch test document
- NSString *path = [NSString stringWithFormat:@"%@ios-test/millenium-dome-exif.jpg", self.rootFolder.path];
+ NSString *path = [NSString stringWithFormat:@"%@/millenium-dome-exif.jpg", self.rootFolder.path];
CMISOperationContext *operationContext = [CMISOperationContext defaultOperationContext];
operationContext.renditionFilterString = @"*";
[self.session retrieveObjectByPath:path operationContext:operationContext completionBlock:^(CMISObject *object, NSError *error) {
@@ -1686,7 +1686,6 @@
// Get content
NSString *filePath = [NSString stringWithFormat:@"%@/testfile.pdf" , NSTemporaryDirectory()];
-// NSString *filePath = @"testfile.pdf";
[thumbnailRendition downloadRenditionContentToFile:filePath completionBlock:^(NSError *error) {
if (error == nil) {
// Assert File exists and check file length
@@ -1715,7 +1714,7 @@
{
[self runTest:^ {
// Fetch test document
- NSString *path = [NSString stringWithFormat:@"%@ios-test/millenium-dome-exif.jpg", self.rootFolder.path];
+ NSString *path = [NSString stringWithFormat:@"%@/millenium-dome-exif.jpg", self.rootFolder.path];
CMISOperationContext *operationContext = [CMISOperationContext defaultOperationContext];
operationContext.renditionFilterString = @"*";
[self.session retrieveObjectByPath:path operationContext:operationContext completionBlock:^(CMISObject *object, NSError *error) {
@@ -1741,7 +1740,6 @@
// Download content through objectService
NSString *filePath = [NSString stringWithFormat:@"%@/testfile-rendition-through-objectservice.pdf", NSTemporaryDirectory()];
-// NSString *filePath = @"testfile-rendition-through-objectservice.pdf";
[self.session.binding.objectService downloadContentOfObject:document.identifier
streamId:thumbnailRendition.streamId
toFile:filePath
diff --git a/ObjectiveCMISTests/env-cfg.plist b/ObjectiveCMISTests/env-cfg.plist
index 4953db2..bad42c4 100644
--- a/ObjectiveCMISTests/env-cfg.plist
+++ b/ObjectiveCMISTests/env-cfg.plist
@@ -5,25 +5,63 @@
<key>environments</key>
<array>
<dict>
+ <key>disabled</key>
+ <true/>
+ <key>summary</key>
+ <string>Alfresco v4.0.0 Enterprise. Legacy (Webscript)</string>
<key>username</key>
- <string>admin</string>
+ <string>cmis</string>
<key>password</key>
- <string>alzheimer</string>
+ <string>unittest</string>
<key>url</key>
<string>http://ec2-54-247-141-218.eu-west-1.compute.amazonaws.com/alfresco/service/api/cmis</string>
<key>repositoryId</key>
<string>368eca28-be2b-4a8d-8bbb-1d7997af7930</string>
</dict>
<dict>
+ <key>disabled</key>
+ <true/>
+ <key>summary</key>
+ <string>Alfresco v4.0.0 Enterprise. OpenCMIS AtomPub 1.0</string>
<key>username</key>
- <string>admin</string>
+ <string>cmis</string>
<key>password</key>
- <string>alzheimer</string>
+ <string>unittest</string>
<key>url</key>
<string>http://ec2-54-247-141-218.eu-west-1.compute.amazonaws.com/alfresco/cmisatom</string>
<key>repositoryId</key>
<string>368eca28-be2b-4a8d-8bbb-1d7997af7930</string>
</dict>
+ <dict>
+ <key>disabled</key>
+ <true/>
+ <key>summary</key>
+ <string>Alfresco v4.2.0 Enterprise. OpenCMIS (PublicAPI) AtomPub 1.0</string>
+ <key>username</key>
+ <string>cmis</string>
+ <key>password</key>
+ <string>unittest</string>
+ <key>url</key>
+ <string>http://ec2-54-195-83-189.eu-west-1.compute.amazonaws.com/alfresco/api/-default-/public/cmis/versions/1.0/atom</string>
+ <key>repositoryId</key>
+ <string>-default-</string>
+ </dict>
+ <dict>
+ <key>disabled</key>
+ <false/>
+ <key>summary</key>
+ <string>Alfresco v4.2.0 Enterprise. OpenCMIS (PublicAPI) Browser 1.1</string>
+ <key>binding</key>
+ <string>browser</string>
+ <key>username</key>
+ <string>cmis</string>
+ <key>password</key>
+ <string>unittest</string>
+ <key>url</key>
+ <string>http://ec2-54-195-83-189.eu-west-1.compute.amazonaws.com/alfresco/api/-default-/public/cmis/versions/1.1/browser</string>
+ <key>repositoryId</key>
+ <string>-default-</string>
+ </dict>
</array>
</dict>
</plist>