Author: jaz
Date: Tue Mar 27 12:57:25 2007 New Revision: 523057 URL: http://svn.apache.org/viewvc?view=rev&rev=523057 Log: added VERY simple xml-rpc test; however this does not work unless OFBiz is running on port 8080 Added: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java (with props) ofbiz/trunk/framework/webapp/testdef/ ofbiz/trunk/framework/webapp/testdef/webapptests.xml (with props) Modified: ofbiz/trunk/framework/webapp/ofbiz-component.xml Modified: ofbiz/trunk/framework/webapp/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/ofbiz-component.xml?view=diff&rev=523057&r1=523056&r2=523057 ============================================================================== --- ofbiz/trunk/framework/webapp/ofbiz-component.xml (original) +++ ofbiz/trunk/framework/webapp/ofbiz-component.xml Tue Mar 27 12:57:25 2007 @@ -21,11 +21,16 @@ <ofbiz-component name="webapp" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/ofbiz-component.xsd"> + <resource-loader name="main" type="component"/> + <classpath type="dir" location="config"/> <classpath type="dir" location="dtd"/> <classpath type="jar" location="lib/*"/> <classpath type="jar" location="build/lib/*"/> + <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup.xml"/> <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/> + + <test-suite loader="main" location="testdef/webapptests.xml"/> </ofbiz-component> Added: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java?view=auto&rev=523057 ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java (added) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java Tue Mar 27 12:57:25 2007 @@ -0,0 +1,67 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. + */ + +package org.ofbiz.webapp.test; + +import org.ofbiz.entity.GenericDelegator; +import org.ofbiz.service.GenericDispatcher; +import org.ofbiz.service.ModelService; +import org.ofbiz.service.LocalDispatcher; +import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; +import org.apache.xmlrpc.client.XmlRpcClient; + +import java.util.Map; +import java.net.URL; + +import junit.framework.TestCase; + +/** + * XmlRpcTests + */ +public class XmlRpcTests extends TestCase { + + public static final String module = XmlRpcTests.class.getName(); + protected LocalDispatcher dispatcher = null; + + public XmlRpcTests(String name) { + super(name); + } + + protected void setUp() throws Exception { + GenericDelegator delegator = GenericDelegator.getGenericDelegator("test"); + dispatcher = GenericDispatcher.getLocalDispatcher("test-dispatcher", delegator); + } + + protected void tearDown() throws Exception { + } + + public void testXmlRpcRequest() throws Exception { + XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); + config.setServerURL(new URL("http://localhost:8080/webtools/control/xmlrpc")); + config.setBasicUserName("admin"); + config.setBasicPassword("ofbiz"); + + XmlRpcClient client = new XmlRpcClient(); + client.setConfig(config); + + Object[] params = new Object[] { new Double(55.00), "message from xml-rpc client" }; + Map result = (Map) client.execute("testScv", params); + assertEquals("XML-RPC Service result success", ModelService.RESPOND_SUCCESS, result.get(ModelService.RESPONSE_MESSAGE)); + } +} Propchange: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/webapp/testdef/webapptests.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/testdef/webapptests.xml?view=auto&rev=523057 ============================================================================== --- ofbiz/trunk/framework/webapp/testdef/webapptests.xml (added) +++ ofbiz/trunk/framework/webapp/testdef/webapptests.xml Tue Mar 27 12:57:25 2007 @@ -0,0 +1,27 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. + --> + +<test-suite suite-name="servicetests" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/test-suite.xsd"> + + <test-case case-name="webapp-tests"> + <junit-test-suite class-name="org.ofbiz.webapp.test.XmlRpcTests"/> + </test-case> +</test-suite> Propchange: ofbiz/trunk/framework/webapp/testdef/webapptests.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/webapp/testdef/webapptests.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/webapp/testdef/webapptests.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml |
Free forum by Nabble | Edit this page |