You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2007/02/09 22:03:46 UTC

svn commit: r505502 - in /beehive/trunk/samples/system-controls-jdbc: ./ src/org/apache/beehive/samples/jdbc/control/ src/test/

Author: cschoett
Date: Fri Feb  9 13:03:45 2007
New Revision: 505502

URL: http://svn.apache.org/viewvc?view=rev&rev=505502
Log:
Minor cleanup for the jdbc system control sample.

Modified:
    beehive/trunk/samples/system-controls-jdbc/build.properties
    beehive/trunk/samples/system-controls-jdbc/build.xml
    beehive/trunk/samples/system-controls-jdbc/src/org/apache/beehive/samples/jdbc/control/EmployeeJdbcControl.java
    beehive/trunk/samples/system-controls-jdbc/src/org/apache/beehive/samples/jdbc/control/StoredProcedures.java
    beehive/trunk/samples/system-controls-jdbc/src/test/EmployeeJdbcControlTest.java

Modified: beehive/trunk/samples/system-controls-jdbc/build.properties
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/system-controls-jdbc/build.properties?view=diff&rev=505502&r1=505501&r2=505502
==============================================================================
--- beehive/trunk/samples/system-controls-jdbc/build.properties (original)
+++ beehive/trunk/samples/system-controls-jdbc/build.properties Fri Feb  9 13:03:45 2007
@@ -1,7 +1,5 @@
 #
 #
 #
-
-#beehive.home=../..
-beehive.home=/home/cschoett/beehive_alt/trunk/build/dist/apache-beehive-1.1-SNAPSHOT
-derby.jar=/home/cschoett/beehive_alt/trunk/external/derby/derby_46005.jar
+beehive.home=../..
+derby.jar=<location of derby jar file>

Modified: beehive/trunk/samples/system-controls-jdbc/build.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/system-controls-jdbc/build.xml?view=diff&rev=505502&r1=505501&r2=505502
==============================================================================
--- beehive/trunk/samples/system-controls-jdbc/build.xml (original)
+++ beehive/trunk/samples/system-controls-jdbc/build.xml Fri Feb  9 13:03:45 2007
@@ -63,7 +63,7 @@
     <target name="test" description="Run JUnit tests" depends="clean,build">
         <mkdir dir="${log.dir}"/>
 
-        <echo message="Web Service Control JUnit log files written to ${log.dir}"/>
+        <echo message="JUnit log files written to ${log.dir}"/>
         <junit printsummary="on" tempdir="${build.classes}" fork="yes">
             <classpath>
                 <path refid="build.classpath"/>

Modified: beehive/trunk/samples/system-controls-jdbc/src/org/apache/beehive/samples/jdbc/control/EmployeeJdbcControl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/system-controls-jdbc/src/org/apache/beehive/samples/jdbc/control/EmployeeJdbcControl.java?view=diff&rev=505502&r1=505501&r2=505502
==============================================================================
--- beehive/trunk/samples/system-controls-jdbc/src/org/apache/beehive/samples/jdbc/control/EmployeeJdbcControl.java (original)
+++ beehive/trunk/samples/system-controls-jdbc/src/org/apache/beehive/samples/jdbc/control/EmployeeJdbcControl.java Fri Feb  9 13:03:45 2007
@@ -51,14 +51,14 @@
     public Employee getEmployee(int employeeId);
 
     /**
-     * Is the employee id value (i.e. is it assigned to an employee in the db?).
+     * Has a employee id already been assigned to an employee in the database?
      * This method invokes a Derby stored procedure, the first parameter to that
      * procedure is the employee id, the second is an out parameter of type string.
      *
      * @param params SQLParameter list.
      */
-    @JdbcControl.SQL(statement="{call isValidIdStoredProc(?,?)}")
-    public void isValidId(JdbcControl.SQLParameter[] params);
+    @JdbcControl.SQL(statement="{call isIdAssignedStoredProc(?,?)}")
+    public void isIdAssigned(JdbcControl.SQLParameter[] params);
 
     /**
      * Use a custom result set mapper to transform a row from the employee db into
@@ -68,6 +68,6 @@
      * @return AddressLabel bean, null if employee id does not exist in table.
      */
     @JdbcControl.SQL(statement="SELECT * FROM employee WHERE employeeid={employeeId}",
-                     resultSetMapper= CustomEmployeeMapper.class)
+                     resultSetMapper=CustomEmployeeMapper.class)
     public AddressLabel getEmployeeAddressLabel(int employeeId);
 }

