@Test public void defaultSelectedSchemaIndexWhenSchemaNameIsNotDefined() throws Exception { PartitionSchema schema = new PartitionSchema( ); StepPartitioningMeta meta = mock( StepPartitioningMeta.class ); when( meta.getPartitionSchema() ).thenReturn( schema ); when( stepMeta.getStepPartitioningMeta() ).thenReturn( meta ); List<String> schemas = Arrays.asList( "test" ); when( partitionSchemasProvider.getPartitionSchemasNames( any( TransMeta.class ) ) ).thenReturn( schemas ); assertEquals( 0, settings.getDefaultSelectedSchemaIndex() ); }
public int getDefaultSelectedSchemaIndex() { List<String> schemaNames; try { schemaNames = schemasProvider.getPartitionSchemasNames( transMeta ); } catch ( KettleException e ) { schemaNames = Collections.emptyList(); } PartitionSchema partitioningSchema = stepMeta.getStepPartitioningMeta().getPartitionSchema(); int defaultSelectedSchemaIndex = 0; if ( partitioningSchema != null && partitioningSchema.getName() != null && !schemaNames.isEmpty() ) { defaultSelectedSchemaIndex = Const.indexOfString( partitioningSchema.getName(), schemaNames ); } return defaultSelectedSchemaIndex != -1 ? defaultSelectedSchemaIndex : 0; }
PartitionSettings { public int getDefaultSelectedSchemaIndex() { List<String> schemaNames; try { schemaNames = schemasProvider.getPartitionSchemasNames( transMeta ); } catch ( KettleException e ) { schemaNames = Collections.emptyList(); } PartitionSchema partitioningSchema = stepMeta.getStepPartitioningMeta().getPartitionSchema(); int defaultSelectedSchemaIndex = 0; if ( partitioningSchema != null && partitioningSchema.getName() != null && !schemaNames.isEmpty() ) { defaultSelectedSchemaIndex = Const.indexOfString( partitioningSchema.getName(), schemaNames ); } return defaultSelectedSchemaIndex != -1 ? defaultSelectedSchemaIndex : 0; } }
PartitionSettings { public int getDefaultSelectedSchemaIndex() { List<String> schemaNames; try { schemaNames = schemasProvider.getPartitionSchemasNames( transMeta ); } catch ( KettleException e ) { schemaNames = Collections.emptyList(); } PartitionSchema partitioningSchema = stepMeta.getStepPartitioningMeta().getPartitionSchema(); int defaultSelectedSchemaIndex = 0; if ( partitioningSchema != null && partitioningSchema.getName() != null && !schemaNames.isEmpty() ) { defaultSelectedSchemaIndex = Const.indexOfString( partitioningSchema.getName(), schemaNames ); } return defaultSelectedSchemaIndex != -1 ? defaultSelectedSchemaIndex : 0; } PartitionSettings( int exactSize, TransMeta transMeta, StepMeta stepMeta,
                            PartitionSchemasProvider schemasProvider ); }
PartitionSettings { public int getDefaultSelectedSchemaIndex() { List<String> schemaNames; try { schemaNames = schemasProvider.getPartitionSchemasNames( transMeta ); } catch ( KettleException e ) { schemaNames = Collections.emptyList(); } PartitionSchema partitioningSchema = stepMeta.getStepPartitioningMeta().getPartitionSchema(); int defaultSelectedSchemaIndex = 0; if ( partitioningSchema != null && partitioningSchema.getName() != null && !schemaNames.isEmpty() ) { defaultSelectedSchemaIndex = Const.indexOfString( partitioningSchema.getName(), schemaNames ); } return defaultSelectedSchemaIndex != -1 ? defaultSelectedSchemaIndex : 0; } PartitionSettings( int exactSize, TransMeta transMeta, StepMeta stepMeta,
                            PartitionSchemasProvider schemasProvider ); void fillOptionsAndCodesByPlugins( List<PluginInterface> plugins ); int getDefaultSelectedMethodIndex(); int getDefaultSelectedSchemaIndex(); String getMethodByMethodDescription( String methodDescription ); String[] getOptions(); String[] getCodes(); List<String> getSchemaNames(); String[] getSchemaNamesArray(); List<PartitionSchema> getSchemas(); StepMeta getStepMeta(); void updateMethodType( int methodType ); void updateMethod( String method ); void updateSchema( PartitionSchema schema ); void rollback( StepMeta before ); StepMeta getBefore(); StepMeta getAfter(); TransMeta getTransMeta(); }
PartitionSettings { public int getDefaultSelectedSchemaIndex() { List<String> schemaNames; try { schemaNames = schemasProvider.getPartitionSchemasNames( transMeta ); } catch ( KettleException e ) { schemaNames = Collections.emptyList(); } PartitionSchema partitioningSchema = stepMeta.getStepPartitioningMeta().getPartitionSchema(); int defaultSelectedSchemaIndex = 0; if ( partitioningSchema != null && partitioningSchema.getName() != null && !schemaNames.isEmpty() ) { defaultSelectedSchemaIndex = Const.indexOfString( partitioningSchema.getName(), schemaNames ); } return defaultSelectedSchemaIndex != -1 ? defaultSelectedSchemaIndex : 0; } PartitionSettings( int exactSize, TransMeta transMeta, StepMeta stepMeta,
                            PartitionSchemasProvider schemasProvider ); void fillOptionsAndCodesByPlugins( List<PluginInterface> plugins ); int getDefaultSelectedMethodIndex(); int getDefaultSelectedSchemaIndex(); String getMethodByMethodDescription( String methodDescription ); String[] getOptions(); String[] getCodes(); List<String> getSchemaNames(); String[] getSchemaNamesArray(); List<PartitionSchema> getSchemas(); StepMeta getStepMeta(); void updateMethodType( int methodType ); void updateMethod( String method ); void updateSchema( PartitionSchema schema ); void rollback( StepMeta before ); StepMeta getBefore(); StepMeta getAfter(); TransMeta getTransMeta();  }