use of ddf.catalog.data.AttributeDescriptor in project ddf by codice.
the class AttributeRegistryImplTest method testRemoveAttribute.
@Test
public void testRemoveAttribute() {
final String attributeName = "attribute";
final AttributeDescriptor descriptor = new AttributeDescriptorImpl(attributeName, true, false, true, false, BasicTypes.STRING_TYPE);
registry.register(descriptor);
Optional<AttributeDescriptor> descriptorOptional = registry.lookup(attributeName);
assertThat(descriptorOptional.isPresent(), is(true));
registry.deregister(descriptor);
descriptorOptional = registry.lookup(attributeName);
assertThat(descriptorOptional.isPresent(), is(false));
}
use of ddf.catalog.data.AttributeDescriptor in project ddf by codice.
the class AttributeRegistryImplTest method testAddAttributeWithSameName.
@Test
public void testAddAttributeWithSameName() {
final String attributeName = "foo";
final AttributeDescriptor descriptor1 = new AttributeDescriptorImpl(attributeName, true, true, true, true, BasicTypes.STRING_TYPE);
registry.register(descriptor1);
final AttributeDescriptor descriptor2 = new AttributeDescriptorImpl(attributeName, false, false, false, false, BasicTypes.BINARY_TYPE);
registry.register(descriptor2);
final Optional<AttributeDescriptor> descriptorOptional = registry.lookup(attributeName);
assertThat(descriptorOptional.isPresent(), is(true));
assertThat(descriptorOptional.get(), is(descriptor1));
}
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);
}
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));
}
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));
}
Aggregations