sqoop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cheolsoo Park" <cheol...@cloudera.com>
Subject Review Request: Use regular expression to verify output in compatibility tests
Date Thu, 01 Mar 2012 07:26:00 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/4122/
-----------------------------------------------------------

Review request for Sqoop and Bilung Lee.


Summary
-------

One of OracleCompatTest tests (timestamp2) fails w/ Oracle 11g XE. The problem is that the
verifyReadback function in testutil does string comparison to verify output, but the output
string does not exactly match with any of expected values.

- Add an additional boolean parameter useRegExp to verifyReadback().
- If useRegExp is true, pattern matching is used rather than string comparison.
- Eliminate try-catch blocks for multiple string comparisons by using regular expressions.


This addresses bug SQOOP-449.
    https://issues.apache.org/jira/browse/SQOOP-449


Diffs
-----

  ./src/test/com/cloudera/sqoop/TestMultiCols.java 1295224 
  ./src/test/com/cloudera/sqoop/manager/OracleCompatTest.java 1295224 
  ./src/test/com/cloudera/sqoop/testutil/BaseSqoopTestCase.java 1295224 
  ./src/test/com/cloudera/sqoop/testutil/ManagerCompatTestCase.java 1295224 

Diff: https://reviews.apache.org/r/4122/diff


Testing
-------

In addition to 'ant test' and 'ant test -Dthirdparty=true', I also verified that my regular
expressions match the previous string values that I replaced:

System.out.println(Pattern.matches("2009-[0]?4-24 18:24:[0]+\\.[ ]*[0]*2[0]*", "2009-4-24
18:24:0. 200000"));
System.out.println(Pattern.matches("2009-[0]?4-24 18:24:[0]+\\.[ ]*[0]*2[0]*", "2009-04-24
18:24:00.2"));
System.out.println(Pattern.matches("2009-[0]?4-24 18:24:[0]+\\.[ ]*[0]*2[0]*", "2009-04-24
18:24:00.0002"));

System.out.println(Pattern.matches("2009-[0]?4-24 18:24:[0]+[\\.[ ]*[0]+]*", "2009-4-24 18:24:0.
0"));
System.out.println(Pattern.matches("2009-[0]?4-24 18:24:[0]+[\\.[ ]*[0]+]*", "2009-04-24 18:24:00"));

System.out.println(Pattern.matches("2009-[0]?1-12 00:00:00[\\.[ ]*[0]+]*", "2009-01-12 00:00:00.0"));
System.out.println(Pattern.matches("2009-[0]?1-12 00:00:00[\\.[ ]*[0]+]*", "2009-01-12 00:00:00"));

System.out.println(Pattern.matches("2009-[0]?4-24 00:00:00[\\.[ ]*[0]+]*", "2009-04-24 00:00:00.0"));
System.out.println(Pattern.matches("2009-[0]?4-24 00:00:00[\\.[ ]*[0]+]*", "2009-04-24 00:00:00"));


Thanks,

Cheolsoo


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message