use of ddf.catalog.data.impl.QualifiedMetacardTypeImpl in project ddf by codice.
the class MetacardTypeRegistryTest method registerMetacardTypeNullName.
@Test(expected = IllegalArgumentException.class)
public void registerMetacardTypeNullName() {
QualifiedMetacardType qmt = new QualifiedMetacardTypeImpl(QUALIFIED_METACARD_TYPE_NAMESPACE_1, null, qmtAttributes);
mtr.register(qmt);
}
use of ddf.catalog.data.impl.QualifiedMetacardTypeImpl in project ddf by codice.
the class MetacardTypeRegistryTest method sampleMetacardTypeA.
private QualifiedMetacardType sampleMetacardTypeA() {
Set<AttributeDescriptor> descriptors = new HashSet<AttributeDescriptor>();
descriptors.add(new AttributeDescriptorImpl(FREQUENCY_ATTRIBUTE_NAME_SAMPLE_METACARD_TYPE_A, true, /* indexed */
true, /* stored */
false, /* tokenized */
false, /* multivalued */
BasicTypes.LONG_TYPE));
descriptors.add(new AttributeDescriptorImpl(MIN_FREQUENCY_ATTRIBUTE_NAME_SAMPLE_METACARD_TYPE_A, true, /* indexed */
true, /* stored */
false, /* tokenized */
false, /* multivalued */
BasicTypes.LONG_TYPE));
descriptors.add(new AttributeDescriptorImpl(MAX_FREQUENCY_ATTRIBUTE_NAME_SAMPLE_METACARD_TYPE_A, true, /* indexed */
true, /* stored */
false, /* tokenized */
false, /* multivalued */
BasicTypes.LONG_TYPE));
descriptors.add(new AttributeDescriptorImpl(ANGLE_ATTRIBUTE_NAME_SAMPLE_METACARD_TYPE_A, true, /* indexed */
true, /* stored */
false, /* tokenized */
false, /* multivalued */
BasicTypes.INTEGER_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));
return new QualifiedMetacardTypeImpl("", SAMPLE_A_METACARD_TYPE_NAME, descriptors);
}
use of ddf.catalog.data.impl.QualifiedMetacardTypeImpl in project ddf by codice.
the class MetacardTypeRegistryTest method testUnregister.
@Test
public void testUnregister() throws IllegalArgumentException, MetacardTypeUnregistrationException {
assertEquals(4, mtr.getRegisteredTypes().size());
mtr.register(sampleMetacardTypeA());
mtr.register(sampleMetacardTypeB());
assertEquals(6, mtr.getRegisteredTypes().size());
QualifiedMetacardType metacardTypeAFromRegistry = mtr.lookup(QualifiedMetacardType.DEFAULT_METACARD_TYPE_NAMESPACE, SAMPLE_A_METACARD_TYPE_NAME);
assertNotNull(metacardTypeAFromRegistry);
assertEquals(SAMPLE_A_METACARD_TYPE_NAME, metacardTypeAFromRegistry.getName());
assertEquals(QualifiedMetacardType.DEFAULT_METACARD_TYPE_NAMESPACE, metacardTypeAFromRegistry.getNamespace());
assertOnSampleMetacardTypeAExpectedAttributes(metacardTypeAFromRegistry);
QualifiedMetacardType metacardTypeBFromRegistry = mtr.lookup(SAMPLE_B_METACARD_TYPE_NAMESPACE, SAMPLE_B_METACARD_TYPE_NAME);
assertNotNull(metacardTypeBFromRegistry);
assertEquals(SAMPLE_B_METACARD_TYPE_NAME, metacardTypeBFromRegistry.getName());
assertEquals(SAMPLE_B_METACARD_TYPE_NAMESPACE, metacardTypeBFromRegistry.getNamespace());
assertOnSampleMetacardTypeBExcpectedAttributes(metacardTypeBFromRegistry);
mtr.unregister(sampleMetacardTypeA());
assertEquals(5, mtr.getRegisteredTypes().size());
assertTrue(mtr.getRegisteredTypes().contains(sampleMetacardTypeB()));
assertFalse(mtr.getRegisteredTypes().contains(sampleMetacardTypeA()));
QualifiedMetacardTypeImpl qmt1 = new QualifiedMetacardTypeImpl(QUALIFIED_METACARD_TYPE_NAMESPACE_1, QUALIFIED_METACARD_TYPE_NAME_1, qmtAttributes);
assertTrue(mtr.getRegisteredTypes().contains(qmt1));
QualifiedMetacardTypeImpl qmt2 = new QualifiedMetacardTypeImpl(QUALIFIED_METACARD_TYPE_NAMESPACE_1, QUALIFIED_METACARD_TYPE_NAME_2, qmtAttributes);
assertTrue(mtr.getRegisteredTypes().contains(qmt2));
QualifiedMetacardTypeImpl qmt3 = new QualifiedMetacardTypeImpl(QualifiedMetacardType.DEFAULT_METACARD_TYPE_NAMESPACE, QUALIFIED_METACARD_TYPE_NAME_3, qmtAttributes);
assertTrue(mtr.getRegisteredTypes().contains(qmt3));
mtr.unregister(sampleMetacardTypeB());
}
use of ddf.catalog.data.impl.QualifiedMetacardTypeImpl in project ddf by codice.
the class MetacardTypeRegistryTest method registerMetacardTypeEmptyName.
@Test(expected = IllegalArgumentException.class)
public void registerMetacardTypeEmptyName() {
QualifiedMetacardType qmt = new QualifiedMetacardTypeImpl(QUALIFIED_METACARD_TYPE_NAMESPACE_1, "", qmtAttributes);
mtr.register(qmt);
}
use of ddf.catalog.data.impl.QualifiedMetacardTypeImpl in project ddf by codice.
the class MetacardTypeRegistryTest method setupMetacardTypeRegistry.
@BeforeClass
public static void setupMetacardTypeRegistry() throws Exception {
mtr = MetacardTypeRegistryImpl.getInstance();
qmtAttributes = new HashSet<AttributeDescriptor>();
AttributeDescriptor ad1 = new AttributeDescriptorImpl(GEO_ATTRIBUTE_DESCRIPTOR_NAME, true, true, false, false, BasicTypes.GEO_TYPE);
qmtAttributes.add(ad1);
AttributeDescriptor ad2 = new AttributeDescriptorImpl(METADATA_ATTRIBUTE_DESCRIPTOR_NAME, true, true, false, false, BasicTypes.XML_TYPE);
qmtAttributes.add(ad2);
QualifiedMetacardTypeImpl qmt1 = new QualifiedMetacardTypeImpl(QUALIFIED_METACARD_TYPE_NAMESPACE_1, QUALIFIED_METACARD_TYPE_NAME_1, qmtAttributes);
mtr.register(qmt1);
QualifiedMetacardTypeImpl qmt2 = new QualifiedMetacardTypeImpl(QUALIFIED_METACARD_TYPE_NAMESPACE_1, QUALIFIED_METACARD_TYPE_NAME_2, qmtAttributes);
mtr.register(qmt2);
QualifiedMetacardTypeImpl qmt3 = new QualifiedMetacardTypeImpl(QualifiedMetacardType.DEFAULT_METACARD_TYPE_NAMESPACE, QUALIFIED_METACARD_TYPE_NAME_3, qmtAttributes);
mtr.register(qmt3);
}
Aggregations