use of ddf.catalog.data.AttributeRegistry in project ddf by codice.
the class CswQueryFactoryTest method setUp.
@org.junit.Before
public void setUp() throws URISyntaxException, SourceUnavailableException, UnsupportedQueryException, FederationException, ParseException, IngestException {
filterBuilder = new GeotoolsFilterBuilder();
FilterAdapter filterAdapter = new GeotoolsFilterAdapterImpl();
metacardTypeList = new ArrayList<>();
queryFactory = new CswQueryFactory(filterBuilder, filterAdapter, getCswMetacardType(), metacardTypeList);
AttributeRegistry mockAttributeRegistry = mock(AttributeRegistry.class);
when(mockAttributeRegistry.lookup(TITLE_TEST_ATTRIBUTE)).thenReturn(Optional.of(mock(AttributeDescriptor.class)));
queryFactory.setAttributeRegistry(mockAttributeRegistry);
polygon = new WKTReader().read(POLYGON_STR);
gmlObjectFactory = new net.opengis.gml.v_3_1_1.ObjectFactory();
filterObjectFactory = new ObjectFactory();
}
use of ddf.catalog.data.AttributeRegistry in project ddf by codice.
the class TestCatalog method testMetacardDefinitionJsonFile.
@Test
// DDF-2743
@ConditionalIgnore(condition = SkipUnstableTest.class)
public void testMetacardDefinitionJsonFile() throws Exception {
final String newMetacardTypeName = "new.metacard.type";
getServiceManager().stopFeature(true, "catalog-security-filter");
File file = ingestDefinitionJsonWithWaitCondition("definitions.json", () -> {
expect("Service to be available: " + MetacardType.class.getName()).within(30, TimeUnit.SECONDS).until(() -> getServiceManager().getServiceReferences(MetacardType.class, "(name=" + newMetacardTypeName + ")"), not(empty()));
return null;
});
String ddfMetacardXml = getFileContent("metacard1.xml");
String modifiedMetacardXml = ddfMetacardXml.replaceFirst("ddf\\.metacard", newMetacardTypeName).replaceFirst("resource-uri", "new-attribute-required-2");
String id = ingest(modifiedMetacardXml, "text/xml");
configureShowInvalidMetacards("true", "true", getAdminConfig());
try {
String newMetacardXpath = format("/metacards/metacard[@id=\"%s\"]", id);
executeOpenSearch("xml", "q=*").log().all().assertThat().body(hasXPath(newMetacardXpath + "/type", is(newMetacardTypeName))).body(hasXPath("count(" + newMetacardXpath + "/string[@name=\"validation-errors\"]/value)", is("1"))).body(hasXPath(newMetacardXpath + "/string[@name=\"validation-errors\"]/value[text()=\"new-attribute-required-1 is required\"]")).body(hasXPath(newMetacardXpath + "/string[@name=\"new-attribute-required-2\"]/value", is("\" + uri + \"")));
} finally {
deleteMetacard(id);
uninstallDefinitionJson(file, () -> {
AttributeRegistry attributeRegistry = getServiceManager().getService(AttributeRegistry.class);
expect("Attributes to be unregistered").within(10, TimeUnit.SECONDS).until(() -> !attributeRegistry.lookup("new-attribute-required-2").isPresent());
return null;
});
getServiceManager().startFeature(true, "catalog-security-filter");
configureShowInvalidMetacards("false", "false", getAdminConfig());
}
}
use of ddf.catalog.data.AttributeRegistry in project ddf by codice.
the class TestGeoJsonExtensible method setUp.
@Before
public void setUp() {
transformer = new GeoJsonInputTransformer();
transformer.setMetacardTypes(prepareMetacardTypes());
AttributeRegistry attributeRegistry = new AttributeRegistryImpl();
attributeRegistry.register(new AttributeDescriptorImpl(TEMPERATURE_KEY, true, true, true, true, DOUBLE_TYPE));
transformer.setAttributeRegistry(attributeRegistry);
}
use of ddf.catalog.data.AttributeRegistry in project ddf by codice.
the class AttributeInjectorImplTest method setUp.
@Before
public void setUp() {
AttributeRegistry attributeRegistry = new AttributeRegistryImpl();
attributeInjector = new AttributeInjectorImpl(attributeRegistry);
attributeRegistry.register(globalAttribute);
attributeRegistry.register(basicAttribute);
attributeRegistry.register(basicAndNitfAttribute);
attributeInjector.setInjectableAttributes(Lists.newArrayList(globalInjection, basicInjection, basicAndNitfInjection));
}
Aggregations