#BAEL-505 (#1337)
* #BAEL-505 Concurrent Test in Spring 5 * add pom description * add spring-5 module to main pom
This commit is contained in:
parent
e46484df4c
commit
64ec368139
1
pom.xml
1
pom.xml
@ -109,6 +109,7 @@
|
||||
<module>selenium-junit-testng</module>
|
||||
<module>solr-fulltext-search</module>
|
||||
<module>spark-java</module>
|
||||
<module>spring-5</module>
|
||||
<module>spring-akka</module>
|
||||
<module>spring-amqp</module>
|
||||
<module>spring-all</module>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>spring-5</name>
|
||||
<description></description>
|
||||
<description>spring 5 sample project about new features</description>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@ -67,6 +67,17 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.19.1</version>
|
||||
<configuration>
|
||||
<parallel>methods</parallel>
|
||||
<useUnlimitedThreads>true</useUnlimitedThreads>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
@ -0,0 +1,57 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = Spring5JUnit4ConcurrentIntegrationTest.SimpleConfiguration.class)
|
||||
public class Spring5JUnit4ConcurrentIntegrationTest implements ApplicationContextAware, InitializingBean {
|
||||
|
||||
@Configuration
|
||||
public static class SimpleConfiguration {
|
||||
}
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
private boolean beanInitialized = false;
|
||||
|
||||
@Override
|
||||
public final void afterPropertiesSet() throws Exception {
|
||||
this.beanInitialized = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void verifyApplicationContextSet() throws InterruptedException {
|
||||
TimeUnit.SECONDS.sleep(2);
|
||||
assertNotNull("The application context should have been set due to ApplicationContextAware semantics.", this.applicationContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void verifyBeanInitialized() throws InterruptedException {
|
||||
TimeUnit.SECONDS.sleep(2);
|
||||
assertTrue("This test bean should have been initialized due to InitializingBean semantics.", this.beanInitialized);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user