Example usage for org.apache.hadoop.conf Configuration clear

List of usage examples for org.apache.hadoop.conf Configuration clear

Introduction

In this page you can find the example usage for org.apache.hadoop.conf Configuration clear.

Prototype

public void clear() 

Source Link

Document

Clears all keys from the configuration.

Usage

From source file:hbaseweb.controllers.CreateTableController.java

@RequestMapping(value = "/disable/{tablename}", method = RequestMethod.GET)
public String Disable(@PathVariable(value = "tablename") String tablename, ModelMap map) {

    try {//from ww  w .j  av  a 2  s . c  o m

        Configuration config = HBaseConfiguration.create();
        config.clear();
        config.set("hbase.zookeeper.quorum", "192.168.10.50");
        config.set("hbase.zookeeper.property.clientPort", "2181");
        HBaseAdmin.checkHBaseAvailable(config);
        Connection connection = ConnectionFactory.createConnection(config);
        Admin admin = connection.getAdmin();
        TableName tableName = TableName.valueOf(tablename);
        HTableDescriptor tableDescriptor = new HTableDescriptor(tableName);
        admin.disableTable(tableName);
    } catch (Exception ce) {
        ce.printStackTrace();
        map.put("error", ce);
        return "delete";
    }

    return "delete";
}

From source file:hbaseweb.controllers.CreateTableController.java

@RequestMapping(value = "/createtable", method = RequestMethod.POST)
public String newtable(NewTableForm newTableForm, ModelMap map) {

    try {/*from w w w . jav a2s.c  om*/

        Configuration config = HBaseConfiguration.create();
        config.clear();
        config.set("hbase.zookeeper.quorum", "192.168.10.50");
        config.set("hbase.zookeeper.property.clientPort", "2181");
        HBaseAdmin.checkHBaseAvailable(config);
        Connection connection = ConnectionFactory.createConnection(config);
        Admin admin = connection.getAdmin();
        TableName tableName = TableName.valueOf(newTableForm.getName());
        HTableDescriptor tableDescriptor = new HTableDescriptor(tableName);
        //            HTableDescriptor tableDescriptor = new HTableDescriptor(TableName.valueOf("dasdas"));
        // ... with two column families
        String[] Famyly = newTableForm.getColumnFamilysList();
        for (int i = 0; i < Famyly.length; i++) {
            tableDescriptor.addFamily(new HColumnDescriptor(Famyly[i]));
        }

        admin.createTable(tableDescriptor);
        map.put("tablename", newTableForm.getName());
        map.put("ColumnFamilys", newTableForm.getColumnFamilys());

        //            System.out.println(newTableForm.getColumnFamilys().length);

    } catch (Exception ce) {
        ce.printStackTrace();
        map.put("newTableForm", newTableForm);
        map.put("error", ce);
        return "CreateTable";
    }

    return "CreateTableSuccess";
}

From source file:hbaseweb.controllers.CreateTableController.java

@RequestMapping(value = "/insert/{tablename}", method = RequestMethod.GET)
public String insert(@PathVariable(value = "tablename") String tablename, ModelMap map) {

    try {/*from  w w  w.  java 2  s .  c  o m*/

        Configuration config = HBaseConfiguration.create();
        config.clear();
        config.set("hbase.zookeeper.quorum", "192.168.10.50");
        config.set("hbase.zookeeper.property.clientPort", "2181");
        HBaseAdmin.checkHBaseAvailable(config);
        Connection connection = ConnectionFactory.createConnection(config);
        Admin admin = connection.getAdmin();
        //            TableName tableName = TableName.valueOf(tablename);
        HTableDescriptor tableDescriptor = admin.getTableDescriptor(TableName.valueOf(tablename));
        HColumnDescriptor[] colfamilis = tableDescriptor.getColumnFamilies();
        map.put("table", tableDescriptor);
        map.put("colfamilis", colfamilis);
        //            admin.deleteTable(tableName);
    } catch (Exception ce) {
        ce.printStackTrace();
        map.put("error", ce);
        return "insert";
    }

    return "insert";
}

From source file:hbaseweb.controllers.DefaultController.java

@RequestMapping(value = "/", method = RequestMethod.GET)

