Beispiel #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));
  }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
 }