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.component;
18:
19: import java.util.List;
20: import java.util.Properties;
21:
22: import javax.xml.namespace.QName;
23:
24: import org.apache.log4j.PropertyConfigurator;
25: import org.apache.servicemix.client.DefaultServiceMixClient;
26: import org.apache.servicemix.tck.SpringTestSupport;
27: import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
28: import org.bpmscript.IProcess;
29: import org.bpmscript.XStreamMarshaler;
30: import org.bpmscript.jbi.PojoServiceProxyFactoryBean;
31: import org.bpmscript.remote.IRemoteProcessManager;
32: import org.springframework.context.support.AbstractXmlApplicationContext;
33:
34: public class RemoteProcessManagerSmokeTest extends SpringTestSupport {
35:
36: public RemoteProcessManagerSmokeTest() {
37: Properties properties = new Properties();
38: properties.put("log4j.rootCategory", "INFO, stdout");
39: properties.put("log4j.appender.stdout",
40: "org.apache.log4j.ConsoleAppender");
41: properties.put("log4j.appender.stdout.layout",
42: "org.apache.log4j.PatternLayout");
43: properties.put(
44: "log4j.appender.stdout.layout.ConversionPattern",
45: "%p [%t] %c{1}.%M(%L) | %m%n");
46: PropertyConfigurator.configure(properties);
47: }
48:
49: public void testProcessManager() throws Exception {
50:
51: final DefaultServiceMixClient client = new DefaultServiceMixClient(
52: jbi);
53:
54: PojoServiceProxyFactoryBean bean = new PojoServiceProxyFactoryBean();
55: bean.setClient(client);
56: bean.setInterfaceClass(IRemoteProcessManager.class);
57: bean.setService(new QName("http://bpmscript.org/jbi",
58: "remoteProcessManager"));
59: bean.setMarshaler(new XStreamMarshaler());
60: bean.setTimeout(200000);
61:
62: IRemoteProcessManager manager = (IRemoteProcessManager) bean
63: .getObject();
64: List<IProcess> primaryProcesses = manager.getPrimaryProcesses();
65: assertNotNull(primaryProcesses);
66: assertTrue(primaryProcesses.size() > 0);
67:
68: String id = manager.createProcess("blah", "blah");
69: assertNotNull(id);
70:
71: }
72:
73: protected AbstractXmlApplicationContext createBeanFactory() {
74: return new ClassPathXmlApplicationContext("/manager/spring.xml");
75: }
76:
77: }
|