use of org.apache.atlas.typesystem.types.TypeUpdateException in project incubator-atlas by apache.
the class StoreBackedTypeCacheMetadataServiceTest method testInvalidUpdateType.
@Test
public void testInvalidUpdateType() throws Exception {
// Cache should be empty
Assert.assertFalse(storeBackedTypeCache.isCachedInMemory(TestUtils.TABLE_TYPE));
HierarchicalTypeDefinition<ClassType> classTypeDef = TypesUtil.createClassTypeDef(TestUtils.TABLE_TYPE, ImmutableSet.<String>of(), new AttributeDefinition("attr1", DataTypes.STRING_TYPE.getName(), Multiplicity.OPTIONAL, false, null));
String json = TypesSerialization.toJson(classTypeDef, false);
// Try to update the type with disallowed changes. Should fail with TypeUpdateException.
try {
metadataService.updateType(json);
Assert.fail(TypeUpdateException.class.getSimpleName() + " was expected but none thrown");
} catch (TypeUpdateException e) {
// good
}
// hive_table type should now be cached.
Assert.assertTrue(storeBackedTypeCache.isCachedInMemory(TestUtils.TABLE_TYPE));
}
Aggregations