if (connectionInfo.isConnectionless()) { TransactionManager txnManager = new TransactionManager(config); TransactionSystemClient txClient = new InMemoryTxSystemClient(txnManager); return new TephraTransactionClient(txClient);
/** * @param tables the TransactionAwares over which the returned TransactionExecutor operates on. * @return a TransactionExecutor that uses an in-memory implementation of a TransactionSystemClient. */ public TransactionExecutor newInMemoryTransactionExecutor(Iterable<TransactionAware> tables) { Preconditions.checkArgument(tables != null); return new DefaultTransactionExecutor(new InMemoryTxSystemClient(txManager), tables); }
/** * @param tables the TransactionAwares over which the returned TransactionExecutor operates on. * @return a TransactionExecutor that uses an in-memory implementation of a TransactionSystemClient. */ public TransactionExecutor newInMemoryTransactionExecutor(TransactionAware...tables) { Preconditions.checkArgument(tables != null); return new DefaultTransactionExecutor(new InMemoryTxSystemClient(txManager), tables); }
@Before public void before() { Configuration txConf = HBaseConfiguration.create(); TransactionManager txManager = new TransactionManager(txConf); txManager.startAndWait(); txClient = new InMemoryTxSystemClient(txManager); }
if (connectionInfo.isConnectionless()) { TransactionManager txnManager = new TransactionManager(config); TransactionSystemClient txClient = new InMemoryTxSystemClient(txnManager); return new TephraTransactionClient(txClient);
if (connectionInfo.isConnectionless()) { TransactionManager txnManager = new TransactionManager(config); TransactionSystemClient txClient = new InMemoryTxSystemClient(txnManager); return new TephraTransactionClient(txClient);
txExecutor = new DynamicTransactionExecutorFactory(new InMemoryTxSystemClient(txManager)) .createExecutor(Collections.<TransactionAware>singleton(jobQueue));
@BeforeClass public static void beforeClass() { Configuration txConf = HBaseConfiguration.create(); txManager = new TransactionManager(txConf); txManager.startAndWait(); TransactionSystemClient txClient = new InMemoryTxSystemClient(txManager); noSqlTableAdmin = new NoSqlStructuredTableAdmin(dsFrameworkUtil.getFramework()); transactionRunner = new NoSqlTransactionRunner(dsFrameworkUtil.getFramework(), new TransactionSystemClientAdapter(txClient)); }
@Test public void testRouteStorage() throws Exception { RouteStore routeStore = new LocalRouteStore(datasetFramework, new InMemoryTxSystemClient(txManager)); ApplicationId appId = new ApplicationId("n1", "a1"); ProgramId service1 = appId.service("s1"); RouteConfig routeConfig = new RouteConfig(ImmutableMap.of("v1", 100)); routeStore.store(service1, routeConfig); Assert.assertEquals(routeConfig.getRoutes(), routeStore.fetch(service1).getRoutes()); routeStore.delete(service1); Assert.assertNotNull(routeStore.fetch(service1)); try { routeStore.delete(service1); Assert.fail("Config should have been deleted and thus a NotFoundException must have been thrown."); } catch (NotFoundException e) { // expected } } }
txManager.startAndWait(); try { TransactionSystemClient txClient = new InMemoryTxSystemClient(txManager);
InMemoryTxSystemClient txSystemClient = new InMemoryTxSystemClient(txManager); TransactionSystemClientService txSystemClientService = new DelegatingTransactionSystemClientService(txSystemClient);
@Test public void testRest() throws Exception { // check non-existence with 404 testAdminOp(bob, "exists", 404, null); // add instance, should automatically create an instance dsFramework.addInstance("table", bob, DatasetProperties.EMPTY); testAdminOp(bob, "exists", 200, true); testAdminOp("bob", "exists", 404, null); // check truncate final Table table = dsFramework.getDataset(bob, DatasetDefinition.NO_ARGUMENTS, null); Assert.assertNotNull(table); TransactionExecutor txExecutor = new DefaultTransactionExecutor(new InMemoryTxSystemClient(txManager), ImmutableList.of((TransactionAware) table)); // writing smth to table txExecutor.execute(() -> table.put(new Put("key1", "col1", "val1"))); // verify that we can read the data txExecutor.execute(() -> Assert.assertEquals("val1", table.get(new Get("key1", "col1")).getString("col1"))); testAdminOp(bob, "truncate", 200, null); // verify that data is no longer there txExecutor.execute(() -> Assert.assertTrue(table.get(new Get("key1", "col1")).isEmpty())); // check upgrade testAdminOp(bob, "upgrade", 200, null); // drop and check non-existence dsFramework.deleteInstance(bob); testAdminOp(bob, "exists", 404, null); }
@Before public void before() throws Exception { txClient = new InMemoryTxSystemClient(dsFrameworkUtil.getTxManager()); dsFrameworkUtil.createInstance("partitionedFileSet", pfsInstance, PartitionedFileSetProperties.builder() .setPartitioning(PARTITIONING_1) .setTablePermissions(tablePermissions) .setBasePath("testDir") .setFilePermissions(fsPermissions) .setFileGroup(group) .build()); pfsBaseLocation = ((PartitionedFileSet) dsFrameworkUtil.getInstance(pfsInstance)) .getEmbeddedFileSet().getBaseLocation(); Assert.assertTrue(pfsBaseLocation.exists()); }
PartitionedFileSet dataset2 = dsFrameworkUtil.getInstance(pfsInstance); TransactionManager txManager = dsFrameworkUtil.getTxManager(); InMemoryTxSystemClient txClient = new InMemoryTxSystemClient(txManager);
@BeforeClass public static void init() throws DatasetManagementException, IOException { dsFramework = dsFrameworkUtil.getFramework(); dsFramework.addModule(NAMESPACE.datasetModule("testDataset"), new TestDatasetModule()); dsFramework.addModule(NAMESPACE2.datasetModule("testDataset"), new TestDatasetModule()); txClient = new InMemoryTxSystemClient(dsFrameworkUtil.getTxManager()); dsFrameworkUtil.createInstance("testDataset", NAMESPACE.dataset("a"), DatasetProperties.EMPTY); dsFrameworkUtil.createInstance("testDataset", NAMESPACE.dataset("b"), DatasetProperties.EMPTY); dsFrameworkUtil.createInstance("testDataset", NAMESPACE.dataset("c"), DatasetProperties.EMPTY); dsFrameworkUtil.createInstance("testDataset", NAMESPACE2.dataset("a2"), DatasetProperties.EMPTY); dsFrameworkUtil.createInstance("testDataset", NAMESPACE2.dataset("c2"), DatasetProperties.EMPTY); }
Assert.assertNotNull(table2); TransactionExecutor txExecutor = new DefaultTransactionExecutor(new InMemoryTxSystemClient(txManager), ImmutableList.of((TransactionAware) table1, (TransactionAware) table2));