diff --git a/framework/base/src/base/org/ofbiz/base/util/ObjectType.java b/framework/base/src/base/org/ofbiz/base/util/ObjectType.java
index 6ca7c88748..cac852faf3 100644
--- a/framework/base/src/base/org/ofbiz/base/util/ObjectType.java
+++ b/framework/base/src/base/org/ofbiz/base/util/ObjectType.java
@@ -288,7 +288,7 @@ public class ObjectType {
* @return
*/
public static boolean isOrSubOf(Class objectClass, Class parentClass) {
-
+ //Debug.logInfo("Checking isOrSubOf for [" + objectClass.getName() + "] and [" + objectClass.getName() + "]", module);
while (objectClass != null) {
if (objectClass == parentClass) return true;
objectClass = objectClass.getSuperclass();
@@ -366,8 +366,9 @@ public class ObjectType {
public static boolean instanceOf(Object obj, String typeName, ClassLoader loader) {
Class infoClass = loadInfoClass(typeName, loader);
- if (infoClass == null)
+ if (infoClass == null) {
throw new IllegalArgumentException("Illegal type found in info map (could not load class for specified type)");
+ }
return instanceOf(obj, infoClass);
}
diff --git a/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java b/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
index 6ef6742f85..f9f4feaea1 100644
--- a/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
+++ b/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java
@@ -53,8 +53,10 @@ public class EntityTestSuite extends TestCase {
/*
* This sets how many values to insert when trying to create a large number of values. 10,000 causes HSQL to crash but is ok
* with Derby. Going up to 100,000 causes problems all around because Java List seems to be capped at about 65,000 values.
+ *
+ * NOTE: setting this lower so that the general tests don't take so long to run; to really push it can increase this number.
*/
- public static final long TEST_COUNT = 10000;
+ public static final long TEST_COUNT = 1000;
public EntityTestSuite(String name) {
super(name);
diff --git a/framework/example/script/org/ofbiz/example/example/ExampleServices.xml b/framework/example/script/org/ofbiz/example/example/ExampleServices.xml
index b26fa6bf3b..680d5f017c 100644
--- a/framework/example/script/org/ofbiz/example/example/ExampleServices.xml
+++ b/framework/example/script/org/ofbiz/example/example/ExampleServices.xml
@@ -106,9 +106,7 @@ under the License.
-
-
-
+
@@ -116,11 +114,20 @@ under the License.
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/framework/example/servicedef/services.xml b/framework/example/servicedef/services.xml
index 7bbcdeb635..2daadc1920 100644
--- a/framework/example/servicedef/services.xml
+++ b/framework/example/servicedef/services.xml
@@ -137,5 +137,4 @@ under the License.
location="org/ofbiz/example/example/ExampleServices.xml" invoke="testCreateExampleService">
-
diff --git a/framework/example/testdef/tests.xml b/framework/example/testdef/tests.xml
index 7c280c5a40..43c5fd4f85 100644
--- a/framework/example/testdef/tests.xml
+++ b/framework/example/testdef/tests.xml
@@ -25,9 +25,10 @@ under the License.
-
-
+
-
+
+
+
diff --git a/framework/testtools/dtd/test-suite.xsd b/framework/testtools/dtd/test-suite.xsd
index e8599da5e2..53750d4853 100644
--- a/framework/testtools/dtd/test-suite.xsd
+++ b/framework/testtools/dtd/test-suite.xsd
@@ -79,6 +79,16 @@ under the License.
+
+
+
+
+
+
+
+
+
+
diff --git a/framework/testtools/servicedef/services.xml b/framework/testtools/servicedef/services.xml
index 7d0980fb21..3df4c38345 100644
--- a/framework/testtools/servicedef/services.xml
+++ b/framework/testtools/servicedef/services.xml
@@ -31,6 +31,7 @@ under the License.
- errorMessage, errorMessageList, errorMessageMap: where messages will comes from for error or fail responses
- successMessage, successMessagesList: where messages will comes from for success responses
-
+
+
diff --git a/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java b/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java
index 9cedc607d4..b27caee642 100644
--- a/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java
+++ b/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java
@@ -92,6 +92,8 @@ public class ModelTestSuite {
}
} else if ("service-test".equals(nodeName)) {
this.testList.add(new ServiceTest(caseName, this, childElement));
+ } else if ("simple-method-test".equals(nodeName)) {
+ this.testList.add(new SimpleMethodTest(caseName, this, childElement));
} else if ("entity-xml-assert".equals(nodeName)) {
this.testList.add(new EntityXmlAssertTest(caseName, this, childElement));
} else if ("jython-test".equals(nodeName)) {
diff --git a/framework/testtools/src/org/ofbiz/testtools/ServiceTest.java b/framework/testtools/src/org/ofbiz/testtools/ServiceTest.java
index d75279b9fb..8ac8276eeb 100644
--- a/framework/testtools/src/org/ofbiz/testtools/ServiceTest.java
+++ b/framework/testtools/src/org/ofbiz/testtools/ServiceTest.java
@@ -58,7 +58,7 @@ public class ServiceTest extends TestCaseBase {
try {
- Map serviceResult = dispatcher.runSync(serviceName, UtilMisc.toMap("testCase", this));
+ Map serviceResult = dispatcher.runSync(serviceName, UtilMisc.toMap("test", this, "testResult", result));
// do something with the errorMessage
String errorMessage = (String) serviceResult.get(ModelService.ERROR_MESSAGE);
diff --git a/framework/testtools/src/org/ofbiz/testtools/SimpleMethodTest.java b/framework/testtools/src/org/ofbiz/testtools/SimpleMethodTest.java
new file mode 100644
index 0000000000..9265b297a8
--- /dev/null
+++ b/framework/testtools/src/org/ofbiz/testtools/SimpleMethodTest.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * 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.testtools;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestResult;
+
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ModelService;
+import org.w3c.dom.Element;
+
+public class SimpleMethodTest extends TestCaseBase {
+
+ public static final String module = ServiceTest.class.getName();
+
+ protected String methodLocation;
+ protected String methodName;
+
+ /**
+ * @param modelTestSuite
+ */
+ public SimpleMethodTest(String caseName, ModelTestSuite modelTestSuite, Element mainElement) {
+ super(caseName, modelTestSuite);
+ this.methodLocation = mainElement.getAttribute("location");
+ this.methodName = mainElement.getAttribute("name");
+ }
+
+ public int countTestCases() {
+ return 1;
+ }
+
+ public void run(TestResult result) {
+ result.startTest(this);
+
+ LocalDispatcher dispatcher = modelTestSuite.getDispatcher();
+
+ try {
+
+ Map serviceResult = SimpleMethod.runSimpleService(methodLocation, methodName, dispatcher.getDispatchContext(),
+ UtilMisc.toMap("test", this, "testResult", result));
+
+ // do something with the errorMessage
+ String errorMessage = (String) serviceResult.get(ModelService.ERROR_MESSAGE);
+ if (UtilValidate.isNotEmpty(errorMessage)) {
+ result.addFailure(this, new AssertionFailedError(errorMessage));
+ }
+
+ // do something with the errorMessageList
+ List errorMessageList = (List) serviceResult.get(ModelService.ERROR_MESSAGE_LIST);
+ if (UtilValidate.isNotEmpty(errorMessageList)) {
+ Iterator i = errorMessageList.iterator();
+ while (i.hasNext()) {
+ result.addFailure(this, new AssertionFailedError((String) i.next()));
+ }
+ }
+
+ // do something with the errorMessageMap
+ Map errorMessageMap = (Map) serviceResult.get(ModelService.ERROR_MESSAGE_MAP);
+ if (!UtilValidate.isEmpty(errorMessageMap)) {
+ Iterator i = errorMessageMap.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry entry = (Map.Entry) i.next();
+ result.addFailure(this, new AssertionFailedError(entry.getKey() + ": " + entry.getValue()));
+ }
+ }
+
+ } catch (MiniLangException e) {
+ result.addError(this, e);
+ }
+
+ result.endTest(this);
+ }
+}