1 17 package org.apache.servicemix.components.net; 18 19 import org.apache.servicemix.jbi.jaxp.StringSource; 20 import org.apache.servicemix.jbi.resolver.ServiceNameEndpointResolver; 21 import org.apache.servicemix.tck.TestSupport; 22 import org.springframework.context.support.AbstractXmlApplicationContext; 23 import org.apache.xbean.spring.context.ClassPathXmlApplicationContext; 24 25 import javax.jbi.messaging.InOnly; 26 import javax.jbi.messaging.NormalizedMessage; 27 import javax.xml.namespace.QName ; 28 29 38 public class FTPTest extends TestSupport { 39 40 public void testSendUsingMessageContentAndUniquelyGeneratedName() throws Exception { 41 42 InOnly exchange = client.createInOnlyExchange(); 44 NormalizedMessage message = exchange.getInMessage(); 45 46 message.setContent(new StringSource("<hello>world!</hello>")); 47 48 client.sendSync(exchange); 49 } 51 52 public void testSendUsingMessageProperties() throws Exception { 53 54 InOnly exchange = client.createInOnlyExchange(); 56 NormalizedMessage message = exchange.getInMessage(); 57 58 message.setProperty("org.apache.servicemix.file.name", "cheese.txt"); 59 message.setProperty("org.apache.servicemix.file.content", "Hello World!"); 60 61 client.sendSync(exchange); 62 } 64 65 public void testSendUsingMessageContentAndExpressionName() throws Exception { 66 67 QName service = new QName ("http://servicemix.org/cheese/", "ftpSenderWithExpression"); 68 ServiceNameEndpointResolver resolver = new ServiceNameEndpointResolver(service); 69 70 InOnly exchange = client.createInOnlyExchange(resolver); 71 NormalizedMessage message = exchange.getInMessage(); 72 73 message.setContent(new StringSource("<order id='abc123'><customer>Duff Beer</customer><value>599.99</value></order>")); 74 75 client.sendSync(exchange); 76 } 77 78 protected AbstractXmlApplicationContext createBeanFactory() { 79 return new ClassPathXmlApplicationContext("org/apache/servicemix/components/net/ftp.xml"); 80 } 81 } 82 | Popular Tags |