cascading
Class PlatformTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by cascading.CascadingTestCase
              extended by cascading.PlatformTestCase
All Implemented Interfaces:
Serializable, junit.framework.Test
Direct Known Subclasses:
CoGroupFieldedPipesPlatformTest, FieldedPipesPlatformTest, JoinFieldedPipesPlatformTest

public class PlatformTestCase
extends CascadingTestCase

PlatformTestCase is the base class for JUnit tests that are platform agnostic. That is using the TestPlatform interface each test can be run against all supported platform like Hadoop or Cascading local mode.

It is strongly recommended users look at the source of FieldedPipesPlatformTest or related tests to see how this class is used.

This test case uses the PlatformRunner to inject the available platform providers which implement the TestPlatform base class.

By default the PlatformRunner looks for "cascading/platform/platform.properties" file in the classpath, and instantiates the class specified by the "platform.classname" property. If more than one "platform.properties" resource is found, each class is instantiated and the whole suite of tests will be run against each instance.

To limit this, setting the system property "platform.includes" to list the platform names that should be run will cause the PlatformRunner to ignore any unlisted platforms. Thus setting platform.includes=local, only local mode will run even if the "hadoop" platform was found in the classpath.

To pass custom properties to each test to be used by the FlowConnector, create system properties prefixed by "platform.". These properties, minus the "platform." prefix in the property name, will override any defaults.

Subclasses of PlatformTestCase can set "useCluster to true on the constructor if the underlying platform can boot a cluster for testing. By setting the system property "test.cluster.enabled" to false, this can be deactivated in order to temporarily speed test execution. By default useCluster is false, typically user tests don't need to have a cluster running to test their functionality so leaving the default is reasonable.

See Also:
Serialized Form

Field Summary
 org.junit.rules.TestName name
           
static String ROOT_OUTPUT_PATH
           
 
Constructor Summary
PlatformTestCase()
           
PlatformTestCase(boolean useCluster)
           
PlatformTestCase(boolean useCluster, int numMapTasks, int numReduceTasks)
           
 
Method Summary
protected  void copyFromLocal(String inputFile)
           
protected  Map<Object,Object> disableDebug()
           
 String getOutputPath(String path)
           
protected  String[] getPathElements()
           
 TestPlatform getPlatform()
           
 String getPlatformName()
           
 Map<Object,Object> getProperties()
           
protected  String getRootPath()
           
 String getTestCaseName()
           
 String getTestName()
           
static String getTestRoot()
           
 void installPlatform(TestPlatform platform)
           
 void setUp()
           
 void tearDown()
           
 
Methods inherited from class cascading.CascadingTestCase
asCollection, asCollection, asCollection, asCollection, asList, asList, asSet, asSet, getSinkAsList, getSourceAsList, invokeAggregator, invokeAggregator, invokeAggregator, invokeAggregator, invokeAggregator, invokeAggregator, invokeBuffer, invokeBuffer, invokeBuffer, invokeBuffer, invokeBuffer, invokeBuffer, invokeFilter, invokeFilter, invokeFilter, invokeFilter, invokeFilter, invokeFilter, invokeFilter, invokeFilter, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, validateLength, validateLength, validateLength, validateLength, validateLength, validateLength, validateLength, validateLength, validateLength, validateLength
 
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ROOT_OUTPUT_PATH

public static final String ROOT_OUTPUT_PATH
See Also:
Constant Field Values

name

public transient org.junit.rules.TestName name
Constructor Detail

PlatformTestCase

public PlatformTestCase(boolean useCluster)

PlatformTestCase

public PlatformTestCase(boolean useCluster,
                        int numMapTasks,
                        int numReduceTasks)

PlatformTestCase

public PlatformTestCase()
Method Detail

installPlatform

public void installPlatform(TestPlatform platform)

getPlatform

public TestPlatform getPlatform()

getTestName

public String getTestName()

getRootPath

protected String getRootPath()

getPathElements

protected String[] getPathElements()

getOutputPath

public String getOutputPath(String path)

getTestCaseName

public String getTestCaseName()

getPlatformName

public String getPlatformName()

getTestRoot

public static String getTestRoot()

setUp

public void setUp()
           throws Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception

getProperties

public Map<Object,Object> getProperties()

copyFromLocal

protected void copyFromLocal(String inputFile)
                      throws IOException
Throws:
IOException

disableDebug

protected Map<Object,Object> disableDebug()

tearDown

public void tearDown()
              throws Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
Exception


Copyright © 2007-2015 Concurrent, Inc. All Rights Reserved.