@Test public void testCascadeID() throws IOException { String path = "idtest"; Flow first = firstFlow( path + "/first", false ); Flow second = secondFlow( first.getSink(), path + "/second" ); Flow third = thirdFlow( second.getSink(), path + "/third" ); Flow fourth = fourthFlow( third.getSink(), path + "/fourth" ); Cascade cascade = new CascadeConnector( getProperties() ).connect( first, second, third, fourth ); String id = cascade.getID(); assertNotNull( "id is null", id ); assertEquals( first.getProperty( "cascading.cascade.id" ), id ); assertEquals( second.getProperty( "cascading.cascade.id" ), id ); assertEquals( third.getProperty( "cascading.cascade.id" ), id ); assertEquals( fourth.getProperty( "cascading.cascade.id" ), id ); }
@Test public void testCascadeID() throws IOException { String path = "idtest"; Flow first = firstFlow( path + "/first", false ); Flow second = secondFlow( first.getSink(), path + "/second" ); Flow third = thirdFlow( second.getSink(), path + "/third" ); Flow fourth = fourthFlow( third.getSink(), path + "/fourth" ); Cascade cascade = new CascadeConnector( getProperties() ).connect( first, second, third, fourth ); String id = cascade.getID(); assertNotNull( "id is null", id ); assertEquals( first.getProperty( "cascading.cascade.id" ), id ); assertEquals( second.getProperty( "cascading.cascade.id" ), id ); assertEquals( third.getProperty( "cascading.cascade.id" ), id ); assertEquals( fourth.getProperty( "cascading.cascade.id" ), id ); }
@Test public void testCopyConfig() throws Exception { Tap source = new Lfs( new TextLine(), "input/path" ); Tap sink = new Hfs( new TextLine(), "output/path", SinkMode.REPLACE ); Pipe pipe = new Pipe( "test" ); Configuration conf = ( (BaseHadoopPlatform) getPlatform() ).getConfiguration(); conf.set( AppProps.APP_NAME, "testname" ); AppProps props = AppProps.appProps().setVersion( "1.2.3" ); Properties properties = props.buildProperties( conf ); // convert job conf to properties instance Flow flow = getPlatform().getFlowConnector( properties ).connect( source, sink, pipe ); assertEquals( "testname", flow.getProperty( AppProps.APP_NAME ) ); assertEquals( "1.2.3", flow.getProperty( AppProps.APP_VERSION ) ); }
@Test public void testCopyConfig() throws Exception { Tap source = new Lfs( new TextLine(), "input/path" ); Tap sink = new Hfs( new TextLine(), "output/path", SinkMode.REPLACE ); Pipe pipe = new Pipe( "test" ); Configuration conf = ( (BaseHadoopPlatform) getPlatform() ).getConfiguration(); conf.set( AppProps.APP_NAME, "testname" ); AppProps props = AppProps.appProps().setVersion( "1.2.3" ); Properties properties = props.buildProperties( conf ); // convert job conf to properties instance Flow flow = getPlatform().getFlowConnector( properties ).connect( source, sink, pipe ); assertEquals( "testname", flow.getProperty( AppProps.APP_NAME ) ); assertEquals( "1.2.3", flow.getProperty( AppProps.APP_VERSION ) ); }
@Test public void testFlowID() throws Exception { Tap source = new Lfs( new TextLine(), "input/path" ); Tap sink = new Hfs( new TextLine(), "output/path", SinkMode.REPLACE ); Pipe pipe = new Pipe( "test" ); Map<Object, Object> props = getProperties(); Flow flow1 = getPlatform().getFlowConnector( props ).connect( source, sink, pipe ); // System.out.println( "flow.getID() = " + flow1.getID() ); assertNotNull( "missing id", flow1.getID() ); assertNotNull( "missing id in conf", flow1.getProperty( "cascading.flow.id" ) ); Flow flow2 = getPlatform().getFlowConnector( props ).connect( source, sink, pipe ); assertTrue( "same id", !flow1.getID().equalsIgnoreCase( flow2.getID() ) ); }
@Test public void testFlowID() throws Exception { Tap source = new Lfs( new TextLine(), "input/path" ); Tap sink = new Hfs( new TextLine(), "output/path", SinkMode.REPLACE ); Pipe pipe = new Pipe( "test" ); Map<Object, Object> props = getProperties(); Flow flow1 = getPlatform().getFlowConnector( props ).connect( source, sink, pipe ); // System.out.println( "flow.getID() = " + flow1.getID() ); assertNotNull( "missing id", flow1.getID() ); assertNotNull( "missing id in conf", flow1.getProperty( "cascading.flow.id" ) ); Flow flow2 = getPlatform().getFlowConnector( props ).connect( source, sink, pipe ); assertTrue( "same id", !flow1.getID().equalsIgnoreCase( flow2.getID() ) ); }