Java Code Examples for org.apache.atlas.model.instance.AtlasEntity#AtlasEntitiesWithExtInfo
The following examples show how to use
org.apache.atlas.model.instance.AtlasEntity#AtlasEntitiesWithExtInfo .
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: AtlasInstanceConverter.java From atlas with Apache License 2.0 | 6 votes |
public AtlasEntity.AtlasEntitiesWithExtInfo toAtlasEntities(List<Referenceable> referenceables) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> toAtlasEntities({})", referenceables); } AtlasFormatConverter.ConverterContext context = new AtlasFormatConverter.ConverterContext(); for (Referenceable referenceable : referenceables) { AtlasEntity entity = fromV1toV2Entity(referenceable, context); context.addEntity(entity); } AtlasEntity.AtlasEntitiesWithExtInfo ret = context.getEntities(); if (LOG.isDebugEnabled()) { LOG.debug("<== toAtlasEntities({}): ret=", referenceables, ret); } return ret; }
Example 2
Source File: ExportServiceTest.java From atlas with Apache License 2.0 | 6 votes |
@BeforeClass public void setupSampleData() throws AtlasBaseException { AtlasTypesDef sampleTypes = TestUtilsV2.defineDeptEmployeeTypes(); AtlasTypesDef typesToCreate = AtlasTypeDefStoreInitializer.getTypesToCreate(sampleTypes, typeRegistry); if (!typesToCreate.isEmpty()) { typeDefStore.createTypesDef(typesToCreate); } AtlasEntity.AtlasEntitiesWithExtInfo deptEg2 = TestUtilsV2.createDeptEg2(); AtlasEntityStream entityStream = new AtlasEntityStream(deptEg2); EntityMutationResponse emr = entityStore.createOrUpdate(entityStream, false); assertNotNull(emr); assertNotNull(emr.getCreatedEntities()); assertTrue(emr.getCreatedEntities().size() > 0); }
Example 3
Source File: AtlasDeleteHandlerV1Test.java From incubator-atlas with Apache License 2.0 | 6 votes |
private AtlasEntity.AtlasEntityWithExtInfo createMapOwnerAndValueEntities() throws AtlasException, AtlasBaseException { final AtlasEntity mapOwnerInstance = new AtlasEntity(compositeMapOwnerType.getTypeName()); mapOwnerInstance.setAttribute(NAME, TestUtils.randomString()); AtlasEntity mapValueInstance = new AtlasEntity(compositeMapValueType.getTypeName()); mapValueInstance.setAttribute(NAME, TestUtils.randomString()); mapOwnerInstance.setAttribute("map", Collections.singletonMap("value1", AtlasTypeUtil.getAtlasObjectId(mapValueInstance))); AtlasEntity.AtlasEntitiesWithExtInfo entities = new AtlasEntity.AtlasEntitiesWithExtInfo(); entities.addReferredEntity(mapValueInstance); entities.addEntity(mapOwnerInstance); List<AtlasEntityHeader> createEntitiesResult = entityStore.createOrUpdate(new AtlasEntityStream(entities), false).getCreatedEntities(); Assert.assertEquals(createEntitiesResult.size(), 2); AtlasEntity.AtlasEntityWithExtInfo entityDefinition = entityStore.getByUniqueAttributes(compositeMapOwnerType, new HashMap<String, Object>() {{ put(NAME, mapOwnerInstance.getAttribute(NAME)); }}); return entityDefinition; }
Example 4
Source File: AtlasAPIV2ServerEmulator.java From nifi with Apache License 2.0 | 6 votes |
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { final AtlasEntity.AtlasEntitiesWithExtInfo withExtInfo = readInputJSON(req, AtlasEntity.AtlasEntitiesWithExtInfo.class); final Map<String, String> guidAssignments = new HashMap<>(); withExtInfo.getEntities().forEach(entity -> { atlasEntitiesByTypedQname.put(toTypedQname(entity), entity); String guid = entity.getGuid(); if (!AtlasUtils.isGuidAssigned(guid)) { final String _guid = String.valueOf(guidSeq.getAndIncrement()); guidAssignments.put(guid, _guid); entity.setGuid(_guid); guid = _guid; } atlasEntitiesByGuid.put(guid, entity); }); final EntityMutationResponse mutationResponse = new EntityMutationResponse(); mutationResponse.setGuidAssignments(guidAssignments); respondWithJson(resp, mutationResponse); }
Example 5
Source File: AtlasInstanceConverter.java From incubator-atlas with Apache License 2.0 | 6 votes |
public AtlasEntity.AtlasEntitiesWithExtInfo toAtlasEntities(List<Referenceable> referenceables) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> toAtlasEntities"); } AtlasFormatConverter.ConverterContext context = new AtlasFormatConverter.ConverterContext(); for (Referenceable referenceable : referenceables) { AtlasEntity entity = fromV1toV2Entity(referenceable, context); context.addEntity(entity); } if (LOG.isDebugEnabled()) { LOG.debug("<== toAtlasEntities"); } return context.getEntities(); }
Example 6
Source File: ExportServiceTest.java From incubator-atlas with Apache License 2.0 | 6 votes |
@BeforeClass public void setupSampleData() throws AtlasBaseException { entityStore = new AtlasEntityStoreV1(deleteHandler, typeRegistry, mockChangeNotifier, graphMapper);; AtlasTypesDef sampleTypes = TestUtilsV2.defineDeptEmployeeTypes(); AtlasTypesDef typesToCreate = AtlasTypeDefStoreInitializer.getTypesToCreate(sampleTypes, typeRegistry); if (!typesToCreate.isEmpty()) { typeDefStore.createTypesDef(typesToCreate); } AtlasEntity.AtlasEntitiesWithExtInfo hrDept = TestUtilsV2.createDeptEg2(); AtlasEntityStream entityStream = new AtlasEntityStream(hrDept); entityStore.createOrUpdate(entityStream, false); LOG.debug("==> setupSampleData: ", AtlasEntity.dumpObjects(hrDept.getEntities(), null).toString()); }
Example 7
Source File: ReplicationEntityAttributeTest.java From atlas with Apache License 2.0 | 5 votes |
private void assertReplicationAttribute(String attrNameReplication) throws AtlasBaseException { pauseForIndexCreation(); AtlasEntity.AtlasEntitiesWithExtInfo entities = entityStore.getByIds(ImmutableList.of(DB_GUID, TABLE_GUID)); for (AtlasEntity e : entities.getEntities()) { Object ex = e.getAttribute(attrNameReplication); assertNotNull(ex); List<String> attrValue = (List) ex; assertEquals(attrValue.size(), 1); } }
Example 8
Source File: NiFiAtlasClient.java From nifi with Apache License 2.0 | 5 votes |
private AtlasEntity registerNiFiFlowEntity(final NiFiFlow nifiFlow) throws AtlasServiceException { final List<AtlasEntity> entities = new ArrayList<>(); final AtlasEntity.AtlasEntitiesWithExtInfo atlasEntities = new AtlasEntity.AtlasEntitiesWithExtInfo(entities); if (!nifiFlow.isMetadataUpdated()) { // Nothing has been changed, return existing entity. return nifiFlow.getExEntity(); } // Create parent flow entity using existing NiFiFlow entity if available, so that common properties are taken over. final AtlasEntity flowEntity = nifiFlow.getExEntity() != null ? new AtlasEntity(nifiFlow.getExEntity()) : new AtlasEntity(); flowEntity.setTypeName(TYPE_NIFI_FLOW); flowEntity.setVersion(1L); flowEntity.setAttribute(ATTR_NAME, nifiFlow.getFlowName()); flowEntity.setAttribute(ATTR_QUALIFIED_NAME, nifiFlow.toQualifiedName(nifiFlow.getRootProcessGroupId())); flowEntity.setAttribute(ATTR_URL, nifiFlow.getUrl()); flowEntity.setAttribute(ATTR_DESCRIPTION, nifiFlow.getDescription()); // If flowEntity is not persisted yet, then store nifi_flow entity to make nifiFlowId available for other entities. if (flowEntity.getGuid().startsWith("-")) { entities.add(flowEntity); final EntityMutationResponse mutationResponse = atlasClient.createEntities(atlasEntities); logger.debug("Registered a new nifi_flow entity, mutation response={}", mutationResponse); final String assignedNiFiFlowGuid = mutationResponse.getGuidAssignments().get(flowEntity.getGuid()); flowEntity.setGuid(assignedNiFiFlowGuid); nifiFlow.setAtlasGuid(assignedNiFiFlowGuid); } return flowEntity; }
Example 9
Source File: AtlasDeleteHandlerV1Test.java From incubator-atlas with Apache License 2.0 | 5 votes |
private AtlasEntity getEmployeeByName(AtlasEntity.AtlasEntitiesWithExtInfo hrDept, String name) { for (AtlasEntity entity : hrDept.getEntities()) { if ( name.equals(entity.getAttribute(NAME))) { return entity; } } return null; }
Example 10
Source File: NotificationHookConsumerTest.java From incubator-atlas with Apache License 2.0 | 5 votes |
@BeforeMethod public void setup() throws AtlasBaseException { MockitoAnnotations.initMocks(this); AtlasType mockType = mock(AtlasType.class); when(typeRegistry.getType(anyString())).thenReturn(mockType); AtlasEntity.AtlasEntitiesWithExtInfo mockEntity = mock(AtlasEntity.AtlasEntitiesWithExtInfo.class); when(instanceConverter.toAtlasEntities(anyList())).thenReturn(mockEntity); EntityMutationResponse mutationResponse = mock(EntityMutationResponse.class); when(atlasEntityStore.createOrUpdate(any(EntityStream.class), anyBoolean())).thenReturn(mutationResponse); }
Example 11
Source File: AtlasTestBase.java From atlas with Apache License 2.0 | 5 votes |
protected void verifyCreatedEntities(AtlasEntityStoreV2 entityStore, String[] entityGuids, int expectedNumberOfEntitiesCreated) { try { AtlasEntity.AtlasEntitiesWithExtInfo entities = entityStore.getByIds(Arrays.asList((String[]) entityGuids)); assertEquals(entities.getEntities().size(), expectedNumberOfEntitiesCreated); } catch (AtlasBaseException e) { throw new SkipException(String.format("getByIds: could not load '%s'", entityGuids.toString())); } }
Example 12
Source File: ImportServiceTest.java From atlas with Apache License 2.0 | 5 votes |
@Test(dataProvider = "stocks-legacy") public void importExistingTopLevelEntity(InputStream inputStream) throws IOException, AtlasBaseException{ loadBaseModel(); loadFsModel(); loadHiveModel(); AtlasEntity db = new AtlasEntity("hive_db", "name", "stocks" ); db.setAttribute("clusterName", "cl1"); db.setAttribute("qualifiedName", "stocks@cl1"); AtlasEntity.AtlasEntitiesWithExtInfo entitiesWithExtInfo = new AtlasEntity.AtlasEntitiesWithExtInfo(); entitiesWithExtInfo.addEntity(db); AtlasEntityStream entityStream = new AtlasEntityStream(entitiesWithExtInfo); EntityMutationResponse createResponse = entityStore.createOrUpdate(entityStream, false); assertNotNull(createResponse); String preImportGuid = createResponse.getCreatedEntities().get(0).getGuid(); runImportWithNoParameters(importService, inputStream); AtlasVertex v = AtlasGraphUtilsV2.findByGuid("886c5e9c-3ac6-40be-8201-fb0cebb64783"); assertNotNull(v); String postImportGuid = AtlasGraphUtilsV2.getIdFromVertex(v); assertNotEquals(preImportGuid, postImportGuid); String historicalGuids = v.getProperty(Constants.HISTORICAL_GUID_PROPERTY_KEY, String.class); assertTrue(historicalGuids.contains(preImportGuid)); }
Example 13
Source File: AtlasDeleteHandlerV1Test.java From incubator-atlas with Apache License 2.0 | 4 votes |
@Test public void testDeleteEntities() throws Exception { // Create a table entity, with 3 composite column entities init(); final AtlasEntity dbEntity = TestUtilsV2.createDBEntity(); EntityMutationResponse dbCreationResponse = entityStore.createOrUpdate(new AtlasEntityStream(dbEntity), false); final AtlasEntity tableEntity = TestUtilsV2.createTableEntity(dbEntity); AtlasEntity.AtlasEntitiesWithExtInfo entitiesInfo = new AtlasEntity.AtlasEntitiesWithExtInfo(tableEntity); final AtlasEntity columnEntity1 = TestUtilsV2.createColumnEntity(tableEntity); entitiesInfo.addReferredEntity(columnEntity1); final AtlasEntity columnEntity2 = TestUtilsV2.createColumnEntity(tableEntity); entitiesInfo.addReferredEntity(columnEntity2); final AtlasEntity columnEntity3 = TestUtilsV2.createColumnEntity(tableEntity); entitiesInfo.addReferredEntity(columnEntity3); tableEntity.setAttribute(COLUMNS_ATTR_NAME, Arrays.asList(AtlasTypeUtil.getAtlasObjectId(columnEntity1), AtlasTypeUtil.getAtlasObjectId(columnEntity2), AtlasTypeUtil.getAtlasObjectId(columnEntity3))); init(); final EntityMutationResponse tblCreationResponse = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo), false); final AtlasEntityHeader column1Created = tblCreationResponse.getCreatedEntityByTypeNameAndAttribute(COLUMN_TYPE, NAME, (String) columnEntity1.getAttribute(NAME)); final AtlasEntityHeader column2Created = tblCreationResponse.getCreatedEntityByTypeNameAndAttribute(COLUMN_TYPE, NAME, (String) columnEntity2.getAttribute(NAME)); final AtlasEntityHeader column3Created = tblCreationResponse.getCreatedEntityByTypeNameAndAttribute(COLUMN_TYPE, NAME, (String) columnEntity3.getAttribute(NAME)); // Retrieve the table entities from the Repository, to get their guids and the composite column guids. ITypedReferenceableInstance tableInstance = metadataService.getEntityDefinitionReference(TestUtils.TABLE_TYPE, NAME, (String) tableEntity.getAttribute(NAME)); List<IReferenceableInstance> columns = (List<IReferenceableInstance>) tableInstance.get(COLUMNS_ATTR_NAME); //Delete column String colId = columns.get(0).getId()._getId(); String tableId = tableInstance.getId()._getId(); init(); EntityMutationResponse deletionResponse = entityStore.deleteById(colId); assertEquals(deletionResponse.getDeletedEntities().size(), 1); assertEquals(deletionResponse.getDeletedEntities().get(0).getGuid(), colId); assertEquals(deletionResponse.getUpdatedEntities().size(), 1); assertEquals(deletionResponse.getUpdatedEntities().get(0).getGuid(), tableId); assertEntityDeleted(colId); final AtlasEntity.AtlasEntityWithExtInfo tableEntityCreated = entityStore.getById(tableId); assertDeletedColumn(tableEntityCreated); assertTestDisconnectUnidirectionalArrayReferenceFromClassType( (List<AtlasObjectId>) tableEntityCreated.getEntity().getAttribute(COLUMNS_ATTR_NAME), colId); //update by removing a column - col1 final AtlasEntity tableEntity1 = TestUtilsV2.createTableEntity(dbEntity, (String) tableEntity.getAttribute(NAME)); AtlasEntity.AtlasEntitiesWithExtInfo entitiesInfo1 = new AtlasEntity.AtlasEntitiesWithExtInfo(tableEntity1); final AtlasEntity columnEntity3New = TestUtilsV2.createColumnEntity(tableEntity1, (String) column3Created.getAttribute(NAME)); tableEntity1.setAttribute(COLUMNS_ATTR_NAME, Arrays.asList(AtlasTypeUtil.getAtlasObjectId(columnEntity3New))); entitiesInfo1.addReferredEntity(columnEntity3New); init(); deletionResponse = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo1), false); assertEquals(deletionResponse.getDeletedEntities().size(), 1); assertEquals(deletionResponse.getDeletedEntities().get(0).getGuid(), column2Created.getGuid()); assertEntityDeleted(colId); // Delete the table entities. The deletion should cascade to their composite columns. tableInstance = metadataService.getEntityDefinitionReference(TestUtils.TABLE_TYPE, NAME, (String) tableEntity.getAttribute(NAME)); init(); EntityMutationResponse tblDeletionResponse = entityStore.deleteById(tableInstance.getId()._getId()); assertEquals(tblDeletionResponse.getDeletedEntities().size(), 2); final AtlasEntityHeader tableDeleted = tblDeletionResponse.getFirstDeletedEntityByTypeName(TABLE_TYPE); final AtlasEntityHeader colDeleted = tblDeletionResponse.getFirstDeletedEntityByTypeName(COLUMN_TYPE); // Verify that deleteEntities() response has guids for tables and their composite columns. Assert.assertTrue(tableDeleted.getGuid().equals(tableInstance.getId()._getId())); Assert.assertTrue(colDeleted.getGuid().equals(column3Created.getGuid())); // Verify that tables and their composite columns have been deleted from the graph Repository. assertEntityDeleted(tableDeleted.getGuid()); assertEntityDeleted(colDeleted.getGuid()); }
Example 14
Source File: AtlasDeleteHandlerV1Test.java From incubator-atlas with Apache License 2.0 | 4 votes |
@Test public void testUpdateEntity_MultiplicityOneNonCompositeReference() throws Exception { AtlasEntity.AtlasEntitiesWithExtInfo hrDept = TestUtilsV2.createDeptEg2(); init(); RequestContextV1.clear(); final EntityMutationResponse hrDeptCreationResponse = entityStore.createOrUpdate(new AtlasEntityStream(hrDept), false); final AtlasEntityHeader deptCreated = hrDeptCreationResponse.getFirstUpdatedEntityByTypeName(DEPARTMENT_TYPE); final AtlasEntityHeader maxEmployeeCreated = hrDeptCreationResponse.getCreatedEntityByTypeNameAndAttribute(TestUtilsV2.EMPLOYEE_TYPE, NAME, "Max"); final AtlasEntityHeader johnEmployeeCreated = hrDeptCreationResponse.getUpdatedEntityByTypeNameAndAttribute(TestUtilsV2.EMPLOYEE_TYPE, NAME, "John"); final AtlasEntityHeader janeEmployeeCreated = hrDeptCreationResponse.getCreatedEntityByTypeNameAndAttribute(TestUtilsV2.MANAGER_TYPE, NAME, "Jane"); final AtlasEntityHeader juliusEmployeeCreated = hrDeptCreationResponse.getUpdatedEntityByTypeNameAndAttribute(TestUtilsV2.MANAGER_TYPE, NAME, "Julius"); ITypedReferenceableInstance max = metadataService.getEntityDefinition(maxEmployeeCreated.getGuid()); String maxGuid = max.getId()._getId(); AtlasVertex vertex = GraphHelper.getInstance().getVertexForGUID(maxGuid); Long creationTimestamp = GraphHelper.getSingleValuedProperty(vertex, Constants.TIMESTAMP_PROPERTY_KEY, Long.class); Assert.assertNotNull(creationTimestamp); Long modificationTimestampPreUpdate = GraphHelper.getSingleValuedProperty(vertex, Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY, Long.class); Assert.assertNotNull(modificationTimestampPreUpdate); AtlasEntity maxEmployee = getEmployeeByName(hrDept, "Max"); maxEmployee.setAttribute("mentor", AtlasTypeUtil.getAtlasObjectId(johnEmployeeCreated)); maxEmployee.setAttribute("department", AtlasTypeUtil.getAtlasObjectId(deptCreated)); maxEmployee.setAttribute("manager", AtlasTypeUtil.getAtlasObjectId(janeEmployeeCreated)); init(); EntityMutationResponse entityResult = entityStore.createOrUpdate(new AtlasEntityStream(maxEmployee), false); assertEquals(entityResult.getUpdatedEntities().size(), 1); assertTrue(extractGuids(entityResult.getUpdatedEntities()).contains(maxGuid)); // Verify the update was applied correctly - john should now be max's mentor. max = metadataService.getEntityDefinition(maxGuid); ITypedReferenceableInstance refTarget = (ITypedReferenceableInstance) max.get("mentor"); Assert.assertEquals(refTarget.getId()._getId(), johnEmployeeCreated.getGuid()); // Verify modification timestamp was updated. vertex = GraphHelper.getInstance().getVertexForGUID(maxGuid); Long modificationTimestampPostUpdate = GraphHelper.getSingleValuedProperty(vertex, Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY, Long.class); Assert.assertNotNull(modificationTimestampPostUpdate); Assert.assertTrue(creationTimestamp < modificationTimestampPostUpdate); // Update max's mentor reference to jane. maxEmployee.setAttribute("mentor", AtlasTypeUtil.getAtlasObjectId(janeEmployeeCreated)); init(); entityResult = entityStore.createOrUpdate(new AtlasEntityStream(maxEmployee), false); assertEquals(entityResult.getUpdatedEntities().size(), 1); assertTrue(extractGuids(entityResult.getUpdatedEntities()).contains(maxGuid)); // Verify the update was applied correctly - jane should now be max's mentor. max = metadataService.getEntityDefinition(maxGuid); refTarget = (ITypedReferenceableInstance) max.get("mentor"); Assert.assertEquals(refTarget.getId()._getId(), janeEmployeeCreated.getGuid()); // Verify modification timestamp was updated. vertex = GraphHelper.getInstance().getVertexForGUID(maxGuid); Long modificationTimestampPost2ndUpdate = GraphHelper.getSingleValuedProperty(vertex, Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY, Long.class); Assert.assertNotNull(modificationTimestampPost2ndUpdate); Assert.assertTrue(modificationTimestampPostUpdate < modificationTimestampPost2ndUpdate); ITypedReferenceableInstance julius = metadataService.getEntityDefinition(juliusEmployeeCreated.getGuid()); Id juliusId = julius.getId(); init(); maxEmployee.setAttribute("manager", AtlasTypeUtil.getAtlasObjectId(juliusEmployeeCreated)); entityResult = entityStore.createOrUpdate(new AtlasEntityStream(maxEmployee), false); assertEquals(entityResult.getUpdatedEntities().size(), 3); List<String> updatedGuids = extractGuids(entityResult.getUpdatedEntities()); assertTrue(updatedGuids.contains(maxGuid)); assertTrue(updatedGuids.contains(janeEmployeeCreated.getGuid())); // Should have updated julius to add max in subordinates list. assertTrue(updatedGuids.contains(juliusEmployeeCreated.getGuid())); // Verify the update was applied correctly - julius should now be max's manager and max should be julius' subordinate. max = metadataService.getEntityDefinition(maxGuid); refTarget = (ITypedReferenceableInstance) max.get("manager"); Assert.assertEquals(refTarget.getId()._getId(), juliusId._getId()); julius = metadataService.getEntityDefinition(juliusId._getId()); Object value = julius.get("subordinates"); Assert.assertTrue(value instanceof List); List<ITypedReferenceableInstance> refList = (List<ITypedReferenceableInstance>) value; Assert.assertEquals(refList.size(), 1); Assert.assertEquals(refList.get(0).getId()._getId(), maxGuid); assertTestUpdateEntity_MultiplicityOneNonCompositeReference(janeEmployeeCreated.getGuid()); }
Example 15
Source File: AtlasDeleteHandlerV1Test.java From incubator-atlas with Apache License 2.0 | 4 votes |
/** * Verify deleting an entity which is contained by another * entity through a bi-directional composite reference. * * @throws Exception */ @Test public void testDisconnectBidirectionalReferences() throws Exception { AtlasEntity.AtlasEntitiesWithExtInfo hrDept = TestUtilsV2.createDeptEg2(); init(); final EntityMutationResponse hrDeptCreationResponse = entityStore.createOrUpdate(new AtlasEntityStream(hrDept), false); final AtlasEntityHeader deptCreated = hrDeptCreationResponse.getFirstCreatedEntityByTypeName(DEPARTMENT_TYPE); final AtlasEntityHeader maxEmployee = hrDeptCreationResponse.getCreatedEntityByTypeNameAndAttribute(TestUtilsV2.EMPLOYEE_TYPE, NAME, "Max"); final AtlasEntityHeader johnEmployee = hrDeptCreationResponse.getCreatedEntityByTypeNameAndAttribute(TestUtilsV2.EMPLOYEE_TYPE, NAME, "John"); final AtlasEntityHeader janeEmployee = hrDeptCreationResponse.getCreatedEntityByTypeNameAndAttribute(TestUtilsV2.MANAGER_TYPE, NAME, "Jane"); final AtlasEntityHeader juliusEmployee = hrDeptCreationResponse.getCreatedEntityByTypeNameAndAttribute(TestUtilsV2.MANAGER_TYPE, NAME, "Julius"); ITypedReferenceableInstance hrDeptInstance = metadataService.getEntityDefinition(deptCreated.getGuid()); Map<String, String> nameGuidMap = getEmployeeNameGuidMap(hrDeptInstance); // Verify that Max is one of Jane's subordinates. ITypedReferenceableInstance jane = metadataService.getEntityDefinition(janeEmployee.getGuid()); Object refValue = jane.get("subordinates"); Assert.assertTrue(refValue instanceof List); List<Object> subordinates = (List<Object>)refValue; Assert.assertEquals(subordinates.size(), 2); List<String> subordinateIds = new ArrayList<>(2); for (Object listValue : subordinates) { Assert.assertTrue(listValue instanceof ITypedReferenceableInstance); ITypedReferenceableInstance employee = (ITypedReferenceableInstance) listValue; subordinateIds.add(employee.getId()._getId()); } Assert.assertTrue(subordinateIds.contains(maxEmployee.getGuid())); init(); EntityMutationResponse entityResult = entityStore.deleteById(maxEmployee.getGuid()); ITypedReferenceableInstance john = metadataService.getEntityDefinitionReference(TestUtilsV2.EMPLOYEE_TYPE, NAME, "John"); assertEquals(entityResult.getDeletedEntities().size(), 1); assertEquals(entityResult.getDeletedEntities().get(0).getGuid(), maxEmployee.getGuid()); assertEquals(entityResult.getUpdatedEntities().size(), 3); assertEquals(extractGuids(entityResult.getUpdatedEntities()), Arrays.asList(janeEmployee.getGuid(), deptCreated.getGuid(), johnEmployee.getGuid())); assertEntityDeleted(maxEmployee.getGuid()); assertMaxForTestDisconnectBidirectionalReferences(nameGuidMap); // Now delete jane - this should disconnect the manager reference from her // subordinate. init(); entityResult = entityStore.deleteById(janeEmployee.getGuid()); assertEquals(entityResult.getDeletedEntities().size(), 1); assertEquals(entityResult.getDeletedEntities().get(0).getGuid(), janeEmployee.getGuid()); assertEquals(entityResult.getUpdatedEntities().size(), 2); assertEquals(extractGuids(entityResult.getUpdatedEntities()), Arrays.asList(deptCreated.getGuid(), johnEmployee.getGuid())); assertEntityDeleted(janeEmployee.getGuid()); final AtlasEntity.AtlasEntityWithExtInfo johnUpdated = entityStore.getById(johnEmployee.getGuid()); assertJohnForTestDisconnectBidirectionalReferences(johnUpdated, janeEmployee.getGuid()); }
Example 16
Source File: AtlasDeleteHandlerV1Test.java From incubator-atlas with Apache License 2.0 | 4 votes |
/** * Verify deleting entities that are the target of class map references. */ @Test public void testDisconnectMapReferenceFromClassType() throws Exception { // Define type for map value. AtlasStructDef.AtlasAttributeDef[] mapValueAttributes = new AtlasStructDef.AtlasAttributeDef[]{ new AtlasStructDef.AtlasAttributeDef("biMapOwner", "MapOwner", true, AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE, 0, 1, false, false, new ArrayList<AtlasStructDef.AtlasConstraintDef>() {{ add(new AtlasStructDef.AtlasConstraintDef( AtlasStructDef.AtlasConstraintDef.CONSTRAINT_TYPE_INVERSE_REF, new HashMap<String, Object>() {{ put(AtlasStructDef.AtlasConstraintDef.CONSTRAINT_PARAM_ATTRIBUTE, "biMap"); }})); }})}; AtlasEntityDef mapValueContainerDef = new AtlasEntityDef("MapValue", "MapValue_desc", "1.0", Arrays.asList(mapValueAttributes), Collections.<String>emptySet()); // Define type with unidirectional and bidirectional map references, // where the map value is a class reference to MapValue. AtlasStructDef.AtlasAttributeDef[] mapOwnerAttributes = new AtlasStructDef.AtlasAttributeDef[]{ new AtlasStructDef.AtlasAttributeDef("map", "map<string,MapValue>", true, AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE, 0, 1, false, false, Collections.<AtlasStructDef.AtlasConstraintDef>emptyList()), new AtlasStructDef.AtlasAttributeDef("biMap", "map<string,MapValue>", true, AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE, 0, 1, false, false, new ArrayList<AtlasStructDef.AtlasConstraintDef>() {{ add(new AtlasStructDef.AtlasConstraintDef( AtlasStructDef.AtlasConstraintDef.CONSTRAINT_TYPE_INVERSE_REF, new HashMap<String, Object>() {{ put(AtlasStructDef.AtlasConstraintDef.CONSTRAINT_PARAM_ATTRIBUTE, "biMapOwner"); }})); }})}; AtlasEntityDef mapOwnerContainerDef = new AtlasEntityDef("MapOwner", "MapOwner_desc", "1.0", Arrays.asList(mapOwnerAttributes), Collections.<String>emptySet()); AtlasTypesDef typesDef = AtlasTypeUtil.getTypesDef(ImmutableList.<AtlasEnumDef>of(), ImmutableList.<AtlasStructDef>of(), ImmutableList.<AtlasClassificationDef>of(), ImmutableList.<AtlasEntityDef>of(mapValueContainerDef, mapOwnerContainerDef)); typeDefStore.createTypesDef(typesDef); // Create instances of MapOwner and MapValue. // Set MapOwner.map and MapOwner.biMap with one entry that references MapValue instance. AtlasEntity mapOwnerInstance = new AtlasEntity("MapOwner"); AtlasEntity mapValueInstance = new AtlasEntity("MapValue"); mapOwnerInstance.setAttribute("map", Collections.singletonMap("value1", AtlasTypeUtil.getAtlasObjectId(mapValueInstance))); mapOwnerInstance.setAttribute("biMap", Collections.singletonMap("value1", AtlasTypeUtil.getAtlasObjectId(mapValueInstance))); // Set biMapOwner reverse reference on MapValue. mapValueInstance.setAttribute("biMapOwner", AtlasTypeUtil.getAtlasObjectId(mapOwnerInstance)); AtlasEntity.AtlasEntitiesWithExtInfo entities = new AtlasEntity.AtlasEntitiesWithExtInfo(); entities.addReferredEntity(mapValueInstance); entities.addEntity(mapOwnerInstance); final EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(entities), false); Assert.assertEquals(response.getCreatedEntities().size(), 2); final List<AtlasEntityHeader> mapOwnerCreated = response.getCreatedEntitiesByTypeName("MapOwner"); AtlasEntity.AtlasEntityWithExtInfo mapOwnerEntity = entityStore.getById(mapOwnerCreated.get(0).getGuid()); String edgeLabel = AtlasGraphUtilsV1.getAttributeEdgeLabel(typeRegistry.getEntityTypeByName("MapOwner"), "map"); String mapEntryLabel = edgeLabel + "." + "value1"; AtlasEdgeLabel atlasEdgeLabel = new AtlasEdgeLabel(mapEntryLabel); // Verify MapOwner.map attribute has expected value. String mapValueGuid = null; AtlasVertex mapOwnerVertex = null; for (String mapAttrName : Arrays.asList("map", "biMap")) { Object object = mapOwnerEntity.getEntity().getAttribute(mapAttrName); Assert.assertNotNull(object); Assert.assertTrue(object instanceof Map); Map<String, AtlasObjectId> map = (Map<String, AtlasObjectId>)object; Assert.assertEquals(map.size(), 1); AtlasObjectId value1Id = map.get("value1"); Assert.assertNotNull(value1Id); mapValueGuid = value1Id.getGuid(); mapOwnerVertex = GraphHelper.getInstance().getVertexForGUID(mapOwnerEntity.getEntity().getGuid()); object = mapOwnerVertex.getProperty(atlasEdgeLabel.getQualifiedMapKey(), Object.class); Assert.assertNotNull(object); } // Delete the map value instance. // This should disconnect the references from the map owner instance. entityStore.deleteById(mapValueGuid); assertEntityDeleted(mapValueGuid); assertTestDisconnectMapReferenceFromClassType(mapOwnerEntity.getEntity().getGuid()); }
Example 17
Source File: AtlasDeleteHandlerV1Test.java From incubator-atlas with Apache License 2.0 | 4 votes |
@Test public void testDeleteByUniqueAttribute() throws Exception { // Create a table entity, with 3 composite column entities init(); final AtlasEntity dbEntity = TestUtilsV2.createDBEntity(); EntityMutationResponse dbCreationResponse = entityStore.createOrUpdate(new AtlasEntityStream(dbEntity), false); final AtlasEntity tableEntity = TestUtilsV2.createTableEntity(dbEntity); AtlasEntity.AtlasEntitiesWithExtInfo entitiesInfo = new AtlasEntity.AtlasEntitiesWithExtInfo(tableEntity); final AtlasEntity columnEntity1 = TestUtilsV2.createColumnEntity(tableEntity); entitiesInfo.addReferredEntity(columnEntity1); final AtlasEntity columnEntity2 = TestUtilsV2.createColumnEntity(tableEntity); entitiesInfo.addReferredEntity(columnEntity2); final AtlasEntity columnEntity3 = TestUtilsV2.createColumnEntity(tableEntity); entitiesInfo.addReferredEntity(columnEntity3); tableEntity.setAttribute(COLUMNS_ATTR_NAME, Arrays.asList(AtlasTypeUtil.getAtlasObjectId(columnEntity1), AtlasTypeUtil.getAtlasObjectId(columnEntity2), AtlasTypeUtil.getAtlasObjectId(columnEntity3))); init(); final EntityMutationResponse tblCreationResponse = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo), false); final AtlasEntityHeader column1Created = tblCreationResponse.getCreatedEntityByTypeNameAndAttribute(COLUMN_TYPE, NAME, (String) columnEntity1.getAttribute(NAME)); final AtlasEntityHeader column2Created = tblCreationResponse.getCreatedEntityByTypeNameAndAttribute(COLUMN_TYPE, NAME, (String) columnEntity2.getAttribute(NAME)); final AtlasEntityHeader column3Created = tblCreationResponse.getCreatedEntityByTypeNameAndAttribute(COLUMN_TYPE, NAME, (String) columnEntity3.getAttribute(NAME)); // Retrieve the table entities from the Repository, to get their guids and the composite column guids. ITypedReferenceableInstance tableInstance = metadataService.getEntityDefinitionReference(TestUtils.TABLE_TYPE, NAME, (String) tableEntity.getAttribute(NAME)); List<IReferenceableInstance> columns = (List<IReferenceableInstance>) tableInstance.get(COLUMNS_ATTR_NAME); //Delete column String colId = columns.get(0).getId()._getId(); String tableId = tableInstance.getId()._getId(); init(); Map<String, Object> uniqueAttrs = new HashMap<>(); uniqueAttrs.put(NAME, column1Created.getAttribute(NAME)); AtlasEntityType columnType = typeRegistry.getEntityTypeByName(COLUMN_TYPE); EntityMutationResponse deletionResponse = entityStore.deleteByUniqueAttributes(columnType, uniqueAttrs); assertEquals(deletionResponse.getDeletedEntities().size(), 1); assertEquals(deletionResponse.getDeletedEntities().get(0).getGuid(), colId); assertEquals(deletionResponse.getUpdatedEntities().size(), 1); assertEquals(deletionResponse.getUpdatedEntities().get(0).getGuid(), tableId); assertEntityDeleted(colId); }
Example 18
Source File: AtlasDeleteHandlerV1Test.java From incubator-atlas with Apache License 2.0 | 4 votes |
@Test public void testDeleteTargetOfRequiredMapReference() throws Exception { // Define type for map value. AtlasEntityDef mapValueDef = new AtlasEntityDef("RequiredMapValue", "RequiredMapValue_description", "1.0", Collections.<AtlasStructDef.AtlasAttributeDef>emptyList(), Collections.<String>emptySet()); AtlasStructDef.AtlasAttributeDef[] mapOwnerAttributes = new AtlasStructDef.AtlasAttributeDef[]{ new AtlasStructDef.AtlasAttributeDef("map", "map<string,RequiredMapValue>", false, AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE, 1, 1, false, false, Collections.<AtlasStructDef.AtlasConstraintDef>emptyList()) }; AtlasEntityDef mapOwnerDef = new AtlasEntityDef("RequiredMapOwner", "RequiredMapOwner_description", "1.0", Arrays.asList(mapOwnerAttributes), Collections.<String>emptySet()); AtlasTypesDef typesDef = AtlasTypeUtil.getTypesDef(ImmutableList.<AtlasEnumDef>of(), ImmutableList.<AtlasStructDef>of(), ImmutableList.<AtlasClassificationDef>of(), ImmutableList.<AtlasEntityDef>of(mapValueDef, mapOwnerDef)); typeDefStore.createTypesDef(typesDef); AtlasEntityType mapOwnerType = typeRegistry.getEntityTypeByName("RequiredMapOwner"); AtlasEntityType mapValueType = typeRegistry.getEntityTypeByName("RequiredMapValue"); // Create instances of RequiredMapOwner and RequiredMapValue. // Set RequiredMapOwner.map with one entry that references RequiredMapValue instance. AtlasEntity mapOwnerInstance = new AtlasEntity(mapOwnerType.getTypeName()); AtlasEntity mapValueInstance = new AtlasEntity(mapValueType.getTypeName()); mapOwnerInstance.setAttribute("map", Collections.singletonMap("value1", AtlasTypeUtil.getAtlasObjectId(mapValueInstance))); AtlasEntity.AtlasEntitiesWithExtInfo entities = new AtlasEntity.AtlasEntitiesWithExtInfo(); entities.addReferredEntity(mapValueInstance); entities.addEntity(mapOwnerInstance); List<AtlasEntityHeader> createEntitiesResult = entityStore.createOrUpdate(new AtlasEntityStream(entities), false).getCreatedEntities(); Assert.assertEquals(createEntitiesResult.size(), 2); List<String> guids = metadataService.getEntityList("RequiredMapOwner"); Assert.assertEquals(guids.size(), 1); String mapOwnerGuid = guids.get(0); guids = metadataService.getEntityList("RequiredMapValue"); Assert.assertEquals(guids.size(), 1); String mapValueGuid = guids.get(0); // Verify MapOwner.map attribute has expected value. final AtlasEntity.AtlasEntityWithExtInfo mapOwnerInstance1 = entityStore.getById(mapOwnerGuid); Object object = mapOwnerInstance1.getEntity().getAttribute("map"); Assert.assertNotNull(object); Assert.assertTrue(object instanceof Map); Map<String, AtlasObjectId> map = (Map<String, AtlasObjectId>)object; Assert.assertEquals(map.size(), 1); AtlasObjectId mapValueInstance1 = map.get("value1"); Assert.assertNotNull(mapValueInstance1); Assert.assertEquals(mapValueInstance1.getGuid(), mapValueGuid); String edgeLabel = AtlasGraphUtilsV1.getAttributeEdgeLabel(mapOwnerType, "map"); String mapEntryLabel = edgeLabel + "." + "value1"; AtlasEdgeLabel atlasEdgeLabel = new AtlasEdgeLabel(mapEntryLabel); AtlasVertex mapOwnerVertex = GraphHelper.getInstance().getVertexForGUID(mapOwnerGuid); object = mapOwnerVertex.getProperty(atlasEdgeLabel.getQualifiedMapKey(), Object.class); Assert.assertNotNull(object); // Verify deleting the target of required map attribute throws a AtlasBaseException. try { entityStore.deleteById(mapValueGuid); Assert.fail(AtlasBaseException.class.getSimpleName() + " was expected but none thrown."); } catch (Exception e) { verifyExceptionThrown(e, AtlasBaseException.class); } }
Example 19
Source File: AtlasDeleteHandlerV1Test.java From incubator-atlas with Apache License 2.0 | 4 votes |
@Test public void testLowerBoundsIgnoredWhenDeletingCompositeEntitesOwnedByMap() throws Exception { // Define MapValueReferencer type with required reference to CompositeMapValue. AtlasStructDef.AtlasAttributeDef[] mapValueAttributes = new AtlasStructDef.AtlasAttributeDef[]{ new AtlasStructDef.AtlasAttributeDef("refToMapValue", "CompositeMapValue", false, AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE, 1, 1, false, false, Collections.<AtlasStructDef.AtlasConstraintDef>emptyList()) }; AtlasEntityDef mapValueDef = new AtlasEntityDef("MapValueReferencer", "RequiredMapValue_description", "1.0", Arrays.asList(mapValueAttributes), Collections.<String>emptySet()); AtlasStructDef.AtlasAttributeDef[] mapContainerAttributes = new AtlasStructDef.AtlasAttributeDef[]{ new AtlasStructDef.AtlasAttributeDef("requiredMap", "map<string,MapValueReferencer>", false, AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE, 1, 1, false, false, new ArrayList<AtlasStructDef.AtlasConstraintDef>() {{ add(new AtlasStructDef.AtlasConstraintDef(AtlasStructDef.AtlasConstraintDef.CONSTRAINT_TYPE_OWNED_REF)); }}) }; AtlasEntityDef mapContainerDef = new AtlasEntityDef("MapValueReferencerContainer", "MapValueReferencerContainer_description", "1.0", Arrays.asList(mapContainerAttributes), Collections.<String>emptySet()); AtlasTypesDef typesDef = AtlasTypeUtil.getTypesDef(ImmutableList.<AtlasEnumDef>of(), ImmutableList.<AtlasStructDef>of(), ImmutableList.<AtlasClassificationDef>of(), ImmutableList.<AtlasEntityDef>of(mapValueDef, mapContainerDef)); typeDefStore.createTypesDef(typesDef); // Create instances of CompositeMapOwner and CompositeMapValue. // Set MapOwner.map with one entry that references MapValue instance. AtlasEntity.AtlasEntityWithExtInfo entityDefinition = createMapOwnerAndValueEntities(); String mapOwnerGuid = entityDefinition.getEntity().getGuid(); // Verify MapOwner.map attribute has expected value. ITypedReferenceableInstance mapOwnerInstance = metadataService.getEntityDefinition(mapOwnerGuid); Object object = mapOwnerInstance.get("map"); Assert.assertNotNull(object); Assert.assertTrue(object instanceof Map); Map<String, ITypedReferenceableInstance> map = (Map<String, ITypedReferenceableInstance>)object; Assert.assertEquals(map.size(), 1); ITypedReferenceableInstance mapValueInstance = map.get("value1"); Assert.assertNotNull(mapValueInstance); String mapValueGuid = mapValueInstance.getId()._getId(); // Create instance of MapValueReferencerContainer RequestContextV1.clear(); AtlasEntity mapValueReferencer = new AtlasEntity(mapValueDef.getName()); mapValueReferencer.setAttribute("refToMapValue", new AtlasObjectId(mapValueInstance.getId()._getId(), mapValueInstance.getTypeName())); AtlasEntity.AtlasEntitiesWithExtInfo entities = new AtlasEntity.AtlasEntitiesWithExtInfo(); entities.addEntity(mapValueReferencer); List<AtlasEntityHeader> createEntitiesResult = entityStore.createOrUpdate(new AtlasEntityStream(entities), false).getCreatedEntities(); Assert.assertEquals(createEntitiesResult.size(), 1); // Create instance of MapValueReferencer, and update mapValueReferencerContainer // to reference it. AtlasEntity mapValueReferenceContainer = new AtlasEntity(mapContainerDef.getName()); entities = new AtlasEntity.AtlasEntitiesWithExtInfo(); entities.addEntity(mapValueReferenceContainer); entities.addReferredEntity(mapValueReferencer); mapValueReferenceContainer.setAttribute("requiredMap", Collections.singletonMap("value1", AtlasTypeUtil.getAtlasObjectId(mapValueReferencer))); RequestContextV1.clear(); EntityMutationResponse updateEntitiesResult = entityStore.createOrUpdate(new AtlasEntityStream(entities), false); String mapValueReferencerContainerGuid = updateEntitiesResult.getCreatedEntitiesByTypeName("MapValueReferencerContainer").get(0).getGuid(); String mapValueReferencerGuid = updateEntitiesResult.getUpdatedEntitiesByTypeName("MapValueReferencer").get(0).getGuid(); Assert.assertEquals(updateEntitiesResult.getCreatedEntities().size(), 1); Assert.assertEquals(updateEntitiesResult.getUpdatedEntities().size(), 1); Assert.assertEquals(updateEntitiesResult.getUpdatedEntities().get(0).getGuid(), mapValueReferencerGuid); // Delete map owner and map referencer container. A total of 4 entities should be deleted, // including the composite entities. The lower bound constraint on MapValueReferencer.refToMapValue // should not be enforced on the composite MapValueReferencer since it is being deleted. EntityMutationResponse deleteEntitiesResult = entityStore.deleteByIds(Arrays.asList(mapOwnerGuid, mapValueReferencerContainerGuid)); Assert.assertEquals(deleteEntitiesResult.getDeletedEntities().size(), 4); Assert.assertTrue(extractGuids(deleteEntitiesResult.getDeletedEntities()).containsAll( Arrays.asList(mapOwnerGuid, mapValueGuid, mapValueReferencerContainerGuid, mapValueReferencerGuid))); }
Example 20
Source File: NiFiAtlasClient.java From nifi with Apache License 2.0 | 4 votes |
public void registerNiFiFlow(NiFiFlow nifiFlow) throws AtlasServiceException { // Create parent flow entity, so that common properties are taken over. final AtlasEntity flowEntity = registerNiFiFlowEntity(nifiFlow); // Create DataSet entities those are created by this NiFi flow. final Map<String, List<AtlasEntity>> updatedDataSetEntities = registerDataSetEntities(nifiFlow); // Create path entities. final Set<AtlasObjectId> remainingPathIds = registerFlowPathEntities(nifiFlow); // Update these attributes only if anything is created, updated or removed. boolean shouldUpdateNiFiFlow = nifiFlow.isMetadataUpdated(); if (remainingPathIds != null) { flowEntity.setAttribute(ATTR_FLOW_PATHS, remainingPathIds); shouldUpdateNiFiFlow = true; } if (updatedDataSetEntities.containsKey(TYPE_NIFI_QUEUE)) { flowEntity.setAttribute(ATTR_QUEUES, updatedDataSetEntities.get(TYPE_NIFI_QUEUE)); shouldUpdateNiFiFlow = true; } if (updatedDataSetEntities.containsKey(TYPE_NIFI_INPUT_PORT)) { flowEntity.setAttribute(ATTR_INPUT_PORTS, updatedDataSetEntities.get(TYPE_NIFI_INPUT_PORT)); shouldUpdateNiFiFlow = true; } if (updatedDataSetEntities.containsKey(TYPE_NIFI_OUTPUT_PORT)) { flowEntity.setAttribute(ATTR_OUTPUT_PORTS, updatedDataSetEntities.get(TYPE_NIFI_OUTPUT_PORT)); shouldUpdateNiFiFlow = true; } if (logger.isDebugEnabled()) { logger.debug("### NiFi Flow Audit Logs START"); nifiFlow.getUpdateAudit().forEach(logger::debug); nifiFlow.getFlowPaths().forEach((k, v) -> { logger.debug("--- NiFiFlowPath Audit Logs: {}", k); v.getUpdateAudit().forEach(logger::debug); }); logger.debug("### NiFi Flow Audit Logs END"); } if (shouldUpdateNiFiFlow) { // Send updated entities. final List<AtlasEntity> entities = new ArrayList<>(); final AtlasEntity.AtlasEntitiesWithExtInfo atlasEntities = new AtlasEntity.AtlasEntitiesWithExtInfo(entities); entities.add(flowEntity); try { final EntityMutationResponse mutationResponse = atlasClient.createEntities(atlasEntities); logger.debug("mutation response={}", mutationResponse); } catch (AtlasServiceException e) { if (e.getStatus().getStatusCode() == AtlasErrorCode.INSTANCE_NOT_FOUND.getHttpCode().getStatusCode() && e.getMessage().contains(AtlasErrorCode.INSTANCE_NOT_FOUND.getErrorCode())) { // NOTE: If previously existed nifi_flow_path entity is removed because the path is removed from NiFi, // then Atlas respond with 404 even though the entity is successfully updated. // Following exception is thrown in this case. Just log it. // org.apache.atlas.AtlasServiceException: // Metadata service API org.apache.atlas.AtlasBaseClient$APIInfo@45a37759 // failed with status 404 (Not Found) Response Body // ({"errorCode":"ATLAS-404-00-00B","errorMessage":"Given instance is invalid/not found: // Could not find entities in the repository with guids: [96d24487-cd66-4795-b552-f00b426fed26]"}) logger.debug("Received error response from Atlas but it should be stored." + e); } else { throw e; } } } }