[Mulgara-svn] r511 - branches/nw-interface/src/jar/itql/java/org/mulgara/itql

pag at mulgara.org pag at mulgara.org
Fri Nov 2 21:16:45 UTC 2007


Author: pag
Date: 2007-11-02 15:16:44 -0600 (Fri, 02 Nov 2007)
New Revision: 511

Modified:
   branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBeanUnitTest.java
Log:
Minor formatting cleanups

Modified: branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBeanUnitTest.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBeanUnitTest.java	2007-11-02 21:15:45 UTC (rev 510)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBeanUnitTest.java	2007-11-02 21:16:44 UTC (rev 511)
@@ -82,32 +82,19 @@
   // Members
   //
 
-  /**
-   * the category to send logging info to
-   *
-   */
-  private static Category log =
-      Category.getInstance(ItqlInterpreterBeanUnitTest.class.getName());
+  /** The category to send logging info to */
+  private static Category log = Category.getInstance(ItqlInterpreterBeanUnitTest.class.getName());
 
-  /**
-   * Description of the Field
-   *
-   */
+  /** Description of the Field */
   private ItqlInterpreterBean bean = null;
 
-  /**
-   * host name of server
-   */
+  /** host name of server */
   private static String hostName = System.getProperty("host.name");
 
-  /**
-   * an example model
-   */
+  /** an example model */
   private static String testModel = "rmi://" + hostName + "/server1#itqlmodel";
 
-  /**
-   * Data directory for test files
-   */
+  /** Data directory for test files */
   private static String dataDirectory = System.getProperty("cvs.root") + "/data";
 
   static {
@@ -116,16 +103,9 @@
     }
   }
 
-  /**
-   * a temp directory location
-   */
+  /** a temp directory location */
   private static File tmpDirectory = TempDir.getTempDir();
 
-  /**
-   * location of test directory
-   */
-  private static String testDir = System.getProperty("test.dir");
-
   //
   // Public API
   //
@@ -142,17 +122,11 @@
 
     // load the logging configuration
     try {
-
-      DOMConfigurator.configure(System.getProperty("cvs.root") +
-          "/log4j-conf.xml");
+      DOMConfigurator.configure(System.getProperty("cvs.root") + "/log4j-conf.xml");
+    } catch (FactoryConfigurationError fce) {
+      log.error("Unable to configure logging service from XML configuration file");
     }
-    catch (FactoryConfigurationError fce) {
 
-      log.error("Unable to configure logging service from XML configuration " +
-          "file");
-    }
-
-    // try-catch
   }
 
   /**
@@ -193,7 +167,7 @@
    * The main program for the ItqlInterpreterBeanUnitTest class
    *
    * @param args The command line arguments
-   * @throws Exception EXCEPTION TO DO
+   * @throws Exception General catch-all for exceptions thrown during the entire test suite
    */
   public static void main(String[] args) throws Exception {
 
@@ -222,7 +196,7 @@
   /**
    * A unit test for JUnit
    *
-   * @throws Exception EXCEPTION TO DO
+   * @throws Exception General catch-all for exceptions thrown during the test
    */
   public void testQuery2() throws Exception {
 
@@ -237,7 +211,7 @@
   /**
    * A unit test for JUnit
    *
-   * @throws Exception EXCEPTION TO DO
+   * @throws Exception General catch-all for exceptions thrown during the test
    */
   public void testQuery3() throws Exception {
 
@@ -271,7 +245,7 @@
    * A unit test for JUnit. Tests that an Answer can be obtained and
    * iterated over and reset multiple times.
    *
-   * @throws Exception EXCEPTION TO DO
+   * @throws Exception General catch-all for exceptions thrown during the test
    */
   public void testAnswerIteration() throws Exception {
 
@@ -327,17 +301,16 @@
   }
 
   /**
-   * METHOD TO DO
+   * Performs a query over the SOAP interface
    *
-   * @param query PARAMETER TO DO
-   * @return RETURNED VALUE TO DO
-   * @throws Exception EXCEPTION TO DO
+   * @param query The TQL query to execute over the interface.
+   * @return The XML response to the call, as a string.
+   * @throws Exception General catch-all for exceptions thrown during the call
    */
   public String executeSoapCall(String query) throws Exception {
 
     //URL url = new URL("http://" + hostName + ":8080/soap/servlet/rpcrouter");
-    URL url = new URL("http://" + hostName +
-        ":8080/webservices/services/ItqlBeanService");
+    URL url = new URL("http://" + hostName + ":8080/webservices/services/ItqlBeanService");
 
     // Build the call.
     Call call = new Call();
@@ -347,7 +320,7 @@
     //call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);
     call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
 
-    Vector params = new Vector();
+    Vector<Parameter> params = new Vector<Parameter>();
     params.addElement(new Parameter("queryString", String.class, query,
         Constants.NS_URI_SOAP_ENC));
     call.setParams(params);
@@ -367,8 +340,7 @@
           " Fault String = " + fault.getFaultString());
 
       return fault.getFaultCode() + " - " + fault.getFaultString();
-    }
-    else {
+    } else {
 
       Parameter result = resp.getReturnValue();
 
@@ -424,8 +396,7 @@
     // execute the load remotely
     long statements = bean.load(null, sourceURI, modelURI);
 
-    this.assertEquals("Incorrect number of statements inserted", 146,
-        statements);
+    assertEquals("Incorrect number of statements inserted", 146, statements);
   }
 
   // testLoadApi1()
@@ -456,8 +427,7 @@
     long statements = bean.load(inputStream,
         sourceURI, modelURI);
 
-    this.assertEquals("Incorrect number of statements inserted", 146,
-        statements);
+    assertEquals("Incorrect number of statements inserted", 146, statements);
 
     inputStream.close();
 
@@ -484,8 +454,7 @@
     long statements = bean.load(sourceURI.toURL().openStream(),
         dummyURI, modelURI);
 
-    this.assertEquals("Incorrect number of statements inserted", 146,
-        statements);
+    assertEquals("Incorrect number of statements inserted", 146, statements);
 
   }
 
@@ -506,8 +475,7 @@
     long statements = bean.load(sourceURI.toURL().openStream(),
         modelURI);
 
-    this.assertEquals("Incorrect number of statements inserted", 146,
-        statements);
+    assertEquals("Incorrect number of statements inserted", 146, statements);
 
   }
 
