tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsiva...@apache.org
Subject svn commit: r713362 [2/2] - in /tuscany/sandbox/event: modules/ modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ modules/binding-event-jms/ modules/binding-even...
Date Wed, 12 Nov 2008 13:16:07 GMT
Modified: tuscany/sandbox/event/samples/event-jms/src/main/resources/weatherPublisher.composite
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/samples/event-jms/src/main/resources/weatherPublisher.composite?rev=713362&r1=713361&r2=713362&view=diff
==============================================================================
--- tuscany/sandbox/event/samples/event-jms/src/main/resources/weatherPublisher.composite
(original)
+++ tuscany/sandbox/event/samples/event-jms/src/main/resources/weatherPublisher.composite
Wed Nov 12 05:16:06 2008
@@ -31,10 +31,14 @@
         
         
         <producer name="weatherPublisher" eventTypes="WeatherEvent">
+          <tuscany:binding.event/>
+          <!--
           <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
-                       jndiURL="tcp://localhost:61619">
+                       jndiURL="tcp://localhost:61619"
+                       messageProcessor="org.apache.tuscany.sca.binding.jms.provider.ObjectMessageProcessor">
               <destination name="WeatherQueue" create="ifnotexist"/>
           </binding.jms>
+          -->
         </producer>
         
     </component>
@@ -51,6 +55,9 @@
     
     <component name="WeatherSubscriberComponent2">
    		<implementation.java class="weather.WeatherSubscriberComponent"/>
+   		<service name="WeatherSubscriber">
+                <interface.java interface="weather.WeatherSubscriber"/>
+        </service>
       
       	<consumer name="weatherSubscriber"/>
     </component>

Modified: tuscany/sandbox/event/samples/event-jms/src/main/resources/weatherSubscriber.composite
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/samples/event-jms/src/main/resources/weatherSubscriber.composite?rev=713362&r1=713361&r2=713362&view=diff
==============================================================================
--- tuscany/sandbox/event/samples/event-jms/src/main/resources/weatherSubscriber.composite
(original)
+++ tuscany/sandbox/event/samples/event-jms/src/main/resources/weatherSubscriber.composite
Wed Nov 12 05:16:06 2008
@@ -26,12 +26,20 @@
     <component name="WeatherSubscriberComponent">
       <implementation.java class="weather.WeatherSubscriberComponent"/>
       
+      <service name="WeatherSubscriber">
+                <interface.java interface="weather.WeatherSubscriber"/>
+      </service>
+      
       
       <consumer name="weatherSubscriber" eventTypes="WeatherEvent">
+          <tuscany:binding.event/>
+          <!--
           <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
-                             jndiURL="tcp://localhost:61619">
+                             jndiURL="tcp://localhost:61619"
+                             messageProcessor="org.apache.tuscany.sca.binding.jms.provider.ObjectMessageProcessor">
               <destination name="WeatherQueue" create="ifnotexist"/>
           </binding.jms>
+          -->
       </consumer>
       
     </component>

Modified: tuscany/sandbox/event/samples/event-jms/src/test/java/weather/WeatherTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/samples/event-jms/src/test/java/weather/WeatherTestCase.java?rev=713362&r1=713361&r2=713362&view=diff
==============================================================================
--- tuscany/sandbox/event/samples/event-jms/src/test/java/weather/WeatherTestCase.java (original)
+++ tuscany/sandbox/event/samples/event-jms/src/test/java/weather/WeatherTestCase.java Wed
Nov 12 05:16:06 2008
@@ -20,6 +20,8 @@
 package weather;
 
 
+import junit.framework.Assert;
+
 import org.apache.activemq.broker.BrokerService;
 import org.apache.tuscany.sca.host.embedded.SCADomain;
 import org.junit.After;
@@ -38,6 +40,8 @@
 	  
     private WeatherService weatherService;
     private WeatherService weatherService2;
+    private WeatherSubscriber weatherSubscriber;
+    private WeatherSubscriber weatherSubscriber2;
     private SCADomain weatherSubscriberDomain;
     private SCADomain weatherPublisherDomain;
    
@@ -52,6 +56,8 @@
             weatherSubscriberDomain = SCADomain.newInstance("weatherSubscriber.composite");
             weatherService = weatherPublisherDomain.getService(WeatherService.class, "WeatherPublisherComponent");
             weatherService2 = weatherPublisherDomain.getService(WeatherService.class, "WeatherPublisherComponent2");
   
+            weatherSubscriber = weatherSubscriberDomain.getService(WeatherSubscriber.class,
"WeatherSubscriberComponent/WeatherSubscriber");
+            weatherSubscriber2 = weatherPublisherDomain.getService(WeatherSubscriber.class,
"WeatherSubscriberComponent2/WeatherSubscriber");
         } catch (Throwable e) {
             e.printStackTrace();
         }
@@ -59,8 +65,27 @@
     
     @Test
     public void runWeatherTest() throws Exception {
+        
         weatherService.start();
         weatherService2.start();
+        
+        Thread.sleep(2000);
+        
+        int[] messageList = weatherSubscriber.getMessageList();
+        Assert.assertNotNull("Message list is null.", messageList);
+        Assert.assertEquals("Message list invalid.", 3, messageList.length);
+        int[] expectedMessages = {0, 1, 1};
+        for (int i = 0; i < messageList.length; i++) {
+            Assert.assertEquals("Message type " + i + " not received correctly.", expectedMessages[i],
messageList[i]);
+        }
+        
+        int[] messageList2 = weatherSubscriber2.getMessageList();
+        Assert.assertNotNull("Message list is null.", messageList2);
+        Assert.assertEquals("Message list invalid.", 3, messageList2.length);
+        int[] expectedMessages2 = {1, 0, 0};
+        for (int i = 0; i < messageList2.length; i++) {
+            Assert.assertEquals("Message type " + i + " not received correctly.", expectedMessages2[i],
messageList2[i]);
+        }
     }
     
     

Modified: tuscany/sandbox/event/samples/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/samples/pom.xml?rev=713362&r1=713361&r2=713362&view=diff
==============================================================================
--- tuscany/sandbox/event/samples/pom.xml (original)
+++ tuscany/sandbox/event/samples/pom.xml Wed Nov 12 05:16:06 2008
@@ -45,6 +45,7 @@
             <modules>
                 <module>helloworld-reference-jms</module>
                 <module>helloworld-service-jms</module>
+                <module>event-jms</module>
             </modules>
         </profile>
     </profiles>



Mime
View raw message