servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lh...@apache.org
Subject svn commit: r995705 [2/2] - in /servicemix/components/bindings/servicemix-smpp/trunk: ./ src/main/java/org/apache/servicemix/smpp/ src/main/java/org/apache/servicemix/smpp/marshaler/ src/main/resources/OSGI-INF/blueprint/ src/test/java/org/apache/servi...
Date Fri, 10 Sep 2010 08:56:04 GMT
Modified: servicemix/components/bindings/servicemix-smpp/trunk/src/test/java/org/apache/servicemix/smpp/SmppXBeanDeployerTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-smpp/trunk/src/test/java/org/apache/servicemix/smpp/SmppXBeanDeployerTest.java?rev=995705&r1=995704&r2=995705&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-smpp/trunk/src/test/java/org/apache/servicemix/smpp/SmppXBeanDeployerTest.java
(original)
+++ servicemix/components/bindings/servicemix-smpp/trunk/src/test/java/org/apache/servicemix/smpp/SmppXBeanDeployerTest.java
Fri Sep 10 08:56:03 2010
@@ -1,15 +1,6 @@
 package org.apache.servicemix.smpp;
 
-import java.io.File;
-import java.net.URI;
-import java.net.URL;
-
-import javax.jbi.messaging.ExchangeStatus;
-import javax.jbi.messaging.InOnly;
-import javax.xml.namespace.QName;
-
 import junit.framework.TestCase;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.client.DefaultServiceMixClient;
@@ -17,9 +8,16 @@ import org.apache.servicemix.jbi.contain
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.jbi.jaxp.StringSource;
 
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOnly;
+import javax.xml.namespace.QName;
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+
 /**
  * Validate the SMPP XBean descriptor
- * 
+ *
  * @author jbonofre
  */
 public class SmppXBeanDeployerTest extends TestCase {
@@ -33,9 +31,9 @@ public class SmppXBeanDeployerTest exten
     private static final String TON = "INTERNATIONAL";
 
     private static final String MSG_VALID = "<message><source>" + SOURCE + "</source><destination>"
-                                            + DESTINATION + "</destination><text>"
+ TEXT + "</text><npi>"
-                                            + NPI + "</npi><ton>" + TON + "</ton></message>";
-    
+            + DESTINATION + "</destination><text>" + TEXT + "</text><npi>"
+            + NPI + "</npi><ton>" + TON + "</ton></message>";
+
     protected JBIContainer container;
 
     protected void setUp() throws Exception {
@@ -54,7 +52,7 @@ public class SmppXBeanDeployerTest exten
 
     /**
      * Main test that check xbean deployment
-     * 
+     *
      * @throws Exception in case of deployment errors
      */
     public void test() throws Exception {
@@ -81,7 +79,7 @@ public class SmppXBeanDeployerTest exten
 
         // test if endpoint present
         assertNotNull("The endpoint http://test/server/sender is not found in the JBI container",
container
-            .getRegistry().getEndpoint(new QName("http://test", "service"), "sender"));
+                .getRegistry().getEndpoint(new QName("http://test", "service"), "sender"));
         // test if the endpoint descriptor contains something
         // TODO add WSDLs support in the SMPP component
         // assertNotNull("The endpoint http://test/server/sender descriptor is null",
@@ -94,14 +92,14 @@ public class SmppXBeanDeployerTest exten
         me.setService(new QName("http://test", "service"));
         me.getInMessage().setContent(new StringSource(MSG_VALID));
         client.sendSync(me);
-        
+
         if (me.getStatus() == ExchangeStatus.ERROR) {
             // the failure is "normal" as there is no SMPP server mock for now
-        	// TODO add a SMPP server mock
-        	// fail("Received ERROR status: " + me.getError());
-        	LOG.warn("Received ERROR status");
+            // TODO add a SMPP server mock
+            // fail("Received ERROR status: " + me.getError());
+            LOG.warn("Received ERROR status");
         } else if (me.getFault() != null) {
             fail("Received fault: " + new SourceTransformer().toString(me.getFault().getContent()));
-        } 
+        }
     }
 }

