Example usage for org.apache.solr SolrTestCaseJ4 useFactory

List of usage examples for org.apache.solr SolrTestCaseJ4 useFactory

Introduction

In this page you can find the example usage for org.apache.solr SolrTestCaseJ4 useFactory.

Prototype

public static void useFactory(String factory) throws Exception 

Source Link

Document

Use a different directory factory.

Usage

From source file:org.apache.sentry.tests.e2e.solr.HdfsTestUtil.java

License:Apache License

public static MiniDFSCluster setupClass(String dataDir) throws Exception {
    LuceneTestCase.assumeFalse("HDFS tests were disabled by -Dtests.disableHdfs",
            Boolean.parseBoolean(System.getProperty("tests.disableHdfs", "false")));
    File dir = new File(dataDir);
    new File(dataDir).mkdirs();

    savedLocale = Locale.getDefault();
    // TODO: we HACK around HADOOP-9643
    Locale.setDefault(Locale.ENGLISH);

    int dataNodes = 2;

    Configuration conf = new Configuration();
    conf.set("dfs.block.access.token.enable", "false");
    conf.set("dfs.permissions.enabled", "false");
    conf.set("hadoop.security.authentication", "simple");
    conf.set("hdfs.minidfs.basedir", dir.getAbsolutePath() + File.separator + "hdfsBaseDir");
    conf.set("dfs.namenode.name.dir", dir.getAbsolutePath() + File.separator + "nameNodeNameDir");

    System.setProperty("test.build.data",
            dir.getAbsolutePath() + File.separator + "hdfs" + File.separator + "build");
    System.setProperty("test.cache.data",
            dir.getAbsolutePath() + File.separator + "hdfs" + File.separator + "cache");
    System.setProperty("solr.lock.type", "hdfs");

    MiniDFSCluster dfsCluster = new MiniDFSCluster(conf, dataNodes, true, null);

    SolrTestCaseJ4.useFactory("org.apache.solr.core.HdfsDirectoryFactory");

    return dfsCluster;
}