cascading

## Class PlatformTestCase

- java.lang.Object
- - junit.framework.Assert
  - - junit.framework.TestCase
    - - cascading.CascadingTestCase
      - - cascading.PlatformTestCase

All Implemented Interfaces:
  java.io.Serializable, junit.framework.Test

Direct Known Subclasses:
  CoGroupFieldedPipesPlatformTest, FieldedPipesPlatformTest, JoinFieldedPipesPlatformTest

    public abstract 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

### Fields inherited from class cascading.CascadingTestCase

`name, ROOT_OUTPUT_PATH, ROOT_PLAN_PATH, TEST_TRACEPLAN_ENABLED`

### Constructor Summary

Constructors
`protected` `PlatformTestCase()`
`protected` `PlatformTestCase(boolean useCluster)`
`protected` `PlatformTestCase(boolean useCluster, int numMapTasks, int numGatherPartitions)`

### Method Summary

Methods
`protected void` `copyFromLocal(java.lang.String inputFile)`
`protected java.util.Map<java.lang.Object,java.lang.Object>` `disableDebug()`
`java.lang.String` `getOutputPath(java.lang.String path)`
`protected java.lang.String[]` `getOutputPathElements()`
`protected java.lang.String[]` `getPlanPathElements()`
`TestPlatform` `getPlatform()`
`java.lang.String` `getPlatformName()`
`java.util.Map<java.lang.Object,java.lang.Object>` `getProperties()`
`void` `installPlatform(TestPlatform platform)`
`protected java.lang.String` `makeOutputPath(java.lang.String path)`
`void` `setUp()`
`void` `tearDown()`

### Methods inherited from class cascading.CascadingTestCase

`asCollection, asCollection, asCollection, asCollection, asList, asList, asSet, asSet, getOutputPath, getPlanPath, getSinkAsList, getSourceAsList, getTestCaseName, getTestName, getTestOutputRoot, getTestPlanRoot, 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`

### Constructor Detail

#### PlatformTestCase

    protected PlatformTestCase(boolean useCluster)

#### PlatformTestCase

    protected PlatformTestCase(boolean useCluster,
                    int numMapTasks,
                    int numGatherPartitions)

#### PlatformTestCase

    protected PlatformTestCase()

### Method Detail

#### installPlatform

    public void installPlatform(TestPlatform platform)

#### getPlatform

    public TestPlatform getPlatform()

#### getOutputPathElements

    protected java.lang.String[] getOutputPathElements()

Overrides:
  `getOutputPathElements` in class `CascadingTestCase`

#### getPlanPathElements

    protected java.lang.String[] getPlanPathElements()

Overrides:
  `getPlanPathElements` in class `CascadingTestCase`

#### getOutputPath

    public java.lang.String getOutputPath(java.lang.String path)

#### makeOutputPath

    protected java.lang.String makeOutputPath(java.lang.String path)

#### getPlatformName

    public java.lang.String getPlatformName()

#### setUp

    public void setUp()
               throws java.lang.Exception

Overrides:
  `setUp` in class `CascadingTestCase`
Throws:
  `java.lang.Exception`

#### getProperties

    public java.util.Map<java.lang.Object,java.lang.Object> getProperties()

#### copyFromLocal

    protected void copyFromLocal(java.lang.String inputFile)
                          throws java.io.IOException

Throws:
  `java.io.IOException`

#### disableDebug

    protected java.util.Map<java.lang.Object,java.lang.Object> disableDebug()

#### tearDown

    public void tearDown()
                  throws java.lang.Exception

Overrides:
  `tearDown` in class `CascadingTestCase`
Throws:
  `java.lang.Exception`