public ModelAndView index(@RequestParam(value = "tablename", required = false) String tablename,
        @RequestParam(value = "page", required = false) String page, ModelMap map) {

    String test = "valod";
    map.put("test", test);
    map.put("testBytes", Bytes.toBytes(test));

    map.put("tablename", tablename);
    map.put("page", page);
    int ipage = 1;
    try {//from  w w w  .ja v a 2 s  . co  m
        ipage = Integer.parseInt(page);
    } catch (Exception e) {
        ipage = 1;
    }

    try {

        Configuration config = HBaseConfiguration.create();
        config.clear();
        config.set("hbase.zookeeper.quorum", "nn1.netangels.net,nn2.netangels.net,rm1.netangels.net");
        config.set("hbase.zookeeper.property.clientPort", "2181");

        HBaseAdmin.checkHBaseAvailable(config);
        System.out.println("HBase is running!");
        Connection connection = ConnectionFactory.createConnection(config);
        Admin admin = connection.getAdmin();

        HTableDescriptor[] tables = admin.listTables();
        map.put("tables", tables);
        if (tablename != "" & tablename != null) {
            TableName tableName = TableName.valueOf(tablename);
            if (admin.tableExists(tableName)) {
                //                    HTable table = new HTable(config, tablename);
                Table table = connection.getTable(tableName);
                //                    aa =  table.getTableDescriptor().getFamilies();
                System.out.println(tablename);

                byte[] POSTFIX = new byte[] { 0x00 };
                Filter filter = new PageFilter(50);
                int totalRows = 0;

                lastrow = null;

                Scan scan = new Scan();
                scan.setFilter(filter);
                //                    byte[] rowPrefix = Hex.decodeHex("000001000004000004000001000001000005000005000002000002000003000003".toCharArray());
                //                    scan.setRowPrefixFilter(rowPrefix);

                for (int i = 1; i <= ipage; i++) {
                    if (lastrow != null) {
                        byte[] startRow = Bytes.add(lastrow, POSTFIX);
                        System.out.println("start row: " + Bytes.toStringBinary(startRow));
                        scan.setStartRow(startRow);
                    }
                    //                    scan.setStopRow(Bytes.toBytes(2));
                    ResultScanner results2 = table.getScanner(scan);
                    for (Result result = results2.next(); result != null; result = results2.next()) {
                        lastrow = result.getRow();
                        totalRows++;
                    }
                }
                ResultScanner results = table.getScanner(scan);

                Result[] values = results.next(50);

                results.close();
                table.close();

                map.put("values", values);
            }
        }

    } catch (Exception ce) {
        ce.printStackTrace();

    }

    //        map.put("msg", "Hello Spring 4 Web MVC!");
    ModelAndView mav = new ModelAndView();
    mav.setViewName("index");
    return mav;
    //        return "index";
}

From source file:org.apache.hcatalog.common.HCatUtil.java

License:Apache License

/**
 * Replace the contents of dest with the contents of src
 * @param src/*from   www  .  j av a  2 s . c om*/
 * @param dest
 */
public static void copyConf(Configuration src, Configuration dest) {
    dest.clear();
    for (Map.Entry<String, String> el : src) {
        dest.set(el.getKey(), el.getValue());
    }
}

From source file:org.apache.kylin.engine.mr.common.MapReduceExecutableTest.java

License:Apache License

@Test
public void testOverwriteJobConf() throws Exception {
    MapReduceExecutable executable = new MapReduceExecutable();
    KylinConfig config = KylinConfig.getInstanceFromEnv();

    Method method = MapReduceExecutable.class.getDeclaredMethod("overwriteJobConf", Configuration.class,
            KylinConfig.class, new String[] {}.getClass());
    method.setAccessible(true);/*  www.ja v a 2  s. co  m*/
    Configuration conf = new Configuration();
    conf.set("mapreduce.job.is-mem-hungry", "true");
    method.invoke(executable, conf, config, new String[] { "-cubename", "ci_inner_join_cube" });
    Assert.assertEquals("mem-test1", conf.get("test1"));
    Assert.assertEquals("mem-test2", conf.get("test2"));

    conf.clear();
    method.invoke(executable, conf, config, new String[] { "-cubename", "ci_inner_join_cube" });
    Assert.assertEquals("test1", conf.get("test1"));
    Assert.assertEquals("test2", conf.get("test2"));
}

