Skip to content

Commit

Permalink
Merge pull request #1021 from suhothayan/master
Browse files Browse the repository at this point in the history
Make test run parallel
  • Loading branch information
pcnfernando committed Feb 13, 2019
2 parents b95936f + 5d50e7d commit c4307c0
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 33 deletions.
7 changes: 5 additions & 2 deletions modules/siddhi-core/pom.xml
Expand Up @@ -16,7 +16,8 @@
~ specific language governing permissions and limitations
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<artifactId>siddhi</artifactId>
Expand Down Expand Up @@ -119,7 +120,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<basedir>${project.build.outputDirectory}/org/wso2/siddhi/core</basedir>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
Expand Down
Expand Up @@ -681,7 +681,7 @@ public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) {
if (inEventCount == 0) {
AssertJUnit.assertTrue("Remove Events will only arrive after the second time period. ",
removeEvents
== null);
== null);
}
if (inEvents != null) {
inEventCount = inEventCount + inEvents.length;
Expand Down Expand Up @@ -740,7 +740,7 @@ public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) {
if (inEventCount == 0) {
AssertJUnit.assertTrue("Remove Events will only arrive after the second time period. ",
removeEvents
== null);
== null);
}
if (inEvents != null) {
inEventCount = inEventCount + inEvents.length;
Expand Down Expand Up @@ -799,7 +799,7 @@ public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) {
if (inEventCount == 0) {
AssertJUnit.assertTrue("Remove Events will only arrive after the second time period. ",
removeEvents
== null);
== null);
}
if (inEvents != null) {
inEventCount = inEventCount + inEvents.length;
Expand Down Expand Up @@ -856,7 +856,7 @@ public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) {
if (inEventCount == 0) {
AssertJUnit.assertTrue("Remove Events will only arrive after the second time period. ",
removeEvents
== null);
== null);
}
if (inEvents != null) {
inEventCount = inEventCount + inEvents.length;
Expand Down Expand Up @@ -910,7 +910,7 @@ public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) {
if (inEventCount == 0) {
AssertJUnit.assertTrue("Remove Events will only arrive after the second time period. ",
removeEvents
== null);
== null);
}
if (inEvents != null) {
inEventCount = inEventCount + inEvents.length;
Expand Down Expand Up @@ -962,8 +962,7 @@ public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) {
EventPrinter.print(timestamp, inEvents, removeEvents);
if (inEventCount == 0) {
AssertJUnit.assertTrue("Remove Events will only arrive after the second time period. ",
removeEvents
== null);
removeEvents == null);
}
if (inEvents != null) {
inEventCount = inEventCount + inEvents.length;
Expand All @@ -981,6 +980,7 @@ public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) {
siddhiAppRuntime.enablePlayBack(true, null, null);
long timestamp = System.currentTimeMillis();
inputHandler.send(timestamp - 500, new Object[]{"IBM", 700f, 0});
Thread.sleep(10);
inputHandler.send(timestamp - 100, new Object[]{"WSO2", 60.5f, 1});
siddhiAppRuntime.enablePlayBack(false, null, null);
inputHandler.send(System.currentTimeMillis(), new Object[]{"ORACLE", 60.5f, 1});
Expand Down
Expand Up @@ -116,7 +116,7 @@ public void receive(Event[] events) {
/**
* To test stats disabling
*/
@Test
@Test(dependsOnMethods = "statisticsTest1")
public void statisticsTest2() throws InterruptedException {
log.info("statistics test 2");
SiddhiManager siddhiManager = new SiddhiManager();
Expand Down Expand Up @@ -186,7 +186,7 @@ public void receive(Event[] events) {
/**
* To test stats dynamic disabling
*/
@Test
@Test(dependsOnMethods = "statisticsTest2")
public void statisticsTest3() throws InterruptedException {
log.info("statistics test 3");
SiddhiManager siddhiManager = new SiddhiManager();
Expand Down Expand Up @@ -271,7 +271,7 @@ public void receive(Event[] events) {
/**
* To test stats dynamic enabling
*/
@Test
@Test(dependsOnMethods = "statisticsTest3")
public void statisticsTest4() throws InterruptedException {
log.info("statistics test 4");
SiddhiManager siddhiManager = new SiddhiManager();
Expand Down Expand Up @@ -356,7 +356,7 @@ public void receive(Event[] events) {
* To not enable stats if no Stats manager enabled
*
*/
@Test
@Test(dependsOnMethods = "statisticsTest4")
public void statisticsTest5() throws InterruptedException {
log.info("statistics test 5");
SiddhiManager siddhiManager = new SiddhiManager();
Expand Down Expand Up @@ -413,7 +413,7 @@ public void receive(Event[] events) {

}

@Test
@Test(dependsOnMethods = "statisticsTest5")
public void statisticsTest6() throws InterruptedException {
log.info("statistics test 1");
SiddhiManager siddhiManager = new SiddhiManager();
Expand Down
Expand Up @@ -61,7 +61,7 @@ public void testQuery1() throws InterruptedException {
siddhiAppRuntime.shutdown();
}

@Test(expectedExceptions = SiddhiAppValidationException.class)
@Test(expectedExceptions = SiddhiAppValidationException.class, dependsOnMethods = "testQuery1")
public void testQuery2() throws InterruptedException {
log.info("testTrigger2 - OUT 0");

Expand All @@ -77,7 +77,7 @@ public void testQuery2() throws InterruptedException {
siddhiAppRuntime.shutdown();
}

@Test(expectedExceptions = DuplicateDefinitionException.class)
@Test(expectedExceptions = DuplicateDefinitionException.class, dependsOnMethods = "testQuery2")
public void testQuery3() throws InterruptedException {
log.info("testTrigger3 - OUT 0");

Expand All @@ -93,7 +93,7 @@ public void testQuery3() throws InterruptedException {
siddhiAppRuntime.shutdown();
}

@Test
@Test(dependsOnMethods = "testQuery3")
public void testQuery4() throws InterruptedException {
log.info("testTrigger4 - OUT 0");

Expand All @@ -110,8 +110,8 @@ public void testQuery4() throws InterruptedException {
}


@Test
public void testFilterQuery5() throws InterruptedException {
@Test(dependsOnMethods = "testQuery4")
public void testQuery5() throws InterruptedException {
log.info("testTrigger5 - OUT 1");

SiddhiManager siddhiManager = new SiddhiManager();
Expand Down Expand Up @@ -141,8 +141,8 @@ public void receive(Event[] events) {

}

@Test
public void testFilterQuery6() throws InterruptedException {
@Test(dependsOnMethods = "testQuery5")
public void testQuery6() throws InterruptedException {
log.info("testTrigger6 - OUT 2");

SiddhiManager siddhiManager = new SiddhiManager();
Expand Down Expand Up @@ -172,8 +172,8 @@ public void receive(Event[] events) {

}

@Test
public void testFilterQuery7() throws InterruptedException {
@Test(dependsOnMethods = "testQuery6")
public void testQuery7() throws InterruptedException {
log.info("testTrigger7 - OUT 2");

SiddhiManager siddhiManager = new SiddhiManager();
Expand Down
15 changes: 9 additions & 6 deletions modules/siddhi-core/src/test/resources/testng.xml
Expand Up @@ -20,7 +20,7 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="Siddhi-Core-Test-Suite">
<test name="siddhi-core-tests" enabled="true" preserve-order="true" parallel="false">
<test name="siddhi-core-tests" enabled="true" parallel="classes">
<classes>
<class name="org.wso2.siddhi.core.aggregation.Aggregation1TestCase"/>
<class name="org.wso2.siddhi.core.aggregation.Aggregation2TestCase"/>
Expand All @@ -30,12 +30,10 @@

<class name="org.wso2.siddhi.core.managment.AsyncTestCase"/>
<class name="org.wso2.siddhi.core.managment.EventTestCase"/>
<class name="org.wso2.siddhi.core.managment.LogTestCase"/>
<class name="org.wso2.siddhi.core.managment.PersistenceTestCase"/>
<class name="org.wso2.siddhi.core.managment.PlaybackTestCase"/>
<class name="org.wso2.siddhi.core.managment.QuerySyncTestCase"/>
<class name="org.wso2.siddhi.core.managment.StatisticsTestCase"/>
<class name="org.wso2.siddhi.core.managment.ValidateTestCase"/>
<class name="org.wso2.siddhi.core.managment.PlaybackTestCase"/>

<class name="org.wso2.siddhi.core.query.aggregator.MaxAggregatorExtensionTestCase"/>
<class name="org.wso2.siddhi.core.query.aggregator.MaxForeverAggregatorExtensionTestCase"/>
Expand Down Expand Up @@ -144,13 +142,18 @@
<class name="org.wso2.siddhi.core.stream.JunctionTestCase"/>
<class name="org.wso2.siddhi.core.stream.event.ComplexEventChunkTestCase"/>
<class name="org.wso2.siddhi.core.stream.event.EventTestCase"/>
</classes>
</test>
<test name="siddhi-core-on-parallel-test" enabled="true" preserve-order="true" parallel="false">
<classes>
<class name="org.wso2.siddhi.core.managment.LogTestCase"/>
<class name="org.wso2.siddhi.core.managment.StatisticsTestCase"/>

<class name="org.wso2.siddhi.core.transport.InMemoryTransportTestCase"/>
<class name="org.wso2.siddhi.core.transport.MultiClientDistributedSinkTestCase"/>
<class name="org.wso2.siddhi.core.transport.SingleClientDistributedTransportTestCases"/>

<class name="org.wso2.siddhi.core.stream.output.sink.LogSinkTest"/>
</classes>


</test>
</suite>
4 changes: 3 additions & 1 deletion modules/siddhi-query-api/pom.xml
Expand Up @@ -65,7 +65,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<basedir>${project.build.outputDirectory}/org/wso2/siddhi/query/api</basedir>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion modules/siddhi-query-api/src/test/resources/testng.xml
Expand Up @@ -20,7 +20,7 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="Siddhi-Api-Test-Suite">
<test name="siddhi-api-tests" enabled="true" preserve-order="true">
<test name="siddhi-api-tests" enabled="true" parallel="classes">
<classes>
<class name="org.wso2.siddhi.query.api.DefineAggregationTestCase"/>
<class name="org.wso2.siddhi.query.api.DefineStreamTestCase"/>
Expand Down
4 changes: 3 additions & 1 deletion modules/siddhi-query-compiler/pom.xml
Expand Up @@ -102,7 +102,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<basedir>${project.build.outputDirectory}/org/wso2/siddhi/query/compiler</basedir>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
Expand Down
Expand Up @@ -20,7 +20,7 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="Siddhi-Compiler-Test-Suite">
<test name="siddhi-compiler-tests" enabled="true" preserve-order="true">
<test name="siddhi-compiler-tests" enabled="true" parallel="classes">
<classes>
<class name="org.wso2.siddhi.query.test.AbsentPatternTestCase"/>
<class name="org.wso2.siddhi.query.test.DefineAggregationTestCase"/>
Expand Down

0 comments on commit c4307c0

Please sign in to comment.