use of org.apache.synapse.core.axis2.ProxyService in project wso2-synapse by wso2.
the class ProxyServiceDeployer method undeploySynapseArtifact.
@Override
public void undeploySynapseArtifact(String artifactName) {
if (log.isDebugEnabled()) {
log.debug("ProxyService Undeployment of the proxy named : " + artifactName + " : Started");
}
try {
ProxyService proxy = getSynapseConfiguration().getProxyService(artifactName);
if (proxy != null) {
proxy.setLogSetterValue();
if (log.isDebugEnabled()) {
log.debug("Stopping the ProxyService named : " + artifactName);
}
proxy.stop(getSynapseConfiguration());
getSynapseConfiguration().removeProxyService(artifactName);
if (log.isDebugEnabled()) {
log.debug("ProxyService Undeployment of the proxy named : " + artifactName + " : Completed");
}
log.info("ProxyService named '" + proxy.getName() + "' has been undeployed");
} else if (log.isDebugEnabled()) {
log.debug("Proxy service " + artifactName + " has already been undeployed");
}
} catch (Exception e) {
handleSynapseArtifactDeploymentError("ProxyService Undeployement of proxy named : " + artifactName + " : Failed", e);
}
}
use of org.apache.synapse.core.axis2.ProxyService in project wso2-synapse by wso2.
the class ProxyServiceDeployer method restoreSynapseArtifact.
@Override
public void restoreSynapseArtifact(String artifactName) {
if (log.isDebugEnabled()) {
log.debug("Restoring the ProxyService with name : " + artifactName + " : Started");
}
try {
ProxyService proxy = getSynapseConfiguration().getProxyService(artifactName);
if (proxy != null) {
proxy.setLogSetterValue();
}
OMElement proxyElem = ProxyServiceSerializer.serializeProxy(null, proxy);
if (proxy.getFileName() != null) {
String fileName = getServerConfigurationInformation().getSynapseXMLLocation() + File.separator + MultiXMLConfigurationBuilder.PROXY_SERVICES_DIR + File.separator + proxy.getFileName();
writeToFile(proxyElem, fileName);
if (log.isDebugEnabled()) {
log.debug("Restoring the ProxyService with name : " + artifactName + " : Completed");
}
log.info("ProxyService named '" + artifactName + "' has been restored");
} else {
handleSynapseArtifactDeploymentError("Couldn't restore the ProxyService named '" + artifactName + "', filename cannot be found");
}
} catch (Exception e) {
handleSynapseArtifactDeploymentError("Restoring of the ProxyService named '" + artifactName + "' has failed", e);
}
}
use of org.apache.synapse.core.axis2.ProxyService in project wso2-synapse by wso2.
the class DebugManagerTest method testDebugManagerProcessCommandClearSkipProxyInSequence.
public void testDebugManagerProcessCommandClearSkipProxyInSequence() throws Exception {
ProxyService ps = new ProxyService("test_proxy_7");
TestMediator in1 = new TestMediator();
TestMediator in2 = new TestMediator();
TestMediator in3 = new TestMediator();
SequenceMediator inSeq = new SequenceMediator();
inSeq.addChild(in1);
inSeq.addChild(in2);
inSeq.addChild(in3);
TestMediator out1 = new TestMediator();
TestMediator out2 = new TestMediator();
TestMediator out3 = new TestMediator();
SequenceMediator outSeq = new SequenceMediator();
outSeq.addChild(out1);
outSeq.addChild(out2);
outSeq.addChild(out3);
ps.setTargetInLineInSequence(inSeq);
ps.setTargetInLineOutSequence(inSeq);
synConfig.addProxyService(ps.getName(), ps);
String debug_command = "{\"command\":\"set\",\"command-argument\":\"skip\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"proxy\":{\"proxy-key\":\"test_proxy_7\",\"sequence-type\":\"proxy_inseq\"," + "\"mediator-position\":\"0\"}}}";
dm.processDebugCommand(debug_command);
debug_command = "{\"command\":\"clear\",\"command-argument\":\"skip\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"proxy\":{\"proxy-key\":\"test_proxy_7\",\"sequence-type\":\"proxy_inseq\"," + "\"mediator-position\":\"0\"}}}";
dm.processDebugCommand(debug_command);
assertTrue(!((AbstractMediator) ps.getTargetInLineInSequence().getChild(0)).isSkipEnabled());
}
use of org.apache.synapse.core.axis2.ProxyService in project wso2-synapse by wso2.
the class DebugManagerTest method testDebugManagerProcessCommandClearBreakPointProxyOutSequence.
public void testDebugManagerProcessCommandClearBreakPointProxyOutSequence() throws Exception {
ProxyService ps = new ProxyService("test_proxy_4");
TestMediator in1 = new TestMediator();
TestMediator in2 = new TestMediator();
TestMediator in3 = new TestMediator();
SequenceMediator inSeq = new SequenceMediator();
inSeq.addChild(in1);
inSeq.addChild(in2);
inSeq.addChild(in3);
TestMediator out1 = new TestMediator();
TestMediator out2 = new TestMediator();
TestMediator out3 = new TestMediator();
SequenceMediator outSeq = new SequenceMediator();
outSeq.addChild(out1);
outSeq.addChild(out2);
outSeq.addChild(out3);
ps.setTargetInLineInSequence(inSeq);
ps.setTargetInLineOutSequence(inSeq);
synConfig.addProxyService(ps.getName(), ps);
String debug_command = "{\"command\":\"set\",\"command-argument\":\"breakpoint\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"proxy\":{\"proxy-key\":\"test_proxy_4\",\"sequence-type\":\"proxy_outseq\"," + "\"mediator-position\":\"0\"}}}";
dm.processDebugCommand(debug_command);
debug_command = "{\"command\":\"clear\",\"command-argument\":\"breakpoint\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"proxy\":{\"proxy-key\":\"test_proxy_4\",\"sequence-type\":\"proxy_outseq\"," + "\"mediator-position\":\"0\"}}}";
dm.processDebugCommand(debug_command);
assertTrue(!((AbstractMediator) ps.getTargetInLineOutSequence().getChild(0)).isBreakPoint());
}
use of org.apache.synapse.core.axis2.ProxyService in project wso2-synapse by wso2.
the class DebugManagerTest method testDebugManagerProcessCommandSetBreakPointProxyInSequence.
public void testDebugManagerProcessCommandSetBreakPointProxyInSequence() throws Exception {
ProxyService ps = new ProxyService("test_proxy_1");
TestMediator in1 = new TestMediator();
TestMediator in2 = new TestMediator();
TestMediator in3 = new TestMediator();
SequenceMediator inSeq = new SequenceMediator();
inSeq.addChild(in1);
inSeq.addChild(in2);
inSeq.addChild(in3);
TestMediator out1 = new TestMediator();
TestMediator out2 = new TestMediator();
TestMediator out3 = new TestMediator();
SequenceMediator outSeq = new SequenceMediator();
outSeq.addChild(out1);
outSeq.addChild(out2);
outSeq.addChild(out3);
ps.setTargetInLineInSequence(inSeq);
ps.setTargetInLineOutSequence(inSeq);
synConfig.addProxyService(ps.getName(), ps);
String debug_command = "{\"command\":\"set\",\"command-argument\":\"breakpoint\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"proxy\":{\"proxy-key\":\"test_proxy_1\",\"sequence-type\":\"proxy_inseq\",\"mediator-position\":\"0\"}}}";
dm.processDebugCommand(debug_command);
assertTrue(((AbstractMediator) ps.getTargetInLineInSequence().getChild(0)).isBreakPoint());
}
Aggregations