@Test public void testVisit() { final LocalTransactionStepDefinition transactionPipeline = mock(LocalTransactionStepDefinition.class); final String gtx = "gtx"; final Supplier proccessSupplier = mock(Supplier.class); final LocalTransaction transaction = mock(LocalTransaction.class, RETURNS_DEEP_STUBS); final Consumer attach = mock(Consumer.class); final BaseTransactionCommand send = mock(BaseTransactionCommand.class); when(mockProvision.getLocalTransaction()).thenReturn(transaction); when(transaction.getGlobalTransaction().getId()).thenReturn(gtx); when(transactionPipeline.getProcess()).thenReturn(Optional.of(proccessSupplier)); when(send.getId()).thenReturn("send"); when(transactionPipeline.getSend()).thenReturn(Stream.of(send)); when(transactionPipeline.getAttach()).thenReturn(Optional.of(attach)); doNothing().when(innerLocalTxStepVisitorUnderTest).receivePayLoad(transactionPipeline); doNothing().when(innerLocalTxStepVisitorUnderTest).receivePayLoadGTX(transactionPipeline, gtx); innerLocalTxStepVisitorUnderTest.visit(transactionPipeline); verify(proccessSupplier).get(); verify(mockBubbleCache).addBubble(same("send"), any(BubbleMessage.class)); verify(mockCommandOrchestrator).receive(send); verify(attach).accept(gtx); verify(innerLocalTxStepVisitorUnderTest).receivePayLoad(transactionPipeline); verify(innerLocalTxStepVisitorUnderTest).receivePayLoadGTX(transactionPipeline, gtx); }
@Override public void visit(LocalTransactionStepDefinition<? extends BaseLocalTransactionEvent> transactionPipeline) { try { String gtx = getProvision().getLocalTransaction().getGlobalTransaction().getId(); transactionPipeline.getProcess().ifPresent(Supplier::get); transactionPipeline.getSend().forEach(c -> { BubbleMessage bubbleMessage = new BubbleMessage(getProvision().getLocalTransaction()); getBubbleCache().addBubble(c.getId(), bubbleMessage); getCommandOrchestrator().receive(c); }); transactionPipeline.getAttach().ifPresent(c -> c.accept(gtx)); this.receivePayLoad(transactionPipeline); this.receivePayLoadGTX(transactionPipeline, gtx); } catch (Exception exception) { compensatingLocalTransaction(transactionPipeline, exception); } }
InnerLocalTxStepVisitor extends StepLocalTxVisitor { @Override public void visit(LocalTransactionStepDefinition<? extends BaseLocalTransactionEvent> transactionPipeline) { try { String gtx = getProvision().getLocalTransaction().getGlobalTransaction().getId(); transactionPipeline.getProcess().ifPresent(Supplier::get); transactionPipeline.getSend().forEach(c -> { BubbleMessage bubbleMessage = new BubbleMessage(getProvision().getLocalTransaction()); getBubbleCache().addBubble(c.getId(), bubbleMessage); getCommandOrchestrator().receive(c); }); transactionPipeline.getAttach().ifPresent(c -> c.accept(gtx)); this.receivePayLoad(transactionPipeline); this.receivePayLoadGTX(transactionPipeline, gtx); } catch (Exception exception) { compensatingLocalTransaction(transactionPipeline, exception); } } }
InnerLocalTxStepVisitor extends StepLocalTxVisitor { @Override public void visit(LocalTransactionStepDefinition<? extends BaseLocalTransactionEvent> transactionPipeline) { try { String gtx = getProvision().getLocalTransaction().getGlobalTransaction().getId(); transactionPipeline.getProcess().ifPresent(Supplier::get); transactionPipeline.getSend().forEach(c -> { BubbleMessage bubbleMessage = new BubbleMessage(getProvision().getLocalTransaction()); getBubbleCache().addBubble(c.getId(), bubbleMessage); getCommandOrchestrator().receive(c); }); transactionPipeline.getAttach().ifPresent(c -> c.accept(gtx)); this.receivePayLoad(transactionPipeline); this.receivePayLoadGTX(transactionPipeline, gtx); } catch (Exception exception) { compensatingLocalTransaction(transactionPipeline, exception); } } InnerLocalTxStepVisitor(BubbleCache bubbleCache, ApplicationEventPublisher applicationEventPublisher,
			VisitorProvision provision, CommandOrchestrator commandOrchestrator, TransactionUtilities utilities); }
InnerLocalTxStepVisitor extends StepLocalTxVisitor { @Override public void visit(LocalTransactionStepDefinition<? extends BaseLocalTransactionEvent> transactionPipeline) { try { String gtx = getProvision().getLocalTransaction().getGlobalTransaction().getId(); transactionPipeline.getProcess().ifPresent(Supplier::get); transactionPipeline.getSend().forEach(c -> { BubbleMessage bubbleMessage = new BubbleMessage(getProvision().getLocalTransaction()); getBubbleCache().addBubble(c.getId(), bubbleMessage); getCommandOrchestrator().receive(c); }); transactionPipeline.getAttach().ifPresent(c -> c.accept(gtx)); this.receivePayLoad(transactionPipeline); this.receivePayLoadGTX(transactionPipeline, gtx); } catch (Exception exception) { compensatingLocalTransaction(transactionPipeline, exception); } } InnerLocalTxStepVisitor(BubbleCache bubbleCache, ApplicationEventPublisher applicationEventPublisher,
			VisitorProvision provision, CommandOrchestrator commandOrchestrator, TransactionUtilities utilities); static InnerLocalTxStepVisitorBuilder builder(); @Override void visit(LocalTransactionStepDefinition<? extends BaseLocalTransactionEvent> transactionPipeline); }
InnerLocalTxStepVisitor extends StepLocalTxVisitor { @Override public void visit(LocalTransactionStepDefinition<? extends BaseLocalTransactionEvent> transactionPipeline) { try { String gtx = getProvision().getLocalTransaction().getGlobalTransaction().getId(); transactionPipeline.getProcess().ifPresent(Supplier::get); transactionPipeline.getSend().forEach(c -> { BubbleMessage bubbleMessage = new BubbleMessage(getProvision().getLocalTransaction()); getBubbleCache().addBubble(c.getId(), bubbleMessage); getCommandOrchestrator().receive(c); }); transactionPipeline.getAttach().ifPresent(c -> c.accept(gtx)); this.receivePayLoad(transactionPipeline); this.receivePayLoadGTX(transactionPipeline, gtx); } catch (Exception exception) { compensatingLocalTransaction(transactionPipeline, exception); } } InnerLocalTxStepVisitor(BubbleCache bubbleCache, ApplicationEventPublisher applicationEventPublisher,
			VisitorProvision provision, CommandOrchestrator commandOrchestrator, TransactionUtilities utilities); static InnerLocalTxStepVisitorBuilder builder(); @Override void visit(LocalTransactionStepDefinition<? extends BaseLocalTransactionEvent> transactionPipeline);  }