Modified: beehive/trunk/samples/system-controls-jdbc/src/org/apache/beehive/samples/jdbc/control/StoredProcedures.java
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/system-controls-jdbc/src/org/apache/beehive/samples/jdbc/control/StoredProcedures.java?view=diff&rev=505502&r1=505501&r2=505502
==============================================================================
--- beehive/trunk/samples/system-controls-jdbc/src/org/apache/beehive/samples/jdbc/control/StoredProcedures.java (original)
+++ beehive/trunk/samples/system-controls-jdbc/src/org/apache/beehive/samples/jdbc/control/StoredProcedures.java Fri Feb  9 13:03:45 2007
@@ -28,14 +28,14 @@
 public final class StoredProcedures {
 
     /**
-     * Check the employee ID to determine if it is valid.
+     * Check the employee ID to determine if it has already been assigned to an employee.
      *
      * @param employeeId id to check, IN parameter.
      * @param isValidId  OUT parameter, contains a value of "true" or "false".
      * @throws SQLException If SQL error.
      * @throws ClassNotFoundException If jdbc driver class cannot be found.
      */
-    public static void isValidIdStoredProc(int employeeId, String[] isValidId)
+    public static void isIdAssignedStoredProc(int employeeId, String[] isValidId)
             throws ClassNotFoundException, SQLException
     {
         Class.forName("org.apache.derby.jdbc.EmbeddedDriver");

Modified: beehive/trunk/samples/system-controls-jdbc/src/test/EmployeeJdbcControlTest.java
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/system-controls-jdbc/src/test/EmployeeJdbcControlTest.java?view=diff&rev=505502&r1=505501&r2=505502
==============================================================================
--- beehive/trunk/samples/system-controls-jdbc/src/test/EmployeeJdbcControlTest.java (original)
+++ beehive/trunk/samples/system-controls-jdbc/src/test/EmployeeJdbcControlTest.java Fri Feb  9 13:03:45 2007
@@ -51,7 +51,7 @@
         Statement s = _con.createStatement();
         try {
             s.executeUpdate("DROP TABLE employee");
-            s.executeUpdate("DROP PROCEDURE isValidIdStoredProc");
+            s.executeUpdate("DROP PROCEDURE isIdAssignedStoredProc");
         }
         catch (Exception e) {
             // noop
@@ -60,11 +60,11 @@
         s.executeUpdate("CREATE TABLE employee (firstname VARCHAR(30), lastname VARCHAR(40), employeeid INT, address VARCHAR(120), city VARCHAR(40), state VARCHAR(10), zip VARCHAR(10))");
         s.executeUpdate("INSERT INTO employee VALUES('Jane', 'Doe', 2, '3433 Any Place', 'Denver', 'CO', '80201')");
 
-        s.executeUpdate("CREATE PROCEDURE isValidIdStoredProc(IN id INT, OUT isValid VARCHAR(5)) " +
+        s.executeUpdate("CREATE PROCEDURE isIdAssignedStoredProc(IN id INT, OUT isValid VARCHAR(5)) " +
                 "PARAMETER STYLE JAVA " +
                 "READS SQL DATA " +
                 "LANGUAGE JAVA " +
-                "EXTERNAL NAME 'org.apache.beehive.samples.jdbc.control.StoredProcedures.isValidIdStoredProc'");
+                "EXTERNAL NAME 'org.apache.beehive.samples.jdbc.control.StoredProcedures.isIdAssignedStoredProc'");
     }
 
     /**
@@ -112,14 +112,14 @@
      * Parameters are passed to the stored procedure in an array
      * of JdbcControl.SQLParameter instances.
      */
-    public void testStoredProcedure1() throws Exception {
+    public void testIsIdAssignedPositive() throws Exception {
         _employeeJdbc.setConnection(_con);
 
         JdbcControl.SQLParameter[] params = new JdbcControl.SQLParameter[2];
         params[0] = new JdbcControl.SQLParameter(2, Types.INTEGER, JdbcControl.SQLParameter.IN);
         params[1] = new JdbcControl.SQLParameter(new String(), Types.VARCHAR, JdbcControl.SQLParameter.OUT);
 
-        _employeeJdbc.isValidId(params);
+        _employeeJdbc.isIdAssigned(params);
         assertEquals("true", params[1].value);
     }
 
@@ -128,21 +128,21 @@
      * Parameters are passed to the stored procedure in an array
      * of JdbcControl.SQLParameter instances.
      */
-    public void testStoredProcedure2() throws Exception {
+    public void testIsIdAssignedNegative() throws Exception {
         _employeeJdbc.setConnection(_con);
 
         JdbcControl.SQLParameter[] params = new JdbcControl.SQLParameter[2];
         params[0] = new JdbcControl.SQLParameter(8, Types.INTEGER, JdbcControl.SQLParameter.IN);
         params[1] = new JdbcControl.SQLParameter(new String(), Types.VARCHAR, JdbcControl.SQLParameter.OUT);
 
-        _employeeJdbc.isValidId(params);
+        _employeeJdbc.isIdAssigned(params);
         assertEquals("false", params[1].value);
     }
 
     /**
      * Test a JDBC control method which uses a custom result set mapper.
      */
-    public void testCustomMapper() throws Exception {
+    public void testEmployeeAddressLabel() throws Exception {
         _employeeJdbc.setConnection(_con);
         AddressLabel al = _employeeJdbc.getEmployeeAddressLabel(2);