Search in sources :

Example 51 with AttributeDescriptor

use of ddf.catalog.data.AttributeDescriptor in project ddf by codice.

the class AttributeRegistryImplTest method testNullAttributeDescriptorName.

@Test(expected = IllegalArgumentException.class)
public void testNullAttributeDescriptorName() {
    final AttributeDescriptor descriptor = new AttributeDescriptorImpl(null, true, false, true, false, BasicTypes.STRING_TYPE);
    registry.register(descriptor);
}
Also used : AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) Test(org.junit.Test)

Example 52 with AttributeDescriptor

use of ddf.catalog.data.AttributeDescriptor in project ddf by codice.

the class AttributeRegistryImplTest method testAddDuplicateAttribute.

@Test
public void testAddDuplicateAttribute() {
    final String attributeName = "foo";
    final AttributeDescriptor descriptor1 = new AttributeDescriptorImpl(attributeName, true, true, true, true, BasicTypes.STRING_TYPE);
    registry.register(descriptor1);
    registry.register(descriptor1);
    final Optional<AttributeDescriptor> descriptorOptional = registry.lookup(attributeName);
    assertThat(descriptorOptional.isPresent(), is(true));
    assertThat(descriptorOptional.get(), is(descriptor1));
}
Also used : AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) Test(org.junit.Test)

Example 53 with AttributeDescriptor

use of ddf.catalog.data.AttributeDescriptor in project ddf by codice.

the class AttributeRegistryImplTest method testAddRemoveAttributeWithSameName.

@Test
public void testAddRemoveAttributeWithSameName() {
    final String attributeName = "test";
    final AttributeDescriptor descriptor1 = new AttributeDescriptorImpl(attributeName, true, true, true, true, BasicTypes.STRING_TYPE);
    final AttributeDescriptor descriptor2 = new AttributeDescriptorImpl(attributeName, false, false, false, false, BasicTypes.STRING_TYPE);
    registry.register(descriptor1);
    registry.register(descriptor2);
    registry.deregister(descriptor1);
    final Optional<AttributeDescriptor> descriptorOptional = registry.lookup(attributeName);
    assertThat(descriptorOptional.isPresent(), is(true));
    assertThat(descriptorOptional.get(), is(descriptor2));
}
Also used : AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) Test(org.junit.Test)

Example 54 with AttributeDescriptor

use of ddf.catalog.data.AttributeDescriptor in project ddf by codice.

the class AttributeRegistryImplTest method testAddAttribute.

@Test
public void testAddAttribute() {
    final String attributeName = "test";
    final AttributeDescriptor descriptor = new AttributeDescriptorImpl(attributeName, true, false, true, false, BasicTypes.STRING_TYPE);
    registry.register(descriptor);
    final Optional<AttributeDescriptor> descriptorOptional = registry.lookup(attributeName);
    assertThat(descriptorOptional.isPresent(), is(true));
    assertThat(descriptorOptional.get(), is(descriptor));
}
Also used : AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) Test(org.junit.Test)

Example 55 with AttributeDescriptor

use of ddf.catalog.data.AttributeDescriptor 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)

Aggregations

AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)111 Test (org.junit.Test)51 MetacardType (ddf.catalog.data.MetacardType)40 Metacard (ddf.catalog.data.Metacard)38 HashSet (java.util.HashSet)29 Attribute (ddf.catalog.data.Attribute)26 AttributeDescriptorImpl (ddf.catalog.data.impl.AttributeDescriptorImpl)24 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)24 MetacardTypeImpl (ddf.catalog.data.impl.MetacardTypeImpl)24 ArrayList (java.util.ArrayList)23 Serializable (java.io.Serializable)16 FeatureMetacardType (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType)9 CatalogTransformerException (ddf.catalog.transform.CatalogTransformerException)8 HashMap (java.util.HashMap)8 Map (java.util.Map)8 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)7 IOException (java.io.IOException)7 Date (java.util.Date)7 List (java.util.List)7 QName (javax.xml.namespace.QName)7