Modified: servicemix/components/bindings/servicemix-smpp/trunk/src/test/java/org/apache/servicemix/smpp/SpringComponentTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-smpp/trunk/src/test/java/org/apache/servicemix/smpp/SpringComponentTest.java?rev=995705&r1=995704&r2=995705&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-smpp/trunk/src/test/java/org/apache/servicemix/smpp/SpringComponentTest.java
(original)
+++ servicemix/components/bindings/servicemix-smpp/trunk/src/test/java/org/apache/servicemix/smpp/SpringComponentTest.java
Fri Sep 10 08:56:03 2010
@@ -1,9 +1,5 @@
 package org.apache.servicemix.smpp;
 
-import javax.jbi.messaging.ExchangeStatus;
-import javax.jbi.messaging.InOnly;
-import javax.xml.namespace.QName;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.client.DefaultServiceMixClient;
@@ -14,18 +10,22 @@ import org.apache.servicemix.tck.SpringT
 import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOnly;
+import javax.xml.namespace.QName;
+
 /**
  * @author jbonofre
  */
 public class SpringComponentTest extends SpringTestSupport {
-	
-	// logging facility
-	private final static transient Log LOG = LogFactory.getLog(SpringComponentTest.class);
+
+    // logging facility
+    private final static transient Log LOG = LogFactory.getLog(SpringComponentTest.class);
 
     private final static String MESSAGE = "<message>" + "<source>0123456789</source>"
-                                          + "<destination>9876543210</destination>"
-                                          + "<text>SMPP Component Test</text>"
+ "<ton>NATIONAL</ton>"
-                                          + "<npi>NATIONAL</npi>" + "</message>";
+            + "<destination>9876543210</destination>"
+            + "<text>SMPP Component Test</text>" + "<ton>NATIONAL</ton>"
+            + "<npi>NATIONAL</npi>" + "</message>";
 
     public void testSending() throws Exception {
         ServiceMixClient client = new DefaultServiceMixClient(jbi);
@@ -34,17 +34,17 @@ public class SpringComponentTest extends
         me.getInMessage().setContent(new StringSource(MESSAGE));
         client.sendSync(me);
         if (me.getStatus() == ExchangeStatus.ERROR) {
-        	// the failure is "normal" as there is no SMPP server mock for now
-        	// TODO add a SMPP server mock
+            // the failure is "normal" as there is no SMPP server mock for now
+            // TODO add a SMPP server mock
             // fail("Received ERROR status: " + me.getError());
-        	LOG.warn("Received ERROR status");
+            LOG.warn("Received ERROR status");
         } else if (me.getFault() != null) {
             fail("Received fault: " + new SourceTransformer().toString(me.getFault().getContent()));
         }
     }
 
     protected AbstractXmlApplicationContext createBeanFactory() {
-        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]
{ "spring.xml" }, false);
+        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"spring.xml"},
false);
         context.setValidating(false);
         context.refresh();
         return context;

Modified: servicemix/components/bindings/servicemix-smpp/trunk/src/test/java/org/apache/servicemix/smpp/marshaler/DefaultSmppMarshalerTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-smpp/trunk/src/test/java/org/apache/servicemix/smpp/marshaler/DefaultSmppMarshalerTest.java?rev=995705&r1=995704&r2=995705&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-smpp/trunk/src/test/java/org/apache/servicemix/smpp/marshaler/DefaultSmppMarshalerTest.java
(original)
+++ servicemix/components/bindings/servicemix-smpp/trunk/src/test/java/org/apache/servicemix/smpp/marshaler/DefaultSmppMarshalerTest.java
Fri Sep 10 08:56:03 2010
@@ -16,34 +16,30 @@
  */
 package org.apache.servicemix.smpp.marshaler;
 
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessageExchangeFactory;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.messaging.NormalizedMessage;
-import javax.xml.transform.TransformerException;
-
 import junit.framework.TestCase;
