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 11
11
12
12
public class AppTest extends TestCase
13
13
{
14
+ private static final String MASTER_URL_NO_SCHEMA = "jdbc:mysql://localhost:3306?user=usertestA&password=password" ;
14
15
private static final String MASTER_URL = "jdbc:mysql://localhost:3306/schema_a?user=usertestA&password=password" ;
15
16
private static final String SLAVE_URL = "jdbc:mysql://localhost:3306/schema_b?user=usertestB&password=password" ;
16
17
@@ -109,4 +110,21 @@ public void testCompareSchemaAndData() throws Exception
109
110
assertTrue (tableDataComparer .getMasterTotalRetrievedRows () > 900000 );
110
111
assertTrue (tableDataComparer .getSlaveTotalRetrievedRows () > 900000 );
111
112
}
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
+
112
130
}
You can’t perform that action at this time.
0 commit comments