@Test(dependsOnMethods = "deletetingCollections") public void addingCollections() throws AtlasBaseException { AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo = entityStore.getById(dbGuid); assertNotNull(entityWithExtInfo); addNewTables(entityWithExtInfo); addNewRegions(entityWithExtInfo); EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(entityWithExtInfo), true); assertNotNull(response); assertTrue(response.getPartialUpdatedEntities().size() > 0); assertAttribute(dbGuid, storageGuid, 3, 3); }
@Test(dependsOnMethods = "entityCreationUsingSoftRef") public void deletetingCollections() throws AtlasBaseException { AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo = entityStore.getById(dbGuid); assertNotNull(entityWithExtInfo); List list = (List)entityWithExtInfo.getEntity().getAttribute(RDBMS_DB_TABLES_PROPERTY); list.remove(1); Map map = (Map) entityWithExtInfo.getEntity().getAttribute(RDBMS_DB_REGIONS_PROPERTY); map.remove("east"); EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(entityWithExtInfo), true); assertNotNull(response); assertTrue(response.getPartialUpdatedEntities().size() > 0); assertAttribute(dbGuid, storageGuid, 1, 1); }
public void onEntitiesMutated(EntityMutationResponse entityMutationResponse, boolean isImport) throws AtlasBaseException { if (CollectionUtils.isEmpty(entityChangeListeners) || instanceConverter == null) { return; } List<AtlasEntityHeader> createdEntities = entityMutationResponse.getCreatedEntities(); List<AtlasEntityHeader> updatedEntities = entityMutationResponse.getUpdatedEntities(); List<AtlasEntityHeader> partiallyUpdatedEntities = entityMutationResponse.getPartialUpdatedEntities(); List<AtlasEntityHeader> deletedEntities = entityMutationResponse.getDeletedEntities(); // complete full text mapping before calling toReferenceables(), from notifyListners(), to // include all vertex updates in the current graph-transaction doFullTextMapping(createdEntities); doFullTextMapping(updatedEntities); doFullTextMapping(partiallyUpdatedEntities); notifyListeners(createdEntities, EntityOperation.CREATE, isImport); notifyListeners(updatedEntities, EntityOperation.UPDATE, isImport); notifyListeners(partiallyUpdatedEntities, EntityOperation.PARTIAL_UPDATE, isImport); notifyListeners(deletedEntities, EntityOperation.DELETE, isImport); notifyPropagatedEntities(); }
public void onEntitiesMutated(EntityMutationResponse entityMutationResponse, boolean isImport) throws AtlasBaseException { if (CollectionUtils.isEmpty(entityChangeListeners) || instanceConverter == null) { return; } List<AtlasEntityHeader> createdEntities = entityMutationResponse.getCreatedEntities(); List<AtlasEntityHeader> updatedEntities = entityMutationResponse.getUpdatedEntities(); List<AtlasEntityHeader> partiallyUpdatedEntities = entityMutationResponse.getPartialUpdatedEntities(); List<AtlasEntityHeader> deletedEntities = entityMutationResponse.getDeletedEntities(); // complete full text mapping before calling toReferenceables(), from notifyListners(), to // include all vertex updates in the current graph-transaction doFullTextMapping(createdEntities); doFullTextMapping(updatedEntities); doFullTextMapping(partiallyUpdatedEntities); notifyListeners(createdEntities, EntityOperation.CREATE, isImport); notifyListeners(updatedEntities, EntityOperation.UPDATE, isImport); notifyListeners(partiallyUpdatedEntities, EntityOperation.PARTIAL_UPDATE, isImport); notifyListeners(deletedEntities, EntityOperation.DELETE, isImport); notifyPropagatedEntities(); }
@Test public void testInverseReferenceAutoUpdate_NonComposite_OneToMany() throws Exception { AtlasObjectId juliusId = nameIdMap.get("Julius"); // Change Max's Employee.manager reference to Julius and apply the change as a partial update. // This should also update Julius to add Max to the inverse Manager.subordinates reference. AtlasEntity maxEntityForUpdate = new AtlasEntity(TestUtilsV2.EMPLOYEE_TYPE); maxEntityForUpdate.setAttribute("manager", juliusId); AtlasEntityType employeeType = typeRegistry.getEntityTypeByName(TestUtilsV2.EMPLOYEE_TYPE); Map<String, Object> uniqAttributes = Collections.<String, Object>singletonMap("name", "Max"); EntityMutationResponse updateResponse = entityStore.updateByUniqueAttributes(employeeType, uniqAttributes , new AtlasEntityWithExtInfo(maxEntityForUpdate)); List<AtlasEntityHeader> partialUpdatedEntities = updateResponse.getPartialUpdatedEntities(); // 3 entities should have been updated: // * Max to change the Employee.manager reference // * Julius to add Max to Manager.subordinates // * Jane to remove Max from Manager.subordinates assertEquals(partialUpdatedEntities.size(), 3); AtlasObjectId maxId = nameIdMap.get("Max"); String janeGuid = nameIdMap.get("Jane").getGuid(); AtlasEntitiesWithExtInfo storedEntities = entityStore.getByIds(ImmutableList.of(maxId.getGuid(), juliusId.getGuid(), janeGuid)); AtlasEntity storedEntity = storedEntities.getEntity(maxId.getGuid()); verifyReferenceValue(storedEntity, "manager", juliusId.getGuid()); storedEntity = storedEntities.getEntity(juliusId.getGuid()); verifyReferenceList(storedEntity, "subordinates", ImmutableList.of(maxId)); storedEntity = storedEntities.getEntity(janeGuid); verify_testInverseReferenceAutoUpdate_NonComposite_OneToMany(storedEntity); }
@Test public void testInverseReferenceAutoUpdate_NonComposite_OneToMany() throws Exception { AtlasObjectId juliusId = nameIdMap.get("Julius"); // Change Max's Employee.manager reference to Julius and apply the change as a partial update. // This should also update Julius to add Max to the inverse Manager.subordinates reference. AtlasEntity maxEntityForUpdate = new AtlasEntity(TestUtilsV2.EMPLOYEE_TYPE); maxEntityForUpdate.setAttribute("manager", juliusId); AtlasEntityType employeeType = typeRegistry.getEntityTypeByName(TestUtilsV2.EMPLOYEE_TYPE); Map<String, Object> uniqAttributes = Collections.<String, Object>singletonMap("name", "Max"); EntityMutationResponse updateResponse = entityStore.updateByUniqueAttributes(employeeType, uniqAttributes , new AtlasEntityWithExtInfo(maxEntityForUpdate)); List<AtlasEntityHeader> partialUpdatedEntities = updateResponse.getPartialUpdatedEntities(); // 3 entities should have been updated: // * Max to change the Employee.manager reference // * Julius to add Max to Manager.subordinates // * Jane to remove Max from Manager.subordinates assertEquals(partialUpdatedEntities.size(), 3); AtlasObjectId maxId = nameIdMap.get("Max"); String janeGuid = nameIdMap.get("Jane").getGuid(); AtlasEntitiesWithExtInfo storedEntities = entityStore.getByIds(ImmutableList.of(maxId.getGuid(), juliusId.getGuid(), janeGuid)); AtlasEntity storedEntity = storedEntities.getEntity(maxId.getGuid()); verifyReferenceValue(storedEntity, "manager", juliusId.getGuid()); storedEntity = storedEntities.getEntity(juliusId.getGuid()); verifyReferenceList(storedEntity, "subordinates", ImmutableList.of(maxId)); storedEntity = storedEntities.getEntity(janeGuid); verify_testInverseReferenceAutoUpdate_NonComposite_OneToMany(storedEntity); }
EntityMutationResponse updateResponse = entityStore.updateByUniqueAttributes(employeeType, uniqAttributes , new AtlasEntityWithExtInfo(maxEntityForUpdate)); List<AtlasEntityHeader> partialUpdatedEntities = updateResponse.getPartialUpdatedEntities(); assertEquals(partialUpdatedEntities.size(), 3); updateResponse = entityStore.updateByUniqueAttributes(employeeType, uniqAttributes , new AtlasEntityWithExtInfo(maxEntityForUpdate)); partialUpdatedEntities = updateResponse.getPartialUpdatedEntities(); assertEquals(partialUpdatedEntities.size(), 3); partialUpdatedEntities = updateResponse.getPartialUpdatedEntities(); assertEquals(partialUpdatedEntities.size(), 3);
init(); response = entityStore.updateByUniqueAttributes(aType, Collections.<String, Object>singletonMap(NAME, a1.getAttribute(NAME)), new AtlasEntityWithExtInfo(aForPartialUpdate)); List<AtlasEntityHeader> partialUpdatedEntities = response.getPartialUpdatedEntities(); init(); response = entityStore.updateByUniqueAttributes(aType, Collections.<String, Object>singletonMap(NAME, a1.getAttribute(NAME)), new AtlasEntityWithExtInfo(aForPartialUpdate)); partialUpdatedEntities = response.getPartialUpdatedEntities();
init(); response = entityStore.updateByUniqueAttributes(aType, Collections.<String, Object>singletonMap(NAME, a1.getAttribute(NAME)), new AtlasEntityWithExtInfo(aForPartialUpdate)); List<AtlasEntityHeader> partialUpdatedEntities = response.getPartialUpdatedEntities(); init(); response = entityStore.updateByUniqueAttributes(aType, Collections.<String, Object>singletonMap(NAME, a1.getAttribute(NAME)), new AtlasEntityWithExtInfo(aForPartialUpdate)); partialUpdatedEntities = response.getPartialUpdatedEntities();
new AtlasEntityWithExtInfo(b1PartialUpdate)); List<AtlasEntityHeader> updatedEntityHeaders = response.getPartialUpdatedEntities(); assertEquals(updatedEntityHeaders.size(), 3);
List<AtlasEntityHeader> partialUpdatedEntitiesHeader = response.getPartialUpdatedEntities(); partialUpdatedEntitiesHeader = response.getPartialUpdatedEntities();
new AtlasEntityWithExtInfo(b1PartialUpdate)); List<AtlasEntityHeader> updatedEntityHeaders = response.getPartialUpdatedEntities(); assertEquals(updatedEntityHeaders.size(), 3);
List<AtlasEntityHeader> partialUpdatedEntitiesHeader = response.getPartialUpdatedEntities(); partialUpdatedEntitiesHeader = response.getPartialUpdatedEntities();
init(); response = entityStore.updateByUniqueAttributes(bType, Collections.<String, Object>singletonMap(NAME, b1.getAttribute(NAME)), new AtlasEntityWithExtInfo(b1ForPartialUpdate)); List<AtlasEntityHeader> partialUpdatedEntities = response.getPartialUpdatedEntities(); assertEquals(partialUpdatedEntities.size(), 3); AtlasEntitiesWithExtInfo storedEntities = entityStore.getByIds(ImmutableList.of(a1.getGuid(), a2.getGuid(), b1.getGuid()));
assertEquals(response.getPartialUpdatedEntities().size(), 3); AtlasEntitiesWithExtInfo updatedEntities = entityStore.getByIds(ImmutableList.of(a1.getGuid(), a2.getGuid(), b.getGuid())); assertEquals(response.getPartialUpdatedEntities().size(), 4); init();
init(); response = entityStore.updateByUniqueAttributes(bType, Collections.<String, Object>singletonMap(NAME, b1.getAttribute(NAME)), new AtlasEntityWithExtInfo(b1ForPartialUpdate)); List<AtlasEntityHeader> partialUpdatedEntities = response.getPartialUpdatedEntities(); assertEquals(partialUpdatedEntities.size(), 3); AtlasEntitiesWithExtInfo storedEntities = entityStore.getByIds(ImmutableList.of(a1.getGuid(), a2.getGuid(), b1.getGuid()));
init(); response = entityStore.updateByUniqueAttributes(bType, Collections.<String, Object>singletonMap(NAME, b.getAttribute(NAME)), new AtlasEntityWithExtInfo(bForPartialUpdate)); List<AtlasEntityHeader> partialUpdatedEntities = response.getPartialUpdatedEntities(); init(); response = entityStore.updateByUniqueAttributes(bType, Collections.<String, Object>singletonMap(NAME, b.getAttribute(NAME)), new AtlasEntityWithExtInfo(bForPartialUpdate)); partialUpdatedEntities = response.getPartialUpdatedEntities();
init(); response = entityStore.updateByUniqueAttributes(bType, Collections.<String, Object>singletonMap(NAME, b.getAttribute(NAME)), new AtlasEntityWithExtInfo(bForPartialUpdate)); List<AtlasEntityHeader> partialUpdatedEntities = response.getPartialUpdatedEntities(); init(); response = entityStore.updateByUniqueAttributes(bType, Collections.<String, Object>singletonMap(NAME, b.getAttribute(NAME)), new AtlasEntityWithExtInfo(bForPartialUpdate)); partialUpdatedEntities = response.getPartialUpdatedEntities();
init(); response = entityStore.updateByUniqueAttributes(bType, Collections.<String, Object>singletonMap(NAME, b.getAttribute(NAME)), new AtlasEntityWithExtInfo(bForPartialUpdate)); List<AtlasEntityHeader> partialUpdatedEntities = response.getPartialUpdatedEntities(); init(); response = entityStore.updateByUniqueAttributes(bType, Collections.<String, Object>singletonMap(NAME, b.getAttribute(NAME)), new AtlasEntityWithExtInfo(bForPartialUpdate)); partialUpdatedEntities = response.getPartialUpdatedEntities();
init(); response = entityStore.updateByUniqueAttributes(bType, Collections.<String, Object>singletonMap(NAME, b.getAttribute(NAME)), new AtlasEntityWithExtInfo(bForPartialUpdate)); List<AtlasEntityHeader> partialUpdatedEntities = response.getPartialUpdatedEntities(); init(); response = entityStore.updateByUniqueAttributes(bType, Collections.<String, Object>singletonMap(NAME, b.getAttribute(NAME)), new AtlasEntityWithExtInfo(bForPartialUpdate)); partialUpdatedEntities = response.getPartialUpdatedEntities();