-
 import org.apache.servicemix.id.IdGenerator;
 import org.apache.servicemix.jbi.helper.MessageExchangePattern;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.jbi.jaxp.StringSource;
 import org.apache.servicemix.jbi.messaging.MessageExchangeFactoryImpl;
-import org.jsmpp.bean.MessageRequest;
-import org.jsmpp.bean.NumberingPlanIndicator;
-import org.jsmpp.bean.SubmitSm;
-import org.jsmpp.bean.TypeOfNumber;
+import org.jsmpp.bean.*;
+import org.jsmpp.bean.OptionalParameter.Tag;
+
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessageExchangeFactory;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.transform.TransformerException;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 /**
  * Unit tests on the SMPP marshaler
- * 
+ *
  * @author jbonofre
  * @author mullerc
  */
 public class DefaultSmppMarshalerTest extends TestCase {
-	
+
     private static final String SOURCE = "0123456789";
     private static final String DESTINATION = "9876543210";
     private static final String TEXT = "This is a SMPP test ...";
@@ -52,74 +48,65 @@ public class DefaultSmppMarshalerTest ex
     private static final String REGISTERED_DELIVERY = "SUCCESS_FAILURE";
     private static final String SCHEDULE_DELIVERY_TIME = "091231143301300+";
     private static final String VALIDITY_PERIOD = "091231153301300+";
-
-    private static final String MSG_VALID_MIN_ATTR = 
-    	"<message>" +
-    	"<source>" + SOURCE + "</source>" +
-    	"<destination>" + DESTINATION + "</destination>" +
-    	"<text>" + TEXT + "</text>" +
-    	"<npi>" + NPI + "</npi>" +
-    	"<ton>" + TON + "</ton>" +
-    	"</message>";
-    
-    private static final String MSG_VALID_MAX_ATTR = 
-    	"<message>" +
-    	"<source>" + SOURCE + "</source>" +
-    	"<destination>" + DESTINATION + "</destination>" +
-    	"<text>" + TEXT + "</text>" +
-    	"<npi>" + NPI + "</npi>" +
-    	"<ton>" + TON + "</ton>" +
-    	"<registeredDelivery>" + REGISTERED_DELIVERY + "</registeredDelivery>" +
-    	"<scheduleDeliveryTime>" + SCHEDULE_DELIVERY_TIME + "</scheduleDeliveryTime>"
+
-    	"<validityPeriod>" + VALIDITY_PERIOD + "</validityPeriod>" +
-    	"</message>";
-    
-    private static final String MSG_VALID_MAX_DEF_ATTR = 
-    	"<message>" +
-    	"<source>" + SOURCE + "</source>" +
-    	"<destination>" + DESTINATION + "</destination>" +
-    	"<text>" + TEXT + "</text>" +
-    	"<npi>" + NPI + "</npi>" +
-    	"<ton>" + TON + "</ton>" +
-    	"<registeredDelivery>DEFAULT</registeredDelivery>" +
-    	"</message>";
-    
+    private static final String MSG_VALID_MIN_ATTR =
+            "<message>"
+                    + "<source>" + SOURCE + "</source>"
+                    + "<destination>" + DESTINATION + "</destination>"
+                    + "<text>" + TEXT + "</text>"
+                    + "<npi>" + NPI + "</npi>"
+                    + "<ton>" + TON + "</ton>"
+                    + "</message>";
+    private static final String MSG_VALID_MAX_ATTR =
+            "<message>"
+                    + "<source>" + SOURCE + "</source>"
+                    + "<destination>" + DESTINATION + "</destination>"
+                    + "<text>" + TEXT + "</text>"
+                    + "<npi>" + NPI + "</npi>"
+                    + "<ton>" + TON + "</ton>"
+                    + "<registeredDelivery>" + REGISTERED_DELIVERY + "</registeredDelivery>"
+                    + "<scheduleDeliveryTime>" + SCHEDULE_DELIVERY_TIME + "</scheduleDeliveryTime>"
+                    + "<validityPeriod>" + VALIDITY_PERIOD + "</validityPeriod>"
+                    + "</message>";
+    private static final String MSG_VALID_MAX_DEF_ATTR =
+            "<message>"
+                    + "<source>" + SOURCE + "</source>"
+                    + "<destination>" + DESTINATION + "</destination>"
+                    + "<text>" + TEXT + "</text>"
+                    + "<npi>" + NPI + "</npi>"
+                    + "<ton>" + TON + "</ton>"
+                    + "<registeredDelivery>DEFAULT</registeredDelivery>"
+                    + "</message>";
     private static final String MSG_INVALID = "Test breaker ...";
-    
-    private static final String MSG_INVALID_DEST = 
-    	"<message>" +
-    	"<source>" + SOURCE + "</source>" +
-    	"<text>" + TEXT + "</text>" +
-    	"<npi>" + NPI + "</npi>" +
-    	"<ton>" + TON + "</ton>" +
-    	"</message>";
-    
-    private static final String MSG_INVALID_TON = 
-    	"<message>" +
-    	"<source>" + SOURCE + "</source>" +
-    	"<destination>" + DESTINATION + "</destination>" +
-    	"<text>" + TEXT + "</text>" +
-    	"<npi>" + NPI + "</npi>" +
-    	"</message>";
-    
-    private static final String MSG_INVALID_NPI = 
-    	"<message>" +
-    	"<source>" + SOURCE + "</source>" +
-    	"<destination>" + DESTINATION + "</destination>" +
-    	"<text>" + TEXT + "</text>" +
-    	"<ton>" + TON + "</ton>" +
-    	"</message>";
-    
-    private static final String MSG_INVALID_REGISTERED_DELIVERY = 
-    	"<message>" +
-    	"<source>" + SOURCE + "</source>" +
-    	"<destination>" + DESTINATION + "</destination>" +
-    	"<text>" + TEXT + "</text>" +
-    	"<npi>" + NPI + "</npi>" +
-    	"<ton>" + TON + "</ton>" +
-    	"<registeredDelivery>xxx</registeredDelivery>" +
-    	"</message>";
-
+    private static final String MSG_INVALID_DEST =
+            "<message>"
+                    + "<source>" + SOURCE + "</source>"
+                    + "<text>" + TEXT + "</text>"
+                    + "<npi>" + NPI + "</npi>"
+                    + "<ton>" + TON + "</ton>"
+                    + "</message>";
+    private static final String MSG_INVALID_TON =
+            "<message>"
+                    + "<source>" + SOURCE + "</source>"
+                    + "<destination>" + DESTINATION + "</destination>"
+                    + "<text>" + TEXT + "</text>"
+                    + "<npi>" + NPI + "</npi>"
+                    + "</message>";
+    private static final String MSG_INVALID_NPI =
+            "<message>"
+                    + "<source>" + SOURCE + "</source>"
+                    + "<destination>" + DESTINATION + "</destination>"
+                    + "<text>" + TEXT + "</text>"
+                    + "<ton>" + TON + "</ton>"
+                    + "</message>";
+    private static final String MSG_INVALID_REGISTERED_DELIVERY =
+            "<message>"
+                    + "<source>" + SOURCE + "</source>"
+                    + "<destination>" + DESTINATION + "</destination>"
+                    + "<text>" + TEXT + "</text>"
+                    + "<npi>" + NPI + "</npi>"
+                    + "<ton>" + TON + "</ton>"
+                    + "<registeredDelivery>xxx</registeredDelivery>"
+                    + "</message>";
     private SmppMarshalerSupport marshaler;
     private MessageExchangeFactory factory;
 
@@ -135,9 +122,9 @@ public class DefaultSmppMarshalerTest ex
         NormalizedMessage message = exchange.createMessage();
         message.setContent(new StringSource(MSG_VALID_MIN_ATTR));
         exchange.setMessage(message, "in");
-        
+
         MessageRequest mr = this.marshaler.fromNMS(exchange, message);
-        
+
         assertEquals(TEXT, new String(mr.getShortMessage()));
         assertEquals(mr.getDestAddress(), DESTINATION);
         assertEquals(SOURCE, mr.getSourceAddr());
@@ -145,7 +132,7 @@ public class DefaultSmppMarshalerTest ex
         assertEquals(TON, TypeOfNumber.valueOf(mr.getSourceAddrTon()).toString());
         assertEquals(NPI, NumberingPlanIndicator.valueOf(mr.getDestAddrNpi()).toString());
         assertEquals(NPI, NumberingPlanIndicator.valueOf(mr.getSourceAddrNpi()).toString());
-        assertEquals((byte)0x00, mr.getRegisteredDelivery());
+        assertEquals((byte) 0x00, mr.getRegisteredDelivery());
         assertNull(mr.getScheduleDeliveryTime());
         assertNull(mr.getValidityPeriod());
     }
