本文整理汇总了Java中org.springframework.test.annotation.Timed类的典型用法代码示例。如果您正苦于以下问题:Java Timed类的具体用法?Java Timed怎么用?Java Timed使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Timed类属于org.springframework.test.annotation包,在下文中一共展示了Timed类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testUsingSpringTimedAnnotationTest
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Timed(millis=2000)
@Test
public void testUsingSpringTimedAnnotationTest() throws InterruptedException {
log.debug("Using Spring Test fixtures:");
List<Document> documents = engine.findByType(webType);
assertNotNull(documents);
assertTrue(documents.size() == 1);
assertEquals(webType.getName(),documents.get(0).getType().getName());
assertEquals(webType.getDesc(),documents.get(0).getType().getDesc());
assertEquals(webType.getExtension(),documents.get(0).getType().getExtension());
Thread.sleep(500);
documents = engine.listAll();
assertNotNull(documents);
assertTrue(documents.size() == 4);
}
开发者ID:Apress,项目名称:introducing-spring-framework,代码行数:19,代码来源:MyDocumentsMoreAnnotationsTest.java
示例2: runTestTimed
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
/**
* Runs a <em>timed</em> test via the supplied {@link TestExecutionCallback}
* , providing support for the {@link Timed @Timed} annotation.
*
* @param tec the test execution callback to run
* @param testMethod the actual test method: used to retrieve the
* {@code timeout}
* @throws Throwable if any exception is thrown
* @see Timed
* @see #runTest
*/
private void runTestTimed(TestExecutionCallback tec, Method testMethod) throws Throwable {
Timed timed = testMethod.getAnnotation(Timed.class);
if (timed == null) {
runTest(tec, testMethod);
}
else {
long startTime = System.currentTimeMillis();
try {
runTest(tec, testMethod);
}
finally {
long elapsed = System.currentTimeMillis() - startTime;
if (elapsed > timed.millis()) {
fail("Took " + elapsed + " ms; limit was " + timed.millis());
}
}
}
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:30,代码来源:AbstractJUnit38SpringContextTests.java
示例3: testMultipleUpdate
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
/**
* test multiple call on update service
*/
@Test
@Timed(millis = 4000)
public void testMultipleUpdate() throws IOException {
for (final int id : testCreateAll()) {
testUpdate(id);
}
}
开发者ID:ligoj,项目名称:bootstrap,代码行数:11,代码来源:CrudRestIT.java
示例4: testMultipleFindAll
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
/**
* test multiple call on find all service
*/
@Test
@Timed(millis = 8000)
public void testMultipleFindAll() throws IOException {
testCreateAll();
for (int loop = NB_ITERATION; loop-- > 0;) {
testFindAll();
}
}
开发者ID:ligoj,项目名称:bootstrap,代码行数:12,代码来源:CrudRestIT.java
示例5: testMultipleFindById
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
/**
* test multiple call on find by id service
*/
@Test
@Timed(millis = 8000)
public void testMultipleFindById() throws IOException {
for (final int id : testCreateAll()) {
testFindById(id);
}
}
开发者ID:ligoj,项目名称:bootstrap,代码行数:11,代码来源:CrudRestIT.java
示例6: testMultipleDelete
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
/**
* test multiple call on delete service
*/
@Test
@Timed(millis = 8000)
public void testMultipleDelete() throws IOException {
for (final int id : testCreateAll()) {
testDelete(id);
}
}
开发者ID:ligoj,项目名称:bootstrap,代码行数:11,代码来源:CrudRestIT.java
示例7: notTransactionalWithSpringTimeout
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
@Timed(millis = 10000)
@Repeat(5)
public void notTransactionalWithSpringTimeout() {
assertInTransaction(false);
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:TimedTransactionalSpringRunnerTests.java
示例8: singleRepetitionExceedsTimeout
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Test
@Timed(millis = 10)
@Repeat(1)
public void singleRepetitionExceedsTimeout() throws Exception {
incrementInvocationCount();
Thread.sleep(15);
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:RepeatedSpringRuleTests.java
示例9: firstRepetitionOfManyExceedsTimeout
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Test
@Timed(millis = 20)
@Repeat(4)
public void firstRepetitionOfManyExceedsTimeout() throws Exception {
incrementInvocationCount();
Thread.sleep(25);
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:RepeatedSpringRuleTests.java
示例10: collectiveRepetitionsExceedTimeout
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Test
@Timed(millis = 100)
@Repeat(10)
public void collectiveRepetitionsExceedTimeout() throws Exception {
incrementInvocationCount();
Thread.sleep(11);
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:RepeatedSpringRuleTests.java
示例11: testJdbcTx2
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Timed(millis=273)
public void testJdbcTx2() throws InterruptedException {
//Thread.sleep(2000);
assertEquals("Any previous tx must have been rolled back", 0, countRowsInTable("person"));
//insertPerson("foo");
executeSqlScript("/org/springframework/orm/jpa/insertPerson.sql", false);
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:8,代码来源:AbstractContainerEntityManagerFactoryIntegrationTests.java
示例12: notTransactionalWithSpringTimeout
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Test
@NotTransactional
@Timed(millis = 10000)
@Repeat(5)
public void notTransactionalWithSpringTimeout() {
assertInTransaction(false);
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:8,代码来源:TimedTransactionalSpringRunnerTests.java
示例13: testTimedExecution
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Test
@Timed(millis = 10)
public void testTimedExecution() throws Exception {
System.out.println("Will fail if method takes longer than 10 millis. " +
"Will wait for it to finish, unlike JUnit timeout");
// java.util.concurrent.TimeUnit.MILLISECONDS.sleep(15);
}
开发者ID:ieugen,项目名称:trainings,代码行数:10,代码来源:TestingAnnotations.java
示例14: testSpringTimeout
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Test()
@Timed(millis = 100)
public void testSpringTimeout() throws InterruptedException {
Thread.sleep(50);
// Thread.sleep(120);
assertThat(true, equalTo(Boolean.TRUE));
}
开发者ID:arnosthavelka,项目名称:spring-advanced-training,代码行数:8,代码来源:TimedAnnotationTest.java
示例15: testMultipleCreate
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
/**
* test multiple call on create service
*/
@Test
@Timed(millis = 4000)
public void testMultipleCreate() throws IOException {
testCreateAll();
}
开发者ID:ligoj,项目名称:bootstrap,代码行数:9,代码来源:CrudRestIT.java
示例16: transactionalWithSpringTimeout
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Test
@Timed(millis = 10000)
@Repeat(5)
public void transactionalWithSpringTimeout() {
assertInTransaction(true);
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:7,代码来源:TimedTransactionalSpringRunnerTests.java
示例17: springTimeoutWithNoOp
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Test
@Timed(millis = 2000)
public void springTimeoutWithNoOp() {
/* no-op */
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:TimedSpringRunnerTests.java
示例18: springTimeoutWithSleep
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Test
@Timed(millis = 100)
public void springTimeoutWithSleep() throws Exception {
Thread.sleep(200);
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:TimedSpringRunnerTests.java
示例19: springAndJUnitTimeouts
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Test(timeout = 200)
@Timed(millis = 200)
public void springAndJUnitTimeouts() {
/* no-op */
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:TimedSpringRunnerTests.java
示例20: nonAnnotated
import org.springframework.test.annotation.Timed; //导入依赖的package包/类
@Test
@Timed(millis = 10000)
public void nonAnnotated() throws Exception {
incrementInvocationCount();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:RepeatedSpringRuleTests.java
注:本文中的org.springframework.test.annotation.Timed类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论