KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > servicemix > jsr181 > Jsr181OverrideTest


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * 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.apache.servicemix.jsr181;
18
19 import javax.naming.InitialContext JavaDoc;
20 import javax.xml.namespace.QName JavaDoc;
21
22 import junit.framework.TestCase;
23
24 import org.apache.servicemix.jbi.container.JBIContainer;
25 import org.apache.servicemix.jsr181.Jsr181Endpoint;
26 import org.apache.servicemix.jsr181.Jsr181SpringComponent;
27
28 import test.EchoService;
29 import test.EchoService2;
30
31 public class Jsr181OverrideTest extends TestCase {
32
33     protected JBIContainer container;
34     
35     protected void setUp() throws Exception JavaDoc {
36         container = new JBIContainer();
37         container.setUseMBeanServer(false);
38         container.setCreateMBeanServer(false);
39         container.setMonitorInstallationDirectory(false);
40         container.setNamingContext(new InitialContext JavaDoc());
41         container.setEmbedded(true);
42         container.init();
43         container.start();
44     }
45     
46     protected void tearDown() throws Exception JavaDoc {
47         if (container != null) {
48             container.shutDown();
49         }
50     }
51     
52     public void testWithSpecifiedNamesWithAnnotations() throws Exception JavaDoc {
53         QName JavaDoc svcName = new QName JavaDoc("svcUri", "service");
54         QName JavaDoc itfName = new QName JavaDoc("itfUri", "interface");
55         String JavaDoc epName = "endpoint";
56         Jsr181SpringComponent component = new Jsr181SpringComponent();
57         Jsr181Endpoint endpoint = new Jsr181Endpoint();
58         endpoint.setService(svcName);
59         endpoint.setInterfaceName(itfName);
60         endpoint.setEndpoint(epName);
61         endpoint.setPojo(new EchoService());
62         component.setEndpoints(new Jsr181Endpoint[] { endpoint });
63         container.activateComponent(component, "JSR181Component");
64     }
65     
66     public void testWithSpecifiedNamesWithoutAnnotations() throws Exception JavaDoc {
67         QName JavaDoc svcName = new QName JavaDoc("svcUri", "service");
68         QName JavaDoc itfName = new QName JavaDoc("itfUri", "interface");
69         String JavaDoc epName = "endpoint";
70         Jsr181SpringComponent component = new Jsr181SpringComponent();
71         Jsr181Endpoint endpoint = new Jsr181Endpoint();
72         endpoint.setService(svcName);
73         endpoint.setInterfaceName(itfName);
74         endpoint.setEndpoint(epName);
75         endpoint.setPojo(new EchoService2());
76         component.setEndpoints(new Jsr181Endpoint[] { endpoint });
77         container.activateComponent(component, "JSR181Component");
78     }
79     
80 }
81
Popular Tags