@@ -157,7 +144,7 @@ public class DefaultSmppMarshalerTest ex
         exchange.setMessage(message, "in");
 
         MessageRequest mr = this.marshaler.fromNMS(exchange, message);
-        
+
         assertEquals(TEXT, new String(mr.getShortMessage()));
         assertEquals(mr.getDestAddress(), DESTINATION);
         assertEquals(SOURCE, mr.getSourceAddr());
@@ -165,11 +152,11 @@ public class DefaultSmppMarshalerTest ex
         assertEquals(TON, TypeOfNumber.valueOf(mr.getSourceAddrTon()).toString());
         assertEquals(NPI, NumberingPlanIndicator.valueOf(mr.getDestAddrNpi()).toString());
         assertEquals(NPI, NumberingPlanIndicator.valueOf(mr.getSourceAddrNpi()).toString());
-        assertEquals((byte)0x01, mr.getRegisteredDelivery());
+        assertEquals((byte) 0x01, mr.getRegisteredDelivery());
         assertEquals(SCHEDULE_DELIVERY_TIME, mr.getScheduleDeliveryTime());
         assertEquals(VALIDITY_PERIOD, mr.getValidityPeriod());
     }
-    
+
     public void testFromNMSNullExchange() {
         try {
             this.marshaler.fromNMS(null, null);
@@ -187,7 +174,7 @@ public class DefaultSmppMarshalerTest ex
             exchange.setMessage(message, "in");
 
             this.marshaler.fromNMS(exchange, message);
-            
+
             fail("Seems we processed a invalid message...");
         } catch (TransformerException transformerException) {
             // expected
@@ -202,7 +189,7 @@ public class DefaultSmppMarshalerTest ex
             exchange.setMessage(message, "in");
 
             this.marshaler.fromNMS(exchange, message);
-            
+
             fail("Seems we processed a message with a invalid destination...");
         } catch (TransformerException transformerException) {
             // expected
@@ -217,7 +204,7 @@ public class DefaultSmppMarshalerTest ex
             exchange.setMessage(message, "in");
 
             this.marshaler.fromNMS(exchange, message);
-            
+
             fail("Seems we processed a message with a invlid type of number...");
         } catch (TransformerException transformerException) {
             // expected
@@ -232,22 +219,22 @@ public class DefaultSmppMarshalerTest ex
             exchange.setMessage(message, "in");
 
             this.marshaler.fromNMS(exchange, message);
-            
+
             fail("Seems we processed a message with a invlid numbering plan indicator...");
         } catch (TransformerException transformerException) {
             // expected
         }
     }
