use of org.apache.atlas.TestUtilsV2.randomString in project atlas by apache.
the class AtlasEntityStoreV1Test method testClassUpdate.
@Test(dependsOnMethods = "testCreate")
public void testClassUpdate() throws Exception {
init();
// Create new db instance
final AtlasEntity databaseInstance = TestUtilsV2.createDBEntity();
EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(databaseInstance), false);
final AtlasEntityHeader dbCreated = response.getFirstCreatedEntityByTypeName(TestUtilsV2.DATABASE_TYPE);
init();
Map<String, AtlasEntity> tableCloneMap = new HashMap<>();
AtlasEntity tableClone = new AtlasEntity(tblEntity.getEntity());
tableClone.setAttribute("database", new AtlasObjectId(dbCreated.getGuid(), TestUtilsV2.DATABASE_TYPE));
tableCloneMap.put(dbCreated.getGuid(), databaseInstance);
tableCloneMap.put(tableClone.getGuid(), tableClone);
response = entityStore.createOrUpdate(new InMemoryMapEntityStream(tableCloneMap), false);
final AtlasEntityHeader tableDefinition = response.getFirstUpdatedEntityByTypeName(TABLE_TYPE);
AtlasEntity updatedTableDefinition = getEntityFromStore(tableDefinition);
Assert.assertNotNull(updatedTableDefinition.getAttribute("database"));
Assert.assertEquals(((AtlasObjectId) updatedTableDefinition.getAttribute("database")).getGuid(), dbCreated.getGuid());
}
use of org.apache.atlas.TestUtilsV2.randomString in project drbookings by DrBookings.
the class Anonymiser method main.
public static void main(final String[] args) throws Exception {
final File file = new File("/home/alex/bookings-anonym.xml");
new BackupCreator().makeBackup(file);
final DataStore ds = new XMLStorage().load(file);
for (final Iterator<BookingBeanSer> it = ds.getBookingsSer().iterator(); it.hasNext(); ) {
final BookingBeanSer bs = it.next();
bs.guestName = new RandomString().ofLength(bs.guestName.length()).toString();
}
for (final Iterator<CleaningBeanSer> it = ds.getCleaningsSer().iterator(); it.hasNext(); ) {
final CleaningBeanSer bs = it.next();
bs.name = new RandomString().ofLength(bs.name.length()).toString();
}
new XMLStorage().save(ds, file);
}
Aggregations