Search in sources :

Example 96 with BeforeClass

use of org.junit.BeforeClass in project hadoop by apache.

the class AbstractZKRegistryTest method createZKServer.

@BeforeClass
public static void createZKServer() throws Exception {
    File zkDir = new File("target/zookeeper");
    FileUtils.deleteDirectory(zkDir);
    assertTrue(zkDir.mkdirs());
    zookeeper = new MicroZookeeperService("InMemoryZKService");
    YarnConfiguration conf = new YarnConfiguration();
    conf.set(MicroZookeeperServiceKeys.KEY_ZKSERVICE_DIR, zkDir.getAbsolutePath());
    zookeeper.init(conf);
    zookeeper.start();
    addToTeardown(zookeeper);
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) File(java.io.File) MicroZookeeperService(org.apache.hadoop.registry.server.services.MicroZookeeperService) BeforeClass(org.junit.BeforeClass)

Example 97 with BeforeClass

use of org.junit.BeforeClass in project hadoop by apache.

the class TestMiniMRClientCluster method setup.

@BeforeClass
public static void setup() throws IOException {
    final Configuration conf = new Configuration();
    final Path TEST_ROOT_DIR = new Path(System.getProperty("test.build.data", "/tmp"));
    testdir = new Path(TEST_ROOT_DIR, "TestMiniMRClientCluster");
    inDir = new Path(testdir, "in");
    outDir = new Path(testdir, "out");
    FileSystem fs = FileSystem.getLocal(conf);
    if (fs.exists(testdir) && !fs.delete(testdir, true)) {
        throw new IOException("Could not delete " + testdir);
    }
    if (!fs.mkdirs(inDir)) {
        throw new IOException("Mkdirs failed to create " + inDir);
    }
    for (int i = 0; i < inFiles.length; i++) {
        inFiles[i] = new Path(inDir, "part_" + i);
        createFile(inFiles[i], conf);
    }
    // create the mini cluster to be used for the tests
    mrCluster = MiniMRClientClusterFactory.create(InternalClass.class, 1, new Configuration());
}
Also used : Path(org.apache.hadoop.fs.Path) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) FileSystem(org.apache.hadoop.fs.FileSystem) IOException(java.io.IOException) BeforeClass(org.junit.BeforeClass)

Example 98 with BeforeClass

use of org.junit.BeforeClass in project hadoop by apache.

the class TestApplicationHistoryManagerOnTimelineStore method prepareStore.

@BeforeClass
public static void prepareStore() throws Exception {
    store = createStore(SCALE);
    TimelineEntities entities = new TimelineEntities();
    entities.addEntity(createApplicationTimelineEntity(ApplicationId.newInstance(0, SCALE + 1), true, true, false, false, YarnApplicationState.FINISHED));
    entities.addEntity(createApplicationTimelineEntity(ApplicationId.newInstance(0, SCALE + 2), true, false, true, false, YarnApplicationState.FINISHED));
    store.put(entities);
}
Also used : TimelineEntities(org.apache.hadoop.yarn.api.records.timeline.TimelineEntities) BeforeClass(org.junit.BeforeClass)

Example 99 with BeforeClass

use of org.junit.BeforeClass in project hadoop by apache.

the class TestAHSWebServices method setupClass.

