1 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 name = "fred"; 31 String query ="props=foo"; 32 String 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 { 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 { 51 String 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 |