下面列出了org.springframework.test.context.transaction.AfterTransaction#org.springframework.test.context.transaction.BeforeTransaction 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@BeforeTransaction
public void create() {
RenderHost host = RenderHost.newBuilder()
.setName(HOST)
.setBootTime(1192369572)
.setFreeMcp(76020)
.setFreeMem(53500)
.setFreeSwap(20760)
.setLoad(1)
.setTotalMcp(195430)
.setTotalMem(8173264)
.setTotalSwap(20960)
.setNimbyEnabled(false)
.setNumProcs(1)
.setCoresPerProc(100)
.addAllTags(ImmutableList.of("mcore", "4core", "8g"))
.setState(HardwareState.UP)
.setFacility("spi")
.putAttributes("freeGpu", "512")
.putAttributes("totalGpu", "512")
.build();
hostManager.createHost(host);
}
@BeforeTransaction
public void create() {
RenderHost host = RenderHost.newBuilder()
.setName(HOST)
.setBootTime(1192369572)
.setFreeMcp(76020)
.setFreeMem(53500)
.setFreeSwap(20760)
.setLoad(1)
.setTotalMcp(195430)
.setTotalMem(8173264)
.setTotalSwap(20960)
.setNimbyEnabled(false)
.setNumProcs(1)
.setCoresPerProc(100)
.addAllTags(ImmutableList.of("mcore", "4core", "8g"))
.setState(HardwareState.UP)
.setFacility("spi")
.putAttributes("freeGpu", "512")
.putAttributes("totalGpu", "512")
.build();
hostManager.createHost(host);
}
@BeforeTransaction
void beforeTransaction() {
assertInTransaction(false);
this.inTransaction = true;
BeforeAndAfterTransactionAnnotationTests.numBeforeTransactionCalls++;
clearPersonTable(jdbcTemplate);
assertEquals("Adding yoda", 1, addPerson(jdbcTemplate, YODA));
}
@BeforeTransaction
void beforeTransaction() {
assertInTransaction(false);
this.inTransaction = true;
BeforeAndAfterTransactionAnnotationTests.numBeforeTransactionCalls++;
clearPersonTable(jdbcTemplate);
assertEquals("Adding yoda", 1, addPerson(jdbcTemplate, YODA));
}
@BeforeTransaction
public void verifyInitialDatabaseState() {
for (App app : appRepository.findAll()) {
System.out.println(app.getAppId());
}
Assert.assertEquals(0, appRepository.count());
Assert.assertEquals(7, appNamespaceRepository.count());
Assert.assertEquals(0, namespaceRepository.count());
Assert.assertEquals(0, clusterRepository.count());
}
@BeforeTransaction
public void beforeTransaction() {
assertInTransaction(false);
this.inTransaction = true;
BeforeAndAfterTransactionAnnotationTests.numBeforeTransactionCalls++;
clearPersonTable(jdbcTemplate);
assertEquals("Adding yoda", 1, addPerson(jdbcTemplate, YODA));
}
@BeforeTransaction
public void assertBeforeTransaction() {
if (nonNull(beforeTransactionAssertion)) {
final RedisConnection connection = connectionFactory.getConnection();
beforeTransactionAssertion.assertBeforeTransaction(connection);
connection.close();
}
}
@BeforeTransaction
public void beforeTransaction() {
localeEn = new Locale("en");
localeFr = new Locale("fr");
baseName = "basename";
moduleName = "modulename";
Assert.notNull(messageBundleService);
resourceBundleEN = ResourceBundle.getBundle("org/sakaiproject/messagebundle/impl/test/bundle", localeEn);
resourceBundleFr = ResourceBundle.getBundle("org/sakaiproject/messagebundle/impl/test/bundle", localeFr);
messageBundleService.saveOrUpdate(baseName, moduleName, resourceBundleEN, localeEn);
messageBundleService.saveOrUpdate(baseName, moduleName, resourceBundleFr, localeFr);
}
@BeforeTransaction
public void beforeTransaction() {
localeEn = new Locale("en");
localeFr = new Locale("fr");
baseName = "basename";
moduleName = "modulename";
Assert.notNull(messageBundleService);
resourceBundleEN = ResourceBundle.getBundle("org/sakaiproject/messagebundle/impl/test/bundle", localeEn);
resourceBundleFr = ResourceBundle.getBundle("org/sakaiproject/messagebundle/impl/test/bundle", localeFr);
messageBundleService.saveOrUpdate(baseName, moduleName, resourceBundleEN, localeEn);
messageBundleService.saveOrUpdate(baseName, moduleName, resourceBundleFr, localeFr);
}
@BeforeTransaction
public void beforeTransaction() {
deleteFromTables("user");
executeSqlScript("classpath:/org/springframework/test/context/jdbc/data.sql", false);
}
@BeforeTransaction
public void beforeTransaction() {
deleteFromTables("user");
executeSqlScript("classpath:/org/springframework/test/context/jdbc/data.sql", false);
}
@BeforeTransaction
void beforeTransaction() {
assertNumRowsInPersonTable(1, "before a transactional test method");
assertAddPerson(YODA);
}
@BeforeTransaction
void beforeTransaction() {
assertNumRowsInPersonTable(1, "before a transactional test method");
assertAddPerson(YODA);
}
@BeforeTransaction
void beforeTransaction() {
fail("always failing beforeTransaction()");
}
@BeforeTransaction
@AfterTransaction
void checkInitialDatabaseState() {
assertEquals(0, countRowsInTable("user"));
}
@BeforeTransaction
@AfterTransaction
void checkInitialDatabaseState() {
assertEquals(0, countRowsInTable("user"));
}
@BeforeTransaction
public void beforeTransaction() {
txManager1.clear();
txManager2.clear();
}
@BeforeTransaction
public void beforeTransaction() {
fail("always failing beforeTransaction()");
}
@BeforeTransaction
public void beforeTransaction() {
txManager1.clear();
txManager2.clear();
}
@BeforeTransaction
public void beforeTransaction() {
txManager1.clear();
txManager2.clear();
}
@BeforeTransaction
public void beforeTransaction() {
txManager1.clear();
txManager2.clear();
}
@BeforeTransaction
public void beforeTransaction() {
txManager.clear();
}
@BeforeTransaction
public void beforeTransaction() {
txManager1.clear();
txManager2.clear();
}
@BeforeTransaction
public void beforeTransaction() {
org.testng.Assert.fail("always failing beforeTransaction()");
}
@BeforeTransaction
public void beforeTransaction() {
assertNumRowsInPersonTable(0, "before a transactional test method");
assertAddPerson(YODA);
}
@BeforeTransaction
public void beforeTransaction() {
fail("always failing beforeTransaction()");
}
@BeforeTransaction
public void beforeTransaction() {
assertEquals("Verifying the number of rows in the person table before a transactional test method.",
1, countRowsInPersonTable());
assertEquals("Adding yoda", 1, addPerson(YODA));
}
@BeforeTransaction
public void beforeTransaction() {
assertNumUsers(0);
}
@BeforeTransaction
@AfterTransaction
public void verifyPreAndPostTransactionDatabaseState() {
assertNumUsers(0);
}
@BeforeTransaction
public void beforeTransaction() {
deleteFromTables("user");
executeSqlScript("classpath:/org/springframework/test/context/jdbc/data.sql", false);
}