protected AtlasEntity getDefaultAtlasEntity(T obj) { AtlasEntity ret = getEntityType().createDefaultValue(); if (obj != null) { if (StringUtils.isNotEmpty(obj.getGuid())) { ret.setGuid(obj.getGuid()); } } return ret; }
protected AtlasEntity getDefaultAtlasEntity(T obj) throws AtlasBaseException { AtlasEntity ret = getEntityType().createDefaultValue(); if (obj != null) { if (StringUtils.isNotEmpty(obj.getGuid())) { ret.setGuid(obj.getGuid()); } } return ret; }
@Test public void testEntityTypeDefaultValue() { AtlasEntity defValue = entityType.createDefaultValue(); assertNotNull(defValue); assertEquals(defValue.getTypeName(), entityType.getTypeName()); }
@Test public void testEntityTypeDefaultValue() { AtlasEntity defValue = entityType.createDefaultValue(); assertNotNull(defValue); assertEquals(defValue.getTypeName(), entityType.getTypeName()); }
private AtlasEntity createHDFSPathEntity(AtlasEntityType hdfsPathEntityType, String path, String clusterName) { AtlasEntity entity = hdfsPathEntityType.createDefaultValue(); entity.setAttribute(HDFS_PATH_ATTRIBUTE_QUALIFIED_NAME, getQualifiedName(path, clusterName)); entity.setAttribute(HDFS_PATH_ATTRIBUTE_NAME_PATH, path); entity.setAttribute(HDFS_PATH_ATTRIBUTE_NAME_NAME, path); entity.setAttribute(HDFS_PATH_ATTRIBUTE_NAME_CLUSTER_NAME, clusterName); return entity; }
private AtlasEntity getDefaultTableEntity(String name) throws AtlasBaseException { AtlasEntityType type = (AtlasEntityType) typeRegistry.getType(TYPE_RDBMS_TABLES); AtlasEntity ret = type.createDefaultValue(); ret.setAttribute("name", name); return ret; }
public static AtlasEntity newEntity(AtlasEntityDef entityDef, AtlasTypeRegistry typesRegistry) { AtlasEntity ret = null; AtlasEntityType entityType = typesRegistry.getEntityTypeByName(entityDef.getName()); if (entityType != null) { ret = entityType.createDefaultValue(); } else { LOG.error("failed to get entity-type {}", entityDef.getName()); } return ret; }
public static AtlasEntity newEntity(AtlasEntityDef entityDef, AtlasTypeRegistry typesRegistry) { AtlasEntity ret = null; AtlasEntityType entityType = typesRegistry.getEntityTypeByName(entityDef.getName()); if (entityType != null) { ret = entityType.createDefaultValue(); } else { LOG.error("failed to get entity-type {}", entityDef.getName()); } return ret; }
@Test public void testEntitySerDe() throws AtlasBaseException { AtlasEntityDef entityDef = ModelTestUtil.getEntityDef(); 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"); }
@Test public void testEntitySerDe() throws AtlasBaseException { AtlasEntityDef entityDef = ModelTestUtil.getEntityDef(); 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"); }
@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"); }
@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"); }
@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"); } }
@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"); } }