sqoop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jiraposter@reviews.apache.org (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SQOOP-449) Use regular expression to verify output in compatibility tests
Date Thu, 01 Mar 2012 07:27:59 GMT

    [ https://issues.apache.org/jira/browse/SQOOP-449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219879#comment-13219879
] 

jiraposter@reviews.apache.org commented on SQOOP-449:
-----------------------------------------------------


-----------------------------------------------------------
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


                
> Use regular expression to verify output in compatibility tests
> --------------------------------------------------------------
>
>                 Key: SQOOP-449
>                 URL: https://issues.apache.org/jira/browse/SQOOP-449
>             Project: Sqoop
>          Issue Type: Test
>            Reporter: Cheolsoo Park
>            Assignee: Cheolsoo Park
>            Priority: Minor
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> 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.
> In fact, doing string comparison is problematic since newer versions of DBs/drivers may
have different output formats, and this test will be broken again. The better way to write
this test would be to use regular expression rather than string comparison. In addition, there
are several tests where the output string is compared against multiple expected values until
succeed. Using regular expression will eliminate multiple tries as well.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message