use of ddf.catalog.data.impl.AttributeDescriptorImpl in project ddf by codice.
the class GeoJsonExtensibleTest method sampleMetacardTypeB.
private MetacardType sampleMetacardTypeB() {
Set<AttributeDescriptor> descriptors = new HashSet<AttributeDescriptor>();
descriptors.add(new AttributeDescriptorImpl(COLUMNS_ATTRIBUTE_KEY, true, /* indexed */
true, /* stored */
false, /* tokenized */
false, /* multivalued */
BasicTypes.INTEGER_TYPE));
descriptors.add(new AttributeDescriptorImpl(ROWS_ATTRIBUTE_KEY, true, /* indexed */
true, /* stored */
false, /* tokenized */
false, /* multivalued */
BasicTypes.INTEGER_TYPE));
descriptors.add(new AttributeDescriptorImpl(DESCRIPTION_ATTRIBUTE_KEY, true, /* indexed */
true, /* stored */
false, /* tokenized */
false, /* multivalued */
BasicTypes.STRING_TYPE));
descriptors.add(new AttributeDescriptorImpl(Metacard.ID, true, /* indexed */
true, /* stored */
false, /* tokenized */
false, /* multivalued */
BasicTypes.STRING_TYPE));
descriptors.add(new AttributeDescriptorImpl(Metacard.TITLE, true, /* indexed */
true, /* stored */
true, /* tokenized */
false, /* multivalued */
BasicTypes.STRING_TYPE));
descriptors.add(new AttributeDescriptorImpl(REVIEWED_ATTRIBUTE_KEY, true, /* indexed */
true, /* stored */
true, /* tokenized */
false, /* multivalued */
BasicTypes.BOOLEAN_TYPE));
descriptors.add(new AttributeDescriptorImpl(PRECISE_LENGTH_METERS_ATTRIBUTE_KEY, true, /* indexed */
true, /* stored */
true, /* tokenized */
false, /* multivalued */
BasicTypes.DOUBLE_TYPE));
descriptors.add(new AttributeDescriptorImpl(PRECISE_HEIGHT_METERS_ATTRIBUTE_KEY, true, /* indexed */
true, /* stored */
true, /* tokenized */
false, /* multivalued */
BasicTypes.FLOAT_TYPE));
descriptors.add(new AttributeDescriptorImpl(NUMBER_REVIEWERS_ATTRIBUTE_KEY, true, /* indexed */
true, /* stored */
true, /* tokenized */
false, /* multivalued */
BasicTypes.SHORT_TYPE));
return new MetacardTypeImpl("MetacardTypeB", descriptors);
}
use of ddf.catalog.data.impl.AttributeDescriptorImpl in project ddf by codice.
the class GeoJsonExtensibleTest 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.impl.AttributeDescriptorImpl in project ddf by codice.
the class MetacardCreatorTest method testValidDoubleAttribute.
@Test
public void testValidDoubleAttribute() {
Set<AttributeDescriptor> extraAttributes = new HashSet<>();
extraAttributes.add(new AttributeDescriptorImpl(Media.DURATION, false, false, false, false, BasicTypes.DOUBLE_TYPE));
final Metadata metadata = new Metadata();
String durationValue = "14.88";
metadata.add(MetacardCreator.DURATION_METDATA_KEY, durationValue);
MetacardTypeImpl extendedMetacardType = new MetacardTypeImpl(MetacardImpl.BASIC_METACARD.getName(), MetacardImpl.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.DURATION).getValue(), is(Double.valueOf(durationValue)));
}
use of ddf.catalog.data.impl.AttributeDescriptorImpl 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(MetacardImpl.BASIC_METACARD.getName(), MetacardImpl.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