Search in sources :

Example 1 with ProxyService

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);
    }
}
Also used : ProxyService(org.apache.synapse.core.axis2.ProxyService) DeploymentException(org.apache.axis2.deployment.DeploymentException)

Example 2 with ProxyService

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);
    }
}
Also used : ProxyService(org.apache.synapse.core.axis2.ProxyService) OMElement(org.apache.axiom.om.OMElement) DeploymentException(org.apache.axis2.deployment.DeploymentException)

Example 3 with ProxyService

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());
}
Also used : ProxyService(org.apache.synapse.core.axis2.ProxyService) TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator) AbstractMediator(org.apache.synapse.mediators.AbstractMediator)

Example 4 with ProxyService

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());
}
Also used : ProxyService(org.apache.synapse.core.axis2.ProxyService) TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator) AbstractMediator(org.apache.synapse.mediators.AbstractMediator)

Example 5 with ProxyService

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());
}
Also used : ProxyService(org.apache.synapse.core.axis2.ProxyService) TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator)

Aggregations

ProxyService (org.apache.synapse.core.axis2.ProxyService)33 OMElement (org.apache.axiom.om.OMElement)13 SequenceMediator (org.apache.synapse.mediators.base.SequenceMediator)12 Properties (java.util.Properties)8 TestMediator (org.apache.synapse.mediators.TestMediator)8 AbstractMediator (org.apache.synapse.mediators.AbstractMediator)6 InboundEndpoint (org.apache.synapse.inbound.InboundEndpoint)5 TemplateMediator (org.apache.synapse.mediators.template.TemplateMediator)5 DeploymentException (org.apache.axis2.deployment.DeploymentException)4 PriorityExecutor (org.apache.synapse.commons.executors.PriorityExecutor)4 Endpoint (org.apache.synapse.endpoints.Endpoint)4 API (org.apache.synapse.rest.API)4 File (java.io.File)3 SynapseEventSource (org.apache.synapse.eventing.SynapseEventSource)3 MessageProcessor (org.apache.synapse.message.processor.MessageProcessor)3 MessageStore (org.apache.synapse.message.store.MessageStore)3 Test (org.junit.Test)3 Iterator (java.util.Iterator)2 AxisService (org.apache.axis2.description.AxisService)2 ManagedLifecycle (org.apache.synapse.ManagedLifecycle)2