@Test public void testParticipateToGlobalTransactionWhenRequestGlobalTransactionNotPresent() { final Optional<RequestGlobalTransaction> orgt = Optional.empty(); final GlobalTransaction result = businessGlobalTransactionServiceImplUnderTest.participateToGlobalTransaction(orgt); assertEquals(null, result); }
@Override public GlobalTransaction participateToGlobalTransaction(Optional<RequestGlobalTransaction> orgt) { GlobalTransaction globalTransaction = null; if (orgt.isPresent()) { RequestGlobalTransaction rgt = orgt.get(); Optional<GlobalTransaction> ogtx = globalTransactionRepository.findByNameAndParentAndStatus(rgt.getName(), rgt.getParent(), GlobalTransaction.GlobalTransactionStatus.PREPARED); if (ogtx.isPresent()) { globalTransaction = ogtx.get(); globalTransaction.setStatus(GlobalTransaction.GlobalTransactionStatus.STARTED); } else { globalTransaction = this.startNewGlobalTransaction(rgt); } } return globalTransaction; }
BusinessGlobalTransactionServiceImpl implements BusinessGlobalTransactionService { @Override public GlobalTransaction participateToGlobalTransaction(Optional<RequestGlobalTransaction> orgt) { GlobalTransaction globalTransaction = null; if (orgt.isPresent()) { RequestGlobalTransaction rgt = orgt.get(); Optional<GlobalTransaction> ogtx = globalTransactionRepository.findByNameAndParentAndStatus(rgt.getName(), rgt.getParent(), GlobalTransaction.GlobalTransactionStatus.PREPARED); if (ogtx.isPresent()) { globalTransaction = ogtx.get(); globalTransaction.setStatus(GlobalTransaction.GlobalTransactionStatus.STARTED); } else { globalTransaction = this.startNewGlobalTransaction(rgt); } } return globalTransaction; } }
BusinessGlobalTransactionServiceImpl implements BusinessGlobalTransactionService { @Override public GlobalTransaction participateToGlobalTransaction(Optional<RequestGlobalTransaction> orgt) { GlobalTransaction globalTransaction = null; if (orgt.isPresent()) { RequestGlobalTransaction rgt = orgt.get(); Optional<GlobalTransaction> ogtx = globalTransactionRepository.findByNameAndParentAndStatus(rgt.getName(), rgt.getParent(), GlobalTransaction.GlobalTransactionStatus.PREPARED); if (ogtx.isPresent()) { globalTransaction = ogtx.get(); globalTransaction.setStatus(GlobalTransaction.GlobalTransactionStatus.STARTED); } else { globalTransaction = this.startNewGlobalTransaction(rgt); } } return globalTransaction; } BusinessGlobalTransactionServiceImpl(); @Autowired  BusinessGlobalTransactionServiceImpl(GlobalTransactionRepository globalTransactionRepository,
												Tracer tracer,
												ApplicationEventPublisher publisher); }
BusinessGlobalTransactionServiceImpl implements BusinessGlobalTransactionService { @Override public GlobalTransaction participateToGlobalTransaction(Optional<RequestGlobalTransaction> orgt) { GlobalTransaction globalTransaction = null; if (orgt.isPresent()) { RequestGlobalTransaction rgt = orgt.get(); Optional<GlobalTransaction> ogtx = globalTransactionRepository.findByNameAndParentAndStatus(rgt.getName(), rgt.getParent(), GlobalTransaction.GlobalTransactionStatus.PREPARED); if (ogtx.isPresent()) { globalTransaction = ogtx.get(); globalTransaction.setStatus(GlobalTransaction.GlobalTransactionStatus.STARTED); } else { globalTransaction = this.startNewGlobalTransaction(rgt); } } return globalTransaction; } BusinessGlobalTransactionServiceImpl(); @Autowired  BusinessGlobalTransactionServiceImpl(GlobalTransactionRepository globalTransactionRepository,
												Tracer tracer,
												ApplicationEventPublisher publisher); @Override Optional<GlobalTransaction> findGlobalTransaction(final String id); @Override GlobalTransaction participateToGlobalTransaction(Optional<RequestGlobalTransaction> orgt); @Override Optional<GlobalTransaction> retrieveGlobalTransaction(Optional<RequestGlobalTransaction> orgt); }
BusinessGlobalTransactionServiceImpl implements BusinessGlobalTransactionService { @Override public GlobalTransaction participateToGlobalTransaction(Optional<RequestGlobalTransaction> orgt) { GlobalTransaction globalTransaction = null; if (orgt.isPresent()) { RequestGlobalTransaction rgt = orgt.get(); Optional<GlobalTransaction> ogtx = globalTransactionRepository.findByNameAndParentAndStatus(rgt.getName(), rgt.getParent(), GlobalTransaction.GlobalTransactionStatus.PREPARED); if (ogtx.isPresent()) { globalTransaction = ogtx.get(); globalTransaction.setStatus(GlobalTransaction.GlobalTransactionStatus.STARTED); } else { globalTransaction = this.startNewGlobalTransaction(rgt); } } return globalTransaction; } BusinessGlobalTransactionServiceImpl(); @Autowired  BusinessGlobalTransactionServiceImpl(GlobalTransactionRepository globalTransactionRepository,
												Tracer tracer,
												ApplicationEventPublisher publisher); @Override Optional<GlobalTransaction> findGlobalTransaction(final String id); @Override GlobalTransaction participateToGlobalTransaction(Optional<RequestGlobalTransaction> orgt); @Override Optional<GlobalTransaction> retrieveGlobalTransaction(Optional<RequestGlobalTransaction> orgt);  }