当前位置: 首页>>代码示例>>Java>>正文


Java UnitOfWork.commit方法代码示例

本文整理汇总了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);
}
 
开发者ID:arturgaleno,项目名称:cqrs-tutorial,代码行数:17,代码来源:MemberRegistrationTest.java

示例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();
  }
 
开发者ID:arturgaleno,项目名称:cqrs-tutorial,代码行数:8,代码来源:MemberRegistrationTest.java

示例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");
  }
 
开发者ID:benwilcock,项目名称:axon-cqrs-sample,代码行数:15,代码来源:ToDoItemDemoRunner.java

示例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();
  }
 
开发者ID:arturgaleno,项目名称:cqrs-tutorial,代码行数:7,代码来源:MemberRegistrationTest.java

示例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);
}
 
开发者ID:arturgaleno,项目名称:cqrs-tutorial,代码行数:17,代码来源:MemberRegistrationTest.java

示例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);
}
 
开发者ID:arturgaleno,项目名称:cqrs-tutorial,代码行数:15,代码来源:MemberRegistrationTest.java

示例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);
}
 
开发者ID:arturgaleno,项目名称:cqrs-tutorial,代码行数:15,代码来源:MemberRegistrationTest.java

示例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);
}
 
开发者ID:arturgaleno,项目名称:cqrs-tutorial,代码行数:15,代码来源:MemberRegistrationTest.java


注:本文中的org.axonframework.unitofwork.UnitOfWork.commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。