tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r682682 - in /tuscany/java/sca/modules/binding-jms/src: main/java/org/apache/tuscany/sca/binding/jms/impl/ test/java/org/apache/tuscany/sca/binding/jms/impl/
Date Tue, 05 Aug 2008 11:56:22 GMT
Author: antelder
Date: Tue Aug  5 04:56:21 2008
New Revision: 682682

URL: http://svn.apache.org/viewvc?rev=682682&view=rev
Log:
Add support for subscriptionHeaders to the jms binding model

Modified:
    tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java
    tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
    tuscany/java/sca/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java

Modified: tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java?rev=682682&r1=682681&r2=682682&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java
(original)
+++ tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java
Tue Aug  5 04:56:21 2008
@@ -100,6 +100,7 @@
     private Map<String, Boolean> operationJMSDeliveryModes = new HashMap<String,
Boolean>();
     private Map<String, Long> operationJMSTimeToLives = new HashMap<String, Long>();
     private Map<String, Integer> operationJMSPriorities = new HashMap<String, Integer>();
+    private String jmsSelector;
     
     public JMSBinding() {
         super();
@@ -474,4 +475,11 @@
         operationJMSPriorities.put(opName, p);
     }
 
+    public String getJMSSelector() {
+        return jmsSelector;
+    }
+    public void setJMSSelector(String jmsSelector) {
+        this.jmsSelector = jmsSelector;
+    }
+
 }

Modified: tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java?rev=682682&r1=682681&r2=682682&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
(original)
+++ tuscany/java/sca/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
Tue Aug  5 04:56:21 2008
@@ -237,6 +237,8 @@
                         parseHeaders(reader, jmsBinding);
                     } else if ("operationProperties".equals(elementName)) {
                         parseOperationProperties(reader, jmsBinding);
+                    } else if ("subscriptionHeaders".equals(elementName)) {
+                        parseSubscriptionHeaders (reader, jmsBinding);
                     }
                     reader.next();
                     break;
@@ -625,6 +627,13 @@
         }
     }
 
+    private void parseSubscriptionHeaders(XMLStreamReader reader, JMSBinding jmsBinding)
{
+        String jmsSelector = reader.getAttributeValue(null, "JMSSelector");
+        if (jmsSelector != null && jmsSelector.length() > 0) {
+            jmsBinding.setJMSSelector(jmsSelector);
+        }
+    }
+
     /**
      * The validation rules for the JMS model are relatively complicated to they all live
together here
      */

Modified: tuscany/java/sca/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java?rev=682682&r1=682681&r2=682682&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java
(original)
+++ tuscany/java/sca/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java
Tue Aug  5 04:56:21 2008
@@ -108,6 +108,19 @@
             + " </component>"
             + "</composite>";
 
+    private static final String SELECTOR =
+        "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
+        + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\"
name=\"binding-jms\">"
+            + " <component name=\"HelloWorldComponent\">"
+            + "   <implementation.java class=\"services.HelloWorld\"/>"
+            + "      <service name=\"HelloWorldService\">"
+            + "          <binding.jms uri=\"jms:testQueue\" >"
+            + "             <subscriptionHeaders JMSSelector=\"prop1 = 2\" />"
+            + "          </binding.jms>"
+            + "      </service>"
+            + " </component>"
+            + "</composite>";
+
     private XMLInputFactory inputFactory;
     private StAXArtifactProcessor<Object> staxProcessor;
     private Monitor monitor;
@@ -185,4 +198,14 @@
         assertEquals(77, ((Integer)op2Props.get("intProp")).intValue());
     }
 
+    public void testSubscriptionHeaders () throws Exception {
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(SELECTOR));
+        
+        Composite composite = (Composite)staxProcessor.read(reader);
+        JMSBinding binding = (JMSBinding)   composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+        
+        assertNotNull(binding);
+
+        assertEquals("prop1 = 2", binding.getJMSSelector());
+    }
 }



Mime
View raw message