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