Author: gertv
Date: Thu Dec 16 09:05:51 2010
New Revision: 1049827

URL: http://svn.apache.org/viewvc?rev=1049827&view=rev
Log:
SM-1890: Improve MockExchangeFactory so the mock exchanges have a MEP and 
exchange id

Added:
    servicemix/utils/trunk/src/test/java/org/apache/servicemix/tck/
    servicemix/utils/trunk/src/test/java/org/apache/servicemix/tck/mock/
    
servicemix/utils/trunk/src/test/java/org/apache/servicemix/tck/mock/MockExchangeFactoryTest.java
Modified:
    
servicemix/utils/trunk/src/main/java/org/apache/servicemix/tck/mock/MockExchangeFactory.java
    
servicemix/utils/trunk/src/main/java/org/apache/servicemix/tck/mock/MockMessageExchange.java

Modified: 
servicemix/utils/trunk/src/main/java/org/apache/servicemix/tck/mock/MockExchangeFactory.java
URL: 
http://svn.apache.org/viewvc/servicemix/utils/trunk/src/main/java/org/apache/servicemix/tck/mock/MockExchangeFactory.java?rev=1049827&r1=1049826&r2=1049827&view=diff
==============================================================================
--- 
servicemix/utils/trunk/src/main/java/org/apache/servicemix/tck/mock/MockExchangeFactory.java
 (original)
+++ 
servicemix/utils/trunk/src/main/java/org/apache/servicemix/tck/mock/MockExchangeFactory.java
 Thu Dec 16 09:05:51 2010
@@ -72,11 +72,34 @@ public class MockExchangeFactory impleme
     }
     
     public static class MockInOnly extends MockMessageExchange implements 
InOnly {
+
+        public MockInOnly() {
+            super();
+            setPattern(IN_ONLY);
+        }
     }
+
     public static class MockInOut extends MockMessageExchange implements InOut 
{
+
+        public MockInOut() {
+            super();
+            setPattern(IN_OUT);
+        }
     }
+
     public static class MockInOptionalOut extends MockMessageExchange 
implements InOptionalOut {
+
+        public MockInOptionalOut() {
+            super();
+            setPattern(IN_OPTIONAL_OUT);
+        }
     }
+
     public static class MockRobustInOnly extends MockMessageExchange 
implements RobustInOnly {
+
+        public MockRobustInOnly() {
+            super();
+            setPattern(ROBUST_IN_ONLY);
+        }
     }
 }

Modified: 
servicemix/utils/trunk/src/main/java/org/apache/servicemix/tck/mock/MockMessageExchange.java
URL: 
http://svn.apache.org/viewvc/servicemix/utils/trunk/src/main/java/org/apache/servicemix/tck/mock/MockMessageExchange.java?rev=1049827&r1=1049826&r2=1049827&view=diff
==============================================================================
--- 
servicemix/utils/trunk/src/main/java/org/apache/servicemix/tck/mock/MockMessageExchange.java
 (original)
+++ 
servicemix/utils/trunk/src/main/java/org/apache/servicemix/tck/mock/MockMessageExchange.java
 Thu Dec 16 09:05:51 2010
@@ -20,6 +20,7 @@ import java.net.URI;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
+import java.util.UUID;
 
 import javax.jbi.messaging.ExchangeStatus;
 import javax.jbi.messaging.Fault;
@@ -44,7 +45,11 @@ public class MockMessageExchange impleme
     private NormalizedMessage outMessage;
     private Fault fault;
     private Map<String, Object> properties = new HashMap<String, Object>();
-    
+
+    public MockMessageExchange() {
+        exchangeId = UUID.randomUUID().toString();
+    }
+
     /**
      * @return the endpoint
      */

Added: 
servicemix/utils/trunk/src/test/java/org/apache/servicemix/tck/mock/MockExchangeFactoryTest.java
URL: 
http://svn.apache.org/viewvc/servicemix/utils/trunk/src/test/java/org/apache/servicemix/tck/mock/MockExchangeFactoryTest.java?rev=1049827&view=auto
==============================================================================
--- 
servicemix/utils/trunk/src/test/java/org/apache/servicemix/tck/mock/MockExchangeFactoryTest.java
 (added)
+++ 
servicemix/utils/trunk/src/test/java/org/apache/servicemix/tck/mock/MockExchangeFactoryTest.java
 Thu Dec 16 09:05:51 2010
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.tck.mock;
+
+import javax.jbi.messaging.InOnly;
+import javax.jbi.messaging.InOptionalOut;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.RobustInOnly;
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author iocanel
+ */
+public class MockExchangeFactoryTest extends TestCase {
+
+    public MockExchangeFactoryTest() {
+    }
+    
+    /**
+     * Test of createInOnlyExchange method, of class MockExchangeFactory.
+     */
+    public void testCreateInOnlyExchange() throws Exception {
+        MockExchangeFactory instance = new MockExchangeFactory();
+        InOnly exchange = instance.createInOnlyExchange();
+        assertNotNull(exchange.getExchangeId());
+        assertEquals(exchange.getPattern(), MockExchangeFactory.IN_ONLY);
+    }
+
+    /**
+     * Test of createInOptionalOutExchange method, of class 
MockExchangeFactory.
+     */
+    public void testCreateInOptionalOutExchange() throws Exception {
+        MockExchangeFactory instance = new MockExchangeFactory();
+        InOptionalOut exchange = instance.createInOptionalOutExchange();
+        assertNotNull(exchange.getExchangeId());
+        assertEquals(exchange.getPattern(), 
MockExchangeFactory.IN_OPTIONAL_OUT);
+    }
+
+    /**
+     * Test of createInOutExchange method, of class MockExchangeFactory.
+     */
+    public void testCreateInOutExchange() throws Exception {
+        MockExchangeFactory instance = new MockExchangeFactory();
+        InOut exchange = instance.createInOutExchange();
+        assertNotNull(exchange.getExchangeId());
+        assertEquals(exchange.getPattern(), MockExchangeFactory.IN_OUT);
+    }
+
+    /**
+     * Test of createRobustInOnlyExchange method, of class MockExchangeFactory.
+     */
+    public void testCreateRobustInOnlyExchange() throws Exception {
+        MockExchangeFactory instance = new MockExchangeFactory();
+        RobustInOnly exchange = instance.createRobustInOnlyExchange();
+        assertNotNull(exchange.getExchangeId());
+        assertEquals(MockExchangeFactory.ROBUST_IN_ONLY,exchange.getPattern());
+    }
+}
\ No newline at end of file


Reply via email to