asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "abdullah alamoudi (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: Remove Unnecessary Prints in Tests
Date Tue, 23 Feb 2016 08:31:04 GMT
abdullah alamoudi has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/655

Change subject: Remove Unnecessary Prints in Tests
......................................................................

Remove Unnecessary Prints in Tests

Change-Id: I4def109c0a8b40343d59d5689f8a791249174478
---
M asterix-external-data/src/main/java/org/apache/asterix/external/util/TweetGenerator.java
M asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdToADMTest.java
M asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdUnitTest.java
M asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdUnitTester.java
M asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/FunctionalTester.java
5 files changed, 104 insertions(+), 120 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/55/655/1

diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/util/TweetGenerator.java
b/asterix-external-data/src/main/java/org/apache/asterix/external/util/TweetGenerator.java
index d4e63ad..3670368 100644
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/util/TweetGenerator.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/util/TweetGenerator.java
@@ -68,7 +68,6 @@
 
     private void writeTweetString(TweetMessage tweetMessage) throws IOException {
         String tweet = tweetMessage.getAdmEquivalent(fields) + "\n";
-        System.out.println(tweet);
         tweetCount++;
         byte[] b = tweet.getBytes();
         if (outputBuffer.position() + b.length > outputBuffer.limit()) {
diff --git a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdToADMTest.java
b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdToADMTest.java
index 92c6ba1..926c40e 100644
--- a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdToADMTest.java
+++ b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdToADMTest.java
@@ -80,22 +80,14 @@
                 int i = 0;
                 while (recordReader.hasNext()) {
                     i++;
-                    System.out.print("{ ");
                     val.clear();
                     IRawRecord<char[]> record = recordReader.next();
                     lexerSource.setNewSource(record.get());
                     parser.setLexerSource(lexerSource);
                     parser.parseNext(pAd);
-                    //System.out.println(pAd);
                     Map<CaseInsensitiveString, ExprTree> attrs = pAd.getAttrList();
-                    boolean notFirst = false;
                     for (Entry<CaseInsensitiveString, ExprTree> entry : attrs.entrySet())
{
-                        CaseInsensitiveString name = entry.getKey();
                         ExprTree tree = entry.getValue();
-                        if (notFirst) {
-                            System.out.print(", ");
-                        }
-                        notFirst = true;
                         switch (tree.getKind()) {
                             case ATTRREF_NODE:
                             case CLASSAD_NODE:
@@ -103,25 +95,15 @@
                             case EXPR_LIST_NODE:
                             case FN_CALL_NODE:
                             case OP_NODE:
-                                if (pAd.evaluateAttr(name.get(), val)) {
-                                    System.out.print("\"" + name + "Expr\":" + "\"expr="
+ tree + "\"");
-                                    System.out.print(", \"" + name + "\":" + val);
-                                } else {
-                                    System.out.print("\"" + name + "\":" + tree);
-                                }
                                 break;
                             case LITERAL_NODE:
-                                // No need to do anything
-                                System.out.print("\"" + name + "\":" + tree);
                                 break;
                             default:
                                 System.out.println("Something is wrong");
                                 break;
                         }
                     }
-                    System.out.println(" }");
                 }
-                System.out.println(i + " number of records found");
                 recordReader.close();
             }
         } catch (Exception e) {
diff --git a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdUnitTest.java
b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdUnitTest.java
index c74fd03..f972f45 100644
--- a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdUnitTest.java
+++ b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdUnitTest.java
@@ -53,7 +53,6 @@
         try {
             ClassAdUnitTester.test(args.length, args);
         } catch (IOException e) {
-            e.printStackTrace();
             assertTrue(false);
         }
         assertTrue(true);
diff --git a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdUnitTester.java
b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdUnitTester.java
index 561b541..2a68734 100644
--- a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdUnitTester.java
+++ b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdUnitTester.java
@@ -232,7 +232,7 @@
         if (parameters.checkAll || parameters.checkOperator) {
         }
         if (parameters.checkAll || parameters.checkCollection) {
-            //test_collection(parameters, results);
+            // test_collection(parameters, results);
         }
         if (parameters.checkAll || parameters.checkUtils) {
             testUtils(parameters, results);
@@ -329,7 +329,7 @@
         AMutableDouble r = new AMutableDouble(0);
         AMutableCharArrayString s = new AMutableCharArrayString();
         ClassAd c = new ClassAd();
-        //ExprList *l;
+        // ExprList *l;
 
         basic = parser.parseClassAd(input_basic);
 
@@ -395,7 +395,6 @@
                         haveSeconds = false;
                         haveOther = false;
                         for (String entry : refs) {
-                            System.out.println(entry);
                             if (entry.compareTo("other.Environment") == 0) {
                                 haveEnvironment = true;
                             } else if (entry.compareTo("other.Time") == 0) {
@@ -439,7 +438,7 @@
                 results);
 
         /* ----- Test chained ClassAds ----- */
-        //classad1 and classad2 from above test are used.
+        // classad1 and classad2 from above test are used.
         ClassAd classad3 = new ClassAd();
 
         classad1.chainToAd(classad2);
@@ -698,29 +697,31 @@
 
     /*
      * This one is deleted too since I don't think we need it
-    public static boolean check_in_view(ClassAdCollection collection, String view_name, String
classad_name) {
-        boolean have_view;
-        boolean in_view;
-
-        in_view = false;
-
-        LocalCollectionQuery query;
-
-        query.Bind(collection);
-
-        have_view = query.Query(view_name, null);
-        if (have_view) {
-            String classad_key;
-            for (query.ToFirst(), query.Current(classad_key); !query.IsAfterLast(); query.Next(classad_key))
{
-                if (!classad_key.compare(classad_name)) {
-                    in_view = true;
-                    break;
-                }
-            }
-        }
-        return in_view;
-    }
-    */
+     * public static boolean check_in_view(ClassAdCollection collection, String view_name,
String
+     * classad_name) {
+     * boolean have_view;
+     * boolean in_view;
+     * 
+     * in_view = false;
+     * 
+     * LocalCollectionQuery query;
+     * 
+     * query.Bind(collection);
+     * 
+     * have_view = query.Query(view_name, null);
+     * if (have_view) {
+     * String classad_key;
+     * for (query.ToFirst(), query.Current(classad_key); !query.IsAfterLast();
+     * query.Next(classad_key)) {
+     * if (!classad_key.compare(classad_name)) {
+     * in_view = true;
+     * break;
+     * }
+     * }
+     * }
+     * return in_view;
+     * }
+     */
 
     /*********************************************************************
      * Function: test_utils
diff --git a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/FunctionalTester.java
b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/FunctionalTester.java
index 88b7a32..fa0975f 100644
--- a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/FunctionalTester.java
+++ b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/FunctionalTester.java
@@ -145,7 +145,7 @@
             // Then we parse to see what the user wants.
             for (int argIndex = 1; argIndex < argc; argIndex++) {
                 if (argv[argIndex].equalsIgnoreCase("-d") || argv[argIndex].equalsIgnoreCase("-debug"))
{
-                    debug = true;
+                    debug = false;
                 } else if (argv[argIndex].equalsIgnoreCase("-v") || argv[argIndex].equalsIgnoreCase("-verbose"))
{
                     verbose = true;
                 } else {
@@ -558,9 +558,6 @@
                 } else {
                     variable = new Variable(variable_name.getStringValue(), value);
                     variables.put(variable_name.getStringValue(), variable);
-                    if (true) {
-                        System.out.println(variable_name.getStringValue() + " = " + value);
-                    }
                 }
             }
         }
@@ -757,39 +754,40 @@
      * @throws IOException
      *********************************************************************/
     /*
-    public static void handle_writexml(AMutableString line, State state, Parameters parameters)
throws IOException {
-    AMutableString filename = new AMutableString("");
-    ExprTree expr;
-    BufferedWriter xml_file;
-
-    if (get_file_name(line, filename, state, parameters)) {
-    if ((expr = get_expr(line, state, parameters)) != null) {
-    if (expr_okay_for_xml_file(expr, state, parameters)) {
-    xml_file = Files.newBufferedWriter(Paths.get(filename.getStringValue()));
-    ClassAdXMLUnParser unparser = new ClassAdXMLUnParser();
-    AMutableCharArrayString classad_text = new AMutableCharArrayString();
-    xml_file.write("<classads>\n");
-    if (expr.getKind() == NodeKind.CLASSAD_NODE) {
-    unparser.Unparse(classad_text, expr);
-    xml_file.write(classad_text.toString());
-    } else {
-    ExprList list = (ExprList) expr;
-    for (ExprTree classad : list.getExprList()) {
-    classad_text.setValue("");
-    unparser.Unparse(classad_text, classad);
-    xml_file.write(classad_text.toString());
-    xml_file.newLine();
-    }
-    }
-    xml_file.write("</classads>\n");
-    xml_file.close();
-    }
-    }
-    }
-    return;
-    }
-
-    *//*********************************************************************
+     * public static void handle_writexml(AMutableString line, State state, Parameters parameters)
+     * throws IOException {
+     * AMutableString filename = new AMutableString("");
+     * ExprTree expr;
+     * BufferedWriter xml_file;
+     * 
+     * if (get_file_name(line, filename, state, parameters)) {
+     * if ((expr = get_expr(line, state, parameters)) != null) {
+     * if (expr_okay_for_xml_file(expr, state, parameters)) {
+     * xml_file = Files.newBufferedWriter(Paths.get(filename.getStringValue()));
+     * ClassAdXMLUnParser unparser = new ClassAdXMLUnParser();
+     * AMutableCharArrayString classad_text = new AMutableCharArrayString();
+     * xml_file.write("<classads>\n");
+     * if (expr.getKind() == NodeKind.CLASSAD_NODE) {
+     * unparser.Unparse(classad_text, expr);
+     * xml_file.write(classad_text.toString());
+     * } else {
+     * ExprList list = (ExprList) expr;
+     * for (ExprTree classad : list.getExprList()) {
+     * classad_text.setValue("");
+     * unparser.Unparse(classad_text, classad);
+     * xml_file.write(classad_text.toString());
+     * xml_file.newLine();
+     * }
+     * }
+     * xml_file.write("</classads>\n");
+     * xml_file.close();
+     * }
+     * }
+     * }
+     * return;
+     * }
+     * 
+     *//*********************************************************************
       * Function: handle_readxml
       * Purpose:
       *
@@ -797,35 +795,36 @@
       *********************************************************************/
 
     /*
-    public static void handle_readxml(AMutableString line, State state, Parameters parameters)
throws IOException {
-    AMutableString variable_name = new AMutableString(null);
-    AMutableString file_name = new AMutableString(null);
-
-    if (get_variable_name(line, false, variable_name, state, parameters)) {
-    if (get_file_name(line, file_name, state, parameters)) {
-    InputStream xml_file = Files.newInputStream(Paths.get(file_name.getStringValue()));
-    ExprList list;
-    ClassAd classad;
-    ClassAdXMLParser parser = new ClassAdXMLParser();
-    Variable variable;
-
-    list = new ExprList();
-    do {
-    classad = parser.ParseClassAd(new InputStreamLexerSource(xml_file));
-    if (classad != null) {
-    list.add(classad);
-    }
-    } while (classad != null);
-    variable = new Variable(variable_name.getStringValue(), list);
-    variables.put(variable_name.getStringValue(), variable);
-    if (parameters.interactive) {
-    print_expr(list, state, parameters);
-    }
-    }
-    }
-    }
-
-    *//*********************************************************************
+     * public static void handle_readxml(AMutableString line, State state, Parameters parameters)
+     * throws IOException {
+     * AMutableString variable_name = new AMutableString(null);
+     * AMutableString file_name = new AMutableString(null);
+     * 
+     * if (get_variable_name(line, false, variable_name, state, parameters)) {
+     * if (get_file_name(line, file_name, state, parameters)) {
+     * InputStream xml_file = Files.newInputStream(Paths.get(file_name.getStringValue()));
+     * ExprList list;
+     * ClassAd classad;
+     * ClassAdXMLParser parser = new ClassAdXMLParser();
+     * Variable variable;
+     * 
+     * list = new ExprList();
+     * do {
+     * classad = parser.ParseClassAd(new InputStreamLexerSource(xml_file));
+     * if (classad != null) {
+     * list.add(classad);
+     * }
+     * } while (classad != null);
+     * variable = new Variable(variable_name.getStringValue(), list);
+     * variables.put(variable_name.getStringValue(), variable);
+     * if (parameters.interactive) {
+     * print_expr(list, state, parameters);
+     * }
+     * }
+     * }
+     * }
+     * 
+     *//*********************************************************************
       * Function: handle_echo
       * Purpose:
       *********************************************************************/
@@ -1066,13 +1065,17 @@
             PrettyPrint unparser = new PrettyPrint();
             unparser.unparse(output, tree);
         } else if (state.format == PrintFormat.print_XML) {/*
-                                                           ClassAdXMLUnParser unparser =
new ClassAdXMLUnParser();
-                                                           unparser.SetCompactSpacing(true);
-                                                           unparser.Unparse(output, tree);
-                                                           } else if (state.format == PrintFormat.print_XMLPretty)
{
-                                                           ClassAdXMLUnParser unparser =
new ClassAdXMLUnParser();
-                                                           unparser.SetCompactSpacing(false);
-                                                           unparser.Unparse(output, tree);*/
+                                                            * ClassAdXMLUnParser unparser
= new
+                                                            * ClassAdXMLUnParser();
+                                                            * unparser.SetCompactSpacing(true);
+                                                            * unparser.Unparse(output, tree);
+                                                            * } else if (state.format ==
+                                                            * PrintFormat.print_XMLPretty)
{
+                                                            * ClassAdXMLUnParser unparser
= new
+                                                            * ClassAdXMLUnParser();
+                                                            * unparser.SetCompactSpacing(false);
+                                                            * unparser.Unparse(output, tree);
+                                                            */
         }
         System.out.println(output);
     }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/655
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4def109c0a8b40343d59d5689f8a791249174478
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <bamousaa@gmail.com>

Mime
View raw message