chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pweschm...@apache.org
Subject svn commit: r1448154 [3/3] - in /chemistry/objectivecmis/trunk: ObjectiveCMIS.xcodeproj/ ObjectiveCMIS/Bindings/ ObjectiveCMIS/Bindings/AtomPub/ ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/ ObjectiveCMIS/Client/ ObjectiveCMIS/Common/ ObjectiveCMIS/Uti...
Date Wed, 20 Feb 2013 13:19:00 GMT
Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISFileUtil.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISFileUtil.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISFileUtil.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISFileUtil.h Wed Feb 20 13:18:59 2013
@@ -19,8 +19,7 @@
 
 #import <Foundation/Foundation.h>
 
-
-@interface FileUtil : NSObject
+@interface CMISFileUtil : NSObject
 /// appends data to a file with given path
 + (void)appendToFileAtPath:(NSString *)filePath data:(NSData *)data;
 /// returns the size of a file at path filePath

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISFileUtil.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISFileUtil.m?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISFileUtil.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISFileUtil.m Wed Feb 20 13:18:59 2013
@@ -20,7 +20,7 @@
 #import "CMISFileUtil.h"
 
 
-@implementation FileUtil
+@implementation CMISFileUtil
 
 + (void)appendToFileAtPath:(NSString *)filePath data:(NSData *)data
 {

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.h Wed Feb 20
13:18:59 2013
@@ -19,7 +19,7 @@
 
 #import "CMISHttpRequest.h"
 
-@interface CMISHttpDownloadRequest : CMISHttpRequest
+@interface CMISHttpDownloadRequest : CMISHttpRequest 
 
 // the outputStream should be unopened but if it is already open it will not be reset but
used as is;
 // it is closed on completion; if no outputStream is provided, download goes to httpResponse.data
@@ -33,16 +33,12 @@
 /** starts a URL request for download. Data are written to the provided output stream
  * completionBlock returns a CMISHttpResponse object or nil if unsuccessful
  */
-+ (CMISHttpDownloadRequest*)startRequest:(NSMutableURLRequest*)urlRequest
++ (id)startRequest:(NSMutableURLRequest*)urlRequest
                               httpMethod:(CMISHttpRequestMethod)httpRequestMethod
                             outputStream:(NSOutputStream*)outputStream
                            bytesExpected:(unsigned long long)bytesExpected
                   authenticationProvider:(id<CMISAuthenticationProvider>) authenticationProvider
                          completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError
*error))completionBlock
                            progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned
long long bytesTotal))progressBlock;
-/// designated initialiser. Do not use directly, instead call the startRequest class method
above
-- (id)initWithHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
-         completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
-           progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long
bytesTotal))progressBlock;
 
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m Wed Feb 20
13:18:59 2013
@@ -24,6 +24,9 @@
 
 @property (nonatomic, copy) void (^progressBlock)(unsigned long long bytesDownloaded, unsigned
long long bytesTotal);
 @property (nonatomic, assign) unsigned long long bytesDownloaded;
+- (id)initWithHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
+         completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
+           progressBlock:(void (^)(unsigned long long bytesDownloaded, unsigned long long
bytesTotal))progressBlock;
 
 @end
 
@@ -31,7 +34,7 @@
 @implementation CMISHttpDownloadRequest
 
 
-+ (CMISHttpDownloadRequest*)startRequest:(NSMutableURLRequest *)urlRequest
++ (id)startRequest:(NSMutableURLRequest *)urlRequest
                               httpMethod:(CMISHttpRequestMethod)httpRequestMethod
                             outputStream:(NSOutputStream*)outputStream
                            bytesExpected:(unsigned long long)bytesExpected

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.h Wed Feb 20 13:18:59
2013
@@ -20,10 +20,10 @@
 #import <Foundation/Foundation.h>
 #import "CMISBindingSession.h"
 #import "CMISNetworkProvider.h"
-
+#import "CMISRequest.h"
 @class CMISAuthenticationProvider;
 
-@interface CMISHttpRequest : NSObject <NSURLConnectionDataDelegate>
+@interface CMISHttpRequest : NSObject <NSURLConnectionDataDelegate, CMISCancellableRequest>
 
 @property (nonatomic, assign) CMISHttpRequestMethod requestMethod;
 @property (nonatomic, strong) NSURLConnection *connection;
@@ -41,7 +41,7 @@
  * @param authenticationProvider (required)
  * completionBlock returns a CMISHTTPResponse object or nil if unsuccessful
  */
