Java Code Examples for org.pentaho.di.job.JobMeta#setDatabases()

The following examples show how to use org.pentaho.di.job.JobMeta#setDatabases() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamToJobNodeConverterTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void filterPrivateDatabasesWithOnePrivateDatabaseTest() {
  IUnifiedRepository purMock = mock( IUnifiedRepository.class );
  JobMeta jobMeta = new JobMeta(  );
  jobMeta.setDatabases( getDummyDatabases() );
  Set<String> privateDatabases = new HashSet<>(  );
  privateDatabases.add( "database2" );
  jobMeta.setPrivateDatabases( privateDatabases );
  StreamToJobNodeConverter jobConverter = new StreamToJobNodeConverter( purMock );
  assertEquals( 1, jobConverter.filterPrivateDatabases( jobMeta ).getDatabases().size() );
}
 
Example 2
Source File: StreamToJobNodeConverterTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void filterPrivateDatabasesWithOnePrivateDatabaseAndOneInUseTest() {
  IUnifiedRepository purMock = mock( IUnifiedRepository.class );
  JobMeta jobMeta = spy( JobMeta.class );
  jobMeta.setDatabases( getDummyDatabases() );
  Set<String> privateDatabases = new HashSet<>(  );
  privateDatabases.add( "database2" );
  jobMeta.setPrivateDatabases( privateDatabases );
  when( jobMeta.isDatabaseConnectionUsed( getDummyDatabases().get( 0 ) ) ).thenReturn( true );
  StreamToJobNodeConverter jobConverter = new StreamToJobNodeConverter( purMock );
  assertEquals( 2, jobConverter.filterPrivateDatabases( jobMeta ).getDatabases().size() );
}
 
Example 3
Source File: StreamToJobNodeConverterTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void filterPrivateDatabasesWithOneInUseTest() {
  IUnifiedRepository purMock = mock( IUnifiedRepository.class );
  JobMeta jobMeta = spy( JobMeta.class );
  jobMeta.setDatabases( getDummyDatabases() );
  jobMeta.setPrivateDatabases( new HashSet<>(  ) );
  when( jobMeta.isDatabaseConnectionUsed( getDummyDatabases().get( 0 ) ) ).thenReturn( true );
  StreamToJobNodeConverter jobConverter = new StreamToJobNodeConverter( purMock );
  assertEquals( 1, jobConverter.filterPrivateDatabases( jobMeta ).getDatabases().size() );
}
 
Example 4
Source File: StreamToJobNodeConverterTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void filterPrivateDatabasesNoPrivateDatabaseTest() {
  IUnifiedRepository purMock = mock( IUnifiedRepository.class );
  JobMeta jobMeta = new JobMeta(  );
  jobMeta.setDatabases( getDummyDatabases() );
  jobMeta.setPrivateDatabases( new HashSet<>(  ) );
  StreamToJobNodeConverter jobConverter = new StreamToJobNodeConverter( purMock );
  assertEquals( 0, jobConverter.filterPrivateDatabases( jobMeta ).getDatabases().size() );
}
 
Example 5
Source File: StreamToJobNodeConverterTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void filterPrivateDatabasesNullPrivateDatabaseTest() {
  IUnifiedRepository purMock = mock( IUnifiedRepository.class );
  JobMeta jobMeta = new JobMeta(  );
  jobMeta.setDatabases( getDummyDatabases() );
  jobMeta.setPrivateDatabases( null );
  StreamToJobNodeConverter jobConverter = new StreamToJobNodeConverter( purMock );
  assertEquals( jobMeta.getDatabases().size(), jobConverter.filterPrivateDatabases( jobMeta ).getDatabases().size() );
}