Search in sources :

Example 1 with ZookeeperTestService

use of org.apache.hudi.common.testutils.minicluster.ZookeeperTestService in project hudi by apache.

the class UtilitiesTestBase method initClass.

public static void initClass(boolean startHiveService) throws Exception {
    hdfsTestService = new HdfsTestService();
    zookeeperTestService = new ZookeeperTestService(hdfsTestService.getHadoopConf());
    dfsCluster = hdfsTestService.start(true);
    dfs = dfsCluster.getFileSystem();
    dfsBasePath = dfs.getWorkingDirectory().toString();
    dfs.mkdirs(new Path(dfsBasePath));
    if (startHiveService) {
        hiveTestService = new HiveTestService(hdfsTestService.getHadoopConf());
        hiveServer = hiveTestService.start();
        clearHiveDb();
    }
    zookeeperTestService.start();
}
Also used : Path(org.apache.hadoop.fs.Path) ZookeeperTestService(org.apache.hudi.common.testutils.minicluster.ZookeeperTestService) HdfsTestService(org.apache.hudi.common.testutils.minicluster.HdfsTestService) HiveTestService(org.apache.hudi.hive.testutils.HiveTestService)

Example 2 with ZookeeperTestService

use of org.apache.hudi.common.testutils.minicluster.ZookeeperTestService in project hudi by apache.

the class ZookeeperServiceProvider method stopLocalZookeeperIfNeeded.

public void stopLocalZookeeperIfNeeded() throws Exception {
    if (config.isHiveLocal()) {
        ZookeeperTestService zookeeperTestService = new ZookeeperTestService(configuration);
        zookeeperTestService.stop();
    }
}
Also used : ZookeeperTestService(org.apache.hudi.common.testutils.minicluster.ZookeeperTestService)

Example 3 with ZookeeperTestService

use of org.apache.hudi.common.testutils.minicluster.ZookeeperTestService in project hudi by apache.

the class ZookeeperServiceProvider method startLocalZookeeperIfNeeded.

public void startLocalZookeeperIfNeeded() throws Exception {
    if (config.isHiveLocal()) {
        ZookeeperTestService zookeeperTestService = new ZookeeperTestService(configuration);
        zookeeperTestService.start();
    }
}
Also used : ZookeeperTestService(org.apache.hudi.common.testutils.minicluster.ZookeeperTestService)

Example 4 with ZookeeperTestService

use of org.apache.hudi.common.testutils.minicluster.ZookeeperTestService in project hudi by apache.

the class HiveSyncFunctionalTestHarness method runBeforeEach.

@BeforeEach
public synchronized void runBeforeEach() throws IOException, InterruptedException {
    initialized = hiveTestService != null && zookeeperTestService != null;
    if (!initialized) {
        hadoopConf = new Configuration();
        zookeeperTestService = new ZookeeperTestService(hadoopConf);
        zookeeperTestService.start();
        hiveTestService = new HiveTestService(hadoopConf);
        hiveTestService.start();
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) ZookeeperTestService(org.apache.hudi.common.testutils.minicluster.ZookeeperTestService) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with ZookeeperTestService

use of org.apache.hudi.common.testutils.minicluster.ZookeeperTestService in project hudi by apache.

the class HiveTestUtil method setUp.

public static void setUp() throws IOException, InterruptedException, HiveException, MetaException {
    configuration = new Configuration();
    if (zkServer == null) {
        zkService = new ZookeeperTestService(configuration);
        zkServer = zkService.start();
    }
    if (hiveServer == null) {
        hiveTestService = new HiveTestService(configuration);
        hiveServer = hiveTestService.start();
    }
    fileSystem = FileSystem.get(configuration);
    hiveSyncConfig = new HiveSyncConfig();
    hiveSyncConfig.jdbcUrl = hiveTestService.getJdbcHive2Url();
    hiveSyncConfig.hiveUser = "";
    hiveSyncConfig.hivePass = "";
    hiveSyncConfig.databaseName = "testdb";
    hiveSyncConfig.tableName = "test1";
    hiveSyncConfig.basePath = Files.createTempDirectory("hivesynctest" + Instant.now().toEpochMilli()).toUri().toString();
    hiveSyncConfig.assumeDatePartitioning = true;
    hiveSyncConfig.usePreApacheInputFormat = false;
    hiveSyncConfig.partitionFields = Collections.singletonList("datestr");
    dtfOut = DateTimeFormatter.ofPattern("yyyy/MM/dd");
    ddlExecutor = new HiveQueryDDLExecutor(hiveSyncConfig, fileSystem, getHiveConf());
    clear();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) ZookeeperTestService(org.apache.hudi.common.testutils.minicluster.ZookeeperTestService) HiveSyncConfig(org.apache.hudi.hive.HiveSyncConfig) HiveQueryDDLExecutor(org.apache.hudi.hive.ddl.HiveQueryDDLExecutor)

Aggregations

ZookeeperTestService (org.apache.hudi.common.testutils.minicluster.ZookeeperTestService)5 Configuration (org.apache.hadoop.conf.Configuration)2 Path (org.apache.hadoop.fs.Path)1 HdfsTestService (org.apache.hudi.common.testutils.minicluster.HdfsTestService)1 HiveSyncConfig (org.apache.hudi.hive.HiveSyncConfig)1 HiveQueryDDLExecutor (org.apache.hudi.hive.ddl.HiveQueryDDLExecutor)1 HiveTestService (org.apache.hudi.hive.testutils.HiveTestService)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1