Пример #1
0
  @Test
  public void testPopulateConfiguration() {
    String[] args =
        new String[] {
          "-inputPath",
          "input",
          "-url",
          "jdbc:mysql://localhost:3306/hiho",
          "-userName",
          "root",
          "-password",
          "newpwd",
          "-querySuffix",
          "mrTest fields terminated by ','"
        };
    ExportToMySQLDB exportToMySQLDB = new ExportToMySQLDB();

    Configuration conf = new Configuration();
    exportToMySQLDB.populateConfiguration(args, conf);

    assertEquals("jdbc:mysql://localhost:3306/hiho", conf.get(DBConfiguration.URL_PROPERTY));
    assertEquals("root", conf.get(DBConfiguration.USERNAME_PROPERTY));
    assertEquals("newpwd", conf.get(DBConfiguration.PASSWORD_PROPERTY));
    assertEquals("mrTest fields terminated by ','", conf.get(HIHOConf.LOAD_QUERY_SUFFIX));
  }
Пример #2
0
 @Test(expected = HIHOException.class)
 public void testCheckMandatoryConfsForJdbcUrl() throws HIHOException {
   String[] args =
       new String[] {
         "-inputPath",
         "input",
         "-url",
         "-userName",
         "root",
         "-password",
         "newpwd",
         "-querySuffix",
         "mrTest fields terminated by ','"
       };
   ExportToMySQLDB exportToMySQLDB = new ExportToMySQLDB();
   Configuration conf = new Configuration();
   exportToMySQLDB.populateConfiguration(args, conf);
   exportToMySQLDB.checkMandatoryConfs(conf);
 }
Пример #3
0
 @Test(expected = HIHOException.class)
 public void testCheckMandatoryConfsForQuerySuffix() throws HIHOException {
   String[] args =
       new String[] {
         "-inputPath",
         "input",
         "-url",
         "jdbc:mysql://localhost:3306/hiho",
         "-userName",
         "username",
         "-password",
         "passwd",
         "-querySuffix"
       };
   ExportToMySQLDB exportToMySQLDB = new ExportToMySQLDB();
   Configuration conf = new Configuration();
   exportToMySQLDB.populateConfiguration(args, conf);
   exportToMySQLDB.checkMandatoryConfs(conf);
 }
Пример #4
0
 @Test
 public void testCheckMandatoryConfsValidValues() throws HIHOException {
   String[] args =
       new String[] {
         "-inputPath",
         "input",
         "-url",
         "jdbc:mysql://localhost:3306/hiho",
         "-userName",
         "root",
         "-password",
         "newpwd",
         "-querySuffix",
         "mrTest fields terminated by ','"
       };
   ExportToMySQLDB exportToMySQLDB = new ExportToMySQLDB();
   Configuration conf = new Configuration();
   exportToMySQLDB.populateConfiguration(args, conf);
   exportToMySQLDB.checkMandatoryConfs(conf);
 }