[Ds-java-dev] svn commit r17511 -
trunk/solutions/data-services/java/modules/core/src/test/java/org/wso2/ws/dataservice/test
sumedha at wso2.com
sumedha at wso2.com
Wed May 28 05:28:16 PDT 2008
Author: sumedha
Date: Wed May 28 05:28:16 2008
New Revision: 17511
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=17511
Log:
Added a test to check insert with not return element
Modified:
trunk/solutions/data-services/java/modules/core/src/test/java/org/wso2/ws/dataservice/test/DataServiceBaseTestCase.java
trunk/solutions/data-services/java/modules/core/src/test/java/org/wso2/ws/dataservice/test/MySQLDataSourceTest.java
Modified: trunk/solutions/data-services/java/modules/core/src/test/java/org/wso2/ws/dataservice/test/DataServiceBaseTestCase.java
URL: http://wso2.org/svn/browse/wso2/trunk/solutions/data-services/java/modules/core/src/test/java/org/wso2/ws/dataservice/test/DataServiceBaseTestCase.java?rev=17511&r1=17510&r2=17511&view=diff
==============================================================================
--- trunk/solutions/data-services/java/modules/core/src/test/java/org/wso2/ws/dataservice/test/DataServiceBaseTestCase.java (original)
+++ trunk/solutions/data-services/java/modules/core/src/test/java/org/wso2/ws/dataservice/test/DataServiceBaseTestCase.java Wed May 28 05:28:16 2008
@@ -6,8 +6,8 @@
public class DataServiceBaseTestCase extends TestCase {
protected UtilServer utilServer = null;
- protected String repository = "/home/sumedha/projects/solutions/data-services/java/modules/core/target/repository";
- protected String axis2Conf = "/home/sumedha/projects/solutions/data-services/java/modules/core/src/test/resources/axis2.xml";
+ protected String repository = "./target/repository";
+ protected String axis2Conf = "./src/test/resources/axis2.xml";
protected String epr = "http://localhost:5555/axis2/services/";
protected void setUp() throws Exception {
Modified: trunk/solutions/data-services/java/modules/core/src/test/java/org/wso2/ws/dataservice/test/MySQLDataSourceTest.java
URL: http://wso2.org/svn/browse/wso2/trunk/solutions/data-services/java/modules/core/src/test/java/org/wso2/ws/dataservice/test/MySQLDataSourceTest.java?rev=17511&r1=17510&r2=17511&view=diff
==============================================================================
--- trunk/solutions/data-services/java/modules/core/src/test/java/org/wso2/ws/dataservice/test/MySQLDataSourceTest.java (original)
+++ trunk/solutions/data-services/java/modules/core/src/test/java/org/wso2/ws/dataservice/test/MySQLDataSourceTest.java Wed May 28 05:28:16 2008
@@ -30,7 +30,8 @@
/**
* @doc : exposes single mysql table as a service,
- * no parameters
+ * no parameters.Generates a response based on a
+ * select query
*/
public void testSingleTableNoParams() {
String endPointUrl = epr + "MySQLService";
@@ -39,7 +40,7 @@
System.out.println("###########################################");
EndpointReference targetEPR = new EndpointReference(endPointUrl);
try {
- OMElement payload = getPayload();
+ OMElement payload = getSelectPayload();
Options options = new Options();
options.setTo(targetEPR);
options.setAction("urn:results1");
@@ -55,7 +56,11 @@
assertTrue(true);
}
- private static OMElement getPayload() {
+ /**
+ *
+ * @doc : payload for SELECT service call
+ */
+ private static OMElement getSelectPayload() {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace(
"http://example1.org/example1", "example1");
@@ -63,4 +68,66 @@
return method;
}
+ /**
+ * @doc : Inserts a record to mysql table.The operation
+ * on database does not return any value. Objective of this
+ * test is to check the behavior when there is not response.
+ * (Result element should not be defined on Query element)
+ */
+ public void testInsertNoReturn() {
+ String endPointUrl = epr + "MySQLService";
+ System.out.println("###########################################");
+ System.out.println("Testing service : "+endPointUrl);
+ System.out.println("###########################################");
+ EndpointReference targetEPR = new EndpointReference(endPointUrl);
+ try {
+ OMElement payload = getInsertPayload();
+ Options options = new Options();
+ options.setTo(targetEPR);
+ options.setAction("urn:insert");
+ long timeOut = 3 * 60 * 1000;
+ options.setTimeOutInMilliSeconds(timeOut);
+
+ ServiceClient sender = new ServiceClient();
+ sender.setOptions(options);
+ sender.sendReceive(payload);
+ //OMElement result = sender.sendReceive(payload);
+ //XMLPrettyPrinter.prettify(result, System.out);
+ //assertNotNull(result);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ assertTrue(true);
+ }
+
+ /**
+ *
+ * @doc : payload for INSERT service call
+ */
+ private static OMElement getInsertPayload() {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace omNs = fac.createOMNamespace(
+ "http://example1.org/example1", "example1");
+ OMElement method = fac.createOMElement("insert", omNs);
+
+ OMElement param1 = fac.createOMElement("id", omNs);
+ param1.setText("5");
+ OMElement param2 = fac.createOMElement("name", omNs);
+ param2.setText("Dutugemunu");
+ OMElement param3 = fac.createOMElement("deptId", omNs);
+ param3.setText("1");
+ OMElement param4 = fac.createOMElement("address", omNs);
+ param4.setText("Anuradhapura");
+ OMElement param5 = fac.createOMElement("email", omNs);
+ param5.setText("dutu at gemunu.org");
+
+ method.addChild(param1);
+ method.addChild(param2);
+ method.addChild(param3);
+ method.addChild(param4);
+ method.addChild(param5);
+ return method;
+ }
+
}
More information about the Ds-java-dev
mailing list