@BeforeClass
public static void setupClass() throws Exception {
    conf = new YarnConfiguration();
    TimelineStore store = TestApplicationHistoryManagerOnTimelineStore.createStore(MAX_APPS);
    TimelineACLsManager aclsManager = new TimelineACLsManager(conf);
    aclsManager.setTimelineStore(store);
    TimelineDataManager dataManager = new TimelineDataManager(store, aclsManager);
    conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
    conf.set(YarnConfiguration.YARN_ADMIN_ACL, "foo");
    conf.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
    conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir);
    dataManager.init(conf);
    ApplicationACLsManager appAclsManager = new ApplicationACLsManager(conf);
    ApplicationHistoryManagerOnTimelineStore historyManager = new ApplicationHistoryManagerOnTimelineStore(dataManager, appAclsManager);
    historyManager.init(conf);
    historyClientService = new ApplicationHistoryClientService(historyManager) {

        @Override
        protected void serviceStart() throws Exception {
        // Do Nothing
        }
    };
    historyClientService.init(conf);
    historyClientService.start();
    ahsWebservice = new AHSWebServices(historyClientService, conf) {

        @Override
        public String getNMWebAddressFromRM(Configuration configuration, String nodeId) throws ClientHandlerException, UniformInterfaceException, JSONException {
            if (nodeId.equals(NM_ID)) {
                return NM_WEBADDRESS;
            }
            return null;
        }
    };
    fs = FileSystem.get(conf);
    GuiceServletConfig.setInjector(Guice.createInjector(new WebServletModule()));
}
Also used : ClientHandlerException(com.sun.jersey.api.client.ClientHandlerException) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) ApplicationHistoryClientService(org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryClientService) JSONException(org.codehaus.jettison.json.JSONException) TimelineACLsManager(org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager) ServletException(javax.servlet.ServletException) UniformInterfaceException(com.sun.jersey.api.client.UniformInterfaceException) JSONException(org.codehaus.jettison.json.JSONException) ClientHandlerException(com.sun.jersey.api.client.ClientHandlerException) TimelineDataManager(org.apache.hadoop.yarn.server.timeline.TimelineDataManager) ApplicationACLsManager(org.apache.hadoop.yarn.server.security.ApplicationACLsManager) UniformInterfaceException(com.sun.jersey.api.client.UniformInterfaceException) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) ApplicationHistoryManagerOnTimelineStore(org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryManagerOnTimelineStore) TestApplicationHistoryManagerOnTimelineStore(org.apache.hadoop.yarn.server.applicationhistoryservice.TestApplicationHistoryManagerOnTimelineStore) ApplicationHistoryManagerOnTimelineStore(org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryManagerOnTimelineStore) TestApplicationHistoryManagerOnTimelineStore(org.apache.hadoop.yarn.server.applicationhistoryservice.TestApplicationHistoryManagerOnTimelineStore) TimelineStore(org.apache.hadoop.yarn.server.timeline.TimelineStore) BeforeClass(org.junit.BeforeClass)

Example 100 with BeforeClass

use of org.junit.BeforeClass in project hadoop by apache.

the class TestApplicationMasterService method setup.

@BeforeClass
public static void setup() {
    conf = new YarnConfiguration();
    conf.setClass(YarnConfiguration.RM_SCHEDULER, FifoScheduler.class, ResourceScheduler.class);
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) BeforeClass(org.junit.BeforeClass)

Aggregations

BeforeClass (org.junit.BeforeClass)2454 File (java.io.File)331 Configuration (org.apache.hadoop.conf.Configuration)275 Connection (java.sql.Connection)111 IOException (java.io.IOException)109 Properties (java.util.Properties)100 Reader (java.io.Reader)99 SqlSessionFactoryBuilder (org.apache.ibatis.session.SqlSessionFactoryBuilder)98 Provisioning (com.zimbra.cs.account.Provisioning)93 ScriptRunner (org.apache.ibatis.jdbc.ScriptRunner)91 MockProvisioning (com.zimbra.cs.account.MockProvisioning)77 URI (java.net.URI)73 HiveConf (org.apache.hadoop.hive.conf.HiveConf)73 Path (org.apache.hadoop.fs.Path)70 SqlSession (org.apache.ibatis.session.SqlSession)62 HashMap (java.util.HashMap)58 MiniDFSCluster (org.apache.hadoop.hdfs.MiniDFSCluster)58 Injector (com.google.inject.Injector)57 CConfiguration (co.cask.cdap.common.conf.CConfiguration)56 DeploymentInfo (io.undertow.servlet.api.DeploymentInfo)55