camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmuel...@apache.org
Subject svn commit: r991323 - in /camel/trunk/components/camel-smpp/src: main/java/org/apache/camel/component/smpp/ test/java/org/apache/camel/component/smpp/
Date Tue, 31 Aug 2010 20:45:39 GMT
Author: cmueller
Date: Tue Aug 31 20:45:39 2010
New Revision: 991323

URL: http://svn.apache.org/viewvc?rev=991323&view=rev
Log:
CAMEL-3093: camel-smpp shoud honor the configured encoding

Modified:
    camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java
    camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java
    camel/trunk/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java
    camel/trunk/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerTest.java

Modified: camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java?rev=991323&r1=991322&r2=991323&view=diff
==============================================================================
--- camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java
(original)
+++ camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java
Tue Aug 31 20:45:39 2010
@@ -36,6 +36,7 @@ public class SmppConfiguration implement
     private String systemId = "smppclient";
     private String password = "password";
     private String systemType = "cp";
+    private byte dataCoding = (byte) 0;
     private String encoding = "ISO-8859-1";
     private Integer enquireLinkTimer = new Integer(5000);
     private Integer transactionTimer = new Integer(10000);
@@ -107,6 +108,14 @@ public class SmppConfiguration implement
         return password;
     }
     
+    public byte getDataCoding() {
+        return dataCoding;
+    }
+
+    public void setDataCoding(byte dataCoding) {
+        this.dataCoding = dataCoding;
+    }
+    
     public String getEncoding() {
         return encoding;
     }
@@ -279,7 +288,9 @@ public class SmppConfiguration implement
             + ", password=" + password 
             + ", port=" + port 
             + ", systemId=" + systemId 
-            + ", systemType=" + systemType 
+            + ", systemType=" + systemType
+            + ", dataCoding=" + dataCoding
+            + ", encoding=" + encoding
             + ", transactionTimer=" + transactionTimer
             + ", registeredDelivery=" + registeredDelivery
             + ", serviceType=" + serviceType 

Modified: camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java?rev=991323&r1=991322&r2=991323&view=diff
==============================================================================
--- camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java
(original)
+++ camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java
Tue Aug 31 20:45:39 2010
@@ -143,7 +143,7 @@ public class SmppProducer extends Defaul
                         false,
                         false,
                         MessageClass.CLASS1,
-                        Alphabet.ALPHA_DEFAULT),
+                        Alphabet.valueOf(configuration.getDataCoding())),
                 (byte) 0,
                 submitSm.getShortMessage());
 

Modified: camel/trunk/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java?rev=991323&r1=991322&r2=991323&view=diff
==============================================================================
--- camel/trunk/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java
(original)
+++ camel/trunk/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java
Tue Aug 31 20:45:39 2010
@@ -151,6 +151,8 @@ public class SmppConfigurationTest {
                 + "port=2775, "
                 + "systemId=smppclient, "
                 + "systemType=cp, "
+                + "dataCoding=0, "
+                + "encoding=ISO-8859-1, "
                 + "transactionTimer=10000, "
                 + "registeredDelivery=1, "
                 + "serviceType=CMT, "

Modified: camel/trunk/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerTest.java?rev=991323&r1=991322&r2=991323&view=diff
==============================================================================
--- camel/trunk/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerTest.java
(original)
+++ camel/trunk/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppProducerTest.java
Tue Aug 31 20:45:39 2010
@@ -250,6 +250,55 @@ public class SmppProducerTest {
     }
     
     @Test
+    public void processInOutShouldHonorTheDataCoding() throws Exception {
+        configuration.setDataCoding((byte) 4);
+        
+        doStartExpectations();
+        SmppBinding binding = createMock(SmppBinding.class);
+        Exchange exchange = createMock(Exchange.class);
+        Message message = createMock(Message.class);
+        SubmitSm submitSm = createMock(SubmitSm.class);
+        expect(exchange.getExchangeId()).andReturn("ID-muellerc-macbookpro/3690-1214458315718/2-0");
+        expect(endpoint.getBinding()).andReturn(binding);
+        expect(binding.createSubmitSm(exchange)).andReturn(submitSm);
+        submitSmExpectations(exchange, binding, submitSm);
+        expect(session.submitShortMessage(
+                eq("CMT"),
+                eq(TypeOfNumber.UNKNOWN),
+                eq(NumberingPlanIndicator.UNKNOWN),
+                eq("1616"),
+                eq(TypeOfNumber.UNKNOWN),
+                eq(NumberingPlanIndicator.UNKNOWN),
+                eq("1717"),
+                isA(ESMClass.class),
+                eq((byte) 0),
+                eq((byte) 1),
+                eq("090830230627004+"),
+                eq("090831232000004+"),
+                eq(new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE)),
+                eq((byte) 0),
+                eq(new GeneralDataCoding(
+                        false,
+                        false,
+                        MessageClass.CLASS1,
+                        Alphabet.ALPHA_8_BIT)),
+                eq((byte) 0),
+                aryEq("Hello SMPP world!".getBytes("ISO-8859-1"))))
+            .andReturn("1");
+        expect(exchange.getPattern()).andReturn(ExchangePattern.InOut);
+        expect(exchange.getOut()).andReturn(message);
+        message.setHeader(SmppBinding.ID, "1"); // expectation without return value
+        expect(exchange.getExchangeId()).andReturn("ID-muellerc-macbookpro/3690-1214458315718/2-0");
+        
+        replay(session, endpoint, binding, exchange, message, submitSm);
+        
+        producer.doStart();
+        producer.process(exchange);
+        
+        verify(session, endpoint, binding, exchange, message, submitSm);
+    }
+    
+    @Test
     public void getterShouldReturnTheSetValues() {
         assertSame(endpoint, producer.getEndpoint());
         assertSame(configuration, producer.getConfiguration());



Mime
View raw message