// assertTrue(adaptorFactory.canAdapt(resource, IHotlinkSource.class));
//
// IHotlinkSource hotlink = (IHotlinkSource) adaptorFactory.adapt(resource,
// IHotlinkSource.class, new NullProgressMonitor());
final BasicHotlinkSource hotlink = new BasicHotlinkSource(resource);
assertNotNull(hotlink);
List<HotlinkDescriptor> list = hotlink.getHotlinkDescriptors(null, new NullProgressMonitor());
assertEquals("descriptors found", 2, list.size());
SimpleFeatureStore featureStore = resource.resolve(SimpleFeatureStore.class,
new NullProgressMonitor());
SimpleFeatureType schema = featureStore.getSchema();
for (HotlinkDescriptor hotlinkDescriptor : list) {
AttributeDescriptor attributeDescriptor = schema.getDescriptor(hotlinkDescriptor
.getAttributeName());
assertNotNull("confirm attribute name matches", attributeDescriptor);
assertTrue("Confirm String",
String.class.isAssignableFrom(attributeDescriptor.getType().getBinding()));
assertNotNull(hotlinkDescriptor.getType() != null);
}
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
SimpleFeatureCollection features = featureStore.getFeatures(ff.equals(ff.property("STATE"),
ff.literal("Tasmania")));
SimpleFeatureIterator iterator = features.features();
assertTrue("Tasmania found", iterator.hasNext());
SimpleFeature tasmania = iterator.next();
List<IDocument> documents = hotlink.getDocuments(tasmania, new NullProgressMonitor());
assertEquals("image document found", 2, documents.size());
// IDocument imageDocument = documents.get(0);
// assertEquals(ContentType.FILE, imageDocument.getContentType());