Skip to content
Snippets Groups Projects
Commit 0fca8460 authored by cramakri's avatar cramakri
Browse files

Fixed implementation of iPad service to return the correct data for the properties

SVN: 26952
parent 439c6164
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,6 @@ enum CISOBIpadServiceErrorCode {
@property(readonly) NSString *permId;
@property(readonly) NSString *entityKind;
@property(readonly) NSString *entityType;
@property(readonly) NSDictionary *properties;
@property(readonly) NSString *properties; //<! The properties as a JSON string.
@end
......@@ -190,12 +190,15 @@ NSString *const CISDOBIpadServiceErrorDomain = @"CISDOBIpadServiceErrorDomain";
return self;
}
- (NSString *)summaryHeader { return [_content objectAtIndex: 0]; }
- (NSString *)summary { return [_content objectAtIndex: 1]; }
- (NSString *)identifier { return [_content objectAtIndex: 2]; }
- (NSString *)permId { return [_content objectAtIndex: 3]; }
- (NSString *)entityKind { return [_content objectAtIndex: 4]; }
- (NSString *)entityType { return [_content objectAtIndex: 5]; }
- (NSDictionary *)properties { return [_content objectAtIndex: 6]; }
- (NSString *)stringContentValueAtIndex:(NSUInteger)index { return [[_content objectAtIndex: index] objectForKey: @"value"]; }
- (NSString *)summaryHeader { return [self stringContentValueAtIndex: 0]; }
- (NSString *)summary { return [self stringContentValueAtIndex: 1]; }
- (NSString *)identifier { return [self stringContentValueAtIndex: 2]; }
- (NSString *)permId { return [self stringContentValueAtIndex: 3]; }
- (NSString *)entityKind { return [self stringContentValueAtIndex: 4]; }
- (NSString *)entityType { return [self stringContentValueAtIndex: 5]; }
- (NSString *)properties { return [self stringContentValueAtIndex: 6]; }
@end
......@@ -65,6 +65,18 @@
STAssertNotNil(_callResult, @"The iPad service should have returned some entities.");
NSArray *rawEntities = _callResult;
STAssertTrue([rawEntities count] > 0, @"The Pad service should have returned some entities.");
for (CISDOBIpadRawEntity *rawEntity in rawEntities) {
NSString *summaryHeader = rawEntity.summaryHeader;
STAssertNotNil(summaryHeader, @"The summary header should not be nil");
STAssertTrue([summaryHeader length], @"Summary header should not be empty");
STAssertNotNil(rawEntity.summary, @"Summary should not be nil");
STAssertNotNil(rawEntity.identifier, @"Identifier should not be nil");
STAssertNotNil(rawEntity.permId, @"PermId should not be nil");
STAssertNotNil(rawEntity.entityKind, @"Entity kind should not be nil");
STAssertNotNil(rawEntity.entityType, @"Entity type should not be nil");
STAssertNotNil(rawEntity.properties, @"Properties type should not be nil");
}
}
@end
......@@ -63,8 +63,11 @@
- (void)assertServiceDataRowIsParsable:(NSArray *)row
{
// The only column we need to check is the properties column, which is the last one.
NSDictionary *jsonProperties = [row objectAtIndex: [row count] - 1];
STAssertNotNil(jsonProperties, @"Properties should have been parsed");
NSDictionary *propertiesRow = [row objectAtIndex: [row count] - 1];
NSString *propertiesValue = [propertiesRow objectForKey: @"value"];
NSError *error;
NSDictionary *jsonProperties = [NSJSONSerialization JSONObjectWithData:[propertiesValue dataUsingEncoding: NSUTF8StringEncoding] options: 0 error:&error];
STAssertNotNil(jsonProperties, @"Properties should have been parsed, %@", error);
}
- (void)testLoginAndListServices
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment