Java Code Examples for org.apache.atlas.type.AtlasClassificationType#normalizeAttributeValues()

The following examples show how to use org.apache.atlas.type.AtlasClassificationType#normalizeAttributeValues() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestAtlasClassification.java    From atlas with Apache License 2.0 4 votes vote down vote up
@Test
public void testClassificationSerDe() throws AtlasBaseException {
    AtlasClassificationDef  classificationDef  = ModelTestUtil.getClassificationDef();
    AtlasTypeRegistry       typeRegistry       = ModelTestUtil.getTypesRegistry();
    AtlasClassificationType classificationType = typeRegistry.getClassificationTypeByName(classificationDef.getName());

    assertNotNull(classificationType);

    AtlasClassification ent1 = ModelTestUtil.newClassification(classificationDef, typeRegistry);

    String jsonString = AtlasType.toJson(ent1);

    AtlasClassification ent2 = AtlasType.fromJson(jsonString, AtlasClassification.class);

    classificationType.normalizeAttributeValues(ent2);

    assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasClassification");
}
 
Example 2
Source File: TestAtlasClassification.java    From atlas with Apache License 2.0 4 votes vote down vote up
@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");
}
 
Example 3
Source File: TestAtlasClassification.java    From atlas with Apache License 2.0 4 votes vote down vote up
@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");
}
 
Example 4
Source File: TestAtlasClassification.java    From incubator-atlas with Apache License 2.0 4 votes vote down vote up
@Test
public void testClassificationSerDe() throws AtlasBaseException {
    AtlasClassificationDef  classificationDef  = ModelTestUtil.getClassificationDef();
    AtlasTypeRegistry       typeRegistry       = ModelTestUtil.getTypesRegistry();
    AtlasClassificationType classificationType = typeRegistry.getClassificationTypeByName(classificationDef.getName());

    assertNotNull(classificationType);

    AtlasClassification ent1 = ModelTestUtil.newClassification(classificationDef, typeRegistry);

    String jsonString = AtlasType.toJson(ent1);

    AtlasClassification ent2 = AtlasType.fromJson(jsonString, AtlasClassification.class);

    classificationType.normalizeAttributeValues(ent2);

    assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasClassification");
}
 
Example 5
Source File: TestAtlasClassification.java    From incubator-atlas with Apache License 2.0 4 votes vote down vote up
@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");
}
 
Example 6
Source File: TestAtlasClassification.java    From incubator-atlas with Apache License 2.0 4 votes vote down vote up
@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");
}