use of org.apache.synapse.inbound.InboundEndpoint in project wso2-synapse by wso2.
the class InboundEndpointDeployer method deploySynapseArtifact.
@Override
public String deploySynapseArtifact(OMElement artifactConfig, String fileName, Properties properties) {
CustomLogSetter.getInstance().setLogAppender(customLogContent);
if (log.isDebugEnabled()) {
log.debug("InboundEndpoint deployment from file : " + fileName + " : Started");
}
try {
InboundEndpoint inboundEndpoint = InboundEndpointFactory.createInboundEndpoint(artifactConfig, getSynapseConfiguration());
if (inboundEndpoint != null) {
inboundEndpoint.setArtifactContainerName(customLogContent);
inboundEndpoint.setFileName(new File(fileName).getName());
if (log.isDebugEnabled()) {
log.debug("Inbound Endpoint named '" + inboundEndpoint.getName() + "' has been built from the file " + fileName);
}
inboundEndpoint.init(getSynapseEnvironment());
if (log.isDebugEnabled()) {
log.debug("Initialized the Inbound Endpoint: " + inboundEndpoint.getName());
}
getSynapseConfiguration().addInboundEndpoint(inboundEndpoint.getName(), inboundEndpoint);
if (log.isDebugEnabled()) {
log.debug("Inbound Endpoint deployment from file : " + fileName + " : Completed");
}
log.info("Inbound Endpoint named '" + inboundEndpoint.getName() + "' has been deployed from file : " + fileName);
return inboundEndpoint.getName();
}
} catch (Exception e) {
handleSynapseArtifactDeploymentError("Inbound Endpoint deployment from the file : " + fileName + " : Failed.", e);
}
return null;
}
use of org.apache.synapse.inbound.InboundEndpoint in project wso2-synapse by wso2.
the class InboundEndpointDeployer method restoreSynapseArtifact.
@Override
public void restoreSynapseArtifact(String artifactName) {
if (log.isDebugEnabled()) {
log.debug("Restoring the Inbound Endpoint with name : " + artifactName + " : Started");
}
try {
InboundEndpoint inboundEndpoint = getSynapseConfiguration().getInboundEndpoint(artifactName);
CustomLogSetter.getInstance().setLogAppender((inboundEndpoint != null) ? inboundEndpoint.getArtifactContainerName() : "");
OMElement inboundEndpointElement = InboundEndpointSerializer.serializeInboundEndpoint(inboundEndpoint);
if (inboundEndpoint.getFileName() != null) {
String fileName = getServerConfigurationInformation().getSynapseXMLLocation() + File.separator + MultiXMLConfigurationBuilder.INBOUND_ENDPOINT_DIR + File.separator + inboundEndpoint.getFileName();
writeToFile(inboundEndpointElement, fileName);
if (log.isDebugEnabled()) {
log.debug("Restoring the Inbound Endpoint with name : " + artifactName + " : Completed");
}
log.info("Inbound Endpoint named '" + artifactName + "' has been restored");
} else {
handleSynapseArtifactDeploymentError("Couldn't restore the Inbound Endpoint named '" + artifactName + "', filename cannot be found");
}
} catch (Exception e) {
handleSynapseArtifactDeploymentError("Restoring of the Inbound Endpoint named '" + artifactName + "' has failed", e);
}
}
use of org.apache.synapse.inbound.InboundEndpoint in project wso2-synapse by wso2.
the class DebugManagerTest method testDebugManagerProcessCommandSetSkipInboundErrorSequence.
public void testDebugManagerProcessCommandSetSkipInboundErrorSequence() throws Exception {
InboundEndpoint inboundEndpoint = new InboundEndpoint();
inboundEndpoint.setName("test_inbound_4");
TestMediator in1 = new TestMediator();
TestMediator in2 = new TestMediator();
TestMediator in3 = new TestMediator();
SequenceMediator dispatchSeq = new SequenceMediator();
dispatchSeq.addChild(in1);
dispatchSeq.addChild(in2);
dispatchSeq.addChild(in3);
TestMediator out1 = new TestMediator();
TestMediator out2 = new TestMediator();
TestMediator out3 = new TestMediator();
SequenceMediator errorSeq = new SequenceMediator();
errorSeq.addChild(out1);
errorSeq.addChild(out2);
errorSeq.addChild(out3);
synConfig.addSequence("dispatch_4", dispatchSeq);
inboundEndpoint.setInjectingSeq("dispatch_4");
synConfig.addSequence("error_4", errorSeq);
inboundEndpoint.setOnErrorSeq("error_4");
synConfig.addInboundEndpoint(inboundEndpoint.getName(), inboundEndpoint);
String debug_command = "{\"command\":\"set\",\"command-argument\":\"skip\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"inbound\":{\"inbound-key\":\"test_inbound_4\",\"sequence-type\":\"inbound_faultseq\",\"mediator-position\":\"0\"}}}";
dm.processDebugCommand(debug_command);
assertTrue(((AbstractMediator) errorSeq.getChild(0)).isSkipEnabled());
}
use of org.apache.synapse.inbound.InboundEndpoint in project wso2-synapse by wso2.
the class DebugManagerTest method testDebugManagerProcessCommandSetBreakPointInboundErrorSequence.
public void testDebugManagerProcessCommandSetBreakPointInboundErrorSequence() throws Exception {
InboundEndpoint inboundEndpoint = new InboundEndpoint();
inboundEndpoint.setName("test_inbound_2");
TestMediator in1 = new TestMediator();
TestMediator in2 = new TestMediator();
TestMediator in3 = new TestMediator();
SequenceMediator dispatchSeq = new SequenceMediator();
dispatchSeq.addChild(in1);
dispatchSeq.addChild(in2);
dispatchSeq.addChild(in3);
TestMediator out1 = new TestMediator();
TestMediator out2 = new TestMediator();
TestMediator out3 = new TestMediator();
SequenceMediator errorSeq = new SequenceMediator();
errorSeq.addChild(out1);
errorSeq.addChild(out2);
errorSeq.addChild(out3);
synConfig.addSequence("dispatch_1", dispatchSeq);
inboundEndpoint.setInjectingSeq("dispatch_1");
synConfig.addSequence("error_1", errorSeq);
inboundEndpoint.setOnErrorSeq("error_1");
synConfig.addInboundEndpoint(inboundEndpoint.getName(), inboundEndpoint);
String debug_command = "{\"command\":\"set\",\"command-argument\":\"breakpoint\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"inbound\":{\"inbound-key\":\"test_inbound_2\",\"sequence-type\":\"inbound_faultseq\",\"mediator-position\":\"0\"}}}";
dm.processDebugCommand(debug_command);
assertTrue(((AbstractMediator) errorSeq.getChild(0)).isBreakPoint());
}
use of org.apache.synapse.inbound.InboundEndpoint in project wso2-synapse by wso2.
the class DebugManagerTest method testDebugManagerProcessCommandSetSkipInboundSequence.
public void testDebugManagerProcessCommandSetSkipInboundSequence() throws Exception {
InboundEndpoint inboundEndpoint = new InboundEndpoint();
inboundEndpoint.setName("test_inbound_3");
TestMediator in1 = new TestMediator();
TestMediator in2 = new TestMediator();
TestMediator in3 = new TestMediator();
SequenceMediator dispatchSeq = new SequenceMediator();
dispatchSeq.addChild(in1);
dispatchSeq.addChild(in2);
dispatchSeq.addChild(in3);
TestMediator out1 = new TestMediator();
TestMediator out2 = new TestMediator();
TestMediator out3 = new TestMediator();
SequenceMediator errorSeq = new SequenceMediator();
errorSeq.addChild(out1);
errorSeq.addChild(out2);
errorSeq.addChild(out3);
synConfig.addSequence("dispatch_3", dispatchSeq);
inboundEndpoint.setInjectingSeq("dispatch_3");
synConfig.addSequence("error_3", errorSeq);
inboundEndpoint.setOnErrorSeq("error_3");
synConfig.addInboundEndpoint(inboundEndpoint.getName(), inboundEndpoint);
String debug_command = "{\"command\":\"set\",\"command-argument\":\"skip\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"inbound\":{\"inbound-key\":\"test_inbound_3\",\"sequence-type\":\"inbound_seq\",\"mediator-position\":\"0\"}}}";
dm.processDebugCommand(debug_command);
assertTrue(((AbstractMediator) dispatchSeq.getChild(0)).isSkipEnabled());
}
Aggregations