Let me add some more information
The code I'm using for querying is this one
@Test
public void discoverInGRSF() throws Exception{
String context = "/d4science.research-infrastructures.eu/FARM/GRSF";
ScopeProvider.instance.set(context);
List<ServiceEndpoint> resources = getConfigurationFromISFORDB();
for (ServiceEndpoint serviceEndpoint : resources) {
logger.debug("Service is " + serviceEndpoint);
}
}
private List<ServiceEndpoint> getConfigurationFromISFORDB() throws Exception{
String RUNTIME_DB_RESOURCE_NAME = "CKanDatabase";
String PLATFORM_DB_NAME = "postgres";
SimpleQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Name/text() eq '"+ RUNTIME_DB_RESOURCE_NAME +"'");
query.addCondition("$resource/Profile/Platform/Name/text() eq '"+ PLATFORM_DB_NAME +"'");
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
List<ServiceEndpoint> toReturn = client.submit(query);
return toReturn;
}
The result set is this one (printed result)
2016-12-13 09:47:23,188 [main] DEBUG org.gcube.datacatalogue.ckanutillibrary.TestDataCatalogueLib - Service is ServiceEndpoint [id=109f7250-74c9-4d00-91b9-e64f0b917a60, scopes=[/d4science.research-infrastructures.eu/FARM/GRSF_Admin], type=RuntimeResource, version=0.4.x, profile=[name=CKanDatabase, description=CKanDatabase, version=null, category=Database, runtime=[hostedOn=ckan-pg-d4s.d4science.org, status=READY, ghn=[id=]], platform=[name=postgres, version=9, minorVersion=1, revisionVersion=0, buildVersion=0], accessPoints=[AccessPoint [description=ckan database access point, accessData=[username=ckan_grsf_admin, password=FePVOjeZOse7gkBmfWzo1nVM9gdbMybN+GuOU3pl2jw=], interface=[endpoints=[name=ckan_prod_grsf_admin, address=ckan-pg-d4s.d4science.org:5432]], properties=[]]]]]
2016-12-13 09:47:23,188 [main] DEBUG org.gcube.datacatalogue.ckanutillibrary.TestDataCatalogueLib - Service is ServiceEndpoint [id=4022e2e2-3bc8-4f05-b84f-56788eb745b0, scopes=[/d4science.research-infrastructures.eu/FARM/GRSF], type=RuntimeResource, version=0.4.x, profile=[name=CKanDatabase, description=CKanDatabase, version=null, category=Database, runtime=[hostedOn=ckan-pg-d4s.d4science.org, status=READY, ghn=[id=]], platform=[name=postgres, version=9, minorVersion=1, revisionVersion=0, buildVersion=0], accessPoints=[AccessPoint [description=ckan database access point, accessData=[username=ckan_grsf, password=FePVOjeZOse7gkBmfWzo1nVM9gdbMybN+GuOU3pl2jw=], interface=[endpoints=[name=ckan_prod_grsf, address=ckan-pg-d4s.d4science.org:5432]], properties=[]]]]]
If the same query is done against the GRSF_Admin scope, a single result is returned (as expected)
Hope it helps