org.pentaho.di.job.Job.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(11.4k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.pentaho.di.job.Job.<init>()方法的一些代码示例,展示了Job.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Job.<init>()方法的具体详情如下:
包路径:org.pentaho.di.job.Job
类名称:Job
方法名:<init>

Job.<init>介绍

暂无

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

@VisibleForTesting
Job createJob( Repository repository, JobMeta jobMeta, LoggingObjectInterface parentLogging ) {
 return new Job( repository, jobMeta, parentLogging );
}

代码示例来源:origin: pentaho/pentaho-kettle

private Job createJob() {
  Job job = new Job(  );
  job = spy( job );

  return job;
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * This test demonstrates the issue fixed in PDI-17398.
 * When a job is scheduled twice, it gets the same log channel Id and both logs get merged
 */
@Test
public void testTwoJobsGetSameLogChannelId() {
 Repository repository = mock( Repository.class );
 JobMeta meta = mock( JobMeta.class );
 Job job1 = new Job( repository, meta );
 Job job2 = new Job( repository, meta );
 assertEquals( job1.getLogChannelId(), job2.getLogChannelId() );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Test
public void testNewJobWithContainerObjectId() {
 Repository repository = mock( Repository.class );
 JobMeta meta = mock( JobMeta.class );
 String carteId = UUID.randomUUID().toString();
 doReturn( carteId ).when( meta ).getContainerObjectId();
 Job job = new Job( repository, meta );
 assertEquals( carteId, job.getContainerObjectId() );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Before
public void setUp() {
 entry = new JobEntryCopyFiles();
 Job parentJob = new Job();
 entry.setParentJob( parentJob );
 JobMeta mockJobMeta = mock( JobMeta.class );
 mockNamedClusterEmbedManager = mock( NamedClusterEmbedManager.class );
 when( mockJobMeta.getNamedClusterEmbedManager() ).thenReturn( mockNamedClusterEmbedManager );
 entry.setParentJobMeta( mockJobMeta );
 entry = spy( entry );
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * This test demonstrates the fix for PDI-17398.
 * Two schedules -> two Carte object Ids -> two log channel Ids
 */
@Test
public void testTwoJobsGetDifferentLogChannelIdWithDifferentCarteId() {
 Repository repository = mock( Repository.class );
 JobMeta meta1 = mock( JobMeta.class );
 JobMeta meta2 = mock( JobMeta.class );
 String carteId1 = UUID.randomUUID().toString();
 String carteId2 = UUID.randomUUID().toString();
 doReturn( carteId1 ).when( meta1 ).getContainerObjectId();
 doReturn( carteId2 ).when( meta2 ).getContainerObjectId();
 Job job1 = new Job( repository, meta1 );
 Job job2 = new Job( repository, meta2 );
 assertNotEquals( job1.getContainerObjectId(), job2.getContainerObjectId() );
 assertNotEquals( job1.getLogChannelId(), job2.getLogChannelId() );
}

代码示例来源:origin: pentaho/pentaho-kettle

public Job executeFilesystemBasedCommand( final String initialDir, final String filename ) throws Exception {
 if ( Utils.isEmpty( filename ) ) {
  return null;
 }
 blockAndThrow( getKettleInit() );
 String fileName = filename;
 // If the filename starts with scheme like zip:, then isAbsolute() will return false even though
 // the path following the zip is absolute path. Check for isAbsolute only if the fileName does not start with scheme
 if ( !KettleVFS.startsWithScheme( fileName ) && !FileUtil.isFullyQualified( fileName ) ) {
  fileName = initialDir + fileName;
 }
 JobMeta jobMeta = new JobMeta( fileName, null, null );
 return new Job( null, jobMeta );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Before
public void setUp() throws Exception {
 job = new Job( null, new JobMeta() );
 entry = new JobEntryFolderIsEmpty();
 job.getJobMeta().addJobEntry( new JobEntryCopy( entry ) );
 entry.setParentJob( job );
 JobMeta mockJobMeta = mock( JobMeta.class );
 entry.setParentJobMeta( mockJobMeta );
 job.setStopped( false );
 File dir = Files.createTempDirectory( "dir", new FileAttribute<?>[0] ).toFile();
 dir.deleteOnExit();
 emptyDir = dir.getPath();
 dir = Files.createTempDirectory( "dir", new FileAttribute<?>[0] ).toFile();
 dir.deleteOnExit();
 nonEmptyDir = dir.getPath();
 File file = File.createTempFile( "existingFile", "ext", dir );
 file.deleteOnExit();
}

代码示例来源:origin: pentaho/pentaho-kettle

Job job = new Job( rep, meta );
job.setInternalKettleVariables( null );

代码示例来源:origin: pentaho/pentaho-kettle

@Before
public void setUp() throws Exception {
 job = new Job( null, new JobMeta() );
 entry = new JobEntryFilesExist();
 job.getJobMeta().addJobEntry( new JobEntryCopy( entry ) );
 entry.setParentJob( job );
 JobMeta mockJobMeta = mock( JobMeta.class );
 entry.setParentJobMeta( mockJobMeta );
 job.setStopped( false );
 existingFile1 = TestUtils.createRamFile( getClass().getSimpleName() + "/existingFile1.ext", entry );
 existingFile2 = TestUtils.createRamFile( getClass().getSimpleName() + "/existingFile2.ext", entry );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Test
public void testHTTPResultDefaultRows() throws IOException {
 File localFileForUpload = getInputFile( "existingFile1", ".tmp" );
 File tempFileForDownload = File.createTempFile( "downloadedFile1", ".tmp" );
 localFileForUpload.deleteOnExit();
 tempFileForDownload.deleteOnExit();
 Object[] r = new Object[] { HTTP_SERVER_BASEURL + "/uploadFile",
     localFileForUpload.getCanonicalPath(), tempFileForDownload.getCanonicalPath() };
 RowMeta rowMetaDefault = new RowMeta();
 rowMetaDefault.addValueMeta( new ValueMetaString( "URL" ) );
 rowMetaDefault.addValueMeta( new ValueMetaString( "UPLOAD" ) );
 rowMetaDefault.addValueMeta( new ValueMetaString( "DESTINATION" ) );
 List<RowMetaAndData> rows = new ArrayList<RowMetaAndData>();
 rows.add( new RowMetaAndData( rowMetaDefault, r ) );
 Result previousResult = new Result();
 previousResult.setRows( rows );
 JobEntryHTTP http = new JobEntryHTTP();
 http.setParentJob( new Job() );
 http.setRunForEveryRow( true );
 http.setAddFilenameToResult( false );
 http.execute( previousResult, 0 );
 assertTrue( FileUtils.contentEquals( localFileForUpload, tempFileForDownload ) );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Test
public void testSetInternalEntryCurrentDirectoryWithFilename( ) {
 Job jobTest = new Job(  );
 boolean hasFilename = true;
 boolean hasRepoDir = false;
 jobTest.copyVariablesFrom( null );
 jobTest.setVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, "Original value defined at run execution" );
 jobTest.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "file:///C:/SomeFilenameDirectory" );
 jobTest.setVariable( Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, "/SomeRepDirectory" );
 jobTest.setInternalEntryCurrentDirectory( hasFilename, hasRepoDir );
 assertEquals( "file:///C:/SomeFilenameDirectory", jobTest.getVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Before
public void setUp() {
 Job parentJob = new Job( null, new JobMeta() );
 jobEntry = spy( new JobEntryColumnsExist( "" ) );
 parentJob.getJobMeta().addJobEntry( new JobEntryCopy( jobEntry ) );
 parentJob.setStopped( false );
 jobEntry.setParentJob( parentJob );
 parentJob.setLogLevel( LogLevel.NOTHING );
 DatabaseMeta dbMeta = mock( DatabaseMeta.class );
 jobEntry.setDatabase( dbMeta );
 db = spy( new Database( jobEntry, dbMeta ) );
 jobEntry.setParentJob( parentJob );
 jobEntry.setTablename( TABLENAME );
 jobEntry.setArguments( COLUMNS );
 jobEntry.setSchemaname( SCHEMANAME );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Test
public void testSetInternalEntryCurrentDirectoryWithRepository( ) {
 Job jobTest = new Job(  );
 boolean hasFilename = false;
 boolean hasRepoDir = true;
 jobTest.copyVariablesFrom( null );
 jobTest.setVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, "Original value defined at run execution" );
 jobTest.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "file:///C:/SomeFilenameDirectory" );
 jobTest.setVariable( Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, "/SomeRepDirectory" );
 jobTest.setInternalEntryCurrentDirectory( hasFilename, hasRepoDir );
 assertEquals( "/SomeRepDirectory", jobTest.getVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Test
public void testSetInternalEntryCurrentDirectoryWithoutFilenameOrRepository( ) {
 Job jobTest = new Job(  );
 jobTest.copyVariablesFrom( null );
 boolean hasFilename = false;
 boolean hasRepoDir = false;
 jobTest.setVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, "Original value defined at run execution" );
 jobTest.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "file:///C:/SomeFilenameDirectory" );
 jobTest.setVariable( Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, "/SomeRepDirectory" );
 jobTest.setInternalEntryCurrentDirectory( hasFilename, hasRepoDir );
 assertEquals( "Original value defined at run execution", jobTest.getVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY )  );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Test
public void testHTTPResultCustomRows() throws IOException {
 File localFileForUpload = getInputFile( "existingFile2", ".tmp" );
 File tempFileForDownload = File.createTempFile( "downloadedFile2", ".tmp" );
 localFileForUpload.deleteOnExit();
 tempFileForDownload.deleteOnExit();
 Object[] r = new Object[] { HTTP_SERVER_BASEURL + "/uploadFile",
     localFileForUpload.getCanonicalPath(), tempFileForDownload.getCanonicalPath() };
 RowMeta rowMetaDefault = new RowMeta();
 rowMetaDefault.addValueMeta( new ValueMetaString( "MyURL" ) );
 rowMetaDefault.addValueMeta( new ValueMetaString( "MyUpload" ) );
 rowMetaDefault.addValueMeta( new ValueMetaString( "MyDestination" ) );
 List<RowMetaAndData> rows = new ArrayList<RowMetaAndData>();
 rows.add( new RowMetaAndData( rowMetaDefault, r ) );
 Result previousResult = new Result();
 previousResult.setRows( rows );
 JobEntryHTTP http = new JobEntryHTTP();
 http.setParentJob( new Job() );
 http.setRunForEveryRow( true );
 http.setAddFilenameToResult( false );
 http.setUrlFieldname( "MyURL" );
 http.setUploadFieldname( "MyUpload" );
 http.setDestinationFieldname( "MyDestination" );
 http.execute( previousResult, 0 );
 assertTrue( FileUtils.contentEquals( localFileForUpload, tempFileForDownload ) );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Before
public void setUp() throws Exception {
 job = new Job( null, new JobMeta() );
 entry = new JobEntrySetVariables();
 job.getJobMeta().addJobEntry( new JobEntryCopy( entry ) );
 entry.setParentJob( job );
 job.setStopped( false );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Test
public void testConfigureParameters() throws Exception {
 JobMeta jobMeta = new JobMeta();
 jobMeta.addParameterDefinition( TEST_PARAM_NAME, DEFAULT_PARAM_VALUE, "This tests a default parameter" );
 assertEquals( "Default parameter was not set correctly on JobMeta", DEFAULT_PARAM_VALUE,
     jobMeta.getParameterDefault( TEST_PARAM_NAME ) );
 assertEquals( "Parameter value should be blank in JobMeta", "", jobMeta.getParameterValue( TEST_PARAM_NAME ) );
 Job job = new Job( null, jobMeta );
 job.copyParametersFrom( jobMeta );
 assertEquals( "Default parameter was not set correctly on Job", DEFAULT_PARAM_VALUE,
     job.getParameterDefault( TEST_PARAM_NAME ) );
 assertEquals( "Parameter value should be blank in Job", "", job.getParameterValue( TEST_PARAM_NAME ) );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Before
public void setUp() throws Exception {
 MockDriver.registerInstance();
 Job job = new Job( null, new JobMeta() );
 entry = new JobEntryEvalTableContent();
 job.getJobMeta().addJobEntry( new JobEntryCopy( entry ) );
 entry.setParentJob( job );
 job.setStopped( false );
 DatabaseMeta dbMeta = new DatabaseMeta();
 dbMeta.setDatabaseType( "mock-db" );
 entry.setDatabase( dbMeta );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Before
public void setUp() throws Exception {
 job = new Job( null, new JobMeta() );
 entry = new MockedJobEntryFTP();
 job.getJobMeta().addJobEntry( new JobEntryCopy( entry ) );
 entry.setParentJob( job );
 job.setStopped( false );
 entry.setServerName( "some.server" );
 entry.setUserName( "anonymous" );
 entry.setFtpDirectory( "." );
 entry.setWildcard( "robots.txt" );
 entry.setBinaryMode( false );
 entry.setSuccessCondition( "success_if_no_errors" );
 existingDir = TestUtils.createTempDir();
}

相关文章