use of ddf.catalog.operation.impl.SourceInfoRequestSources in project ddf by codice.
the class CatalogFrameworkImplTest method testGetSites.
@Test
public void testGetSites() {
framework.setId("ddf");
framework.getSourceOperations().setId("ddf");
Set<String> ids = new HashSet<String>();
for (FederatedSource source : federatedSources) {
ids.add(source.getId());
}
ids.add(framework.getId());
SourceInfoRequest request = new SourceInfoRequestSources(true, ids);
SourceInfoResponse response = null;
try {
response = framework.getSourceInfo(request);
} catch (SourceUnavailableException e) {
fail();
}
Set<SourceDescriptor> sourceDescriptors = response.getSourceInfo();
List<String> siteNames = new ArrayList<String>();
for (SourceDescriptor descriptor : sourceDescriptors) {
LOGGER.debug("Descriptor id: {}", descriptor.getSourceId());
siteNames.add(descriptor.getSourceId());
}
// add a plus one for now to simulate that the framework is ad
// assertTrue( sourceDescriptor.containsAll( federatedSources ) );
// assertTrue( sourceDescriptor.containsAll( expectedSourceSet ) );
assertEquals(ids.size(), sourceDescriptors.size());
String[] expectedOrdering = { "A", "B", "C", framework.getId() };
assertArrayEquals(expectedOrdering, siteNames.toArray(new String[siteNames.size()]));
}
Aggregations