org.apache.curator.framework.api.transaction.TransactionDeleteBuilder Java Examples
The following examples show how to use
org.apache.curator.framework.api.transaction.TransactionDeleteBuilder.
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: CuratorTransactionImpl.java From xian with Apache License 2.0 | 5 votes |
@Override public TransactionDeleteBuilder delete() { Preconditions.checkState(!isCommitted, "transaction already committed"); return new DeleteBuilderImpl(client).asTransactionDeleteBuilder(this, transaction); }
Example #2
Source File: ShardingServiceTest.java From shardingsphere-elasticjob-lite with Apache License 2.0 | 5 votes |
@Test public void assertPersistShardingInfoTransactionExecutionCallback() throws Exception { CuratorTransactionFinal curatorTransactionFinal = mock(CuratorTransactionFinal.class); TransactionCreateBuilder transactionCreateBuilder = mock(TransactionCreateBuilder.class); TransactionDeleteBuilder transactionDeleteBuilder = mock(TransactionDeleteBuilder.class); CuratorTransactionBridge curatorTransactionBridge = mock(CuratorTransactionBridge.class); when(curatorTransactionFinal.create()).thenReturn(transactionCreateBuilder); when(transactionCreateBuilder.forPath("/test_job/sharding/0/instance", "host0@-@0".getBytes())).thenReturn(curatorTransactionBridge); when(transactionCreateBuilder.forPath("/test_job/sharding/1/instance", "host0@-@0".getBytes())).thenReturn(curatorTransactionBridge); when(transactionCreateBuilder.forPath("/test_job/sharding/2/instance", "host0@-@0".getBytes())).thenReturn(curatorTransactionBridge); when(curatorTransactionBridge.and()).thenReturn(curatorTransactionFinal); when(curatorTransactionFinal.delete()).thenReturn(transactionDeleteBuilder); when(transactionDeleteBuilder.forPath("/test_job/leader/sharding/necessary")).thenReturn(curatorTransactionBridge); when(curatorTransactionBridge.and()).thenReturn(curatorTransactionFinal); when(curatorTransactionFinal.delete()).thenReturn(transactionDeleteBuilder); when(transactionDeleteBuilder.forPath("/test_job/leader/sharding/processing")).thenReturn(curatorTransactionBridge); when(curatorTransactionBridge.and()).thenReturn(curatorTransactionFinal); Map<JobInstance, List<Integer>> shardingResult = new HashMap<>(); shardingResult.put(new JobInstance("host0@-@0"), Arrays.asList(0, 1, 2)); ShardingService.PersistShardingInfoTransactionExecutionCallback actual = shardingService.new PersistShardingInfoTransactionExecutionCallback(shardingResult); actual.execute(curatorTransactionFinal); verify(curatorTransactionFinal, times(3)).create(); verify(curatorTransactionFinal, times(2)).delete(); verify(transactionDeleteBuilder).forPath("/test_job/leader/sharding/necessary"); verify(transactionDeleteBuilder).forPath("/test_job/leader/sharding/processing"); verify(curatorTransactionBridge, times(5)).and(); }
Example #3
Source File: MockCurator.java From vespa with Apache License 2.0 | 4 votes |
@Override public TransactionDeleteBuilder delete() { ensureNotCommitted(); return new MockTransactionDeleteBuilder(); }
Example #4
Source File: TransactionOpImpl.java From curator with Apache License 2.0 | 4 votes |
@Override public TransactionDeleteBuilder<CuratorOp> delete() { ExtractingCuratorOp op = new ExtractingCuratorOp(); return new DeleteBuilderImpl(client).<CuratorOp>asTransactionDeleteBuilder(op, op.getRecord()); }