-    
+
     public void testFromNMSInvalidRegisteredDelivery() throws MessagingException {
         try {
             MessageExchange exchange = this.factory.createExchange(MessageExchangePattern.IN_ONLY);
             NormalizedMessage message = exchange.createMessage();
             message.setContent(new StringSource(MSG_INVALID_REGISTERED_DELIVERY));
             exchange.setMessage(message, "in");
-            
+
             this.marshaler.fromNMS(exchange, message);
-            
+
             fail("Seems we processed a message with a invlid registered delivery value...");
         } catch (TransformerException transformerException) {
             // expected
@@ -263,16 +250,16 @@ public class DefaultSmppMarshalerTest ex
         mr.setSourceAddrNpi(NumberingPlanIndicator.valueOf(NPI).value());
         mr.setSourceAddrTon(TypeOfNumber.valueOf(TON).value());
         mr.setShortMessage(TEXT.getBytes());
-        
+
         MessageExchange exchange = this.factory.createExchange(MessageExchangePattern.IN_ONLY);
         NormalizedMessage message = exchange.createMessage();
         exchange.setMessage(message, "in");
-        
+
         this.marshaler.toNMS(message, mr);
-        
+
         assertEquals(MSG_VALID_MAX_DEF_ATTR, new SourceTransformer().contentToString(message));
     }
-    
+
     public void testToNMSValidMaxAttr() throws Exception {
         MessageRequest mr = new SubmitSm();
         mr.setDestAddress(DESTINATION);
@@ -282,16 +269,16 @@ public class DefaultSmppMarshalerTest ex
         mr.setSourceAddrNpi(NumberingPlanIndicator.valueOf(NPI).value());
         mr.setSourceAddrTon(TypeOfNumber.valueOf(TON).value());
         mr.setShortMessage(TEXT.getBytes());
-        mr.setRegisteredDelivery((byte)0x01);
+        mr.setRegisteredDelivery((byte) 0x01);
         mr.setScheduleDeliveryTime(SCHEDULE_DELIVERY_TIME);
         mr.setValidityPeriod(VALIDITY_PERIOD);
-        
+
         MessageExchange exchange = this.factory.createExchange(MessageExchangePattern.IN_ONLY);
         NormalizedMessage message = exchange.createMessage();
         exchange.setMessage(message, "in");
-        
+
         this.marshaler.toNMS(message, mr);
-        
+
         assertEquals(MSG_VALID_MAX_ATTR, new SourceTransformer().contentToString(message));
     }
 
@@ -302,10 +289,10 @@ public class DefaultSmppMarshalerTest ex
         MessageExchange exchange = this.factory.createExchange(MessageExchangePattern.IN_ONLY);
         NormalizedMessage message = exchange.createMessage();
         exchange.setMessage(message, "in");
-        
+
         try {
             this.marshaler.toNMS(message, mr);
-            
+
             fail("Seems we processed an invalid MessageRequest...");
         } catch (MessagingException messagingException) {
             // expected
@@ -317,10 +304,10 @@ public class DefaultSmppMarshalerTest ex
         MessageExchange exchange = this.factory.createExchange(MessageExchangePattern.IN_ONLY);
         NormalizedMessage message = exchange.createMessage();
         exchange.setMessage(message, "in");
-        
+
         try {
             this.marshaler.toNMS(message, mr);
-            
+
             fail("Seems we processed a Null MessageRequest...");
         } catch (MessagingException messagingException) {
             // expected
@@ -330,13 +317,50 @@ public class DefaultSmppMarshalerTest ex
     public void testToNMSNullMessage() {
         MessageRequest mr = new SubmitSm();
         mr.setShortMessage(TEXT.getBytes());
-        
+
         try {
             marshaler.toNMS(null, mr);
-            
+
             fail("Seems we processed a MessageRequest with a Null NormalizedMessage...");
         } catch (MessagingException messagingException) {
             // expected
         }
     }
-}
\ No newline at end of file
+
+    public void testOptinalParametersOnRequest() throws Exception {
+        MessageRequest mr = new SubmitSm();
+        mr.setDestAddress(DESTINATION);
+        mr.setDestAddrNpi(NumberingPlanIndicator.valueOf(NPI).value());
+        mr.setDestAddrTon(TypeOfNumber.valueOf(TON).value());
+        mr.setSourceAddr(SOURCE);
+        mr.setSourceAddrNpi(NumberingPlanIndicator.valueOf(NPI).value());
+        mr.setSourceAddrTon(TypeOfNumber.valueOf(TON).value());
+        mr.setShortMessage(TEXT.getBytes());
+
+
+        mr.setOptionalParametes(new OptionalParameter.Byte(Tag.DEST_ADDR_SUBUNIT, (byte)
1), new OptionalParameter.Null(Tag.ALERT_ON_MESSAGE_DELIVERY));
+
+        MessageExchange exchange = this.factory.createExchange(MessageExchangePattern.IN_ONLY);
+        NormalizedMessage message = exchange.createMessage();
+        exchange.setMessage(message, "in");
+
+        this.marshaler.toNMS(message, mr);
+
+        assertEquals(message.getProperty("DEST_ADDR_SUBUNIT"), (byte) 1);
+        assertNotNull(message.getProperty("ALERT_ON_MESSAGE_DELIVERY"));
+    }
+
+    public void testOptinalParametersOnExchange() throws Exception {
+        MessageExchange exchange = this.factory.createExchange(MessageExchangePattern.IN_ONLY);
+        NormalizedMessage message = exchange.createMessage();
+        message.setProperty("ALERT_ON_MESSAGE_DELIVERY", "");
+        message.setProperty("PAYLOAD_TYPE", "0");
+        message.setContent(new StringSource(MSG_VALID_MIN_ATTR));
+        exchange.setMessage(message, "in");
+
+        MessageRequest mr = this.marshaler.fromNMS(exchange, message);
+
+        OptionalParameter[] optionalParameters = mr.getOptionalParametes();
+        assertEquals(optionalParameters.length, 2);
+    }
+}

Modified: servicemix/components/bindings/servicemix-smpp/trunk/src/test/resources/spring.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-smpp/trunk/src/test/resources/spring.xml?rev=995705&r1=995704&r2=995705&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-smpp/trunk/src/test/resources/spring.xml (original)
+++ servicemix/components/bindings/servicemix-smpp/trunk/src/test/resources/spring.xml Fri
Sep 10 08:56:03 2010
@@ -20,9 +20,9 @@
 <beans xmlns:sm="http://servicemix.apache.org/config/1.0"
        xmlns:smpp="http://servicemix.apache.org/smpp/1.0"
        xmlns:test="http://test">
-       
+
     <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
-    
+
     <sm:container id="jbi" embedded="true" createMBeanServer="false">
         <sm:activationSpecs>
             <sm:activationSpec>
@@ -30,15 +30,15 @@
                     <smpp:component>
                         <smpp:endpoints>
                             <smpp:provider service="test:service" endpoint="endpoint"
-                                host="localhost"
-                                port="2700"
-                                systemId="test"
-                                password="test"/>
+                                           host="localhost"
+                                           port="2700"
+                                           systemId="test"
+                                           password="test"/>
                         </smpp:endpoints>
                     </smpp:component>
                 </sm:component>
             </sm:activationSpec>
         </sm:activationSpecs>
     </sm:container>
-       
-</beans>
\ No newline at end of file
+
+</beans>

Modified: servicemix/components/bindings/servicemix-smpp/trunk/src/test/resources/xbean/xbean.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-smpp/trunk/src/test/resources/xbean/xbean.xml?rev=995705&r1=995704&r2=995705&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-smpp/trunk/src/test/resources/xbean/xbean.xml
(original)
+++ servicemix/components/bindings/servicemix-smpp/trunk/src/test/resources/xbean/xbean.xml
Fri Sep 10 08:56:03 2010
@@ -19,12 +19,12 @@
 -->
 <beans xmlns:smpp="http://servicemix.apache.org/smpp/1.0"
        xmlns:test="http://test">
-       
+
     <smpp:provider service="test:service"
-                 endpoint="sender"
-                 host="localhost"
-                 port="2700"
-                 systemId="test"
-                 password="test"/>
-       
-</beans>
\ No newline at end of file
+                   endpoint="sender"
+                   host="localhost"
+                   port="2700"
+                   systemId="test"
+                   password="test"/>
+
+</beans>



Mime
View raw message