Skip to content
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 @@ -25,6 +25,7 @@
import org.apache.synapse.Mediator;
import org.apache.synapse.SynapseException;
import org.apache.synapse.SynapseConstants;
import org.apache.synapse.mediators.AbstractMediator;
import org.apache.synapse.mediators.ext.ClassMediator;
import org.apache.synapse.mediators.v2.Utils;
import org.apache.synapse.mediators.v2.ext.AbstractClassMediator;
Expand Down Expand Up @@ -118,6 +119,9 @@ public Mediator createSpecificMediator(OMElement elem, Properties properties) {

try {
mediator = (Mediator) clazz.newInstance();
if (mediator instanceof AbstractMediator && FactoryUtils.isVersionedDeployment(properties)) {
((AbstractMediator) mediator).setArtifactIdentifier(properties.getProperty(SynapseConstants.SYNAPSE_ARTIFACT_IDENTIFIER));
}
} catch (Throwable e) {
String msg = "Error in instantiating class : " + name.getAttributeValue();
log.error(msg, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ public static InboundEndpoint createInboundEndpoint(OMElement inboundEndpointEle

InboundEndpoint inboundEndpoint = new InboundEndpoint();
if (inboundEndpointElem.getAttributeValue(ATT_NAME) != null) {
inboundEndpoint.setName(FactoryUtils.getFullyQualifiedName(properties,
inboundEndpointElem.getAttributeValue(ATT_NAME)));
inboundEndpoint.setName(inboundEndpointElem.getAttributeValue(ATT_NAME));
} else {
String msg = "Inbound Endpoint name cannot be null";
log.error(msg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private static SynapseLibrary createSynapseLibraryWithDeps(OMElement artifactEle
}
String packageName = readAttribute(artifactEle, LibDeployerConstants.PACKAGE_ATTR);
SynapseLibrary synLib;
if (deploymentFileData.isVersionedDeployment()) {
if (deploymentFileData != null && deploymentFileData.isVersionedDeployment()) {
synLib = new SynapseLibrary(deploymentFileData.getArtifactIdentifier(), readAttribute(artifactEle, LibDeployerConstants.NAME),
packageName);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public abstract class AbstractMediator implements Mediator, AspectConfigurable {
private boolean isSkipEnabled = false;

private SynapseMediationFlowPoint flowPoint = null;
private String artifactIdentifier;


/**
Expand Down Expand Up @@ -567,4 +568,14 @@ protected MediatorFaultHandler getLastSequenceFaultHandler(MessageContext synCtx
}
return null;
}

public String getArtifactIdentifier() {

return artifactIdentifier;
}

public void setArtifactIdentifier(String artifactIdentifier) {

this.artifactIdentifier = artifactIdentifier;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ private void updateTaskForVersioning(TaskDescription taskDescription, Properties

taskDescription.setName(FactoryUtils.getFullyQualifiedName(properties, taskDescription.getName()));
taskDescription.getXmlProperties().forEach(prop -> {
if (prop.getAttributeValue(NAME).equals("sequenceName")
|| prop.getAttributeValue(NAME).equals("proxyName")) {
if (prop.getAttributeValue(NAME).equals("sequenceName")) {
prop.setText(FactoryUtils.getFullyQualifiedName(properties, prop.getText()));
String value = prop.getAttributeValue(VALUE);
if (value != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import org.apache.synapse.config.xml.inbound.InboundEndpointSerializer;
import org.apache.synapse.inbound.InboundEndpoint;

import java.util.Properties;

/**
* Testing InboundEndpoint related operations
*/
Expand Down Expand Up @@ -73,6 +75,30 @@ public class InboundEndpointTestCase extends TestCase {
+ "<sequence xmlns=\"http://ws.apache.org/ns/synapse\" name=\"receiveSeq\">\n" + " <send/>\n"
+ "</sequence>";

private static final String rabbitMQInbound = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<inboundEndpoint name=\"RabbitMQInbound\" sequence=\"RabbitMQInbound-inboundSequence\" onError=\"RabbitMQInbound-inboundErrorSequence\" suspend=\"false\" protocol=\"rabbitmq\">\n" +
" <parameters xmlns=\"http://ws.apache.org/ns/synapse\">\n" +
" <parameter name=\"rabbitmq.connection.factory\">QueueConnectionFactory</parameter>\n" +
" <parameter name=\"rabbitmq.server.host.name\">localhost</parameter>\n" +
" <parameter name=\"rabbitmq.server.port\">5672</parameter>\n" +
" <parameter name=\"rabbitmq.server.user.name\">guest</parameter>\n" +
" <parameter name=\"rabbitmq.server.password\">guest</parameter>\n" +
" <parameter name=\"rabbitmq.queue.name\">queue_transaction</parameter>\n" +
" <parameter name=\"sequential\">true</parameter>\n" +
" <parameter name=\"coordination\">true</parameter>\n" +
" <parameter name=\"rabbitmq.queue.durable\">false</parameter>\n" +
" <parameter name=\"rabbitmq.queue.exclusive\">false</parameter>\n" +
" <parameter name=\"rabbitmq.queue.auto.delete\">false</parameter>\n" +
" <parameter name=\"rabbitmq.queue.auto.ack\">false</parameter>\n" +
" <parameter name=\"rabbitmq.queue.autodeclare\">false</parameter>\n" +
" <parameter name=\"rabbitmq.exchange.durable\">false</parameter>\n" +
" <parameter name=\"rabbitmq.exchange.auto.delete\">false</parameter>\n" +
" <parameter name=\"rabbitmq.exchange.autodeclare\">false</parameter>\n" +
" <parameter name=\"rabbitmq.connection.ssl.enabled\">false</parameter>\n" +
" <parameter name=\"rabbitmq.channel.consumer.qos\">0</parameter>\n" +
" </parameters>\n" +
"</inboundEndpoint>";

public void testCreateValidInboundEP() throws Exception {
ep = factory.createInboundEndpoint(AXIOMUtil.stringToOM(sampleEP), config);
Assert.assertNotNull("Inbound Endpoint is null", ep);
Expand Down Expand Up @@ -110,4 +136,28 @@ public void testCreateInvalidInboundEP() throws Exception {
Assert.assertEquals(e.getMessage().contains("Inbound Endpoint name cannot be null"), true);
}
}

public void testInboundEPWithVersionedDeployment() throws Exception {

Properties properties = new Properties();
properties.put("synapse.artifact.versioned.deployment", true);
properties.put("synapse.artifact.identifier", "com.microintegrator.projects__beta1__1.0.2");

ep = factory.createInboundEndpoint(AXIOMUtil.stringToOM(rabbitMQInbound), config, properties);
Assert.assertEquals("RabbitMQInbound", ep.getName());
Assert.assertEquals("com.microintegrator.projects__beta1__1.0.2__RabbitMQInbound-inboundSequence", ep.getInjectingSeq());
Assert.assertEquals("com.microintegrator.projects__beta1__1.0.2__RabbitMQInbound-inboundErrorSequence", ep.getOnErrorSeq());
}

public void testInboundEPWithNonVersionedDeployment() throws Exception {

Properties properties = new Properties();
properties.put("synapse.artifact.versioned.deployment", false);
properties.put("synapse.artifact.identifier", "com.microintegrator.projects__beta1__1.0.2");

ep = factory.createInboundEndpoint(AXIOMUtil.stringToOM(rabbitMQInbound), config, properties);
Assert.assertEquals("RabbitMQInbound", ep.getName());
Assert.assertEquals("RabbitMQInbound-inboundSequence", ep.getInjectingSeq());
Assert.assertEquals("RabbitMQInbound-inboundErrorSequence", ep.getOnErrorSeq());
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@
<mina.version>2.1.6</mina.version>
<jms-1.1-spec.version>1.1</jms-1.1-spec.version>
<!-- Axis2 and its dependencies -->
<axis2.version>1.6.1-wso2v112</axis2.version>
<axis2.version>1.6.1-wso2v113</axis2.version>
<axis2.transport.version>2.0.0-wso2v77</axis2.transport.version>
<axiom.version>1.2.11-wso2v30</axiom.version>
<xml_schema.version>1.4.7</xml_schema.version>
Expand Down
Loading