Skip to content

Commit

Permalink
[TEST] - Separating out integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Rosander committed Oct 6, 2015
1 parent bbe7eb8 commit 34de8e4
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 37 deletions.
2 changes: 1 addition & 1 deletion assemblies/features/pom.xml
Expand Up @@ -54,7 +54,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${dependency.build-helper-maven-plugin.revision}</version>
<version>${plugin.org.codehaus.mojo.build-helper-maven-plugin.version}</version>
<executions>
<execution>
<id>attach-artifacts</id>
Expand Down
Expand Up @@ -40,7 +40,7 @@

import static org.junit.Assert.assertEquals;

public class JobEntryPigScriptExecutorIntegrationTest {
public class JobEntryPigScriptExecutorIT {

StringBuffer m_reference;

Expand All @@ -61,7 +61,7 @@ private StringBuffer readResource( Reader r ) throws IOException {
public void setup() throws IOException {
BufferedReader br =
new BufferedReader(
new InputStreamReader( JobEntryPigScriptExecutorIntegrationTest.class.getClassLoader().getResourceAsStream(
new InputStreamReader( JobEntryPigScriptExecutorIT.class.getClassLoader().getResourceAsStream(
"org/pentaho/di/job/entries/pig/JobEntryPigScriptExecutorTest.ref" ) ) );

m_reference = readResource( br );
Expand Down
Expand Up @@ -31,13 +31,13 @@
import org.pentaho.di.trans.TransMeta;
import org.pentaho.hadoop.mapreduce.MRUtil;

public class MRUtilIntegrationTest {
public class MRUtilIT {

@Test
public void createTrans_normalEngine() throws Exception {
KettleEnvironment.init();
final Configuration c = new Configuration();
final TransMeta transMeta = new TransMeta( "./src/test/resources/wordcount-reducer.ktr" );
final TransMeta transMeta = new TransMeta( "./src/it/resources/wordcount-reducer.ktr" );
final Trans trans = MRUtil.getTrans( c, transMeta.getXML(), false );
assertEquals( TransMeta.TransformationType.Normal, trans.getTransMeta().getTransformationType() );
}
Expand All @@ -46,7 +46,7 @@ public void createTrans_normalEngine() throws Exception {
public void createTrans_singleThreaded() throws Exception {
KettleEnvironment.init();
final Configuration c = new Configuration();
final TransMeta transMeta = new TransMeta( "./src/test/resources/wordcount-reducer.ktr" );
final TransMeta transMeta = new TransMeta( "./src/it/resources/wordcount-reducer.ktr" );
final Trans trans = MRUtil.getTrans( c, transMeta.getXML(), true );
assertEquals( TransMeta.TransformationType.SingleThreaded, trans.getTransMeta().getTransformationType() );
}
Expand Down
Expand Up @@ -75,7 +75,7 @@
import static org.junit.Assert.*;

@SuppressWarnings( { "nls", "unchecked", "deprecation", "rawtypes" } )
public class PentahoMapReduceIntegrationTest {
public class PentahoMapReduceIT {

private boolean debug = false;

Expand All @@ -96,7 +96,7 @@ public void testMapperBadInjectorFields() throws IOException, KettleException {
MockOutputCollector outputCollector = new MockOutputCollector();
MockReporter reporter = new MockReporter();
MockRecordReader reader = new MockRecordReader( Arrays.asList( "test" ) );
mapper.configure( createJobConf( "./src/test/resources/bad-injector-fields.ktr", "./src/test/resources/wordcount-reducer.ktr" ) );
mapper.configure( createJobConf( "./src/test/resources/bad-injector-fields.ktr", "./src/it/resources/wordcount-reducer.ktr" ) );

mapper.run( reader, outputCollector, reporter );
fail( "Should have thrown an exception" );
Expand Down Expand Up @@ -443,7 +443,7 @@ public void testMapRunnable_wordCount() throws IOException, KettleException {
MockOutputCollector outputCollector = new MockOutputCollector();
MockReporter reporter = new MockReporter();

mapRunnable.configure( createJobConf( "./src/test/resources/wordcount-mapper.ktr", "./src/test/resources/wordcount-reducer.ktr" ) );
mapRunnable.configure( createJobConf( "./src/it/resources/wordcount-mapper.ktr", "./src/it/resources/wordcount-reducer.ktr" ) );

final int ROWS = 10000;

Expand Down Expand Up @@ -502,7 +502,7 @@ public void countValues( String k, Object v, MockOutputCollector oc ) {
MockOutputCollector inputCollector = outputCollector;
outputCollector = new MockOutputCollector();

reducer.configure( createJobConf( "./src/test/resources/wordcount-mapper.ktr", "./src/test/resources/wordcount-reducer.ktr" ) );
reducer.configure( createJobConf( "./src/it/resources/wordcount-mapper.ktr", "./src/it/resources/wordcount-reducer.ktr" ) );

start = System.currentTimeMillis();
for ( Object key : inputCollector.getCollection().keySet() ) {
Expand Down Expand Up @@ -618,8 +618,8 @@ public void testReducer_null_output_value() throws Exception {
@Test
public void testLogChannelLeaking_mapper() throws Exception {
JobConf jobConf =
createJobConf( "./src/test/resources/wordcount-mapper.ktr", "./src/test/resources/wordcount-reducer.ktr",
"./src/test/resources/wordcount-reducer.ktr" );
createJobConf( "./src/it/resources/wordcount-mapper.ktr", "./src/it/resources/wordcount-reducer.ktr",
"./src/it/resources/wordcount-reducer.ktr" );
PentahoMapRunnable mapper = new PentahoMapRunnable();
mapper.configure( jobConf );
MockReporter reporter = new MockReporter();
Expand Down Expand Up @@ -651,8 +651,8 @@ public void testLogChannelLeaking_mapper() throws Exception {
@Test
public void testLogChannelLeaking_combiner() throws Exception {
JobConf jobConf =
createJobConf( "./src/test/resources/wordcount-mapper.ktr", "./src/test/resources/wordcount-reducer.ktr",
"./src/test/resources/wordcount-reducer.ktr" );
createJobConf( "./src/it/resources/wordcount-mapper.ktr", "./src/it/resources/wordcount-reducer.ktr",
"./src/it/resources/wordcount-reducer.ktr" );
List<IntWritable> input = Arrays.asList( new IntWritable( 1 ) );
GenericTransCombiner combiner = new GenericTransCombiner();
combiner.configure( jobConf );
Expand Down Expand Up @@ -685,8 +685,8 @@ public void testLogChannelLeaking_combiner() throws Exception {
@Test
public void testLogChannelLeaking_reducer() throws Exception {
JobConf jobConf =
createJobConf( "./src/test/resources/wordcount-mapper.ktr", "./src/test/resources/wordcount-reducer.ktr",
"./src/test/resources/wordcount-reducer.ktr" );
createJobConf( "./src/it/resources/wordcount-mapper.ktr", "./src/it/resources/wordcount-reducer.ktr",
"./src/it/resources/wordcount-reducer.ktr" );
List<IntWritable> input = Arrays.asList( new IntWritable( 1 ) );
GenericTransReduce reducer = new GenericTransReduce();
reducer.configure( jobConf );
Expand Down Expand Up @@ -754,8 +754,8 @@ public void testMapReduce_InputOutput() throws Exception {
@Test
public void testCombinerOutputClasses() throws IOException, KettleException {
JobConf jobConf =
createJobConf( "./src/test/resources/wordcount-mapper.ktr", "./src/test/resources/wordcount-reducer.ktr",
"./src/test/resources/wordcount-reducer.ktr" );
createJobConf( "./src/it/resources/wordcount-mapper.ktr", "./src/it/resources/wordcount-reducer.ktr",
"./src/it/resources/wordcount-reducer.ktr" );

jobConf.setMapOutputKeyClass( Text.class );
jobConf.setMapOutputValueClass( IntWritable.class );
Expand All @@ -773,8 +773,8 @@ public void testCombinerOutputClasses() throws IOException, KettleException {
@Test
public void testReducerOutputClasses() throws IOException, KettleException {
JobConf jobConf =
createJobConf( "./src/test/resources/wordcount-mapper.ktr", "./src/test/resources/wordcount-reducer.ktr",
"./src/test/resources/wordcount-reducer.ktr" );
createJobConf( "./src/it/resources/wordcount-mapper.ktr", "./src/it/resources/wordcount-reducer.ktr",
"./src/it/resources/wordcount-reducer.ktr" );

jobConf.setMapOutputKeyClass( Text.class );
jobConf.setMapOutputValueClass( IntWritable.class );
Expand All @@ -792,8 +792,8 @@ public void testReducerOutputClasses() throws IOException, KettleException {
@Test
public void testTaskIdExtraction() throws Exception {
JobConf conf =
createJobConf( "./src/test/resources/wordcount-mapper.ktr", "./src/test/resources/wordcount-reducer.ktr",
"./src/test/resources/wordcount-reducer.ktr" );
createJobConf( "./src/it/resources/wordcount-mapper.ktr", "./src/it/resources/wordcount-reducer.ktr",
"./src/it/resources/wordcount-reducer.ktr" );
conf.set( "mapred.task.id", "job_201208090841_0133" );
PentahoMapRunnable mapRunnable = new PentahoMapRunnable();

Expand All @@ -809,8 +809,8 @@ public void testTaskIdExtraction() throws Exception {
@Test
public void testTaskIdExtraction_over_10000() throws Exception {
JobConf conf =
createJobConf( "./src/test/resources/wordcount-mapper.ktr", "./src/test/resources/wordcount-reducer.ktr",
"./src/test/resources/wordcount-reducer.ktr" );
createJobConf( "./src/it/resources/wordcount-mapper.ktr", "./src/it/resources/wordcount-reducer.ktr",
"./src/it/resources/wordcount-reducer.ktr" );
conf.set( "mapred.task.id", "job_201208090841_013302" );
PentahoMapRunnable mapRunnable = new PentahoMapRunnable();

Expand Down
58 changes: 45 additions & 13 deletions pom.xml
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.pentaho</groupId>
Expand Down Expand Up @@ -37,7 +38,10 @@
</scm>
<properties>
<dependency.mockito.revision>1.9.5</dependency.mockito.revision>
<dependency.build-helper-maven-plugin.revision>1.5</dependency.build-helper-maven-plugin.revision>
<plugin.org.codehaus.mojo.build-helper-maven-plugin.version>1.5
</plugin.org.codehaus.mojo.build-helper-maven-plugin.version>
<plugin.org.apache.maven.plugins.maven-failsafe-plugin.version>2.17
</plugin.org.apache.maven.plugins.maven-failsafe-plugin.version>
<dependency.json.revision>6.1-SNAPSHOT</dependency.json.revision>
<dependency.maven-bundle-plugin.revision>2.3.7</dependency.maven-bundle-plugin.revision>
<dependency.httpcomponents.revision>4.4</dependency.httpcomponents.revision>
Expand Down Expand Up @@ -86,23 +90,16 @@
<dependency.osgi.revision>4.3.1</dependency.osgi.revision>
</properties>
<build>
<testResources>
<testResource>
<directory>src/it/resources</directory>
</testResource>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<!-- remove this once it's in the parent pom -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${dependency.build-helper-maven-plugin.revision}</version>
<version>${plugin.org.codehaus.mojo.build-helper-maven-plugin.version}</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>process-resources</phase>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
Expand All @@ -112,8 +109,43 @@
</sources>
</configuration>
</execution>
<execution>
<id>add-test-resource</id>
<phase>generate-test-resources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/it/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- remove this once it's in the parent pom -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${plugin.org.apache.maven.plugins.maven-failsafe-plugin.version}</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
Expand Down

0 comments on commit 34de8e4

Please sign in to comment.