tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r682278 - in /tuscany/java/sca/modules/binding-jms/src/test: java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCaseFIXME.java resources/simple/
Date Mon, 04 Aug 2008 07:42:55 GMT
Author: antelder
Date: Mon Aug  4 00:42:55 2008
New Revision: 682278

URL: http://svn.apache.org/viewvc?rev=682278&view=rev
Log:
Start on testing for properties support

Added:
    tuscany/java/sca/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCaseFIXME.java
      - copied, changed from r681379, tuscany/java/sca/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java
Removed:
    tuscany/java/sca/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java
    tuscany/java/sca/modules/binding-jms/src/test/resources/simple/

Copied: tuscany/java/sca/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCaseFIXME.java
(from r681379, 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/JMSBindingProcessorTestCaseFIXME.java?p2=tuscany/java/sca/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCaseFIXME.java&p1=tuscany/java/sca/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java&r1=681379&r2=682278&rev=682278&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/JMSBindingProcessorTestCaseFIXME.java
Mon Aug  4 00:42:55 2008
@@ -20,6 +20,7 @@
 package org.apache.tuscany.sca.binding.jms.impl;
 
 import java.io.StringReader;
+import java.util.Map;
 
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
@@ -40,7 +41,7 @@
 /**
  * Tests for JMS binding xml
  */
-public class JMSBindingProcessorTestCase extends TestCase {
+public class JMSBindingProcessorTestCaseFIXME extends TestCase {
     
     private static final String COMPOSITE =
         "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
@@ -53,6 +54,60 @@
             + " </component>"
             + "</composite>";
 
+    private static final String HEADERS1 =
+        "<?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\" >"
+            + "             <headers JMSType=\"myType\" JMSCorrelationId=\"myCorrelId\"
JMSDeliveryMode=\"PERSISTENT\" JMSTimeToLive=\"54321\" JMSPriority=\"5\" >"
+            + "             </headers>" 
+            + "          </binding.jms>"
+            + "      </service>"
+            + " </component>"
+            + "</composite>";
+
+    private static final String PROPERTIES1 =
+        "<?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\" >"
+            + "             <headers>"
+            + "                <property name=\"p1\">bla</property>"
+            + "                <property name=\"intProp\" type=\"int\">42</property>"
+            + "             </headers>" 
+            + "          </binding.jms>"
+            + "      </service>"
+            + " </component>"
+            + "</composite>";
+    
+    private static final String OP_PROPERTIES1 =
+        "<?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\" >"
+            + "             <operationProperties name=\"op1\">"
+            + "                <headers JMSType=\"op1Type\" >"
+            + "                   <property name=\"p1\">bla</property>"
+            + "                   <property name=\"intProp\" type=\"int\">42</property>"
+            + "                </headers>" 
+            + "             </operationProperties >" 
+            + "             <operationProperties name=\"op2\" nativeOperation=\"nativeOp2\"
>"
+            + "                <headers JMSType=\"op2Type\">"
+            + "                   <property name=\"p2\">op2bla</property>"
+            + "                   <property name=\"intProp\" type=\"int\">77</property>"
+            + "                </headers>" 
+            + "             </operationProperties >" 
+            + "          </binding.jms>"
+            + "      </service>"
+            + " </component>"
+            + "</composite>";
+
     private XMLInputFactory inputFactory;
     private StAXArtifactProcessor<Object> staxProcessor;
     private Monitor monitor;
@@ -85,4 +140,49 @@
         assertNotNull(binding);
         assertEquals("testQueue", binding.getDestinationName());
     }
+
+    public void testHeaders1() throws Exception {
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(HEADERS1));
+        
+        Composite composite = (Composite)staxProcessor.read(reader);
+        JMSBinding binding = (JMSBinding)   composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+        
+        assertNotNull(binding);
+        assertEquals("myType", binding.getJMSType());
+        assertEquals("myCorrelId", binding.getJMSCorrelationId());
+        assertTrue(binding.isdeliveryModePersistent());
+        assertEquals(54321, binding.getJMSTimeToLive().longValue());
+        assertEquals(5, binding.getJMSPriority().intValue());
+    }
+
+    public void testProperties1() throws Exception {
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(PROPERTIES1));
+        
+        Composite composite = (Composite)staxProcessor.read(reader);
+        JMSBinding binding = (JMSBinding)   composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+        
+        assertNotNull(binding);
+        assertEquals("bla", binding.getProperty("p1"));
+        assertEquals(42, ((Integer)binding.getProperty("intProp")).intValue());
+    }
+
+    public void testOpProperties1() throws Exception {
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(OP_PROPERTIES1));
+        
+        Composite composite = (Composite)staxProcessor.read(reader);
+        JMSBinding binding = (JMSBinding)   composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+        
+        assertNotNull(binding);
+
+        Map<String, Object> op1Props = binding.getOperationProperties("op1");
+        assertEquals("op1Type", binding.getOperationJMSType("op1"));
+        assertEquals("bla", op1Props.get("p1"));
+        assertEquals(42, ((Integer)op1Props.get("intProp")).intValue());
+        
+        assertEquals("op2Type", binding.getOperationJMSType("op2"));
+        Map<String, Object> op2Props = binding.getOperationProperties("op2");
+        assertEquals("op2bla", op2Props.get("p2"));
+        assertEquals(77, ((Integer)op2Props.get("intProp")).intValue());
+    }
+
 }



Mime
View raw message