DataServiceModel extends XulEventSourceAdapter { public ImmutableList<String> getStepFields() { List<String> fields = new ArrayList<>(); if ( getTransMeta() != null && getServiceStep() != null ) { StepMeta stepMeta = transMeta.findStep( serviceStep ); try { RowMetaInterface row = transMeta.getStepFields( stepMeta ); for ( int i = 0; i < row.size(); i++ ) { fields.add( row.getValueMeta( i ).getName() ); } return ImmutableList.copyOf( fields ); } catch ( KettleException e ) { } } return ImmutableList.of(); } DataServiceModel( TransMeta transMeta );  DataServiceModel( TransMeta transMeta, boolean streaming ); TransMeta getTransMeta(); String getServiceName(); void setServiceName( String serviceName ); int getServiceMaxRows(); void setServiceMaxRows( int serviceMaxRows ); long getServiceMaxTime(); void setServiceMaxTime( long serviceMaxTime ); void setStreaming( boolean streaming ); boolean isStreaming(); String getServiceStep(); void setServiceStep( String serviceStep ); ImmutableList<String> getStepFields(); ImmutableList<PushDownOptimizationMeta> getPushDownOptimizations(); void setPushDownOptimizations( List<PushDownOptimizationMeta> pushDownOptimizations ); boolean add( PushDownOptimizationMeta pushDownOptimizationMeta ); boolean addAll( Collection<PushDownOptimizationMeta> pushDownOptimizations ); boolean remove( PushDownOptimizationMeta pushDownOptimization ); boolean removeAll( Collection<PushDownOptimizationMeta> c ); DataServiceMeta getDataService(); ImmutableList<PushDownOptimizationMeta> getPushDownOptimizations( final Class<? extends PushDownType> type );  }
@Test public void testGetStepFields() throws Exception { model.setServiceStep( "step" ); when( transMeta.findStep( model.getServiceStep() ) ).thenReturn( stepMeta ); when( transMeta.getStepFields( stepMeta ) ).thenReturn( rowMetaInterface ); when( rowMetaInterface.size() ).thenReturn( 1 ); when( rowMetaInterface.getValueMeta( 0 ) ).thenReturn( valueMetaInterface ); when( valueMetaInterface.getName() ).thenReturn( "serviceField" ); ImmutableList<String> stepFields = model.getStepFields(); verify( transMeta ).findStep( "step" ); verify( transMeta ).getStepFields( stepMeta ); assertThat( stepFields.size(), equalTo( 1 ) ); assertThat( stepFields.get( 0 ), equalTo( "serviceField" ) ); }