superTypeClassification.setPropagate(classification.isPropagate());
@Test(dependsOnMethods = {"updateClassification_PropagateTrueToFalse"}) public void deleteClassification_PropagateTrue() throws AtlasBaseException { AtlasEntity hdfs_employees = getEntity(HDFS_PATH_EMPLOYEES); AtlasClassification tag1 = new AtlasClassification("tag1"); tag1.setPropagate(true); tag1.setEntityGuid(hdfs_employees.getGuid()); deleteClassification(hdfs_employees, tag1); List<String> propagatedToEntities = Arrays.asList(EMPLOYEES1_PROCESS, EMPLOYEES2_PROCESS, EMPLOYEES1_TABLE, EMPLOYEES2_TABLE, EMPLOYEES_UNION_PROCESS, EMPLOYEES_UNION_TABLE); assertClassificationNotExistInEntities(propagatedToEntities, tag1); }
@Test(dependsOnMethods = {"updateClassification_PropagateTrueToFalse"}) public void deleteClassification_PropagateTrue() throws AtlasBaseException { AtlasEntity hdfs_employees = getEntity(HDFS_PATH_EMPLOYEES); AtlasClassification tag1 = new AtlasClassification("tag1"); tag1.setPropagate(true); tag1.setEntityGuid(hdfs_employees.getGuid()); deleteClassification(hdfs_employees, tag1); List<String> propagatedToEntities = Arrays.asList(EMPLOYEES1_PROCESS, EMPLOYEES2_PROCESS, EMPLOYEES1_TABLE, EMPLOYEES2_TABLE, EMPLOYEES_UNION_PROCESS, EMPLOYEES_UNION_TABLE); assertClassificationNotExistInEntities(propagatedToEntities, tag1); }
@Test(dependsOnMethods = {"updateClassification_PropagateFalseToTrue"}) public void addClassification_PropagateTrue() throws AtlasBaseException { AtlasEntity hdfs_employees = getEntity(HDFS_PATH_EMPLOYEES); AtlasClassification tag1 = new AtlasClassification("tag1"); tag1.setPropagate(true); tag1.setEntityGuid(hdfs_employees.getGuid()); // add classification with propagate flag to 'true' addClassification(hdfs_employees, tag1); List<String> propagatedToEntities = Arrays.asList(EMPLOYEES1_PROCESS, EMPLOYEES2_PROCESS, EMPLOYEES1_TABLE, EMPLOYEES2_TABLE, EMPLOYEES_UNION_PROCESS, EMPLOYEES_UNION_TABLE); assertClassificationExistInEntities(propagatedToEntities, tag1); }
@Test(dependsOnMethods = {"updateClassification_PropagateFalseToTrue"}) public void addClassification_PropagateTrue() throws AtlasBaseException { AtlasEntity hdfs_employees = getEntity(HDFS_PATH_EMPLOYEES); AtlasClassification tag1 = new AtlasClassification("tag1"); tag1.setPropagate(true); tag1.setEntityGuid(hdfs_employees.getGuid()); // add classification with propagate flag to 'true' addClassification(hdfs_employees, tag1); List<String> propagatedToEntities = Arrays.asList(EMPLOYEES1_PROCESS, EMPLOYEES2_PROCESS, EMPLOYEES1_TABLE, EMPLOYEES2_TABLE, EMPLOYEES_UNION_PROCESS, EMPLOYEES_UNION_TABLE); assertClassificationExistInEntities(propagatedToEntities, tag1); }
@Test(dependsOnMethods = {"addClassification_PropagateTrue"}) public void updateClassification_PropagateTrueToFalse() throws AtlasBaseException { AtlasEntity hdfs_employees = getEntity(HDFS_PATH_EMPLOYEES); AtlasClassification tag1 = new AtlasClassification("tag1"); tag1.setEntityGuid(hdfs_employees.getGuid()); List<String> propagatedToEntities = Arrays.asList(EMPLOYEES1_PROCESS, EMPLOYEES2_PROCESS, EMPLOYEES1_TABLE, EMPLOYEES2_TABLE, EMPLOYEES_UNION_PROCESS, EMPLOYEES_UNION_TABLE); // update propagate flag to 'false' tag1 = getClassification(hdfs_employees, tag1); tag1.setPropagate(false); updateClassifications(hdfs_employees, tag1); assertClassificationNotExistInEntities(propagatedToEntities, tag1); }
@Test(dependsOnMethods = {"addClassification_PropagateTrue"}) public void updateClassification_PropagateTrueToFalse() throws AtlasBaseException { AtlasEntity hdfs_employees = getEntity(HDFS_PATH_EMPLOYEES); AtlasClassification tag1 = new AtlasClassification("tag1"); tag1.setEntityGuid(hdfs_employees.getGuid()); List<String> propagatedToEntities = Arrays.asList(EMPLOYEES1_PROCESS, EMPLOYEES2_PROCESS, EMPLOYEES1_TABLE, EMPLOYEES2_TABLE, EMPLOYEES_UNION_PROCESS, EMPLOYEES_UNION_TABLE); // update propagate flag to 'false' tag1 = getClassification(hdfs_employees, tag1); tag1.setPropagate(false); updateClassifications(hdfs_employees, tag1); assertClassificationNotExistInEntities(propagatedToEntities, tag1); }
@Test(dependsOnMethods = {"addClassification_PropagateFalse"}) public void updateClassification_PropagateFalseToTrue() throws AtlasBaseException { AtlasEntity hdfs_employees = getEntity(HDFS_PATH_EMPLOYEES); AtlasClassification tag2 = new AtlasClassification("tag2"); tag2.setEntityGuid(hdfs_employees.getGuid()); //update tag2 propagate to 'true' tag2 = getClassification(hdfs_employees, tag2); tag2.setPropagate(true); updateClassifications(hdfs_employees, tag2); List<String> propagatedToEntities = Arrays.asList(EMPLOYEES1_PROCESS, EMPLOYEES2_PROCESS, EMPLOYEES1_TABLE, EMPLOYEES2_TABLE, EMPLOYEES_UNION_PROCESS, EMPLOYEES_UNION_TABLE); assertClassificationExistInEntities(propagatedToEntities, tag2); deleteClassification(hdfs_employees, tag2); }
@Test(dependsOnMethods = {"addClassification_PropagateFalse"}) public void updateClassification_PropagateFalseToTrue() throws AtlasBaseException { AtlasEntity hdfs_employees = getEntity(HDFS_PATH_EMPLOYEES); AtlasClassification tag2 = new AtlasClassification("tag2"); tag2.setEntityGuid(hdfs_employees.getGuid()); //update tag2 propagate to 'true' tag2 = getClassification(hdfs_employees, tag2); tag2.setPropagate(true); updateClassifications(hdfs_employees, tag2); List<String> propagatedToEntities = Arrays.asList(EMPLOYEES1_PROCESS, EMPLOYEES2_PROCESS, EMPLOYEES1_TABLE, EMPLOYEES2_TABLE, EMPLOYEES_UNION_PROCESS, EMPLOYEES_UNION_TABLE); assertClassificationExistInEntities(propagatedToEntities, tag2); deleteClassification(hdfs_employees, tag2); }
/** This test uses the lineage graph: * Lineage - 1 ----------- [Process1] ----> [Employees1] / \ / \ [hdfs_employees] [Process3] ----> [ EmployeesUnion ] \ / \ / [Process2] ----> [Employees2] Lineage - 2 ----------- [Employees] ----> [Process] ----> [ US_Employees ] Lineage - 3 ----------- [Orders] ----> [Process] ----> [ US_Orders ] */ @Test public void addClassification_PropagateFalse() throws AtlasBaseException { AtlasEntity hdfs_employees = getEntity(HDFS_PATH_EMPLOYEES); AtlasClassification tag2 = new AtlasClassification("tag2"); tag2.setPropagate(false); tag2.setEntityGuid(hdfs_employees.getGuid()); // add classification with propagate to 'false' addClassification(hdfs_employees, tag2); List<String> propagatedToEntities = Arrays.asList(EMPLOYEES1_PROCESS, EMPLOYEES2_PROCESS, EMPLOYEES1_TABLE, EMPLOYEES2_TABLE, EMPLOYEES_UNION_PROCESS, EMPLOYEES_UNION_TABLE); assertClassificationNotExistInEntities(propagatedToEntities, tag2); }
tag1.setPropagate(true); tag1.setEntityGuid(hdfs_employees.getGuid()); tag1.setPropagate(true); tag1.setEntityGuid(employees2_table.getGuid());
/** This test uses the lineage graph: * Lineage - 1 ----------- [Process1] ----> [Employees1] / \ / \ [hdfs_employees] [Process3] ----> [ EmployeesUnion ] \ / \ / [Process2] ----> [Employees2] Lineage - 2 ----------- [Employees] ----> [Process] ----> [ US_Employees ] Lineage - 3 ----------- [Orders] ----> [Process] ----> [ US_Orders ] */ @Test public void addClassification_PropagateFalse() throws AtlasBaseException { AtlasEntity hdfs_employees = getEntity(HDFS_PATH_EMPLOYEES); AtlasClassification tag2 = new AtlasClassification("tag2"); tag2.setPropagate(false); tag2.setEntityGuid(hdfs_employees.getGuid()); // add classification with propagate to 'false' addClassification(hdfs_employees, tag2); List<String> propagatedToEntities = Arrays.asList(EMPLOYEES1_PROCESS, EMPLOYEES2_PROCESS, EMPLOYEES1_TABLE, EMPLOYEES2_TABLE, EMPLOYEES_UNION_PROCESS, EMPLOYEES_UNION_TABLE); assertClassificationNotExistInEntities(propagatedToEntities, tag2); }
public AtlasClassification toAtlasClassification(AtlasVertex classificationVertex) throws AtlasBaseException { AtlasClassification ret = new AtlasClassification(getTypeName(classificationVertex)); ret.setEntityGuid(AtlasGraphUtilsV2.getEncodedProperty(classificationVertex, CLASSIFICATION_ENTITY_GUID, String.class)); ret.setEntityStatus(getClassificationEntityStatus(classificationVertex)); ret.setPropagate(isPropagationEnabled(classificationVertex)); ret.setRemovePropagationsOnEntityDelete(getRemovePropagations(classificationVertex)); String strValidityPeriods = AtlasGraphUtilsV2.getEncodedProperty(classificationVertex, CLASSIFICATION_VALIDITY_PERIODS_KEY, String.class); if (strValidityPeriods != null) { ret.setValidityPeriods(AtlasJson.fromJson(strValidityPeriods, TIME_BOUNDARIES_LIST_TYPE)); } mapAttributes(classificationVertex, ret, null); 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()); } }
public AtlasClassification toAtlasClassification(AtlasVertex classificationVertex) throws AtlasBaseException { AtlasClassification ret = new AtlasClassification(getTypeName(classificationVertex)); ret.setEntityGuid(AtlasGraphUtilsV2.getEncodedProperty(classificationVertex, CLASSIFICATION_ENTITY_GUID, String.class)); ret.setEntityStatus(getClassificationEntityStatus(classificationVertex)); ret.setPropagate(isPropagationEnabled(classificationVertex)); ret.setRemovePropagationsOnEntityDelete(getRemovePropagations(classificationVertex)); String strValidityPeriods = AtlasGraphUtilsV2.getEncodedProperty(classificationVertex, CLASSIFICATION_VALIDITY_PERIODS_KEY, String.class); if (strValidityPeriods != null) { ret.setValidityPeriods(AtlasJson.fromJson(strValidityPeriods, TIME_BOUNDARIES_LIST_TYPE)); } mapAttributes(classificationVertex, ret, null); return ret; }
@Test(dependsOnMethods = {"removeBlockedPropagatedClassifications"}) public void addClassification_removePropagationsTrue_DeleteCase() throws AtlasBaseException { AtlasEntity orders = getEntity(ORDERS_TABLE); AtlasClassification tag2 = new AtlasClassification("tag2"); tag2.setEntityGuid(orders.getGuid()); tag2.setPropagate(true); tag2.setRemovePropagationsOnEntityDelete(true); addClassification(orders, tag2); List<String> propagatedEntities = Arrays.asList(EMPLOYEES_PROCESS, US_EMPLOYEES_TABLE); assertClassificationExistInEntities(propagatedEntities, tag2); AtlasEntity orders_process = getEntity(ORDERS_PROCESS); AtlasEntity us_orders = getEntity(US_ORDERS_TABLE); deletePropagatedClassificationExpectFail(orders_process, tag2); deletePropagatedClassificationExpectFail(us_orders, tag2); deleteEntity(ORDERS_TABLE); assertClassificationNotExistInEntity(ORDERS_PROCESS, tag2); assertClassificationNotExistInEntity(US_ORDERS_TABLE, tag2); }
@Test(dependsOnMethods = {"addClassification_removePropagationsTrue_DeleteCase"}) public void addClassification_removePropagationsFalse_DeleteCase() throws AtlasBaseException { AtlasEntity employees = getEntity(EMPLOYEES_TABLE); AtlasClassification tag1 = new AtlasClassification("tag1"); tag1.setEntityGuid(employees.getGuid()); tag1.setPropagate(true); tag1.setRemovePropagationsOnEntityDelete(false); addClassification(employees, tag1); List<String> propagatedEntities = Arrays.asList(EMPLOYEES_PROCESS, US_EMPLOYEES_TABLE); assertClassificationExistInEntities(propagatedEntities, tag1); AtlasEntity employees_process = getEntity(EMPLOYEES_PROCESS); AtlasEntity us_employees = getEntity(US_EMPLOYEES_TABLE); deletePropagatedClassificationExpectFail(employees_process, tag1); deletePropagatedClassificationExpectFail(us_employees, tag1); deleteEntity(EMPLOYEES_PROCESS); assertClassificationExistInEntity(EMPLOYEES_PROCESS, tag1); assertClassificationExistInEntity(US_EMPLOYEES_TABLE, tag1); }
@Test(dependsOnMethods = {"addClassification_removePropagationsTrue_DeleteCase"}) public void addClassification_removePropagationsFalse_DeleteCase() throws AtlasBaseException { AtlasEntity employees = getEntity(EMPLOYEES_TABLE); AtlasClassification tag1 = new AtlasClassification("tag1"); tag1.setEntityGuid(employees.getGuid()); tag1.setPropagate(true); tag1.setRemovePropagationsOnEntityDelete(false); addClassification(employees, tag1); List<String> propagatedEntities = Arrays.asList(EMPLOYEES_PROCESS, US_EMPLOYEES_TABLE); assertClassificationExistInEntities(propagatedEntities, tag1); AtlasEntity employees_process = getEntity(EMPLOYEES_PROCESS); AtlasEntity us_employees = getEntity(US_EMPLOYEES_TABLE); deletePropagatedClassificationExpectFail(employees_process, tag1); deletePropagatedClassificationExpectFail(us_employees, tag1); deleteEntity(EMPLOYEES_PROCESS); assertClassificationExistInEntity(EMPLOYEES_PROCESS, tag1); assertClassificationExistInEntity(US_EMPLOYEES_TABLE, tag1); }
@Test(dependsOnMethods = {"removeBlockedPropagatedClassifications"}) public void addClassification_removePropagationsTrue_DeleteCase() throws AtlasBaseException { AtlasEntity orders = getEntity(ORDERS_TABLE); AtlasClassification tag2 = new AtlasClassification("tag2"); tag2.setEntityGuid(orders.getGuid()); tag2.setPropagate(true); tag2.setRemovePropagationsOnEntityDelete(true); addClassification(orders, tag2); List<String> propagatedEntities = Arrays.asList(EMPLOYEES_PROCESS, US_EMPLOYEES_TABLE); assertClassificationExistInEntities(propagatedEntities, tag2); AtlasEntity orders_process = getEntity(ORDERS_PROCESS); AtlasEntity us_orders = getEntity(US_ORDERS_TABLE); deletePropagatedClassificationExpectFail(orders_process, tag2); deletePropagatedClassificationExpectFail(us_orders, tag2); deleteEntity(ORDERS_TABLE); assertClassificationNotExistInEntity(ORDERS_PROCESS, tag2); assertClassificationNotExistInEntity(US_ORDERS_TABLE, tag2); }
AtlasEntity employees2 = getEntity(EMPLOYEES2_TABLE); AtlasClassification PII_tag1 = new AtlasClassification("PII"); PII_tag1.setPropagate(true); PII_tag1.setEntityGuid(hdfs_path.getGuid()); PII_tag1.setAttribute("type", "from hdfs_path entity"); PII_tag1.setAttribute("valid", true); AtlasClassification PII_tag2 = new AtlasClassification("PII"); PII_tag2.setPropagate(true); PII_tag2.setEntityGuid(employees1.getGuid()); PII_tag2.setAttribute("type", "from employees1 entity"); PII_tag2.setAttribute("valid", true); AtlasClassification PII_tag3 = new AtlasClassification("PII"); PII_tag3.setPropagate(true); PII_tag3.setEntityGuid(employees2.getGuid()); PII_tag3.setAttribute("type", "from employees2 entity"); PII_tag3.setAttribute("valid", true);