@@ -41,6 +41,8 @@ public class SlicingDiceTester {
4141
4242 private boolean perTestInsertion ;
4343
44+ private boolean insertSqlData ;
45+
4446 public SlicingDiceTester (final String apiKey ) {
4547 this .client = new SlicingDice (apiKey );
4648 this .loadConfigTest ();
@@ -53,7 +55,7 @@ public SlicingDiceTester(final String apiKey, final boolean verbose) {
5355 }
5456
5557 private void loadConfigTest () {
56- this .sleepTime = 5 ;
58+ this .sleepTime = 10 ;
5759 this .path = "src/test/java/com/slicingdice/jslicer/examples/" ;
5860 this .fileExtension = ".json" ;
5961 this .numberOfSuccesses = 0 ;
@@ -71,7 +73,7 @@ public void runTests(final String queryType) throws ExecutionException, Interrup
7173 final int numberOfTests = testData .length ();
7274
7375 this .perTestInsertion = testData .getJSONObject (0 ).has ("insert" );
74- if (!this .perTestInsertion ) {
76+ if (!this .perTestInsertion && this . insertSqlData ) {
7577 final JSONArray insertionData = this .loadInsertionData (queryType );
7678 for (final Object insertCommand : insertionData ) {
7779 this .client .insert ((JSONObject ) insertCommand ).get ();
@@ -190,13 +192,13 @@ private void createColumns(final JSONObject columnObject) {
190192 * @param column the column to put timestamp
191193 */
192194 private void addTimestampToColumnName (final JSONObject column ) {
193- final String oldName = "\" " + column .getString ("api-name" );
195+ final String oldName = "\" " + column .getString ("api-name" ) + " \" " ;
194196
195197 final String timestamp = this .getTimestamp ();
196198 column .put ("name" , column .get ("name" ) + timestamp );
197199 column .put ("api-name" , column .get ("api-name" ) + timestamp );
198200
199- final String newName = "\" " + column .getString ("api-name" );
201+ final String newName = "\" " + column .getString ("api-name" ) + " \" " ;
200202 this .columnTranslation .put (oldName , newName );
201203 }
202204
@@ -365,8 +367,13 @@ private void compareResult(final JSONObject expectedObject, final String queryTy
365367
366368 System .out .println (String .format ("\t Expected: \" %1$s\" : %2$s" , keyStr ,
367369 expected .getJSONObject (keyStr ).toString ()));
368- System .out .println (String .format ("\t Result: \" %1$s\" : %2$s" , keyStr ,
369- result .getJSONObject (keyStr ).toString ()));
370+ try {
371+ System .out .println (String .format ("\t Result: \" %1$s\" : %2$s" , keyStr ,
372+ result .getJSONObject (keyStr ).toString ()));
373+ } catch (final Exception e ) {
374+ System .out .println (String .format ("\t Result: \" %1$s\" : %2$s" , keyStr ,
375+ e .getMessage ()));
376+ }
370377 System .out .println ("\t Status: Failed\n " );
371378 return ;
372379 } else {
@@ -403,7 +410,7 @@ private boolean testSecondTime(final JSONObject expectedObject, final String que
403410 System .out .println ("\t Status: Passed\n " );
404411 return true ;
405412 }
406- } catch (ExecutionException | InterruptedException e ) {
413+ } catch (final Exception e ) {
407414 e .printStackTrace ();
408415 }
409416
@@ -497,7 +504,7 @@ private boolean compareJsonValue(final Object valueExpected, final Object valueG
497504 }
498505 return true ;
499506 }
500- } catch (final ClassCastException e ) {
507+ } catch (final Exception e ) {
501508 return false ;
502509 }
503510
0 commit comments