use of ddf.catalog.data.AttributeDescriptor in project ddf by codice.
the class MetacardTypeImplTest method testSerializationNullDescriptors.
@Test
public void testSerializationNullDescriptors() throws IOException, ClassNotFoundException {
MetacardTypeImpl metacardType = new MetacardTypeImpl("basic", (Set<AttributeDescriptor>) null);
String fileLocation = "target/metacardType.ser";
Serializer<MetacardType> serializer = new Serializer<>();
serializer.serialize(metacardType, fileLocation);
MetacardType readMetacardType = serializer.deserialize(fileLocation);
assertThat(metacardType.getName(), is(readMetacardType.getName()));
Set<AttributeDescriptor> oldAd = metacardType.getAttributeDescriptors();
Set<AttributeDescriptor> newAd = readMetacardType.getAttributeDescriptors();
assertThat(oldAd.isEmpty(), is(true));
assertThat(newAd.isEmpty(), is(true));
}
use of ddf.catalog.data.AttributeDescriptor in project ddf by codice.
the class MetacardTypeImplTest method assertMetacardAttributes.
private void assertMetacardAttributes(MetacardType metacardType, Set<AttributeDescriptor> expected) {
Set<AttributeDescriptor> actual = metacardType.getAttributeDescriptors();
assertThat(metacardType.getName(), is(TEST_NAME));
for (AttributeDescriptor attributeDescriptor : expected) {
assertThat(actual, hasItem(attributeDescriptor));
}
}
use of ddf.catalog.data.AttributeDescriptor in project ddf by codice.
the class MetacardTypeRegistryTest method sampleMetacardTypeB.
private QualifiedMetacardType 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 QualifiedMetacardTypeImpl(SAMPLE_B_METACARD_TYPE_NAMESPACE, SAMPLE_B_METACARD_TYPE_NAME, descriptors);
}
use of ddf.catalog.data.AttributeDescriptor in project ddf by codice.
the class MetacardTypeRegistryTest method assertOnExpectedMetacardTypeFields.
private void assertOnExpectedMetacardTypeFields(QualifiedMetacardType qmtResult) {
Set<AttributeDescriptor> attributeDescriptors = qmtResult.getAttributeDescriptors();
assertNotNull(attributeDescriptors);
assertEquals(QUALIFIED_METACARD_TYPE_DESCRIPTORS_SIZE, attributeDescriptors.size());
AttributeDescriptor geoAD = qmtResult.getAttributeDescriptor(GEO_ATTRIBUTE_DESCRIPTOR_NAME);
assertNotNull(geoAD);
assertEquals(GEO_ATTRIBUTE_DESCRIPTOR_NAME, geoAD.getName());
AttributeDescriptor metadataAD = qmtResult.getAttributeDescriptor(METADATA_ATTRIBUTE_DESCRIPTOR_NAME);
assertNotNull(metadataAD);
assertEquals(METADATA_ATTRIBUTE_DESCRIPTOR_NAME, metadataAD.getName());
}
use of ddf.catalog.data.AttributeDescriptor in project ddf by codice.
the class MetacardTypeRegistryTest method assertOnSampleMetacardTypeBExcpectedAttributes.
private void assertOnSampleMetacardTypeBExcpectedAttributes(QualifiedMetacardType qmt) {
Set<AttributeDescriptor> attributeDescriptors = qmt.getAttributeDescriptors();
assertNotNull(attributeDescriptors);
assertEquals(NUM_ATTRIBUTES_SAMPLE_METACARD_TYPE_B, attributeDescriptors.size());
AttributeDescriptor preciseHeight = qmt.getAttributeDescriptor(PRECISE_HEIGHT_METERS_ATTRIBUTE_KEY);
assertNotNull(preciseHeight);
assertEquals(PRECISE_HEIGHT_METERS_ATTRIBUTE_KEY, preciseHeight.getName());
AttributeDescriptor reviewed = qmt.getAttributeDescriptor(REVIEWED_ATTRIBUTE_KEY);
assertNotNull(reviewed);
assertEquals(REVIEWED_ATTRIBUTE_KEY, reviewed.getName());
AttributeDescriptor preciseLength = qmt.getAttributeDescriptor(PRECISE_LENGTH_METERS_ATTRIBUTE_KEY);
assertNotNull(preciseLength);
assertEquals(PRECISE_LENGTH_METERS_ATTRIBUTE_KEY, preciseLength.getName());
AttributeDescriptor description = qmt.getAttributeDescriptor(DESCRIPTION_ATTRIBUTE_KEY);
assertNotNull(description);
assertEquals(DESCRIPTION_ATTRIBUTE_KEY, description.getName());
AttributeDescriptor rows = qmt.getAttributeDescriptor(ROWS_ATTRIBUTE_KEY);
assertNotNull(rows);
assertEquals(ROWS_ATTRIBUTE_KEY, rows.getName());
AttributeDescriptor columns = qmt.getAttributeDescriptor(COLUMNS_ATTRIBUTE_KEY);
assertNotNull(columns);
assertEquals(COLUMNS_ATTRIBUTE_KEY, columns.getName());
AttributeDescriptor numReviewers = qmt.getAttributeDescriptor(NUMBER_REVIEWERS_ATTRIBUTE_KEY);
assertNotNull(numReviewers);
assertEquals(NUMBER_REVIEWERS_ATTRIBUTE_KEY, numReviewers.getName());
AttributeDescriptor metacardId = qmt.getAttributeDescriptor(Metacard.ID);
assertNotNull(metacardId);
assertEquals(Metacard.ID, metacardId.getName());
AttributeDescriptor metacardTitle = qmt.getAttributeDescriptor(Metacard.TITLE);
assertNotNull(metacardTitle);
assertEquals(Metacard.TITLE, metacardTitle.getName());
}
Aggregations