use of ddf.catalog.data.impl.MetacardTypeImpl in project ddf by codice.
the class FilterPluginTest method getNoSecurityAttributeMetacard.
private Metacard getNoSecurityAttributeMetacard() {
MetacardImpl metacard = new MetacardImpl();
metacard.setResourceSize("100");
try {
metacard.setResourceURI(new URI("http://some.fancy.uri/goes/here"));
} catch (URISyntaxException e) {
LOGGER.error("", e);
}
//Intentionally do not set the Metacard.SECURITY attribute
metacard.setContentTypeName("Resource");
metacard.setTitle("Metacard 1");
metacard.setContentTypeVersion("1");
metacard.setType(new MetacardTypeImpl(MetacardType.DEFAULT_METACARD_TYPE_NAME, new HashSet<>()));
return metacard;
}
use of ddf.catalog.data.impl.MetacardTypeImpl in project ddf by codice.
the class FilterPluginTest method getExactRolesMetacard.
private Metacard getExactRolesMetacard() {
MetacardImpl metacard = new MetacardImpl();
metacard.setResourceSize("100");
try {
metacard.setResourceURI(new URI("http://some.fancy.uri/goes/here"));
} catch (URISyntaxException e) {
LOGGER.error("", e);
}
metacard.setContentTypeName("Resource");
metacard.setTitle("Metacard 1");
metacard.setContentTypeVersion("1");
metacard.setType(new MetacardTypeImpl(MetacardType.DEFAULT_METACARD_TYPE_NAME, new HashSet<>()));
HashMap<String, List<String>> security = new HashMap<>();
security.put("Roles", Arrays.asList("A", "B"));
metacard.setSecurity(security);
metacard.setId("exactroles");
return metacard;
}
use of ddf.catalog.data.impl.MetacardTypeImpl in project ddf by codice.
the class FilterPluginTest method getMissingRolesMetacard.
private Metacard getMissingRolesMetacard() {
MetacardImpl metacard = new MetacardImpl();
metacard.setResourceSize("100");
try {
metacard.setResourceURI(new URI("http://some.fancy.uri/goes/here"));
} catch (URISyntaxException e) {
LOGGER.error("", e);
}
metacard.setContentTypeName("Resource");
metacard.setTitle("Metacard 1");
metacard.setContentTypeVersion("1");
metacard.setType(new MetacardTypeImpl(MetacardType.DEFAULT_METACARD_TYPE_NAME, new HashSet<>()));
HashMap<String, List<String>> security = new HashMap<>();
security.put("Roles", Arrays.asList("A"));
metacard.setSecurity(security);
return metacard;
}
use of ddf.catalog.data.impl.MetacardTypeImpl in project ddf by codice.
the class FilterPluginTest method getNoRolesMetacard.
private Metacard getNoRolesMetacard() {
MetacardImpl metacard = new MetacardImpl();
metacard.setResourceSize("100");
try {
metacard.setResourceURI(new URI("http://some.fancy.uri/goes/here"));
} catch (URISyntaxException e) {
LOGGER.error("", e);
}
metacard.setContentTypeName("Resource");
metacard.setTitle("Metacard 1");
metacard.setContentTypeVersion("1");
metacard.setType(new MetacardTypeImpl(MetacardType.DEFAULT_METACARD_TYPE_NAME, new HashSet<>()));
HashMap<String, List<String>> security = new HashMap<>();
metacard.setSecurity(security);
return metacard;
}
use of ddf.catalog.data.impl.MetacardTypeImpl in project ddf by codice.
the class MetacardCreatorTest method testIntAttribute.
@Test
public void testIntAttribute() {
Set<AttributeDescriptor> extraAttributes = new HashSet<>();
extraAttributes.add(new AttributeDescriptorImpl(Media.DURATION, false, false, false, false, BasicTypes.INTEGER_TYPE));
final Metadata metadata = new Metadata();
String imageLength = "14";
metadata.add(TIFF.IMAGE_LENGTH, imageLength);
MetacardTypeImpl extendedMetacardType = new MetacardTypeImpl(BasicTypes.BASIC_METACARD.getName(), BasicTypes.BASIC_METACARD, extraAttributes);
final String id = "id";
final String metadataXml = "<xml>test</xml>";
Metacard metacard = MetacardCreator.createMetacard(metadata, id, metadataXml, extendedMetacardType);
assertThat(metacard.getMetadata(), is(metadataXml));
assertThat(metacard.getAttribute(Media.HEIGHT).getValue(), is(Integer.valueOf(imageLength)));
}
Aggregations