Search in sources :

Example 1 with JobLauncherTestHelper

use of org.apache.gobblin.runtime.JobLauncherTestHelper in project incubator-gobblin by apache.

the class MRJobLauncherTest method startUp.

@BeforeClass
public void startUp() throws Exception {
    this.testLogger.info("startUp: in");
    testMetastoreDatabase = TestMetastoreDatabaseFactory.get();
    this.launcherProps = new Properties();
    try (InputStream propsReader = getClass().getClassLoader().getResourceAsStream("gobblin.mr-test.properties")) {
        this.launcherProps.load(propsReader);
    }
    this.launcherProps.setProperty(ConfigurationKeys.JOB_HISTORY_STORE_ENABLED_KEY, "true");
    this.launcherProps.setProperty(ConfigurationKeys.METRICS_ENABLED_KEY, "true");
    this.launcherProps.setProperty(ConfigurationKeys.METRICS_REPORTING_FILE_ENABLED_KEY, "false");
    this.launcherProps.setProperty(ConfigurationKeys.JOB_HISTORY_STORE_URL_KEY, testMetastoreDatabase.getJdbcUrl());
    StateStore<JobState.DatasetState> datasetStateStore = new FsStateStore<>(this.launcherProps.getProperty(ConfigurationKeys.STATE_STORE_FS_URI_KEY), this.launcherProps.getProperty(ConfigurationKeys.STATE_STORE_ROOT_DIR_KEY), JobState.DatasetState.class);
    this.jobLauncherTestHelper = new JobLauncherTestHelper(this.launcherProps, datasetStateStore);
    // Other tests may not clean up properly, clean up outputDir and stagingDir or some of these tests might fail.
    String outputDir = this.launcherProps.getProperty(ConfigurationKeys.WRITER_OUTPUT_DIR);
    String stagingDir = this.launcherProps.getProperty(ConfigurationKeys.WRITER_STAGING_DIR);
    FileUtils.deleteDirectory(new File(outputDir));
    FileUtils.deleteDirectory(new File(stagingDir));
    this.testLogger.info("startUp: out");
}
Also used : InputStream(java.io.InputStream) JobLauncherTestHelper(org.apache.gobblin.runtime.JobLauncherTestHelper) JobState(org.apache.gobblin.runtime.JobState) FsStateStore(org.apache.gobblin.metastore.FsStateStore) Properties(java.util.Properties) File(java.io.File) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with JobLauncherTestHelper

use of org.apache.gobblin.runtime.JobLauncherTestHelper in project incubator-gobblin by apache.

the class LocalJobLauncherTest method startUp.

@BeforeClass
public void startUp() throws Exception {
    testMetastoreDatabase = TestMetastoreDatabaseFactory.get();
    this.launcherProps = new Properties();
    this.launcherProps.load(new FileReader("gobblin-test/resource/gobblin.test.properties"));
    this.launcherProps.setProperty(ConfigurationKeys.JOB_HISTORY_STORE_ENABLED_KEY, "true");
    this.launcherProps.setProperty(ConfigurationKeys.METRICS_ENABLED_KEY, "true");
    this.launcherProps.setProperty(ConfigurationKeys.METRICS_REPORTING_FILE_ENABLED_KEY, "false");
    this.launcherProps.setProperty(ConfigurationKeys.JOB_HISTORY_STORE_URL_KEY, testMetastoreDatabase.getJdbcUrl());
    StateStore<JobState.DatasetState> datasetStateStore = new FsStateStore<>(this.launcherProps.getProperty(ConfigurationKeys.STATE_STORE_FS_URI_KEY), this.launcherProps.getProperty(ConfigurationKeys.STATE_STORE_ROOT_DIR_KEY), JobState.DatasetState.class);
    this.jobLauncherTestHelper = new JobLauncherTestHelper(this.launcherProps, datasetStateStore);
}
Also used : JobLauncherTestHelper(org.apache.gobblin.runtime.JobLauncherTestHelper) JobState(org.apache.gobblin.runtime.JobState) FileReader(java.io.FileReader) FsStateStore(org.apache.gobblin.metastore.FsStateStore) Properties(java.util.Properties) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

Properties (java.util.Properties)2 FsStateStore (org.apache.gobblin.metastore.FsStateStore)2 JobLauncherTestHelper (org.apache.gobblin.runtime.JobLauncherTestHelper)2 JobState (org.apache.gobblin.runtime.JobState)2 BeforeClass (org.testng.annotations.BeforeClass)2 File (java.io.File)1 FileReader (java.io.FileReader)1 InputStream (java.io.InputStream)1