Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 868207 Details for
Bug 1067636
Please change SCAInvoker so it contains setOperation() to enable multiple-operation interfaces
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch file.
BZ1067636.patch (text/plain), 5.65 KB, created by
Rick Wagner
on 2014-02-26 22:02:08 UTC
(
hide
)
Description:
Patch file.
Filename:
MIME Type:
Creator:
Rick Wagner
Created:
2014-02-26 22:02:08 UTC
Size:
5.65 KB
patch
obsolete
>diff --git a/sca/src/main/java/org/switchyard/component/sca/SCAInvoker.java b/sca/src/main/java/org/switchyard/component/sca/SCAInvoker.java >index 4817630..d663546 100644 >--- a/sca/src/main/java/org/switchyard/component/sca/SCAInvoker.java >+++ b/sca/src/main/java/org/switchyard/component/sca/SCAInvoker.java >@@ -105,6 +105,12 @@ public class SCAInvoker extends BaseServiceHandler { > } > } > >+ // This method exists for test purposes and should not be used at runtime. Initialization >+ // of the invoker instance occurs in the constructor for SCAInvoker. >+ void setInvoker(ClusteredInvoker invoker) { >+ _invoker = invoker; >+ } >+ > private void invokeLocal(Exchange exchange) throws HandlerException { > // Figure out the QName for the service were invoking > QName serviceName = getTargetServiceName(exchange); >@@ -145,6 +151,7 @@ public class SCAInvoker extends BaseServiceHandler { > RemoteMessage request = new RemoteMessage() > .setDomain(exchange.getProvider().getDomain().getName()) > .setService(serviceName) >+ .setOperation(exchange.getContract().getConsumerOperation().getName()) > .setContent(exchange.getMessage().getContent()); > exchange.getContext().mergeInto(request.getContext()); > boolean transactionPropagated = bridgeOutgoingTransaction(request); >@@ -284,3 +291,4 @@ public class SCAInvoker extends BaseServiceHandler { > } > } > } >+ >diff --git a/sca/src/test/java/org/switchyard/component/sca/SCAInvokerTest.java b/sca/src/test/java/org/switchyard/component/sca/SCAInvokerTest.java >index ab6b61d..71db519 100644 >--- a/sca/src/test/java/org/switchyard/component/sca/SCAInvokerTest.java >+++ b/sca/src/test/java/org/switchyard/component/sca/SCAInvokerTest.java >@@ -1,11 +1,28 @@ >+/* >+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors. >+ * >+ * 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.switchyard.component.sca; > >+import java.io.IOException; >+import java.util.LinkedList; >+ > import javax.xml.namespace.QName; > > import junit.framework.Assert; > > import org.junit.Before; > import org.junit.Test; >+import org.mockito.Mockito; > import org.switchyard.Exchange; > import org.switchyard.HandlerException; > import org.switchyard.Message; >@@ -21,7 +38,9 @@ import org.switchyard.config.model.switchyard.SwitchYardNamespace; > import org.switchyard.metadata.InOnlyOperation; > import org.switchyard.metadata.InOnlyService; > import org.switchyard.remote.RemoteEndpoint; >+import org.switchyard.remote.RemoteMessage; > import org.switchyard.remote.RemoteRegistry; >+import org.switchyard.remote.cluster.ClusteredInvoker; > import org.switchyard.remote.cluster.LoadBalanceStrategy; > import org.switchyard.remote.cluster.RandomStrategy; > import org.switchyard.remote.cluster.RoundRobinStrategy; >@@ -288,6 +307,54 @@ public class SCAInvokerTest { > // expected > } > } >+ >+ @Test >+ public void verifyRemoteMessageCreation() throws Exception { >+ // Create a binding config with clustering enabled >+ V1SCABindingModel config = new V1SCABindingModel(SwitchYardNamespace.DEFAULT.uri()) { >+ @Override >+ public String getName() { >+ return "verifyRemoteMessageCreation"; >+ } >+ @Override >+ public boolean isClustered() { >+ return true; >+ } >+ @Override >+ public String getTarget() { >+ return "test-target"; >+ } >+ public CompositeReferenceModel getReference() { >+ return new V1CompositeReferenceModel(); >+ }; >+ }; >+ >+ // Mock the invoker so that we don't need an actual remote endpoint >+ final LinkedList<RemoteMessage> msgs = new LinkedList<RemoteMessage>(); >+ ClusteredInvoker clInovker = new ClusteredInvoker(null) { >+ @Override >+ public RemoteMessage invoke(RemoteMessage request) throws IOException { >+ msgs.push(request); >+ return null; >+ } >+ }; >+ >+ SCAInvoker scaInvoker = new SCAInvoker(config); >+ scaInvoker.setInvoker(clInovker); >+ scaInvoker.start(); >+ >+ // Verify that exchange is mapped to remote message correctly >+ Exchange mockEx = Mockito.mock(Exchange.class, Mockito.RETURNS_DEEP_STUBS); >+ Mockito.when(mockEx.getContract().getConsumerOperation().getName()).thenReturn("test-operation"); >+ Mockito.when(mockEx.getProvider().getDomain().getName()).thenReturn(new QName("test-domain")); >+ Mockito.when(mockEx.getMessage().getContent()).thenReturn("test-content"); >+ scaInvoker.handleMessage(mockEx); >+ >+ RemoteMessage remoteMsg = msgs.pop(); >+ Assert.assertEquals(new QName("test-domain"), remoteMsg.getDomain()); >+ Assert.assertEquals("test-operation", remoteMsg.getOperation()); >+ Assert.assertEquals("test-content", remoteMsg.getContent()); >+ } > } > > class MyLoadBalancer implements LoadBalanceStrategy { >@@ -306,3 +373,4 @@ class MyLoadBalancer implements LoadBalanceStrategy { > public void setRegistry(RemoteRegistry registry) { > } > } >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1067636
: 868207