private void assertClassificationEquals(Set<AtlasClassification> propagatedClassifications, AtlasClassification expected) { String expectedTypeName = expected.getTypeName(); for (AtlasClassification c : propagatedClassifications) { if(c.getTypeName().equals(expectedTypeName)) { assertTrue(c.isPropagate() == expected.isPropagate(), "isPropgate does not match"); assertTrue(c.getValidityPeriods() == expected.getValidityPeriods(), "validityPeriods do not match"); return; } } fail(expectedTypeName + " could not be found"); }
private void assertClassificationEquals(Set<AtlasClassification> propagatedClassifications, AtlasClassification expected) { String expectedTypeName = expected.getTypeName(); for (AtlasClassification c : propagatedClassifications) { if(c.getTypeName().equals(expectedTypeName)) { assertTrue(c.isPropagate() == expected.isPropagate(), "isPropgate does not match"); assertTrue(c.getValidityPeriods() == expected.getValidityPeriods(), "validityPeriods do not match"); return; } } fail(expectedTypeName + " could not be found"); }
superTypeClassification.setPropagate(classification.isPropagate());
@Test(dataProvider = "sales") public void importDB1(ZipSource zipSource) throws AtlasBaseException, IOException { loadBaseModel(); runAndVerifyQuickStart_v1_Import(importService, zipSource); assertEntityCount("DB_v1", "bfe88eb8-7556-403c-8210-647013f44a44", 1); AtlasEntity entity = assertEntity("Table_v1", "fe91bf93-eb0c-4638-8361-15937390c810"); assertEquals(entity.getClassifications().size(), 1); assertFalse(entity.getClassifications().get(0).isPropagate(), "Default propagate should be false"); }
Boolean currentTagPropagation = currentClassification.isPropagate(); Boolean updatedTagPropagation = classification.isPropagate();
Boolean currentTagPropagation = currentClassification.isPropagate(); Boolean updatedTagPropagation = classification.isPropagate();
AtlasClassification classification = new AtlasClassification(c); String classificationName = classification.getTypeName(); Boolean propagateTags = classification.isPropagate(); Boolean removePropagations = classification.getRemovePropagationsOnEntityDelete();
@Test(dataProvider = "tag-prop-2") public void importTagProp2(ZipSource zipSource) throws IOException, AtlasBaseException { loadBaseModel(); loadFsModel(); loadHiveModel(); runImportWithNoParameters(importService, zipSource); assertEntityCount("hive_db", "7d7d5a18-d992-457e-83c0-e36f5b95ebdb", 1); assertEntityCount("hive_table", "dbe729bb-c614-4e23-b845-3258efdf7a58", 1); AtlasEntity entity = assertEntity("hive_table", "092e9888-de96-4908-8be3-925ee72e3395"); assertEquals(entity.getClassifications().size(), 2); assertTrue(entity.getClassifications().get(0).isPropagate()); assertFalse(entity.getClassifications().get(0).getEntityGuid().equalsIgnoreCase(entity.getGuid())); assertFalse(entity.getClassifications().get(1).getEntityGuid().equalsIgnoreCase(entity.getGuid())); }
AtlasClassification classification = new AtlasClassification(c); String classificationName = classification.getTypeName(); Boolean propagateTags = classification.isPropagate(); Boolean removePropagations = classification.getRemovePropagationsOnEntityDelete();
private AtlasEdge mapClassification(EntityOperation operation, final EntityMutationContext context, AtlasClassification classification, AtlasEntityType entityType, AtlasVertex parentInstanceVertex, AtlasVertex traitInstanceVertex) throws AtlasBaseException { if (classification.getValidityPeriods() != null) { String strValidityPeriods = AtlasJson.toJson(classification.getValidityPeriods()); AtlasGraphUtilsV2.setEncodedProperty(traitInstanceVertex, CLASSIFICATION_VALIDITY_PERIODS_KEY, strValidityPeriods); } else { // if 'null', don't update existing value in the classification } if (classification.isPropagate() != null) { AtlasGraphUtilsV2.setEncodedProperty(traitInstanceVertex, CLASSIFICATION_VERTEX_PROPAGATE_KEY, classification.isPropagate()); } if (classification.getRemovePropagationsOnEntityDelete() != null) { AtlasGraphUtilsV2.setEncodedProperty(traitInstanceVertex, CLASSIFICATION_VERTEX_REMOVE_PROPAGATIONS_KEY, classification.getRemovePropagationsOnEntityDelete()); } // map all the attributes to this newly created AtlasVertex mapAttributes(classification, traitInstanceVertex, operation, context); AtlasEdge ret = getClassificationEdge(parentInstanceVertex, traitInstanceVertex); if (ret == null) { ret = graphHelper.addClassificationEdge(parentInstanceVertex, traitInstanceVertex, false); } return ret; }
private AtlasEdge mapClassification(EntityOperation operation, final EntityMutationContext context, AtlasClassification classification, AtlasEntityType entityType, AtlasVertex parentInstanceVertex, AtlasVertex traitInstanceVertex) throws AtlasBaseException { if (classification.getValidityPeriods() != null) { String strValidityPeriods = AtlasJson.toJson(classification.getValidityPeriods()); AtlasGraphUtilsV2.setEncodedProperty(traitInstanceVertex, CLASSIFICATION_VALIDITY_PERIODS_KEY, strValidityPeriods); } else { // if 'null', don't update existing value in the classification } if (classification.isPropagate() != null) { AtlasGraphUtilsV2.setEncodedProperty(traitInstanceVertex, CLASSIFICATION_VERTEX_PROPAGATE_KEY, classification.isPropagate()); } if (classification.getRemovePropagationsOnEntityDelete() != null) { AtlasGraphUtilsV2.setEncodedProperty(traitInstanceVertex, CLASSIFICATION_VERTEX_REMOVE_PROPAGATIONS_KEY, classification.getRemovePropagationsOnEntityDelete()); } // map all the attributes to this newly created AtlasVertex mapAttributes(classification, traitInstanceVertex, operation, context); AtlasEdge ret = getClassificationEdge(parentInstanceVertex, traitInstanceVertex); if (ret == null) { ret = graphHelper.addClassificationEdge(parentInstanceVertex, traitInstanceVertex, false); } return ret; }
public AtlasClassification(AtlasClassification other) { if (other != null) { setTypeName(other.getTypeName()); setAttributes(other.getAttributes()); setEntityGuid(other.getEntityGuid()); setEntityStatus(other.getEntityStatus()); setPropagate(other.isPropagate()); setValidityPeriods(other.getValidityPeriods()); setRemovePropagationsOnEntityDelete(other.getRemovePropagationsOnEntityDelete()); } }