@Test public void shouldBuildOperatorRuntimeSchemaFromOperatorSchema () { final OperatorSchema schemaAnnotation = AnnotatedClass.class.getDeclaredAnnotation( OperatorSchema.class ); final OperatorRuntimeSchemaBuilder builder = new OperatorRuntimeSchemaBuilder( 1, 1, schemaAnnotation ); final OperatorRuntimeSchema schema = builder.build(); assertThat( schema.getInputSchemas(), hasSize( 1 ) ); assertThat( schema.getOutputSchemas(), hasSize( 1 ) ); final PortRuntimeSchema inputSchema0 = schema.getInputSchema( 0 ); final PortRuntimeSchema outputSchema0 = schema.getOutputSchema( 0 ); assertThat( inputSchema0.getFields(), hasSize( 1 ) ); assertThat( outputSchema0.getFields(), hasSize( 1 ) ); final RuntimeSchemaField field1 = inputSchema0.getFields().get( 0 ); final RuntimeSchemaField field2 = outputSchema0.getFields().get( 0 ); assertThat( field1, equalTo( new RuntimeSchemaField( "field1", int.class ) ) ); assertThat( field2, equalTo( new RuntimeSchemaField( "field2", long.class ) ) ); }
public OperatorRuntimeSchema build () { final PortRuntimeSchema[] inputSchemas = new PortRuntimeSchema[ inputSchemaBuilders.length ]; final PortRuntimeSchema[] outputSchemas = new PortRuntimeSchema[ outputSchemaBuilders.length ]; for ( int i = 0; i < inputSchemaBuilders.length; i++ ) { final PortRuntimeSchemaBuilder builder = getOrCreate( inputSchemaBuilders, i ); inputSchemas[ i ] = builder.build(); } for ( int i = 0; i < outputSchemaBuilders.length; i++ ) { final PortRuntimeSchemaBuilder builder = getOrCreate( outputSchemaBuilders, i ); outputSchemas[ i ] = builder.build(); } return new OperatorRuntimeSchema( Arrays.asList( inputSchemas ), Arrays.asList( outputSchemas ) ); }
OperatorRuntimeSchemaBuilder { public OperatorRuntimeSchema build () { final PortRuntimeSchema[] inputSchemas = new PortRuntimeSchema[ inputSchemaBuilders.length ]; final PortRuntimeSchema[] outputSchemas = new PortRuntimeSchema[ outputSchemaBuilders.length ]; for ( int i = 0; i < inputSchemaBuilders.length; i++ ) { final PortRuntimeSchemaBuilder builder = getOrCreate( inputSchemaBuilders, i ); inputSchemas[ i ] = builder.build(); } for ( int i = 0; i < outputSchemaBuilders.length; i++ ) { final PortRuntimeSchemaBuilder builder = getOrCreate( outputSchemaBuilders, i ); outputSchemas[ i ] = builder.build(); } return new OperatorRuntimeSchema( Arrays.asList( inputSchemas ), Arrays.asList( outputSchemas ) ); } }
OperatorRuntimeSchemaBuilder { public OperatorRuntimeSchema build () { final PortRuntimeSchema[] inputSchemas = new PortRuntimeSchema[ inputSchemaBuilders.length ]; final PortRuntimeSchema[] outputSchemas = new PortRuntimeSchema[ outputSchemaBuilders.length ]; for ( int i = 0; i < inputSchemaBuilders.length; i++ ) { final PortRuntimeSchemaBuilder builder = getOrCreate( inputSchemaBuilders, i ); inputSchemas[ i ] = builder.build(); } for ( int i = 0; i < outputSchemaBuilders.length; i++ ) { final PortRuntimeSchemaBuilder builder = getOrCreate( outputSchemaBuilders, i ); outputSchemas[ i ] = builder.build(); } return new OperatorRuntimeSchema( Arrays.asList( inputSchemas ), Arrays.asList( outputSchemas ) ); } OperatorRuntimeSchemaBuilder( final int inputPortCount, final int outputPortCount );  OperatorRuntimeSchemaBuilder( final int inputPortCount, final int outputPortCount, final OperatorSchema operatorSchema ); }
OperatorRuntimeSchemaBuilder { public OperatorRuntimeSchema build () { final PortRuntimeSchema[] inputSchemas = new PortRuntimeSchema[ inputSchemaBuilders.length ]; final PortRuntimeSchema[] outputSchemas = new PortRuntimeSchema[ outputSchemaBuilders.length ]; for ( int i = 0; i < inputSchemaBuilders.length; i++ ) { final PortRuntimeSchemaBuilder builder = getOrCreate( inputSchemaBuilders, i ); inputSchemas[ i ] = builder.build(); } for ( int i = 0; i < outputSchemaBuilders.length; i++ ) { final PortRuntimeSchemaBuilder builder = getOrCreate( outputSchemaBuilders, i ); outputSchemas[ i ] = builder.build(); } return new OperatorRuntimeSchema( Arrays.asList( inputSchemas ), Arrays.asList( outputSchemas ) ); } OperatorRuntimeSchemaBuilder( final int inputPortCount, final int outputPortCount );  OperatorRuntimeSchemaBuilder( final int inputPortCount, final int outputPortCount, final OperatorSchema operatorSchema ); PortRuntimeSchemaBuilder getInputPortSchemaBuilder( final int portIndex ); PortRuntimeSchemaBuilder getOutputPortSchemaBuilder( final int portIndex ); OperatorRuntimeSchemaBuilder addInputField( final int portIndex, final String fieldName, final Class<?> type ); OperatorRuntimeSchemaBuilder addOutputField( final int portIndex, final String fieldName, final Class<?> type ); OperatorRuntimeSchema build(); }
OperatorRuntimeSchemaBuilder { public OperatorRuntimeSchema build () { final PortRuntimeSchema[] inputSchemas = new PortRuntimeSchema[ inputSchemaBuilders.length ]; final PortRuntimeSchema[] outputSchemas = new PortRuntimeSchema[ outputSchemaBuilders.length ]; for ( int i = 0; i < inputSchemaBuilders.length; i++ ) { final PortRuntimeSchemaBuilder builder = getOrCreate( inputSchemaBuilders, i ); inputSchemas[ i ] = builder.build(); } for ( int i = 0; i < outputSchemaBuilders.length; i++ ) { final PortRuntimeSchemaBuilder builder = getOrCreate( outputSchemaBuilders, i ); outputSchemas[ i ] = builder.build(); } return new OperatorRuntimeSchema( Arrays.asList( inputSchemas ), Arrays.asList( outputSchemas ) ); } OperatorRuntimeSchemaBuilder( final int inputPortCount, final int outputPortCount );  OperatorRuntimeSchemaBuilder( final int inputPortCount, final int outputPortCount, final OperatorSchema operatorSchema ); PortRuntimeSchemaBuilder getInputPortSchemaBuilder( final int portIndex ); PortRuntimeSchemaBuilder getOutputPortSchemaBuilder( final int portIndex ); OperatorRuntimeSchemaBuilder addInputField( final int portIndex, final String fieldName, final Class<?> type ); OperatorRuntimeSchemaBuilder addOutputField( final int portIndex, final String fieldName, final Class<?> type ); OperatorRuntimeSchema build();  }