Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue https://github.com/wso2/product-ei/issues/1036 #127

Merged
merged 2 commits into from
Jan 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,13 @@ public MessageContext createResponseMessageContext(MessageContext outMsgCtx) {
* @return true if a sync response is expected
*/
protected boolean waitForSynchronousResponse(MessageContext msgCtx) {
return
msgCtx.getOperationContext() != null &&
WSDL2Constants.MEP_URI_OUT_IN.equals(
msgCtx.getOperationContext().getAxisOperation().getMessageExchangePattern());
boolean waitingState = false;
if (msgCtx.getOperationContext() != null) {
String MEP = msgCtx.getOperationContext().getAxisOperation().getMessageExchangePattern();
waitingState = "http://www.w3.org/ns/wsdl/out-in".equals(MEP) ||
"http://www.w3.org/ns/wsdl/in-out".equals(MEP);
}
return waitingState;
}

public String getTransportName() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.axis2.transport.base;

import junit.framework.TestCase;
import org.apache.axis2.AxisFault;
import org.apache.axis2.client.OperationClient;
import org.apache.axis2.client.Options;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.OperationContext;
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.description.AxisMessage;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.transport.OutTransportInfo;

import java.util.ArrayList;

public class AbstractTransportSenderTest extends TestCase {
public void testWaitForSynchronousResponse() {
AbstractTransportSender abstractTransportSender = new AbstractTransportSender() {
@Override
public void sendMessage(MessageContext msgCtx, String targetEPR, OutTransportInfo outTransportInfo)
throws AxisFault {

}
};
MessageContext messageContext = new MessageContext();
AxisOperation axisOperation = new AxisOperation() {
@Override
public void addMessage(AxisMessage message, String label) {

}

@Override
public void addMessageContext(MessageContext msgContext, OperationContext opContext) throws AxisFault {

}

@Override
public void addFaultMessageContext(MessageContext msgContext, OperationContext opContext) throws AxisFault {

}

@Override
public AxisMessage getMessage(String label) {
return null;
}

@Override
public ArrayList getPhasesInFaultFlow() {
return null;
}

@Override
public ArrayList getPhasesOutFaultFlow() {
return null;
}

@Override
public ArrayList getPhasesOutFlow() {
return null;
}

@Override
public ArrayList getRemainingPhasesInFlow() {
return null;
}

@Override
public void setPhasesInFaultFlow(ArrayList list) {

}

@Override
public void setPhasesOutFaultFlow(ArrayList list) {

}

@Override
public void setPhasesOutFlow(ArrayList list) {

}

@Override
public void setRemainingPhasesInFlow(ArrayList list) {

}

@Override
public OperationClient createClient(ServiceContext sc, Options options) {
return null;
}
};
ServiceContext serviceContext = new ServiceContext();
axisOperation.setMessageExchangePattern("http://www.w3.org/ns/wsdl/in-out");
OperationContext operationContext = new OperationContext(axisOperation, serviceContext);
messageContext.setOperationContext(operationContext);
assertTrue(abstractTransportSender.waitForSynchronousResponse(messageContext));
}
}