From source file:org.apache.oozie.action.hadoop.TestJavaActionExecutor.java

License:Apache License

public void testAddToCache() throws Exception {
    JavaActionExecutor ae = new JavaActionExecutor();
    Configuration conf = new XConfiguration();

    Path appPath = new Path(getFsTestCaseDir(), "wf");
    URI appUri = appPath.toUri();

    // test archive without fragment
    Path archivePath = new Path("test.jar");
    Path archiveFullPath = new Path(appPath, archivePath);
    ae.addToCache(conf, appPath, archiveFullPath.toString(), true);
    assertTrue(conf.get("mapred.cache.archives").contains(archiveFullPath.toString()));
    assertTrue(DistributedCache.getSymlink(conf));

    // test archive with fragment
    Path archiveFragmentPath = new Path("test.jar#a.jar");
    Path archiveFragmentFullPath = new Path(appPath, archiveFragmentPath);
    conf.clear();
    ae.addToCache(conf, appPath, archiveFragmentFullPath.toString(), true);
    assertTrue(conf.get("mapred.cache.archives").contains(archiveFragmentFullPath.toString()));
    assertTrue(DistributedCache.getSymlink(conf));

    // test .so without fragment
    Path appSoPath = new Path("lib/a.so");
    Path appSoFullPath = new Path(appPath, appSoPath);
    conf.clear();/*from  w  w  w  .ja v  a  2 s  .  c o m*/
    ae.addToCache(conf, appPath, appSoFullPath.toString(), false);
    assertTrue(conf.get("mapred.cache.files").contains(appSoFullPath.toString()));
    assertTrue(DistributedCache.getSymlink(conf));

    // test .so with fragment
    Path appSoFragmentPath = new Path("lib/a.so#a.so");
    Path appSoFragmentFullPath = new Path(appPath, appSoFragmentPath);
    conf.clear();
    ae.addToCache(conf, appPath, appSoFragmentFullPath.toString(), false);
    assertTrue(conf.get("mapred.cache.files").contains(appSoFragmentFullPath.toString()));
    assertTrue(DistributedCache.getSymlink(conf));

    // test .jar without fragment where app path is on same cluster as jar path
    Path appJarPath = new Path("lib/a.jar");
    Path appJarFullPath = new Path(appPath, appJarPath);
    conf = new Configuration();
    conf.set(WorkflowAppService.HADOOP_USER, getTestUser());
    ae.addToCache(conf, appPath, appJarFullPath.toString(), false);
    // assert that mapred.cache.files contains jar URI path (full on Hadoop-2)
    Path jarPath = HadoopShims.isYARN() ? new Path(appJarFullPath.toUri())
            : new Path(appJarFullPath.toUri().getPath());
    assertTrue(conf.get("mapred.cache.files").contains(jarPath.toString()));
    // assert that dist cache classpath contains jar URI path
    Path[] paths = DistributedCache.getFileClassPaths(conf);
    boolean pathFound = false;
    for (Path path : paths) {
        if (path.equals(jarPath)) {
            pathFound = true;
            break;
        }
    }
    assertTrue(pathFound);
    assertTrue(DistributedCache.getSymlink(conf));

    // test .jar without fragment where app path is on a different cluster than jar path
    appJarPath = new Path("lib/a.jar");
    appJarFullPath = new Path(appPath, appJarPath);
    Path appDifferentClusterPath = new Path(new URI(appUri.getScheme(), null, appUri.getHost() + "x",
            appUri.getPort(), appUri.getPath(), appUri.getQuery(), appUri.getFragment()));
    conf.clear();
    conf.set(WorkflowAppService.HADOOP_USER, getTestUser());
    ae.addToCache(conf, appDifferentClusterPath, appJarFullPath.toString(), false);
    // assert that mapred.cache.files contains absolute jar URI
    assertTrue(conf.get("mapred.cache.files").contains(appJarFullPath.toString()));
    assertTrue(DistributedCache.getSymlink(conf));

    // test .jar with fragment
    Path appJarFragmentPath = new Path("lib/a.jar#a.jar");
    Path appJarFragmentFullPath = new Path(appPath, appJarFragmentPath);
    conf.clear();
    conf.set(WorkflowAppService.HADOOP_USER, getTestUser());
    ae.addToCache(conf, appPath, appJarFragmentFullPath.toString(), false);
    assertTrue(conf.get("mapred.cache.files").contains(appJarFragmentFullPath.toString()));
    assertTrue(DistributedCache.getSymlink(conf));

    // test regular file without fragment
    Path appFilePath = new Path("lib/a.txt");
    Path appFileFullPath = new Path(appPath, appFilePath);
    conf.clear();
    ae.addToCache(conf, appPath, appFileFullPath.toString(), false);
    assertTrue(conf.get("mapred.cache.files").contains(appFileFullPath.toString()));
    assertTrue(DistributedCache.getSymlink(conf));

    // test regular file with fragment
    Path appFileFragmentPath = new Path("lib/a.txt#a.txt");
    Path appFileFragmentFullPath = new Path(appPath, appFileFragmentPath);
    conf.clear();
    ae.addToCache(conf, appPath, appFileFragmentFullPath.toString(), false);
    assertTrue(conf.get("mapred.cache.files").contains(appFileFragmentFullPath.toString()));
    assertTrue(DistributedCache.getSymlink(conf));

    // test path starting with "/" for archive
    Path testPath = new Path("/tmp/testpath/a.jar#a.jar");
    conf.clear();
    ae.addToCache(conf, appPath, testPath.toString(), true);
    assertTrue(conf.get("mapred.cache.archives").contains(testPath.toString()));
    assertTrue(DistributedCache.getSymlink(conf));

    // test path starting with "/" for cache.file
    conf.clear();
    ae.addToCache(conf, appPath, testPath.toString(), false);
    assertTrue(conf.get("mapred.cache.files").contains(testPath.toString()));
    assertTrue(DistributedCache.getSymlink(conf));

    // test absolute path for archive
    Path testAbsolutePath = new Path("hftp://namenode.test.com:8020/tmp/testpath/a.jar#a.jar");
    conf.clear();
    ae.addToCache(conf, appPath, testAbsolutePath.toString(), true);
    assertTrue(conf.get("mapred.cache.archives").contains(testAbsolutePath.toString()));
    assertTrue(DistributedCache.getSymlink(conf));

    // test absolute path for cache files
    conf.clear();
    ae.addToCache(conf, appPath, testAbsolutePath.toString(), false);
    assertTrue(conf.get("mapred.cache.files").contains(testAbsolutePath.toString()));
    assertTrue(DistributedCache.getSymlink(conf));

    // test relative path for archive
    conf.clear();
    ae.addToCache(conf, appPath, "lib/a.jar#a.jar", true);
    assertTrue(conf.get("mapred.cache.archives").contains(appUri.getPath() + "/lib/a.jar#a.jar"));
    assertTrue(DistributedCache.getSymlink(conf));

    // test relative path for cache files
    conf.clear();
    ae.addToCache(conf, appPath, "lib/a.jar#a.jar", false);
    assertTrue(conf.get("mapred.cache.files").contains(appUri.getPath() + "/lib/a.jar#a.jar"));
    assertTrue(DistributedCache.getSymlink(conf));
}

