1 5 package org.ofbiz.service.test; 6 7 import java.util.Map ; 8 9 import junit.framework.TestCase; 10 import org.ofbiz.base.util.UtilMisc; 11 import org.ofbiz.entity.GenericDelegator; 12 import org.ofbiz.service.GenericDispatcher; 13 import org.ofbiz.service.LocalDispatcher; 14 import org.ofbiz.service.ModelService; 15 16 22 public class ServiceEngineTests extends TestCase { 23 24 public static final String DELEGATOR_NAME = "test"; 25 public static final String DISPATCHER_NAME = "test-dispatcher"; 26 27 private LocalDispatcher dispatcher = null; 28 29 public ServiceEngineTests(String name) { 30 super(name); 31 } 32 33 protected void setUp() throws Exception { 34 GenericDelegator delegator = GenericDelegator.getGenericDelegator(DELEGATOR_NAME); 35 dispatcher = new GenericDispatcher(DISPATCHER_NAME, delegator); 36 } 37 38 protected void tearDown() throws Exception { 39 dispatcher.deregister(); 40 } 41 42 public void testBasicJavaInvocation() throws Exception { 43 Map result = dispatcher.runSync("testScv", UtilMisc.toMap("message", "Unit Test")); 44 assertEquals("Service result success", ModelService.RESPOND_SUCCESS, result.get(ModelService.RESPONSE_MESSAGE)); 45 } 46 } 47 | Popular Tags |