Skip to content

Commit

Permalink
Build time optimization (eugenp#1553)
Browse files Browse the repository at this point in the history
* Add integration tests

* Optimize build
  • Loading branch information
pivovarit authored Apr 1, 2017
1 parent 4b98413 commit 760692b
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 33 deletions.
2 changes: 2 additions & 0 deletions apache-poi/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.docx
temp.xls
temp.xlsx
2 changes: 1 addition & 1 deletion jee7/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>com.baeldung</groupId>
<artifactId>jee7schedule</artifactId>
<artifactId>jee7</artifactId>
<version>1.0-SNAPSHOT</version>
<description>JavaEE 7 Arquillian Archetype Sample</description>
<packaging>war</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,27 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;


@RunWith(Arquillian.class)
public class ScheduleTimerBeanIntegrationTest {

final static long TIMEOUT = 5000l;
final static long TOLERANCE = 1000l;
private final static long TIMEOUT = 5000l;
private final static long TOLERANCE = 1000l;

@Inject
TimerEventListener timerEventListener;
@Inject TimerEventListener timerEventListener;

@Deployment
public static WebArchive deploy() {
File[] jars = Maven.resolver().loadPomFromFile("pom.xml")
.resolve("com.jayway.awaitility:awaitility")
.withTransitivity().asFile();
File[] jars = Maven
.resolver()
.loadPomFromFile("pom.xml")
.resolve("com.jayway.awaitility:awaitility")
.withTransitivity()
.asFile();

return ShrinkWrap.create(WebArchive.class)
.addAsLibraries(jars)
.addClasses(WithinWindowMatcher.class, TimerEvent.class, TimerEventListener.class, ScheduleTimerBean.class);
return ShrinkWrap
.create(WebArchive.class)
.addAsLibraries(jars)
.addClasses(WithinWindowMatcher.class, TimerEvent.class, TimerEventListener.class, ScheduleTimerBean.class);
}

@Test
Expand All @@ -46,9 +48,15 @@ public void should_receive_three_pings() {
Awaitility.setDefaultTimeout(30, TimeUnit.SECONDS);
await().untilCall(to(timerEventListener.getEvents()).size(), equalTo(3));

TimerEvent firstEvent = timerEventListener.getEvents().get(0);
TimerEvent secondEvent = timerEventListener.getEvents().get(1);
TimerEvent thirdEvent = timerEventListener.getEvents().get(2);
TimerEvent firstEvent = timerEventListener
.getEvents()
.get(0);
TimerEvent secondEvent = timerEventListener
.getEvents()
.get(1);
TimerEvent thirdEvent = timerEventListener
.getEvents()
.get(2);

long delay = secondEvent.getTime() - firstEvent.getTime();
assertThat(delay, Matchers.is(WithinWindowMatcher.withinWindow(TIMEOUT, TOLERANCE)));
Expand Down
3 changes: 0 additions & 3 deletions jooq/src/test/java/com/baeldung/JOOLTest.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.baeldung;


import junit.framework.Assert;
import org.jooq.lambda.Seq;
import org.jooq.lambda.Unchecked;
import org.jooq.lambda.function.Function1;
import org.jooq.lambda.function.Function2;
import org.jooq.lambda.tuple.Tuple;
import org.jooq.lambda.tuple.Tuple2;
import org.jooq.lambda.tuple.Tuple3;
import org.jooq.lambda.tuple.Tuple4;
Expand Down
13 changes: 13 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
<module>vertx</module>
<module>spring-data-gemfire</module>
</modules>

<build>
<plugins>
<plugin>
Expand All @@ -226,6 +227,18 @@

</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*LongRunningUnitTest.java</exclude>
<exclude>**/*ManualTest.java</exclude>
</excludes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
<extensions>
<!--<extension>
Expand Down
1 change: 0 additions & 1 deletion querydsl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
*/
package org.baeldung.querydsl.intro;

import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.baeldung.querydsl.intro.entities.BlogPost;
import org.baeldung.querydsl.intro.entities.QBlogPost;
import org.baeldung.querydsl.intro.entities.QUser;
import org.baeldung.querydsl.intro.entities.User;
import com.querydsl.core.Tuple;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.core.types.dsl.NumberPath;
import com.querydsl.jpa.JPAExpressions;
import com.querydsl.jpa.impl.JPAQueryFactory;
import org.baeldung.querydsl.intro.entities.BlogPost;
import org.baeldung.querydsl.intro.entities.QBlogPost;
import org.baeldung.querydsl.intro.entities.QUser;
import org.baeldung.querydsl.intro.entities.User;
import org.junit.*;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import java.util.List;

import static org.junit.Assert.*;

public class QueryDSLTest {
public class QueryDSLIntegrationTest {

private static EntityManagerFactory emf;

Expand Down
13 changes: 13 additions & 0 deletions rxjava/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*LongRunningUnitTest.java</exclude>
<exclude>**/*ManualTest.java</exclude>
</excludes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -47,4 +59,5 @@
<hamcrest.version>1.3</hamcrest.version>
</properties>


</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import static org.junit.Assert.assertTrue;

public class RxJavaBackpressureTest {
public class RxJavaBackpressureLongRunningUnitTest {

@Test
public void givenColdObservable_shouldNotThrowException() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.verify;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;

@RunWith(SpringRunner.class)
@ActiveProfiles("test")
@SpringBootTest(webEnvironment=SpringBootTest.WebEnvironment.RANDOM_PORT)
public class MessageControllerTest {
@SpringBootTest(webEnvironment = RANDOM_PORT)
public class MessageControllerIntegrationTest {

@Autowired
private TestRestTemplate restTemplate;
Expand Down
2 changes: 1 addition & 1 deletion spring-jooq/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung</groupId>
<artifactId>jooq-spring</artifactId>
<artifactId>sprin-jooq</artifactId>
<version>0.0.1-SNAPSHOT</version>

<dependencyManagement>
Expand Down

0 comments on commit 760692b

Please sign in to comment.