-+ (CMISHttpRequest*)startRequest:(NSMutableURLRequest *)urlRequest
++ (id)startRequest:(NSMutableURLRequest *)urlRequest
                       httpMethod:(CMISHttpRequestMethod)httpRequestMethod
                      requestBody:(NSData*)requestBody
                          headers:(NSDictionary*)additionalHeaders
@@ -49,8 +49,7 @@
                  completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
 
 /**
- * designated initialiser. Do not use this initialiser directly. Instead use the
- * class method startRequest:withHttpMethod:requestBody:headers:authenticationProvider:completionBlock
+ * initialises with a specified HTTP method
  */
 - (id)initWithHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
          completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock;
@@ -58,7 +57,4 @@
 /// starts the URL request
 - (BOOL)startRequest:(NSMutableURLRequest*)urlRequest;
 
-/// cancel method. This may be called from a CMISRequest object
-- (void)cancel;
-
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpRequest.m Wed Feb 20 13:18:59
2013
@@ -41,7 +41,7 @@ NSString * const kCMISExceptionVersionin
 @implementation CMISHttpRequest
 
 
-+ (CMISHttpRequest*)startRequest:(NSMutableURLRequest *)urlRequest
++ (id)startRequest:(NSMutableURLRequest *)urlRequest
                       httpMethod:(CMISHttpRequestMethod)httpRequestMethod
                      requestBody:(NSData*)requestBody
                          headers:(NSDictionary*)additionalHeaders

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpResponse.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpResponse.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpResponse.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpResponse.h Wed Feb 20 13:18:59
2013
@@ -36,6 +36,7 @@
                                 responseData:(NSData *)data;
 
 - (NSString*)exception;
+
 - (NSString*)errorMessage;
 
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.h Wed Feb 20 13:18:59
2013
@@ -19,7 +19,7 @@
 
 #import "CMISHttpRequest.h"
 
-@interface CMISHttpUploadRequest : CMISHttpRequest
+@interface CMISHttpUploadRequest : CMISHttpRequest 
 
 @property (nonatomic, strong) NSInputStream *inputStream;
 @property (nonatomic, assign) unsigned long long bytesExpected; // optional; if not set,
expected content length from HTTP header is used
@@ -30,7 +30,7 @@
  * setHTTPBodyStream method
  * completionBlock returns CMISHttpResponse instance or nil if unsuccessful
  */
-+ (CMISHttpUploadRequest*)startRequest:(NSMutableURLRequest *)urlRequest
++ (id)startRequest:(NSMutableURLRequest *)urlRequest
                             httpMethod:(CMISHttpRequestMethod)httpRequestMethod
                            inputStream:(NSInputStream*)inputStream
                                headers:(NSDictionary*)addionalHeaders
@@ -39,9 +39,5 @@
                        completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError
*error))completionBlock
                          progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned
long long bytesTotal))progressBlock;
 
-/// designated initialiser. Do not call this method directly. Use the class method startRequest:withHttpMethod:inputStream:headers:bytesExpected:authenticationProvider:completionBlock:progressBlock
instead
-- (id)initWithHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
-         completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
-           progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
 
 @end

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m Wed Feb 20 13:18:59
2013
@@ -23,6 +23,9 @@
 
 @property (nonatomic, assign) unsigned long long bytesUploaded;
 @property (nonatomic, copy) void (^progressBlock)(unsigned long long bytesUploaded, unsigned
long long bytesTotal);
+- (id)initWithHttpMethod:(CMISHttpRequestMethod)httpRequestMethod
+         completionBlock:(void (^)(CMISHttpResponse *httpResponse, NSError *error))completionBlock
+           progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock;
 
 @end
 
@@ -30,7 +33,7 @@
 @implementation CMISHttpUploadRequest
 
 
-+ (CMISHttpUploadRequest*)startRequest:(NSMutableURLRequest *)urlRequest
++ (id)startRequest:(NSMutableURLRequest *)urlRequest
                             httpMethod:(CMISHttpRequestMethod)httpRequestMethod
                            inputStream:(NSInputStream*)inputStream
                                headers:(NSDictionary*)additionalHeaders
@@ -47,7 +50,7 @@
     httpRequest.bytesExpected = bytesExpected;
     httpRequest.authenticationProvider = authenticationProvider;
     
