public static boolean removeStateFromDistCache( Configuration conf, String path ) throws IOException { return new Hfs( new TextLine(), path ).deleteResource( conf ); }
public static boolean removeStateFromDistCache( Configuration conf, String path ) throws IOException { return new Hfs( new TextLine(), path ).deleteResource( conf ); }
@Test public void testFailOnMissingSuccessFlowListener() throws Exception { getPlatform().copyFromLocal( inputFileLower ); FlowListener listener = new FailOnMissingSuccessFlowListener(); Hfs source = new Hfs( new TextLine( new Fields( "offset", "line" ) ), inputFileLower ); Hfs success = new Hfs( new TextLine(), getOutputPath( "withsuccess" ), SinkMode.REPLACE ); Hfs without = new Hfs( new TextLine(), getOutputPath( "withoutsuccess" ), SinkMode.REPLACE ); Hfs sink = new Hfs( new TextLine(), getOutputPath( "final" ), SinkMode.REPLACE ); Flow firstFlow = getPlatform().getFlowConnector( getProperties() ).connect( source, success, new Pipe( "lower" ) ); firstFlow.addListener( listener ); firstFlow.complete(); Flow secondFlow = getPlatform().getFlowConnector( getProperties() ).connect( success, without, new Pipe( "lower" ) ); secondFlow.addListener( listener ); secondFlow.complete(); Hfs successTap = new Hfs( new TextLine(), new Path( without.getPath(), "_SUCCESS" ).toString() ); assertTrue( successTap.deleteResource( getPlatform().getFlowProcess() ) ); Flow thirdFlow = getPlatform().getFlowConnector( getProperties() ).connect( without, sink, new Pipe( "lower" ) ); thirdFlow.addListener( listener ); try { thirdFlow.complete(); fail( "listener did not fail flow" ); } catch( FlowException exception ) { // do nothing } } }
@Test public void testFailOnMissingSuccessFlowListener() throws Exception { getPlatform().copyFromLocal( inputFileLower ); FlowListener listener = new FailOnMissingSuccessFlowListener(); Hfs source = new Hfs( new TextLine( new Fields( "offset", "line" ) ), inputFileLower ); Hfs success = new Hfs( new TextLine(), getOutputPath( "withsuccess" ), SinkMode.REPLACE ); Hfs without = new Hfs( new TextLine(), getOutputPath( "withoutsuccess" ), SinkMode.REPLACE ); Hfs sink = new Hfs( new TextLine(), getOutputPath( "final" ), SinkMode.REPLACE ); Flow firstFlow = getPlatform().getFlowConnector( getProperties() ).connect( source, success, new Pipe( "lower" ) ); firstFlow.addListener( listener ); firstFlow.complete(); Flow secondFlow = getPlatform().getFlowConnector( getProperties() ).connect( success, without, new Pipe( "lower" ) ); secondFlow.addListener( listener ); secondFlow.complete(); Hfs successTap = new Hfs( new TextLine(), new Path( without.getPath(), "_SUCCESS" ).toString() ); assertTrue( successTap.deleteResource( getPlatform().getFlowProcess() ) ); Flow thirdFlow = getPlatform().getFlowConnector( getProperties() ).connect( without, sink, new Pipe( "lower" ) ); thirdFlow.addListener( listener ); try { thirdFlow.complete(); fail( "listener did not fail flow" ); } catch( FlowException exception ) { // do nothing } } }
tap.deleteResource( getPlatform().getFlowProcess() );
tap.deleteResource( getPlatform().getFlowProcess() );