Spring for Apache Hadoop

org.springframework.data.hadoop.test.junit
Class AbstractHadoopClusterTests

java.lang.Object
  extended by org.springframework.data.hadoop.test.junit.AbstractHadoopClusterTests
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
AbstractMapReduceTests

public abstract class AbstractHadoopClusterTests
extends java.lang.Object
implements org.springframework.context.ApplicationContextAware

Abstract base class providing default functionality for running tests using Hadoop mini cluster.

Author:
Janne Valkealahti

Field Summary
protected  org.springframework.context.ApplicationContext applicationContext
           
protected  org.apache.hadoop.conf.Configuration configuration
           
protected  HadoopCluster hadoopCluster
           
 
Constructor Summary
AbstractHadoopClusterTests()
           
 
Method Summary
 org.springframework.context.ApplicationContext getApplicationContext()
          Gets the ApplicationContext for tests.
 org.apache.hadoop.conf.Configuration getConfiguration()
          Gets the running cluster runtime Configuration for tests.
protected  org.apache.hadoop.fs.FileSystem getFileSystem()
          Returns a configured FileSystem instance for test cases to read and write files to it.
 HadoopCluster getHadoopCluster()
          Gets the running HadoopCluster for tests.
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setConfiguration(org.apache.hadoop.conf.Configuration configuration)
          Sets the Configuration.
 void setHadoopCluster(HadoopCluster hadoopCluster)
          Sets the HadoopCluster
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

applicationContext

protected org.springframework.context.ApplicationContext applicationContext

configuration

protected org.apache.hadoop.conf.Configuration configuration

hadoopCluster

protected HadoopCluster hadoopCluster
Constructor Detail

AbstractHadoopClusterTests

public AbstractHadoopClusterTests()
Method Detail

getApplicationContext

public org.springframework.context.ApplicationContext getApplicationContext()
Gets the ApplicationContext for tests.

Returns:
the Application context

setApplicationContext

public final void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware

getConfiguration

public org.apache.hadoop.conf.Configuration getConfiguration()
Gets the running cluster runtime Configuration for tests.

Returns:
the Hadoop cluster config

setConfiguration

@Autowired
public void setConfiguration(org.apache.hadoop.conf.Configuration configuration)
Sets the Configuration.

Parameters:
configuration - the Configuration

getHadoopCluster

public HadoopCluster getHadoopCluster()
Gets the running HadoopCluster for tests.

Returns:
the Hadoop cluster

setHadoopCluster

@Autowired
public void setHadoopCluster(HadoopCluster hadoopCluster)
Sets the HadoopCluster

Parameters:
hadoopCluster - the Hadoop cluster

getFileSystem

protected org.apache.hadoop.fs.FileSystem getFileSystem()
                                                 throws java.io.IOException
Returns a configured FileSystem instance for test cases to read and write files to it.

Tests should use this FileSystem instance.

Returns:
the filesystem configured by mini cluster.
Throws:
java.io.IOException

Spring for Apache Hadoop