-    if ([httpRequest startRequest:urlRequest]) {
+    if ([httpRequest startRequest:urlRequest] == NO) {
         httpRequest = nil;
     }
     

Modified: chemistry/objectivecmis/trunk/ObjectiveCMISTests/ObjectiveCMISTests.m
URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMISTests/ObjectiveCMISTests.m?rev=1448154&r1=1448153&r2=1448154&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMISTests/ObjectiveCMISTests.m (original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMISTests/ObjectiveCMISTests.m Wed Feb 20 13:18:59
2013
@@ -474,9 +474,9 @@
                                    
                                    // Compare file sizes
                                    NSError *fileError;
-                                   unsigned long long originalFileSize = [FileUtil fileSizeForFileAtPath:fileToUploadPath
error:&fileError];
+                                   unsigned long long originalFileSize = [CMISFileUtil fileSizeForFileAtPath:fileToUploadPath
error:&fileError];
                                    STAssertNil(fileError, @"Got error while getting file
size for %@: %@", fileToUploadPath, [fileError description]);
-                                   unsigned long long downloadedFileSize = [FileUtil fileSizeForFileAtPath:downloadedFilePath
error:&fileError];
+                                   unsigned long long downloadedFileSize = [CMISFileUtil
fileSizeForFileAtPath:downloadedFilePath error:&fileError];
                                    STAssertNil(fileError, @"Got error while getting file
size for %@: %@", downloadedFilePath, [fileError description]);
                                    STAssertTrue(originalFileSize == downloadedFileSize, @"Original
file size (%llu) is not equal to downloaded file size (%llu)", originalFileSize, downloadedFileSize);
                                    
@@ -644,7 +644,7 @@
         // Basic check if the service returns results that are usable
         [discoveryService query:@"SELECT * FROM cmis:document"
               searchAllVersions:NO
-                  relationShips:CMISIncludeRelationshipNone
+                  relationships:CMISIncludeRelationshipNone
                 renditionFilter:nil
             includeAllowableActions:YES
                        maxItems:[NSNumber numberWithInt:3]
@@ -665,7 +665,7 @@
              // Doing a query without any maxItems or skipCount, and also only requesting
one property 'column'
              [discoveryService query:@"SELECT cmis:name FROM cmis:document WHERE cmis:name
LIKE '%quote%'"
                    searchAllVersions:NO
-                       relationShips:CMISIncludeRelationshipNone
+                       relationships:CMISIncludeRelationshipNone
                      renditionFilter:nil
              includeAllowableActions:YES
                             maxItems:nil skipCount:nil completionBlock:^(CMISObjectList *objectList,
NSError *error) {
@@ -919,15 +919,17 @@
     [self runTest:^ {
          // Upload test file
          [self uploadTestFileWithCompletionBlock:^(CMISDocument *originalDocument) {
+             STAssertTrue([originalDocument.contentStreamMediaType isEqualToString:@"text/plain"],
@"Mime type for original document should be text/plain but it is: %@", originalDocument.contentStreamMediaType);
              // Change content of test file using overwrite
              __block long long previousUploadedBytes = -1;
              NSString *newContentFilePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"test_file_2.txt"
ofType:nil];
              [self.session.binding.objectService
               changeContentOfObject:[CMISStringInOutParameter inOutParameterUsingInParameter:originalDocument.identifier]
-                toContentOfFile:newContentFilePath
-                overwriteExisting:YES
-                changeToken:nil
-              completionBlock: ^(NSError *error) {
+                    toContentOfFile:newContentFilePath
+                           mimeType:originalDocument.contentStreamMediaType
+                  overwriteExisting:YES
+                        changeToken:nil
+                    completionBlock: ^(NSError *error) {
                   if (error == nil) {
                       NSLog(@"Content has been successfully changed");
                       
@@ -936,6 +938,7 @@
 //                      NSString *tempDownloadFilePath = @"temp_download_file.txt";
                       // some repos will up the version when uploading new content
                       [originalDocument retrieveObjectOfLatestVersionWithMajorVersion:NO
completionBlock:^(CMISDocument *latestVersionOfDocument , NSError *error) {
+                          STAssertTrue([latestVersionOfDocument.contentStreamMediaType isEqualToString:@"text/plain"],
@"Mime type for updated document should be text/plain but it is: %@", latestVersionOfDocument.contentStreamMediaType);
                           [latestVersionOfDocument downloadContentToFile:tempDownloadFilePath
completionBlock:^(NSError *error) {
                               if (error == nil) {
                                   NSString *contentOfDownloadedFile = [NSString stringWithContentsOfFile:tempDownloadFilePath
encoding:NSUTF8StringEncoding error:nil];



Mime
View raw message