From source file:org.apache.oozie.service.TestConfigurationService.java

License:Apache License

public void testOozieConfig() throws Exception {
    prepareOozieConfDir("oozie-site2.xml");
    ConfigurationService cl = new ConfigurationService();
    cl.init(null);//from   w  w w  .j a  v  a2s .co  m
    assertEquals("SITE1", cl.getConf().get("oozie.system.id"));
    assertEquals("SITE2", cl.getConf().get("oozie.dummy"));
    assertEquals("SITE1", ConfigurationService.get(cl.getConf(), "oozie.system.id"));
    assertEquals("SITE2", ConfigurationService.get(cl.getConf(), "oozie.dummy"));

    assertNull(cl.getConf().get("oozie.test.nonexist"));
    assertEquals(ConfigUtils.STRING_DEFAULT, ConfigurationService.get(cl.getConf(), "oozie.test.nonexist"));
    assertEquals(ConfigUtils.BOOLEAN_DEFAULT,
            ConfigurationService.getBoolean(cl.getConf(), "oozie.test.nonexist"));

    Configuration testConf = new Configuration(false);
    assertEquals(ConfigUtils.STRING_DEFAULT, ConfigurationService.get("test.nonexist"));
    assertEquals(ConfigUtils.STRING_DEFAULT, ConfigurationService.get(testConf, "test.nonexist"));
    testConf.set("test.nonexist", "another-conf");
    assertEquals(ConfigUtils.STRING_DEFAULT, ConfigurationService.get("test.nonexist"));
    assertEquals("another-conf", ConfigurationService.get(testConf, "test.nonexist"));
    Services.get().getConf().set("test.nonexist", "oozie-conf");
    assertEquals("oozie-conf", ConfigurationService.get("test.nonexist"));
    assertEquals("another-conf", ConfigurationService.get(testConf, "test.nonexist"));
    testConf.clear();
    assertEquals("oozie-conf", ConfigurationService.get("test.nonexist"));
    assertEquals(ConfigUtils.STRING_DEFAULT, ConfigurationService.get(testConf, "test.nonexist"));

    assertEquals("http://localhost:8080/oozie/callback",
            ConfigurationService.get(CallbackService.CONF_BASE_URL));
    assertEquals(5, ConfigurationService.getInt(CallbackService.CONF_EARLY_REQUEUE_MAX_RETRIES));
    assertEquals("gz", ConfigurationService.get(CodecFactory.COMPRESSION_OUTPUT_CODEC));
    assertEquals(4096, ConfigurationService.getInt(XLogStreamingService.STREAM_BUFFER_LEN));
    assertEquals(10000, ConfigurationService.getLong(JvmPauseMonitorService.WARN_THRESHOLD_KEY));
    assertEquals(60, ConfigurationService.getInt(InstrumentationService.CONF_LOGGING_INTERVAL));
    assertEquals(30, ConfigurationService.getInt(PurgeService.CONF_OLDER_THAN));
    assertEquals(7, ConfigurationService.getInt(PurgeService.COORD_CONF_OLDER_THAN));
    assertEquals(7, ConfigurationService.getInt(PurgeService.BUNDLE_CONF_OLDER_THAN));
    assertEquals(100, ConfigurationService.getInt(PurgeService.PURGE_LIMIT));
    assertEquals(3600, ConfigurationService.getInt(PurgeService.CONF_PURGE_INTERVAL));
    assertEquals(300, ConfigurationService.getInt(CoordMaterializeTriggerService.CONF_LOOKUP_INTERVAL));
    assertEquals(0, ConfigurationService.getInt(CoordMaterializeTriggerService.CONF_SCHEDULING_INTERVAL));
    assertEquals(300, cl.getConf().getInt(CoordMaterializeTriggerService.CONF_SCHEDULING_INTERVAL,
            ConfigurationService.getInt(CoordMaterializeTriggerService.CONF_LOOKUP_INTERVAL)));
    assertEquals(3600, ConfigurationService.getInt(CoordMaterializeTriggerService.CONF_MATERIALIZATION_WINDOW));
    assertEquals(10, ConfigurationService.getInt(CoordMaterializeTriggerService.CONF_CALLABLE_BATCH_SIZE));
    assertEquals(50,
            ConfigurationService.getInt(CoordMaterializeTriggerService.CONF_MATERIALIZATION_SYSTEM_LIMIT));
    assertEquals(0.05f, ConfigurationService.getFloat(CoordSubmitXCommand.CONF_MAT_THROTTLING_FACTOR));

    assertEquals("oozie", ConfigurationService.get(JPAService.CONF_DB_SCHEMA));
    assertEquals("jdbc:hsqldb:mem:oozie-db;create=true", ConfigurationService.get(JPAService.CONF_URL));
    assertEquals("org.hsqldb.jdbcDriver", ConfigurationService.get(JPAService.CONF_DRIVER));
    assertEquals("sa", ConfigurationService.get(JPAService.CONF_USERNAME));
    assertEquals("", ConfigurationService.get(JPAService.CONF_PASSWORD).trim());
    assertEquals("10", ConfigurationService.get(JPAService.CONF_MAX_ACTIVE_CONN).trim());
    assertEquals("org.apache.commons.dbcp.BasicDataSource",
            ConfigurationService.get(JPAService.CONF_CONN_DATA_SOURCE));
    assertEquals("", ConfigurationService.get(JPAService.CONF_CONN_PROPERTIES).trim());
    assertEquals("300000", ConfigurationService.get(JPAService.CONF_VALIDATE_DB_CONN_EVICTION_INTERVAL).trim());
    assertEquals("10", ConfigurationService.get(JPAService.CONF_VALIDATE_DB_CONN_EVICTION_NUM).trim());

    assertEquals(2048, ConfigurationService.getInt(LauncherMapper.CONF_OOZIE_ACTION_MAX_OUTPUT_DATA));
    assertEquals("http://localhost:8080/oozie?job=", ConfigurationService.get(JobXCommand.CONF_CONSOLE_URL));
    assertEquals(true, ConfigurationService.getBoolean(JavaActionExecutor.CONF_HADOOP_YARN_UBER_MODE));
    assertEquals(false, ConfigurationService
            .getBoolean("oozie.action.shell.launcher." + JavaActionExecutor.HADOOP_YARN_UBER_MODE));
    assertEquals(false, ConfigurationService.getBoolean(HadoopAccessorService.KERBEROS_AUTH_ENABLED));

    assertEquals(0, ConfigurationService.getStrings("no.defined").length);
    assertEquals(0, ConfigurationService.getStrings(CredentialsProvider.CRED_KEY).length);
    assertEquals(1, ConfigurationService.getStrings(DistcpActionExecutor.CLASS_NAMES).length);
    assertEquals("distcp=org.apache.hadoop.tools.DistCp",
            ConfigurationService.getStrings(DistcpActionExecutor.CLASS_NAMES)[0]);
    assertEquals(1, ConfigurationService.getInt(CoordActionInputCheckXCommand.COORD_EXECUTION_NONE_TOLERANCE));
    assertEquals(1000, ConfigurationService.getInt(V1JobServlet.COORD_ACTIONS_DEFAULT_LENGTH));

    assertEquals(cl.getConf().get(LiteWorkflowStoreService.CONF_USER_RETRY_ERROR_CODE),
            ConfigurationService.get(LiteWorkflowStoreService.CONF_USER_RETRY_ERROR_CODE));
    assertEquals(cl.getConf().get(LiteWorkflowStoreService.CONF_USER_RETRY_ERROR_CODE_EXT),
            ConfigurationService.get(LiteWorkflowStoreService.CONF_USER_RETRY_ERROR_CODE_EXT));

    assertEquals("simple", cl.getConf().get(AuthFilter.OOZIE_PREFIX + AuthFilter.AUTH_TYPE));
    assertEquals("36000", cl.getConf().get(AuthFilter.OOZIE_PREFIX + AuthFilter.AUTH_TOKEN_VALIDITY));
    // The cookie.domain config is in oozie-default.xml mostly for documentation purposes, but it needs to have an empty string
    // value by default, which Configuration parses as null
    assertNull(cl.getConf().get(AuthFilter.OOZIE_PREFIX + AuthFilter.COOKIE_DOMAIN));
    assertEquals("true", cl.getConf().get(AuthFilter.OOZIE_PREFIX + "simple.anonymous.allowed"));
    assertEquals("HTTP/localhost@LOCALHOST", cl.getConf().get(AuthFilter.OOZIE_PREFIX + "kerberos.principal"));
    assertEquals(cl.getConf().get(HadoopAccessorService.KERBEROS_KEYTAB),
            cl.getConf().get(AuthFilter.OOZIE_PREFIX + "kerberos.keytab"));
    assertEquals("DEFAULT", cl.getConf().get(AuthFilter.OOZIE_PREFIX + "kerberos.name.rules"));

    assertEquals(true, ConfigurationService.getBoolean(LiteWorkflowAppParser.VALIDATE_FORK_JOIN));
    assertEquals(false,
            ConfigurationService.getBoolean(CoordActionGetForInfoJPAExecutor.COORD_GET_ALL_COLS_FOR_ACTION));
    assertEquals(1, ConfigurationService.getStrings(URIHandlerService.URI_HANDLERS).length);
    assertEquals("org.apache.oozie.dependency.FSURIHandler",
            ConfigurationService.getStrings(URIHandlerService.URI_HANDLERS)[0]);
    assertEquals(cl.getConf().getBoolean("oozie.hadoop-2.0.2-alpha.workaround.for.distributed.cache", false),
            ConfigurationService.getBoolean(LauncherMapper.HADOOP2_WORKAROUND_DISTRIBUTED_CACHE));

    assertEquals("org.apache.oozie.event.MemoryEventQueue",
            (ConfigurationService.getClass(cl.getConf(), EventHandlerService.CONF_EVENT_QUEUE).getName()));
    assertEquals(-1, ConfigurationService.getInt(XLogFilter.MAX_SCAN_DURATION));
    assertEquals(-1, ConfigurationService.getInt(XLogFilter.MAX_ACTIONLIST_SCAN_DURATION));
    assertEquals(10000, ConfigurationService.getLong(JvmPauseMonitorService.WARN_THRESHOLD_KEY));
    assertEquals(1000, ConfigurationService.getLong(JvmPauseMonitorService.INFO_THRESHOLD_KEY));

    assertEquals(10000, ConfigurationService.getInt(CallableQueueService.CONF_QUEUE_SIZE));
    assertEquals(10, ConfigurationService.getInt(CallableQueueService.CONF_THREADS));
    assertEquals(3, ConfigurationService.getInt(CallableQueueService.CONF_CALLABLE_CONCURRENCY));
    assertEquals(120, ConfigurationService.getInt(CoordSubmitXCommand.CONF_DEFAULT_TIMEOUT_NORMAL));

    assertEquals(300, ConfigurationService.getInt(ZKLocksService.REAPING_THRESHOLD));
    assertEquals(2, ConfigurationService.getInt(ZKLocksService.REAPING_THREADS));
    assertEquals(10000, ConfigurationService.getInt(JobXCommand.DEFAULT_REQUEUE_DELAY));

    assertEquals(0, ConfigurationService.getStrings(AbandonedCoordCheckerService.TO_ADDRESS).length);
    assertEquals(25, ConfigurationService.getInt(AbandonedCoordCheckerService.CONF_FAILURE_LEN));
    assertEquals(false, ConfigurationService.getBoolean(AbandonedCoordCheckerService.CONF_JOB_KILL));
    assertEquals(60, ConfigurationService.getInt(AbandonedCoordCheckerService.CONF_CHECK_DELAY));
    assertEquals(1440, ConfigurationService.getInt(AbandonedCoordCheckerService.CONF_CHECK_INTERVAL));
    assertEquals(2880, ConfigurationService.getInt(AbandonedCoordCheckerService.CONF_JOB_OLDER_THAN));

    assertEquals(true, ConfigurationService.getBoolean(ZKConnectionListener.CONF_SHUTDOWN_ON_TIMEOUT));

    assertEquals(7, ConfigurationService.getInt(ShareLibService.LAUNCHERJAR_LIB_RETENTION));
    assertEquals(5000, ConfigurationService.getInt(SLAService.CONF_CAPACITY));

    cl.destroy();
}

From source file:org.apache.tez.common.TestTezUtils.java

License:Apache License

@Test(timeout = 2000)
public void testByteStringToAndFromConf() throws IOException {
    Configuration conf = getConf();
    Assert.assertEquals(conf.size(), 6);
    ByteString bsConf = TezUtils.createByteStringFromConf(conf);
    conf.clear();
    Assert.assertEquals(conf.size(), 0);
    conf = TezUtils.createConfFromByteString(bsConf);
    Assert.assertEquals(conf.size(), 6);
    checkConf(conf);//from   w  ww .j ava 2 s.  com
}

From source file:org.apache.tez.common.TestTezUtils.java

License:Apache License

@Test(timeout = 2000)
public void testPayloadToAndFromConf() throws IOException {
    Configuration conf = getConf();
    Assert.assertEquals(conf.size(), 6);
    UserPayload bConf = TezUtils.createUserPayloadFromConf(conf);
    conf.clear();
    Assert.assertEquals(conf.size(), 0);
    conf = TezUtils.createConfFromUserPayload(bConf);
    Assert.assertEquals(conf.size(), 6);
    checkConf(conf);//from ww  w  .  ja v a 2s . co m
}