You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/02/03 18:36:24 UTC

svn commit: r374714 - in /incubator/servicemix/trunk/servicemix-core/src: main/java/org/apache/servicemix/jbi/servicedesc/InternalEndpoint.java test/java/org/apache/servicemix/jbi/framework/ComponentPacketTest.java

Author: gnodet
Date: Fri Feb  3 09:36:18 2006
New Revision: 374714

URL: http://svn.apache.org/viewcvs?rev=374714&view=rev
Log:
SM-271: Activating multiple service endpoints with the same "endpoint" name on a single component is not supported

Added:
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentPacketTest.java
Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/InternalEndpoint.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/InternalEndpoint.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/InternalEndpoint.java?rev=374714&r1=374713&r2=374714&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/InternalEndpoint.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/InternalEndpoint.java Fri Feb  3 09:36:18 2006
@@ -114,7 +114,9 @@
         boolean result = false;
         if (obj != null && obj instanceof InternalEndpoint){
             InternalEndpoint other = (InternalEndpoint)obj;
-            result = other.getComponentNameSpace().equals(this.getComponentNameSpace()) && other.endpointName.equals(this.endpointName);
+            result = other.getComponentNameSpace().equals(this.getComponentNameSpace()) && 
+                     other.serviceName.equals(this.serviceName);
+                     other.endpointName.equals(this.endpointName);
         }
         return result;
     }
@@ -124,7 +126,9 @@
      * @return has code
      */
     public int hashCode() {
-        return getComponentNameSpace().hashCode() ^ endpointName.hashCode();
+        return getComponentNameSpace().hashCode() ^
+               serviceName.hashCode() ^
+               endpointName.hashCode() ;
     }
     
     /**

Added: incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentPacketTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentPacketTest.java?rev=374714&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentPacketTest.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentPacketTest.java Fri Feb  3 09:36:18 2006
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.jbi.framework;
+
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.servicemix.jbi.servicedesc.InternalEndpoint;
+
+public class ComponentPacketTest extends TestCase {
+    
+    public void testRegisterTwoEndpoints() throws Exception {
+        ComponentPacket packet = new ComponentPacket();
+        ComponentNameSpace cns = new ComponentNameSpace("container", "component", null);
+        ServiceEndpoint ep1 = new InternalEndpoint(cns, "endpoint", new QName("urn:foo", "service1"));
+        ServiceEndpoint ep2 = new InternalEndpoint(cns, "endpoint", new QName("urn:foo", "service2"));
+        packet.addActiveEndpoint(ep1);
+        packet.addActiveEndpoint(ep2);
+        assertEquals(2, packet.getActiveEndpoints().size());
+    }
+
+}