File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
src/test/java/com/geckotechnology/mySqlDataCompare Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1111
1212public class AppTest extends TestCase
1313{
14+ private static final String MASTER_URL_NO_SCHEMA = "jdbc:mysql://localhost:3306?user=usertestA&password=password" ;
1415 private static final String MASTER_URL = "jdbc:mysql://localhost:3306/schema_a?user=usertestA&password=password" ;
1516 private static final String SLAVE_URL = "jdbc:mysql://localhost:3306/schema_b?user=usertestB&password=password" ;
1617
@@ -109,4 +110,21 @@ public void testCompareSchemaAndData() throws Exception
109110 assertTrue (tableDataComparer .getMasterTotalRetrievedRows () > 900000 );
110111 assertTrue (tableDataComparer .getSlaveTotalRetrievedRows () > 900000 );
111112 }
113+
114+ public void testURLWithoutSchema () {
115+ MySQLSchemaRetriever retriever = null ;
116+ try {
117+ retriever = new MySQLSchemaRetriever (MASTER_URL_NO_SCHEMA );
118+ retriever .openConnection ();
119+ retriever .retrieveMetaData ();
120+ fail ("MySQLSchemaRetriever should fail when there is no schema specified in URL" );
121+ } catch (Exception e ) {
122+ assertEquals (e .getMessage (), "Schema not defined in URL" );
123+ try {
124+ retriever .closeConnection ();
125+ } catch (Exception e1 ) {
126+ }
127+ }
128+ }
129+
112130}
You can’t perform that action at this time.
0 commit comments