use of org.apache.atlas.type.AtlasTypeRegistry in project incubator-atlas by apache.
the class RestUtilsTest method convertV2toV1.
private List<HierarchicalTypeDefinition<ClassType>> convertV2toV1(List<AtlasEntityDef> toConvert) throws AtlasBaseException {
AtlasTypeRegistry reg = createRegistry(toConvert);
List<HierarchicalTypeDefinition<ClassType>> result = new ArrayList<>(toConvert.size());
for (int i = 0; i < toConvert.size(); i++) {
AtlasEntityDef entityDef = toConvert.get(i);
AtlasEntityType entity = reg.getEntityTypeByName(entityDef.getName());
HierarchicalTypeDefinition<ClassType> converted = TypeConverterUtil.toTypesDef(entity, reg).classTypesAsJavaList().get(0);
result.add(converted);
}
return result;
}
use of org.apache.atlas.type.AtlasTypeRegistry in project incubator-atlas by apache.
the class TestAtlasClassification method testClassificationSerDeWithSuperType.
@Test
public void testClassificationSerDeWithSuperType() throws AtlasBaseException {
AtlasClassificationDef classificationDef = ModelTestUtil.getClassificationDefWithSuperType();
AtlasTypeRegistry typeRegistry = ModelTestUtil.getTypesRegistry();
AtlasClassificationType classificationType = typeRegistry.getClassificationTypeByName(classificationDef.getName());
assertNotNull(classificationType);
AtlasClassification ent1 = classificationType.createDefaultValue();
String jsonString = AtlasType.toJson(ent1);
AtlasClassification ent2 = AtlasType.fromJson(jsonString, AtlasClassification.class);
classificationType.normalizeAttributeValues(ent2);
assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasClassification with superType");
}
use of org.apache.atlas.type.AtlasTypeRegistry in project incubator-atlas by apache.
the class TestAtlasClassification method testClassificationSerDeWithSuperTypes.
@Test
public void testClassificationSerDeWithSuperTypes() throws AtlasBaseException {
AtlasClassificationDef classificationDef = ModelTestUtil.getClassificationDefWithSuperTypes();
AtlasTypeRegistry typeRegistry = ModelTestUtil.getTypesRegistry();
AtlasClassificationType classificationType = typeRegistry.getClassificationTypeByName(classificationDef.getName());
assertNotNull(classificationType);
AtlasClassification ent1 = classificationType.createDefaultValue();
String jsonString = AtlasType.toJson(ent1);
AtlasClassification ent2 = AtlasType.fromJson(jsonString, AtlasClassification.class);
classificationType.normalizeAttributeValues(ent2);
assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasClassification with superTypes");
}
use of org.apache.atlas.type.AtlasTypeRegistry in project incubator-atlas by apache.
the class TestAtlasEntity method testEntitySerDeWithSuperType.
@Test
public void testEntitySerDeWithSuperType() throws AtlasBaseException {
AtlasEntityDef entityDef = ModelTestUtil.getEntityDefWithSuperType();
AtlasTypeRegistry typeRegistry = ModelTestUtil.getTypesRegistry();
AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entityDef.getName());
assertNotNull(entityType);
AtlasEntity ent1 = entityType.createDefaultValue();
String jsonString = AtlasType.toJson(ent1);
AtlasEntity ent2 = AtlasType.fromJson(jsonString, AtlasEntity.class);
entityType.normalizeAttributeValues(ent2);
assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasEntity with superType");
}
use of org.apache.atlas.type.AtlasTypeRegistry in project incubator-atlas by apache.
the class TestAtlasEntity method testEntitySerDeWithSuperTypes.
@Test
public void testEntitySerDeWithSuperTypes() throws AtlasBaseException {
AtlasEntityDef entityDef = ModelTestUtil.getEntityDefWithSuperTypes();
AtlasTypeRegistry typeRegistry = ModelTestUtil.getTypesRegistry();
AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entityDef.getName());
assertNotNull(entityType);
AtlasEntity ent1 = entityType.createDefaultValue();
String jsonString = AtlasType.toJson(ent1);
AtlasEntity ent2 = AtlasType.fromJson(jsonString, AtlasEntity.class);
entityType.normalizeAttributeValues(ent2);
assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasEntity with superTypes");
}
Aggregations