ImportTransforms { public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo != null) { apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } } return entityWithExtInfo; } private  ImportTransforms(); private  ImportTransforms(String jsonString); static ImportTransforms fromJson(String jsonString); Map<String, Map<String, List<ImportTransformer>>> getTransforms(); Map<String, List<ImportTransformer>> getTransforms(String typeName); AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo); AtlasEntity apply(AtlasEntity entity);  }
@Test public void transformEntityWith2Transforms() throws AtlasBaseException { AtlasEntity entity = getHiveTableAtlasEntity(); String attrValue = (String) entity.getAttribute(qualifiedName); transform.apply(entity); assertEquals(entity.getAttribute(qualifiedName), applyDefaultTransform(attrValue)); }
@Test public void transformEntityWithExtInfo() throws AtlasBaseException { addColumnTransform(transform); AtlasEntityWithExtInfo entityWithExtInfo = getAtlasEntityWithExtInfo(); AtlasEntity entity = entityWithExtInfo.getEntity(); String attrValue = (String) entity.getAttribute(qualifiedName); String[] expectedValues = getExtEntityExpectedValues(entityWithExtInfo); transform.apply(entityWithExtInfo); assertEquals(entityWithExtInfo.getEntity().getAttribute(qualifiedName), applyDefaultTransform(attrValue)); for (int i = 0; i < expectedValues.length; i++) { assertEquals(entityWithExtInfo.getReferredEntities().get(Integer.toString(i)).getAttribute(qualifiedName), expectedValues[i]); } }
@Test public void transformEntityWithExtInfoNullCheck() throws AtlasBaseException { addColumnTransform(transform); AtlasEntityWithExtInfo entityWithExtInfo = getAtlasEntityWithExtInfo(); entityWithExtInfo.setReferredEntities(null); AtlasEntityWithExtInfo transformedEntityWithExtInfo = transform.apply(entityWithExtInfo); assertNotNull(transformedEntityWithExtInfo); assertEquals(entityWithExtInfo.getEntity().getGuid(), transformedEntityWithExtInfo.getEntity().getGuid()); }