DataServiceModel extends XulEventSourceAdapter { public DataServiceMeta getDataService() { DataServiceMeta dataService = new DataServiceMeta( transMeta ); dataService.setName( getServiceName() ); dataService.setPushDownOptimizationMeta( getPushDownOptimizations() ); dataService.setStepname( getServiceStep() ); dataService.setStreaming( isStreaming() ); dataService.setRowLimit( serviceMaxRows ); dataService.setTimeLimit( serviceMaxTime ); for ( PushDownOptimizationMeta pushDownOptimization : pushDownOptimizations ) { pushDownOptimization.getType().init( transMeta, dataService, pushDownOptimization ); } return dataService; } 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 testGetDataService() throws Exception { model.setServiceName( "service" ); model.setServiceStep( "step" ); PushDownOptimizationMeta optimizationMeta = mock( PushDownOptimizationMeta.class ); model.setPushDownOptimizations( Lists.newArrayList( optimizationMeta ) ); PushDownType pushDownType = mock( PushDownType.class ); when( optimizationMeta.getType() ).thenReturn( pushDownType ); DataServiceMeta dataService = model.getDataService(); assertThat( dataService, allOf( hasProperty( "name", equalTo( "service" ) ), hasProperty( "stepname", equalTo( "step" ) ), hasProperty( "pushDownOptimizationMeta", contains( optimizationMeta ) ) ) ); verify( pushDownType ).init( transMeta, dataService, optimizationMeta ); }