@@ -527,8 +495,7 @@
     // execute the load locally
     long statements = bean.load(source, modelURI);
 
-    this.assertEquals("Incorrect number of statements inserted", 1482,
-        statements);
+    assertEquals("Incorrect number of statements inserted", 1482, statements);
 
   }
 
@@ -548,8 +515,7 @@
     // execute the load locally
     long statements = bean.load(source, modelURI);
 
-    this.assertEquals("Incorrect number of statements inserted", 103,
-        statements);
+    assertEquals("Incorrect number of statements inserted", 103, statements);
 
   }
 
@@ -570,13 +536,12 @@
 
     // execute the load locally
     try {
-      long statements = bean.load(source, modelURI);
-    }
-    catch (QueryException ex) {
+      bean.load(source, modelURI);
+    } catch (QueryException ex) {
       badFile = true;
     }
 
-    this.assertTrue("Excepting a bad file", badFile);
+    assertTrue("Excepting a bad file", badFile);
 
   }
 
@@ -596,7 +561,7 @@
     // execute the load locally
     long statements = bean.load(source, modelURI);
 
-    this.assertEquals("Incorrect number of statements inserted", 99, statements);
+    assertEquals("Incorrect number of statements inserted", 99, statements);
 
   }
 
@@ -618,8 +583,7 @@
       // execute the load locally
       long statements = bean.load(source, modelURI);
 
-      this.assertEquals("Incorrect number of statements inserted", 512,
-          statements);
+      assertEquals("Incorrect number of statements inserted", 512, statements);
     } catch (Exception exception) {
 
       exception.printStackTrace();
@@ -645,7 +609,7 @@
 
     bean.backup(modelURI, file);
 
-    this.assertTrue("Excepting a backup file", file.exists());
+    assertTrue("Excepting a backup file", file.exists());
 
   }
 
@@ -667,7 +631,7 @@
 
     bean.backup(serverURI, file);
 
-    this.assertTrue("Excepting a backup file", file.exists());
+    assertTrue("Excepting a backup file", file.exists());
 
   }
 
@@ -689,7 +653,7 @@
 
     bean.backup(modelURI, new FileOutputStream(file));
 
-    this.assertTrue("Excepting a backup file", file.exists());
+    assertTrue("Excepting a backup file", file.exists());
 
   }
 
@@ -711,7 +675,7 @@
 
     bean.backup(serverURI, new FileOutputStream(file));
 
-    this.assertTrue("Excepting a backup file", file.exists());
+    assertTrue("Excepting a backup file", file.exists());
 
   }
 
@@ -773,23 +737,23 @@
 
     // select the statement
     Answer answer = bean.executeQuery(select);
-    this.assertTrue("Excepting a answer before restore", answer != null);
-    this.assertTrue("Excepting a single result and found :" +
+    assertTrue("Excepting a answer before restore", answer != null);
+    assertTrue("Excepting a single result and found :" +
         answer.getRowCount(), (answer.getRowCount() == 3));
 
     //backup the server
     File file = new File(tmpDirectory, "roundtrip.gz");
     file.delete();
     bean.backup(serverURI, new FileOutputStream(file));
-    this.assertTrue("Excepting a backup file", file.exists());
+    assertTrue("Excepting a backup file", file.exists());
 
     // restore the server
     bean.restore(file.toURL().openStream(), serverURI);
 
     // select the statement
     answer = bean.executeQuery(select);
-    this.assertTrue("Excepting a answer after restore", answer != null);
-    this.assertTrue("Excepting a single result and found :" +
+    assertTrue("Excepting a answer after restore", answer != null);
+    assertTrue("Excepting a single result and found :" +
         answer.getRowCount(), (answer.getRowCount() == 3));
 
   }
@@ -836,13 +800,14 @@
         assertTrue("Failed to query system model", answer.getRowCount() > 0);
         answer.close();
 
-      }
-      catch (Exception ex) {
+      } catch (Exception ex) {
         log.error("Failed to create/query the " + count + " ItqlInterpreterBean", ex);
+        System.err.println("Failed to create/query the " + count + " ItqlInterpreterBean");
+        System.err.println("Exception: " + ex.getMessage());
+        ex.printStackTrace();
         assertTrue("Failed to create/query the " + count + " ItqlInterpreterBean", false);
         break;
-      }
-      finally {
+      } finally {
         bean.close();
       }
     }
@@ -875,8 +840,7 @@
     if (bean != null) {
       try {
         bean.close();
-      }
-      finally {
+      } finally {
         bean = null;
       }
     }




More information about the Mulgara-svn mailing list