@Test public void testGetLocalTransactionWhenGlobalTxNotExist() { when(mockGlobalTransactionRepository.findById(anyString())).thenReturn(Optional.empty()); final Optional<LocalTransaction> result = businessLocalTransactionManagerImplUnderTest.getLocalTransaction(anyString(), anyString(),any()); assertEquals(Optional.empty(), result); }
Optional<LocalTransaction> getLocalTransaction(String gtx, String name, Optional<List<String>> businessKey) { Optional<LocalTransaction> localTransaction = Optional.empty(); Long key = BusinessKey.getKey(businessKey); Optional<GlobalTransaction> globalTransaction = this.globalTransactionRepository.findById(gtx); if (globalTransaction.isPresent()) { GlobalTransaction gt = globalTransaction.get(); localTransaction = gt.getLocalTransactions().stream().filter(ltx -> { return name.equals(ltx.getName()) && (key != null ? key.equals(ltx.getbKey()) : true); }).findFirst(); } return localTransaction; }
BusinessLocalTransactionManagerImpl implements BusinessLocalTransactionManager { Optional<LocalTransaction> getLocalTransaction(String gtx, String name, Optional<List<String>> businessKey) { Optional<LocalTransaction> localTransaction = Optional.empty(); Long key = BusinessKey.getKey(businessKey); Optional<GlobalTransaction> globalTransaction = this.globalTransactionRepository.findById(gtx); if (globalTransaction.isPresent()) { GlobalTransaction gt = globalTransaction.get(); localTransaction = gt.getLocalTransactions().stream().filter(ltx -> { return name.equals(ltx.getName()) && (key != null ? key.equals(ltx.getbKey()) : true); }).findFirst(); } return localTransaction; } }
BusinessLocalTransactionManagerImpl implements BusinessLocalTransactionManager { Optional<LocalTransaction> getLocalTransaction(String gtx, String name, Optional<List<String>> businessKey) { Optional<LocalTransaction> localTransaction = Optional.empty(); Long key = BusinessKey.getKey(businessKey); Optional<GlobalTransaction> globalTransaction = this.globalTransactionRepository.findById(gtx); if (globalTransaction.isPresent()) { GlobalTransaction gt = globalTransaction.get(); localTransaction = gt.getLocalTransactions().stream().filter(ltx -> { return name.equals(ltx.getName()) && (key != null ? key.equals(ltx.getbKey()) : true); }).findFirst(); } return localTransaction; } BusinessLocalTransactionManagerImpl(GlobalTransactionRepository globalTransactionRepository,
			CommandOrchestrator commandOrchestrator, ApplicationEventPublisher applicationEventPublisher,
			BubbleCache bubbleCache, TransactionUtilities txUtilities); }
BusinessLocalTransactionManagerImpl implements BusinessLocalTransactionManager { Optional<LocalTransaction> getLocalTransaction(String gtx, String name, Optional<List<String>> businessKey) { Optional<LocalTransaction> localTransaction = Optional.empty(); Long key = BusinessKey.getKey(businessKey); Optional<GlobalTransaction> globalTransaction = this.globalTransactionRepository.findById(gtx); if (globalTransaction.isPresent()) { GlobalTransaction gt = globalTransaction.get(); localTransaction = gt.getLocalTransactions().stream().filter(ltx -> { return name.equals(ltx.getName()) && (key != null ? key.equals(ltx.getbKey()) : true); }).findFirst(); } return localTransaction; } BusinessLocalTransactionManagerImpl(GlobalTransactionRepository globalTransactionRepository,
			CommandOrchestrator commandOrchestrator, ApplicationEventPublisher applicationEventPublisher,
			BubbleCache bubbleCache, TransactionUtilities txUtilities); @Override void begin(final LocalTransactionStepDefinition localTransactionStepDefinition); @Override void commit(
			final LocalTransactionStepDefinition<? extends BaseTransactionEvent> localTransactionStepDefinition); @Override void rollBack(
			LocalTransactionStepDefinition<? extends BaseTransactionEvent> localTransactionStepDefinition); @Override Optional<GlobalTransaction> findGlobalTransaction(final String GTX); }
BusinessLocalTransactionManagerImpl implements BusinessLocalTransactionManager { Optional<LocalTransaction> getLocalTransaction(String gtx, String name, Optional<List<String>> businessKey) { Optional<LocalTransaction> localTransaction = Optional.empty(); Long key = BusinessKey.getKey(businessKey); Optional<GlobalTransaction> globalTransaction = this.globalTransactionRepository.findById(gtx); if (globalTransaction.isPresent()) { GlobalTransaction gt = globalTransaction.get(); localTransaction = gt.getLocalTransactions().stream().filter(ltx -> { return name.equals(ltx.getName()) && (key != null ? key.equals(ltx.getbKey()) : true); }).findFirst(); } return localTransaction; } BusinessLocalTransactionManagerImpl(GlobalTransactionRepository globalTransactionRepository,
			CommandOrchestrator commandOrchestrator, ApplicationEventPublisher applicationEventPublisher,
			BubbleCache bubbleCache, TransactionUtilities txUtilities); @Override void begin(final LocalTransactionStepDefinition localTransactionStepDefinition); @Override void commit(
			final LocalTransactionStepDefinition<? extends BaseTransactionEvent> localTransactionStepDefinition); @Override void rollBack(
			LocalTransactionStepDefinition<? extends BaseTransactionEvent> localTransactionStepDefinition); @Override Optional<GlobalTransaction> findGlobalTransaction(final String GTX);  }