01: /*
02: * Copyright 2005-2006 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.bpmscript;
17:
18: import java.util.List;
19: import java.util.Properties;
20:
21: import javax.naming.InitialContext;
22: import javax.xml.namespace.QName;
23:
24: import junit.framework.TestCase;
25:
26: import org.apache.activemq.xbean.BrokerFactoryBean;
27: import org.apache.log4j.PropertyConfigurator;
28: import org.apache.servicemix.client.DefaultServiceMixClient;
29: import org.apache.servicemix.jbi.container.JBIContainer;
30: import org.apache.servicemix.tck.SpringTestSupport;
31: import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
32: import org.bpmscript.jbi.PojoServiceProxyFactoryBean;
33: import org.bpmscript.remote.IRemoteProcessManager;
34: import org.springframework.context.support.AbstractXmlApplicationContext;
35: import org.springframework.core.io.ClassPathResource;
36:
37: public class RemoteProcessManagerTest extends SpringTestSupport {
38:
39: protected void setUp() throws Exception {
40: super .setUp();
41: Properties properties = new Properties();
42: properties.put("log4j.rootCategory", "INFO, stdout");
43: properties.put("log4j.appender.stdout",
44: "org.apache.log4j.ConsoleAppender");
45: properties.put("log4j.appender.stdout.layout",
46: "org.apache.log4j.PatternLayout");
47: PropertyConfigurator.configure(properties);
48: }
49:
50: protected void tearDown() throws Exception {
51: super .tearDown();
52: }
53:
54: public void testRemoteProcessManager() throws Exception {
55:
56: DefaultServiceMixClient client = new DefaultServiceMixClient(
57: jbi);
58:
59: PojoServiceProxyFactoryBean bean = new PojoServiceProxyFactoryBean();
60: bean.setClient(client);
61: bean.setInterfaceClass(IRemoteProcessManager.class);
62: bean.setService(new QName("http://bpmscript.org/jbi",
63: "remoteProcessManager"));
64: bean.setMarshaler(new XStreamMarshaler());
65: bean.setTimeout(2000);
66:
67: IRemoteProcessManager manager = (IRemoteProcessManager) bean
68: .getObject();
69: List<IProcess> primaryProcesses = manager.getPrimaryProcesses();
70: assertNotNull(primaryProcesses);
71:
72: }
73:
74: protected AbstractXmlApplicationContext createBeanFactory() {
75: return new ClassPathXmlApplicationContext("/manager/spring.xml");
76: }
77:
78: }
|