Search in sources :

Example 1 with QualifiedMetacardTypeImpl

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);
}
Also used : QualifiedMetacardTypeImpl(ddf.catalog.data.impl.QualifiedMetacardTypeImpl) QualifiedMetacardType(ddf.catalog.data.QualifiedMetacardType) Test(org.junit.Test)

Example 2 with QualifiedMetacardTypeImpl

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);
}
Also used : QualifiedMetacardTypeImpl(ddf.catalog.data.impl.QualifiedMetacardTypeImpl) AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) AttributeDescriptorImpl(ddf.catalog.data.impl.AttributeDescriptorImpl) HashSet(java.util.HashSet)

Example 3 with QualifiedMetacardTypeImpl

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());
}
Also used : QualifiedMetacardTypeImpl(ddf.catalog.data.impl.QualifiedMetacardTypeImpl) QualifiedMetacardType(ddf.catalog.data.QualifiedMetacardType) Test(org.junit.Test)

Example 4 with QualifiedMetacardTypeImpl

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);
}
Also used : QualifiedMetacardTypeImpl(ddf.catalog.data.impl.QualifiedMetacardTypeImpl) QualifiedMetacardType(ddf.catalog.data.QualifiedMetacardType) Test(org.junit.Test)

Example 5 with QualifiedMetacardTypeImpl

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);
}
Also used : QualifiedMetacardTypeImpl(ddf.catalog.data.impl.QualifiedMetacardTypeImpl) AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) AttributeDescriptorImpl(ddf.catalog.data.impl.AttributeDescriptorImpl) BeforeClass(org.junit.BeforeClass)

Aggregations

QualifiedMetacardTypeImpl (ddf.catalog.data.impl.QualifiedMetacardTypeImpl)9 QualifiedMetacardType (ddf.catalog.data.QualifiedMetacardType)6 Test (org.junit.Test)6 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)3 AttributeDescriptorImpl (ddf.catalog.data.impl.AttributeDescriptorImpl)3 HashSet (java.util.HashSet)2 BeforeClass (org.junit.BeforeClass)1