Author: mmerz
Date: Wed Nov 3 13:50:32 2004
New Revision: 56530
Added:
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/client-tests/
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/client-tests/org/
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/client-tests/org/apache/
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/client-tests/org/apache/beehive/
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/client-tests/org/apache/beehive/EmployeeDB/
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/client-tests/org/apache/beehive/EmployeeDB/EmployeeWSTestCase.java
Modified:
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/client-build.xml
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample/EmployeeDBControl.jcx
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample/WSEmployee.java
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/src/web/Service.jws
Log:
Fix for BEEHIVE-57; added copyright notice to those files.
Modified:
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/client-build.xml
==============================================================================
---
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/client-build.xml
(original)
+++
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/client-build.xml
Wed Nov 3 13:50:32 2004
@@ -1,68 +1,74 @@
<?xml version="1.0" ?>
-<project name="AddressBookClient" basedir="." default="all">
+<project name="EmployeeWSClient" basedir="." default="all">
- <property name="AddressBook.wsdl.url"
- value="http://localhost:8080/EmployeeWS/web/Service.jws?wsdl" />
+ <property name="EmployeeWS.wsdl.url"
+ value="http://localhost:8080/EmployeeWS/web/Service.jws?wsdl" />
-
- <path id="jars">
- <fileset dir="lib">
- <include name="**/*.jar"/>
- </fileset>
- </path>
-
- <taskdef name="wsdl2java"
classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask"
- loaderref="axis" >
+ <path id="jars">
+ <fileset dir="lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ </path>
+
+ <taskdef name="wsdl2java"
+ classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask"
+ loaderref="axis">
<classpath refid="jars"/>
- </taskdef>
+ </taskdef>
-
- <target name="clean">
- <delete dir="build" />
- </target>
-
- <target name="dirs">
- <mkdir dir="build" />
- <mkdir dir="build/generated" />
- <mkdir dir="build/classes" />
-
- </target>
- <target name="all" depends="genClient, compile, test"/>
-
- <target name="genClient" depends="dirs">
- <wsdl2java url="${AddressBook.wsdl.url}"
- output="build/generated"
- testcase="yes">
- </wsdl2java>
+ <!-- targets -->
- </target>
+ <target name="all" depends="genClient,compile,test" />
- <target name="compile" depends="genClient">
- <javac srcdir="build/generated"
- destdir="build/classes"
- classpathref="jars"
- failonerror="true"
- source="1.4"
- />
-
- </target>
-
- <target name="test" depends="compile">
- <junit printsummary="yes" haltonfailure="yes" showoutput="yes">
- <classpath>
- <pathelement location= "build/classes"/>
- <path refid="jars"/>
- </classpath>
+ <target name="dirs">
+ <mkdir dir="build" />
+ <mkdir dir="build/generated" />
+ <mkdir dir="build/classes" />
+ <mkdir dir="logs" />
+ </target>
+ <target name="genClient" depends="dirs">
+ <echo>** generating client classes into build/generated **</echo>
+ <wsdl2java url="${EmployeeWS.wsdl.url}"
+ output="build/generated"
+ testcase="no">
+ </wsdl2java>
+ </target>
+
+ <target name="compile" depends="genClient">
+ <echo>** compiling generated classes **</echo>
+ <javac srcdir="build/generated"
+ destdir="build/classes"
+ classpathref="jars"
+ failonerror="true"
+ source="1.4"/>
+ </target>
+
+ <target name="test" depends="compile">
+ <echo>** junit logfiles written to logs **</echo>
+ <javac srcdir="client-tests"
+ destdir="build/classes"
+ classpathref="jars"
+ failonerror="true"
+ source="1.4" />
+ <junit printsummary="on" tempdir="." fork="yes">
+ <classpath>
+ <pathelement location= "build/classes"/>
+ <path refid="jars"/>
+ </classpath>
+ <formatter type="plain" />
+ <batchtest fork="yes" todir="logs">
+ <fileset dir="build/classes">
+ <include name="**/*Test*.class"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
- <batchtest fork="yes" todir=".">
- <fileset dir="build/classes">
- <include name="**/*Test*.class"/>
- </fileset>
- </batchtest>
- </junit>
-
- </target>
+ <target name="clean">
+ <delete dir="build" />
+ <delete dir="logs" />
+ </target>
-</project>
\ No newline at end of file
+</project>
Added:
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/client-tests/org/apache/beehive/EmployeeDB/EmployeeWSTestCase.java
==============================================================================
--- (empty file)
+++
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/client-tests/org/apache/beehive/EmployeeDB/EmployeeWSTestCase.java
Wed Nov 3 13:50:32 2004
@@ -0,0 +1,79 @@
+package org.apache.beehive.EmployeeDB;
+
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+public class EmployeeWSTestCase extends junit.framework.TestCase {
+ public EmployeeWSTestCase(java.lang.String name) {
+ super(name);
+ }
+
+ public void testServiceWSDL() throws Exception {
+ javax.xml.rpc.ServiceFactory serviceFactory =
javax.xml.rpc.ServiceFactory.newInstance();
+ java.net.URL url = new java.net.URL(new
org.apache.beehive.EmployeeDB.ServiceServiceLocator().getServiceAddress() +
"?WSDL");
+ javax.xml.rpc.Service service = serviceFactory.createService(url, new
org.apache.beehive.EmployeeDB.ServiceServiceLocator().getServiceName());
+ assertTrue(service != null);
+ }
+
+ public void testEmployeeDataBase() throws Exception {
+ org.apache.beehive.EmployeeDB.ServiceSoapBindingStub binding;
+ try {
+ binding = (org.apache.beehive.EmployeeDB.ServiceSoapBindingStub)
+ new
org.apache.beehive.EmployeeDB.ServiceServiceLocator().getService();
+ }
+ catch (javax.xml.rpc.ServiceException jre) {
+ if(jre.getLinkedCause()!=null)
+ jre.getLinkedCause().printStackTrace();
+ throw new junit.framework.AssertionFailedError("JAX-RPC
ServiceException caught: " + jre);
+ }
+ assertNotNull("binding is null", binding);
+
+ // Time out after a minute
+ binding.setTimeout(60000);
+
+ // Test creat table, add employee, delete employee, delete table.
+ try {
+ binding.createTable();
+
+ binding.insertEmployee(new
org.apache.beehive.sample.WSEmployee(100, "John", "Kerry", "Senator"));
+ org.apache.beehive.sample.WSEmployee employee = null;
+ employee = binding.selectEmployee(100);
+ assertTrue(employee.getFName().compareTo("John") == 0);
+ org.apache.beehive.sample.WSEmployee[] employees = null;
+ employees = binding.selectEmployees();
+ assertTrue(employees.length == 1);
+ binding.changeTitle(0, new java.lang.String());
+ binding.deleteEmployee(100);
+
+ binding.dropTable();
+
+ }
+ catch (org.apache.beehive.EmployeeDB.SQLException e1) {
+ throw new junit.framework.AssertionFailedError("SQLException
Exception caught: " + e1);
+ }
+ catch (org.apache.beehive.EmployeeDB.RemoteException e2) {
+ throw new junit.framework.AssertionFailedError("RemoteException
Exception caught: " + e2);
+ }
+
+ }
+
+
+
+
+
+}
Modified:
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample/EmployeeDBControl.jcx
==============================================================================
---
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample/EmployeeDBControl.jcx
(original)
+++
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample/EmployeeDBControl.jcx
Wed Nov 3 13:50:32 2004
@@ -1,20 +1,37 @@
package org.apache.beehive.sample;
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
import java.sql.SQLException;
import java.io.Serializable;
import java.util.Iterator;
import java.util.HashMap;
import org.apache.beehive.controls.api.bean.ControlExtension;
-import dbControl.*;
-
-
+import dbControl.DatabaseControl;
+import dbControl.DatabaseControl.ConnectionDataSource;
+import dbControl.DatabaseControl.SQL;
@ControlExtension
-//@ConnectionDataSource(jndiName="jdbc:derby:build/databaseControlTestDB;create=true")
[EMAIL PROTECTED](jndiName="jdbc:derby:build/databaseControlTestDB;create=true")
public interface EmployeeDBControl extends DatabaseControl
{
-
@SQL(statement="CREATE TABLE EMPLOYEE ( id INT PRIMARY KEY NOT NULL, " +
"fName VARCHAR(20), lName VARCHAR(20), title VARCHAR(15))")
public void createTable() throws SQLException;
@@ -24,11 +41,11 @@
@SQL(statement="INSERT INTO EMPLOYEE " +
"(id, fName, lName, title) " +
- "VALUES ({1}, {2}, {3}, {4})")
- public void insertEmployee(WSEmployee e) throws SQLException;
+ "VALUES ({emp.id}, {emp.fName}, {emp.lName}, {emp.title})")
+ public void insertEmployee(WSEmployee emp) throws SQLException;
- @SQL(statement="SELECT * FROM EMPLOYEE WHERE id={1}")
- public WSEmployee selectEmployee(int p_id) throws SQLException;
+ @SQL(statement="SELECT * FROM EMPLOYEE WHERE id={id}")
+ public WSEmployee selectEmployee(int id) throws SQLException;
@SQL(statement="SELECT * FROM EMPLOYEE ORDER BY id")
public WSEmployee[] selectEmployees() throws SQLException;
@@ -42,9 +59,9 @@
@SQL(statement="SELECT * FROM EMPLOYEE ORDER BY id", maxRows=1)
public WSEmployee[] selectOneEmployee() throws SQLException;
- @SQL(statement="UPDATE EMPLOYEE SET title = {2} WHERE id = {1}")
- public void changeTitle(int p_id, String p_title) throws SQLException;
+ @SQL(statement="UPDATE EMPLOYEE SET title = {title} WHERE id = {id}")
+ public void changeTitle(int id, String title) throws SQLException;
- @SQL(statement="DELETE FROM EMPLOYEE WHERE id = {1}")
- public void deleteEmployee(int p_id) throws SQLException;
+ @SQL(statement="DELETE FROM EMPLOYEE WHERE id = {id}")
+ public void deleteEmployee(int id) throws SQLException;
}
Modified:
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample/WSEmployee.java
==============================================================================
---
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample/WSEmployee.java
(original)
+++
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/src/org/apache/beehive/sample/WSEmployee.java
Wed Nov 3 13:50:32 2004
@@ -1,4 +1,23 @@
package org.apache.beehive.sample;
+
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
import java.io.Serializable;
public class WSEmployee implements Serializable
Modified:
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/src/web/Service.jws
==============================================================================
---
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/src/web/Service.jws
(original)
+++
incubator/beehive/branches/v1/alpha/samples/EmployeeWS/WEB-INF/src/web/Service.jws
Wed Nov 3 13:50:32 2004
@@ -1,5 +1,23 @@
package web;
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
import java.rmi.RemoteException;
import java.sql.SQLException;
import org.apache.beehive.controls.api.bean.Control;
@@ -14,7 +32,7 @@
import javax.jws.WebService;
/*
- * Web service to demonstrate integration of controls with drop in deploymnet.
+ * Sample for WSM/controls integration.
*/
@WebService( targetNamespace="http://beehive.apache.org/EmployeeDB")
public class Service {