本文整理汇总了Java中org.axonframework.unitofwork.UnitOfWork.commit方法的典型用法代码示例。如果您正苦于以下问题:Java UnitOfWork.commit方法的具体用法?Java UnitOfWork.commit怎么用?Java UnitOfWork.commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.axonframework.unitofwork.UnitOfWork
的用法示例。
在下文中一共展示了UnitOfWork.commit方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: debitEventShouldReflectStateChange
import org.axonframework.unitofwork.UnitOfWork; //导入方法依赖的package包/类
@Test
public void debitEventShouldReflectStateChange() throws Exception {
double value = 100.00;
String account = "cc-1";
UnitOfWork unitOfWork = DefaultUnitOfWork.startAndGet(new JPATransationManager(tx));
Account acc = creditAccount(account, value);
acc = debitAccount(account, value);
unitOfWork.commit();
AccountView accountView = em.find(AccountView.class, acc.getIdentifier());
Assert.assertEquals(Double.valueOf(value), accountView.getAmmount(), 0.001);
Assert.assertEquals(acc.getBalance(), accountView.getBalance(), 0.001);
}
示例2: afterTeste
import org.axonframework.unitofwork.UnitOfWork; //导入方法依赖的package包/类
@After
public void afterTeste() {
UnitOfWork unitOfWork = DefaultUnitOfWork.startAndGet(new JPATransationManager(tx));
Account acc = repository.load("cc-1");
acc.markDeleted();
unitOfWork.commit();
}
示例3: loadAggregate
import org.axonframework.unitofwork.UnitOfWork; //导入方法依赖的package包/类
private static void loadAggregate(EventSourcingRepository repository, String toDoItemId) {
System.out.println("\n------------------- LOADING AGGREGATE -----------------------");
System.out.println("Loading 'ToDoItem' with Id: " + toDoItemId);
System.out.println("Events being re-applied...");
UnitOfWork unitOfWork = new DefaultUnitOfWorkFactory().createUnitOfWork();
ToDoItem item = (ToDoItem) repository.load(toDoItemId);
unitOfWork.commit();
System.out.println("Loaded...");
System.out.println(
"ToDoItem (" + item.getId() + ") " + "'" + item.getDescription() + "' " + "Complete?: "
+ item.isComplete());
System.out.println("---------------------- AGGREGATE LOADED -----------------------\n");
}
示例4: beforeTest
import org.axonframework.unitofwork.UnitOfWork; //导入方法依赖的package包/类
@Before
public void beforeTest() {
UnitOfWork unitOfWork = DefaultUnitOfWork.startAndGet(new JPATransationManager(tx));
repository.add(new Account("cc-1"));
unitOfWork.commit();
}
示例5: debitShouldDecreaseBalance
import org.axonframework.unitofwork.UnitOfWork; //导入方法依赖的package包/类
@Test
public void debitShouldDecreaseBalance() throws Exception {
UnitOfWork unitOfWork = DefaultUnitOfWork.startAndGet(new JPATransationManager(tx));
double value = 100.00;
String account = "cc-1";
Account acc = creditAccount(account, value);
acc = debitAccount(account, value);
unitOfWork.commit();
Assert.assertEquals(acc.getBalance(), 0.0000, 0.001);
}
示例6: debitShouldNotResultInNegativeBalance
import org.axonframework.unitofwork.UnitOfWork; //导入方法依赖的package包/类
@Test
public void debitShouldNotResultInNegativeBalance() throws Exception {
UnitOfWork unitOfWork = DefaultUnitOfWork.startAndGet(new JPATransationManager(tx));
double debitValue = 100.00;
String account = "cc-1";
Account acc = debitAccount(account, debitValue);
unitOfWork.commit();
Assert.assertEquals(acc.getBalance(), 0.0000, 0.001);
}
示例7: shouldNotCreditNegativeValue
import org.axonframework.unitofwork.UnitOfWork; //导入方法依赖的package包/类
@Test
public void shouldNotCreditNegativeValue() throws Exception {
UnitOfWork unitOfWork = DefaultUnitOfWork.startAndGet(new JPATransationManager(tx));
double creditValue = -100.00;
String account = "cc-1";
Account acc = creditAccount(account, creditValue);
unitOfWork.commit();
Assert.assertEquals(acc.getBalance(), 0.0000, 0.001);
}
示例8: creditShouldIncreaseBalance
import org.axonframework.unitofwork.UnitOfWork; //导入方法依赖的package包/类
@Test
public void creditShouldIncreaseBalance() throws Exception {
UnitOfWork unitOfWork = DefaultUnitOfWork.startAndGet(new JPATransationManager(tx));
double creditValue = 100.00;
String account = "cc-1";
Account acc = creditAccount(account, creditValue);
unitOfWork.commit();
Assert.assertEquals(acc.getBalance(), creditValue, 0.001);
}