KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > servicemix > jbi > nmr > flow > FlowProviderTest


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.jbi.nmr.flow;
18
19 import org.apache.servicemix.jbi.nmr.flow.Flow;
20 import org.apache.servicemix.jbi.nmr.flow.FlowProvider;
21 import org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow;
22 import org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow;
23 import org.apache.servicemix.jbi.nmr.flow.st.STFlow;
24
25 import junit.framework.TestCase;
26
27 public class FlowProviderTest extends TestCase{
28     
29     public void testGetFlowName(){
30         String JavaDoc name = "fred";
31         String JavaDoc query ="props=foo";
32         String JavaDoc nameAndQuery = name + "?" + query;
33         assertTrue(FlowProvider.getFlowName(name).equals(name));
34         assertTrue(FlowProvider.getFlowName(nameAndQuery).equals(name));
35         assertTrue(FlowProvider.getQuery(nameAndQuery).equals(query));
36        
37     }
38     
39     public void testGetFlows() throws Exception JavaDoc{
40         Flow flow = FlowProvider.getFlow("st");
41         assertTrue(flow instanceof STFlow);
42         flow = FlowProvider.getFlow("seda");
43         assertTrue(flow instanceof SedaFlow);
44         flow = FlowProvider.getFlow("jms");
45         assertTrue(flow instanceof JMSFlow);
46         flow = FlowProvider.getFlow("cluster");
47         assertTrue(flow instanceof JMSFlow);
48     }
49     
50     public void testSetProperties() throws Exception JavaDoc {
51         String JavaDoc jmsURL = "reliable://tcp://fred:666";
52         Flow flow = FlowProvider.getFlow("jms?jmsURL="+jmsURL);
53         assertTrue(flow instanceof JMSFlow);
54         JMSFlow jmsFlow = (JMSFlow)flow;
55         assertTrue(jmsFlow.getJmsURL().equals(jmsURL));
56     }
57 }
58
Popular Tags