Skip to content

Commit 5710c14

Browse files
erik-edlingAnders Breid
authored andcommitted
Add integration tests (#222)
* Add integrationtests * Fix rules to work with queryAggregatedObject * fixed drop condition
1 parent 3549455 commit 5710c14

32 files changed

+1564
-603
lines changed

.travis.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ sudo: required
22

33
language: java
44

5+
services:
6+
- docker
7+
58
jdk:
69
- oraclejdk8
710

@@ -17,8 +20,11 @@ script:
1720
#
1821
# It is also important that the first test to be run is a Spring Boot Test since spring boot also downloads
1922
# another version of embedded mongo db so all Spring Boot tests will end up in a race condition also
20-
- mvn -DsomeModule.test.includes="**/QueryServiceTest.java" test
21-
- mvn -DsomeModule.test.excludes="**/QueryServiceTest.java" test
23+
- source docker-env.bash
24+
- docker-compose up -d
25+
- mvn -DsomeModule.test.includes="**/QueryServiceTest.java" test -DskipITs
26+
- mvn -DsomeModule.test.excludes="**/QueryServiceTest.java" test -DskipITs
27+
- mvn verify -DskipUTs -Der.url=http://localhost:8084/search/ -Drabbitmq.exchange.name=ei-exchange -Dspring.mail.host=localhost -Dspring.mail.port=1025 -Dwaitlist.fixedRateResend=1
2228

2329
before_deploy:
2430
- rm -rf docs

pom.xml

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
<groupId>junit</groupId>
180180
<artifactId>junit</artifactId>
181181
<version>4.12</version>
182+
<scope>test</scope>
182183
</dependency>
183184

184185
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
@@ -450,35 +451,37 @@
450451
</plugin>
451452

452453
<plugin>
453-
<groupId>org.apache.maven.plugins</groupId>
454-
<artifactId>maven-failsafe-plugin</artifactId>
455-
<version>2.22.0</version>
456-
<executions>
457-
<execution>
458-
<id>integration-test</id>
459-
<goals>
460-
<goal>integration-test</goal>
461-
<goal>verify</goal>
462-
</goals>
463-
<phase>integration-test</phase>
464-
<configuration>
465-
<skipTests>${skipTests}</skipTests>
466-
<skipITs>${skipITs}</skipITs>
467-
<systemPropertyVariables>
468-
<systemTest>true</systemTest>
469-
<er.url>http://localhost:8080/eventrepository/search/</er.url>
470-
</systemPropertyVariables>
471-
<excludes>
472-
<exclude>**/test/*</exclude>
473-
<exclude>**/functionaltests/*</exclude>
474-
</excludes>
475-
<additionalClasspathElements>
476-
<additionalClasspathElement>${basedir}/target/classes</additionalClasspathElement>
477-
</additionalClasspathElements>
478-
</configuration>
479-
</execution>
480-
</executions>
481-
</plugin>
454+
<groupId>org.apache.maven.plugins</groupId>
455+
<artifactId>maven-failsafe-plugin</artifactId>
456+
<version>2.22.0</version>
457+
<executions>
458+
<execution>
459+
<id>integration-test</id>
460+
<goals>
461+
<goal>integration-test</goal>
462+
<goal>verify</goal>
463+
</goals>
464+
<phase>integration-test</phase>
465+
</execution>
466+
</executions>
467+
<configuration>
468+
<forkCount>3</forkCount>
469+
<reuseForks>false</reuseForks>
470+
<skipTests>${skipTests}</skipTests>
471+
<skipITs>${skipITs}</skipITs>
472+
<systemPropertyVariables>
473+
<systemTest>true</systemTest>
474+
<er.url>http://localhost:8080/eventrepository/search/</er.url>
475+
</systemPropertyVariables>
476+
<excludes>
477+
<exclude>**/test/*</exclude>
478+
<exclude>**/functionaltests/*</exclude>
479+
</excludes>
480+
<additionalClasspathElements>
481+
<additionalClasspathElement>${basedir}/target/classes</additionalClasspathElement>
482+
</additionalClasspathElements>
483+
</configuration>
484+
</plugin>
482485

483486
<plugin>
484487
<groupId>org.apache.maven.plugins</groupId>

src/functionaltests/java/com/ericsson/ei/subscriptions/repeatHandler/SubscriptionRepeatHandlerSteps.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ public void check_in_MongoDB_RepeatFlagHandler_collections_that_the_subscription
134134
List<String> resultRepeatFlagHandler = mongoDBHandler.find(dataBaseName, repeatFlagHandlerCollection,
135135
subscriptionIdMatchedAggrIdObjQuery);
136136
assertEquals("[]", resultRepeatFlagHandler.toString());
137-
assertTrue(mongoDBHandler.dropDocument(dataBaseName, collectionName,
138-
eventManager.getJSONFromFile(AGGREGATED_OBJECT_FINAL_FILE_PATH).toString()));
137+
String condition = "{\"_id\": \"" + AGGREGATED_OBJECT_ID + "\"}";
138+
assertTrue(mongoDBHandler.dropDocument(dataBaseName, collectionName, condition));
139139
}
140140

141141
@When("^In MongoDb RepeatFlagHandler collection the subscription has matched the AggrObjectId at least two times$")

src/integrationtests/java/com/ericsson/ei/artifactintegration/ArtifactFlowRunnerIT.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/integrationtests/java/com/ericsson/ei/artifactintegration/ArtifactFlowStepsIT.java

Lines changed: 0 additions & 170 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.ericsson.ei.integrationtests;
2+
3+
import org.junit.BeforeClass;
4+
import org.junit.runner.RunWith;
5+
import org.springframework.test.context.TestPropertySource;
6+
7+
import cucumber.api.CucumberOptions;
8+
import cucumber.api.junit.Cucumber;
9+
10+
@RunWith(Cucumber.class)
11+
@CucumberOptions(features = "src/integrationtests/resources/features/ArtifactFlowIT.feature", glue = {
12+
"com.ericsson.ei.integrationtests" }, plugin = { "pretty",
13+
"html:target/cucumber-reports/ArtifactFlowRunnerIT"})
14+
public class ArtifactFlowRunnerIT {
15+
@BeforeClass
16+
public static void before() {
17+
System.setProperty("aggregated.collection.name", "aggregated_objects_artifact_flow");
18+
System.setProperty("waitlist.collection.name", "wait_list_artifact_flow");
19+
System.setProperty("subscription.collection.name", "subscription_artifact_flow");
20+
System.setProperty("event_object_map.collection.name", "event_object_map_artifact_flow");
21+
System.setProperty("subscription.collection.repeatFlagHandlerName", "subscription_repeat_handler_artifact_flow");
22+
System.setProperty("missedNotificationCollectionName", "missed_notification_artifact_flow");
23+
System.setProperty("sessions.collection.name", "sessions_artifact_flow");
24+
25+
System.setProperty("rules.path", "/ArtifactRules_new.json");
26+
System.setProperty("rabbitmq.consumerName", "artifact_queue");
27+
}
28+
}

0 commit comments

Comments
 (0)