You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mb...@apache.org on 2017/12/17 11:41:23 UTC

svn commit: r1818480 - in /ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test: AbstractXmlRpcTestCase.java ServiceEntityAutoTests.java XmlRpcTests.java

Author: mbrohl
Date: Sun Dec 17 11:41:23 2017
New Revision: 1818480

URL: http://svn.apache.org/viewvc?rev=1818480&view=rev
Log:
Improved: General refactoring and code improvements, package 
org.apache.ofbiz.service.test.
(OFBIZ-9947)

Thanks Dennis Balkir for reporting and providing the patches.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/AbstractXmlRpcTestCase.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServiceEntityAutoTests.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/XmlRpcTests.java

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/AbstractXmlRpcTestCase.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/AbstractXmlRpcTestCase.java?rev=1818480&r1=1818479&r2=1818480&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/AbstractXmlRpcTestCase.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/AbstractXmlRpcTestCase.java Sun Dec 17 11:41:23 2017
@@ -69,8 +69,7 @@ public class AbstractXmlRpcTestCase exte
 
         if (keyStoreComponent != null && keyStoreName != null && keyAlias != null) {
             return new XmlRpcClient(config, keyStoreComponent, keyStoreName, keyAlias);
-        } else {
-            return new XmlRpcClient(config);
         }
+        return new XmlRpcClient(config);
     }
 }

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServiceEntityAutoTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServiceEntityAutoTests.java?rev=1818480&r1=1818479&r2=1818480&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServiceEntityAutoTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServiceEntityAutoTests.java Sun Dec 17 11:41:23 2017
@@ -48,7 +48,7 @@ public class ServiceEntityAutoTests exte
 
     public void testEntityAutoCreateSinglPkEntity() throws Exception {
         //test create with given pk
-        Map<String, Object> testingPkPresentMap = new HashMap<String, Object>();
+        Map<String, Object> testingPkPresentMap = new HashMap<>();
         testingPkPresentMap.put("testingId", "TESTING_1");
         testingPkPresentMap.put("testingName", "entity auto testing");
         Map<String, Object> results = dispatcher.runSync("testEntityAutoCreateTestingPkPresent", testingPkPresentMap);
@@ -57,7 +57,7 @@ public class ServiceEntityAutoTests exte
         assertNotNull(testing);
 
         //test create with auto sequence
-        Map<String, Object> testingPkMissingMap = new HashMap<String, Object>();
+        Map<String, Object> testingPkMissingMap = new HashMap<>();
         testingPkPresentMap.put("testingName", "entity auto testing without pk part in");
         results = dispatcher.runSync("testEntityAutoCreateTestingPkMissing", testingPkMissingMap);
         assertTrue(ServiceUtil.isSuccess(results));
@@ -162,7 +162,7 @@ public class ServiceEntityAutoTests exte
         delegator.create("TestingNode", "testingNodeId", "TESTNODE_6");
         Map<String, Object> testingNodeMemberPkMap = UtilMisc.toMap("testingId", "TESTING_6", "testingNodeId", "TESTNODE_6", "fromDate", now);
         delegator.create("TestingNodeMember", testingNodeMemberPkMap);
- 
+
         //test expire the thruDate
         Map<String, Object> results = dispatcher.runSync("testEntityAutoExpireTestingNodeMember", testingNodeMemberPkMap);
         assertTrue(ServiceUtil.isSuccess(results));

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/XmlRpcTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/XmlRpcTests.java?rev=1818480&r1=1818479&r2=1818480&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/XmlRpcTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/XmlRpcTests.java Sun Dec 17 11:41:23 2017
@@ -58,7 +58,7 @@ public class XmlRpcTests extends Abstrac
         Map<String, Object> result = UtilGenerics.cast(client.execute("testScv", params));
         assertEquals("XML-RPC Service result success", "service done", result.get("resp"));
     }
-    
+
     /**
      * Service to receive information from xml-rpc call
      */
@@ -77,7 +77,7 @@ public class XmlRpcTests extends Abstrac
 
     /**
      * Service to send information to xml-rpc service
-     */    
+     */
     public static Map<String, Object> testXmlRpcClientAdd(DispatchContext dctx, Map<String, ?> context) {
         Locale locale = (Locale) context.get("locale");
         Map<String, Object> result = null;
@@ -92,9 +92,11 @@ public class XmlRpcTests extends Abstrac
         catch (GenericServiceException e) {
             return ServiceUtil.returnError(e.getLocalizedMessage());
         }
-        if (ServiceUtil.isError(result)) return result;
+        if (ServiceUtil.isError(result)) {
+            return result;
+        }
         Integer res = (Integer) result.get("resulting");
-        if (res == (num1 + num2)) { 
+        if (res == (num1 + num2)) {
             result = ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "ServiceTestXmlRpcCalculationOK", locale) + res);
         } else {
             result = ServiceUtil.returnError(UtilProperties.getMessage(resource, "ServiceTestXmlRpcCalculationKO", locale));