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

BIS-312 SP-474 : Added explicit command for listing navigational entities.

SVN: 28245
parent 5fb8b918
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,9 @@ enum CISOBIpadServiceErrorCode {
//! A call that has no purpose except to inform the server that we are still here
- (CISDOBAsyncCall *)heartbeat;
//! Get all top-level categories from the openBIS ipad service. The success block will be invoked with a collection of CISDOBIpadRawEntity objects.
- (CISDOBAsyncCall *)listNavigationalEntities;
//! Get all root-level entities from the openBIS ipad service, possibly along with some children as well. The success block will be invoked with a collection of CISDOBIpadRawEntity objects.
- (CISDOBAsyncCall *)listRootLevelEntities;
......
......@@ -147,6 +147,13 @@ static id OpenBisTableRowValueAtIndex(NSArray *rowData, NSUInteger index)
return serviceCall;
}
- (CISDOBAsyncCall *)listNavigationalEntities
{
NSDictionary *parameters = [NSDictionary dictionaryWithObject: @"NAVIGATION" forKey: @"requestKey"];
CISDOBIpadServiceCall *serviceCall = [self createIpadServiceCallWithParameters: parameters];
return serviceCall;
}
- (CISDOBAsyncCall *)listRootLevelEntities
{
NSDictionary *parameters = [NSDictionary dictionaryWithObject: @"ROOT" forKey: @"requestKey"];
......
......@@ -55,6 +55,31 @@
[self waitSeconds: waitTime forCallToComplete: call];
}
- (void)testListNavigationalEntities
{
CISDOBAsyncCall *call;
call = [_service loginUser: GetDefaultUserName() password: GetDefaultUserPassword()];
[self configureAndRunCallSynchronously: call];
call = [_service listNavigationalEntities];
[self configureAndRunCallSynchronously: call];
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");
STAssertNotNil(rawEntity.permId, @"PermId should not be nil");
STAssertNotNil(rawEntity.refcon, @"Refcon should not be nil");
// STAssertNotNil(rawEntity.category, @"Group should not be nil");
STAssertTrue([summaryHeader length], @"Summary header should not be empty");
STAssertNotNil(rawEntity.summary, @"Summary should not be nil");
STAssertNotNil(rawEntity.rootLevel, @"RootLevel should not be nil");
STAssertEquals([rawEntity.rootLevel boolValue], YES, @"RootLevel should not be true");
}
}
- (void)testListRootEntities
{
CISDOBAsyncCall *call;
......
......@@ -185,11 +185,11 @@ The communication model between the iPad and the service has been designed to tr
<td>KEY, VALUE</td>
</tr>
<tr>
<td>CATEGORIES</td>
<td>NAVIGATION</td>
<td>None</td>
<td>Return the root categories.</td>
<td>Return the top-level categories used for navigation.</td>
<td>Used to initialize the top level of the navigation view.</td>
<td>PERM_ID, REFCON, SUMMARY_HEADER, SUMMARY, CHILDREN</td>
<td>PERM_ID, REFCON, CATEGORY, SUMMARY_HEADER, SUMMARY, ROOT_LEVEL</td>
</tr>
<tr>
<td>ROOT</td>
......
......@@ -179,6 +179,12 @@ class DetailRequestHandler(RequestHandler):
def optional_headers(self):
return ["CATEGORY", "SUMMARY_HEADER", "SUMMARY", "IDENTIFIER", "IMAGES", "PROPERTIES"]
class NavigationRequestHandler(RequestHandler):
"""Abstract Handler for the NAVIGATION request."""
def optional_headers(self):
return ["CATEGORY", "SUMMARY_HEADER", "SUMMARY", "ROOT_LEVEL"]
#
# END Infrastructure
#
......@@ -462,6 +468,13 @@ class ExampleDetailRequestHandler(DetailRequestHandler):
self.add_rows(self.material_dict_array)
self.add_rows(samples_to_dict(self.samples, self.material_by_perm_id, self.sample_type_properties_definitions))
class ExampleNavigationRequestHandler(NavigationRequestHandler):
"""Handler for the NAVIGATION request"""
def add_data_rows(self):
materials_nav = navigation_dict('Targets and Compounds', [])
probe_nav = navigation_dict('Probes', [])
self.add_rows([materials_nav, probe_nav])
class TestingRootRequestHandler(ExampleRootRequestHandler):
"""A version of the root request handler designed for testing"""
......@@ -490,6 +503,8 @@ def aggregate(parameters, builder):
request_key = parameters.get('requestKey')
if 'CLIENT_PREFS' == request_key:
handler = ExampleClientPreferencesRequestHandler(parameters, builder)
elif 'NAVIGATION' == request_key:
handler = ExampleNavigationRequestHandler(parameters, builder)
elif 'ROOT' == request_key:
handler = TestingRootRequestHandler(parameters, builder)
elif 'DRILL' == request_key:
......
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