Search in sources :

Example 6 with URI

use of org.apache.axis2.databinding.types.URI in project wso2-synapse by wso2.

the class EndpointDeployerTest method testDeploy.

/**
 * Testing the deployment of an endpoint
 *
 * @throws Exception
 */
@Test
public void testDeploy() throws Exception {
    String inputXML = "<endpoint name = \"sampleEP\" xmlns=\"http://ws.apache.org/ns/synapse\">" + "<address uri=\"http://localhost:9000/services/SimpleStockQuoteService\" >" + "</address>" + "</endpoint>";
    OMElement inputElement = AXIOMUtil.stringToOM(inputXML);
    EndpointDeployer endpointDeployer = new EndpointDeployer();
    SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
    AxisConfiguration axisConfiguration = synapseConfiguration.getAxisConfiguration();
    ConfigurationContext cfgCtx = new ConfigurationContext(axisConfiguration);
    SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(cfgCtx, synapseConfiguration);
    axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment));
    axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_CONFIG, synapseConfiguration));
    cfgCtx.setAxisConfiguration(axisConfiguration);
    endpointDeployer.init(cfgCtx);
    String response = endpointDeployer.deploySynapseArtifact(inputElement, "sampleFile", null);
    Assert.assertEquals("Endpoint not deployed!", "sampleEP", response);
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) SynapseEnvironment(org.apache.synapse.core.SynapseEnvironment) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) Parameter(org.apache.axis2.description.Parameter) OMElement(org.apache.axiom.om.OMElement) SynapseConfiguration(org.apache.synapse.config.SynapseConfiguration) Test(org.junit.Test)

Example 7 with URI

use of org.apache.axis2.databinding.types.URI in project wso2-synapse by wso2.

the class ProxyServiceDeployerTest method testUndeploy.

/**
 * Test undeploying a proxy service
 *
 * @throws Exception
 */
@Test
public void testUndeploy() throws Exception {
    String inputXML = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"TestProxy\">" + "        <target>" + "            <endpoint>" + "                <address uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/>" + "            </endpoint>" + "            <outSequence>" + "                <send/>" + "            </outSequence>" + "        </target>" + "    </proxy>";
    OMElement inputElement = AXIOMUtil.stringToOM(inputXML);
    ProxyServiceDeployer proxyServiceDeployer = new ProxyServiceDeployer();
    SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
    AxisConfiguration axisConfiguration = synapseConfiguration.getAxisConfiguration();
    ConfigurationContext cfgCtx = new ConfigurationContext(axisConfiguration);
    SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(cfgCtx, synapseConfiguration);
    axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment));
    axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_CONFIG, synapseConfiguration));
    cfgCtx.setAxisConfiguration(axisConfiguration);
    proxyServiceDeployer.init(cfgCtx);
    proxyServiceDeployer.deploySynapseArtifact(inputElement, "sampleFile", null);
    Assert.assertNotNull("Proxy not deployed!", synapseConfiguration.getProxyService("TestProxy"));
    proxyServiceDeployer.undeploySynapseArtifact("TestProxy");
    Assert.assertNull("Proxy service cannot be undeployed", synapseConfiguration.getProxyService("TestProxy"));
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) SynapseEnvironment(org.apache.synapse.core.SynapseEnvironment) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) Parameter(org.apache.axis2.description.Parameter) OMElement(org.apache.axiom.om.OMElement) SynapseConfiguration(org.apache.synapse.config.SynapseConfiguration) Test(org.junit.Test)

Example 8 with URI

use of org.apache.axis2.databinding.types.URI in project wso2-synapse by wso2.

the class ProxyServiceDeployerTest method testUpdate.

/**
 * Test updating a proxy service
 *
 * @throws Exception
 */
@Test
public void testUpdate() throws Exception {
    String inputXML = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"TestProxy\">" + "        <target>" + "            <endpoint>" + "                <address uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/>" + "            </endpoint>" + "            <outSequence>" + "                <send/>" + "            </outSequence>" + "        </target>" + "    </proxy>";
    OMElement inputElement = AXIOMUtil.stringToOM(inputXML);
    ProxyServiceDeployer proxyServiceDeployer = new ProxyServiceDeployer();
    SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
    AxisConfiguration axisConfiguration = synapseConfiguration.getAxisConfiguration();
    ConfigurationContext cfgCtx = new ConfigurationContext(axisConfiguration);
    SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(cfgCtx, synapseConfiguration);
    axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment));
    axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_CONFIG, synapseConfiguration));
    cfgCtx.setAxisConfiguration(axisConfiguration);
    proxyServiceDeployer.init(cfgCtx);
    proxyServiceDeployer.deploySynapseArtifact(inputElement, "sampleFile", null);
    String inputUpdateXML = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"TestProxyUpdated\">" + "        <target>" + "            <endpoint>" + "                <address uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/>" + "            </endpoint>" + "            <outSequence>" + "                <send/>" + "            </outSequence>" + "        </target>" + "    </proxy>";
    OMElement updatedElement = AXIOMUtil.stringToOM(inputUpdateXML);
    String response = proxyServiceDeployer.updateSynapseArtifact(updatedElement, "sampleUpdateFile", "TestProxy", null);
    Assert.assertEquals("Proxy not updated!", "TestProxyUpdated", response);
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) SynapseEnvironment(org.apache.synapse.core.SynapseEnvironment) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) Parameter(org.apache.axis2.description.Parameter) OMElement(org.apache.axiom.om.OMElement) SynapseConfiguration(org.apache.synapse.config.SynapseConfiguration) Test(org.junit.Test)

Example 9 with URI

use of org.apache.axis2.databinding.types.URI in project wso2-synapse by wso2.

the class ProxyServiceDeployerTest method testDeploy.

/**
 * Testing the deployment of a proxy service
 *
 * @throws Exception
 */
@Test
public void testDeploy() throws Exception {
    String inputXML = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"TestProxy\">" + "        <target>" + "            <endpoint>" + "                <address uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/>" + "            </endpoint>" + "            <outSequence>" + "                <send/>" + "            </outSequence>" + "        </target>" + "    </proxy>";
    OMElement inputElement = AXIOMUtil.stringToOM(inputXML);
    ProxyServiceDeployer proxyServiceDeployer = new ProxyServiceDeployer();
    SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
    AxisConfiguration axisConfiguration = synapseConfiguration.getAxisConfiguration();
    ConfigurationContext cfgCtx = new ConfigurationContext(axisConfiguration);
    SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(cfgCtx, synapseConfiguration);
    axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment));
    axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_CONFIG, synapseConfiguration));
    cfgCtx.setAxisConfiguration(axisConfiguration);
    proxyServiceDeployer.init(cfgCtx);
    String response = proxyServiceDeployer.deploySynapseArtifact(inputElement, "sampleFile", null);
    Assert.assertEquals("Proxy service not deployed!", "TestProxy", response);
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) SynapseEnvironment(org.apache.synapse.core.SynapseEnvironment) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) Parameter(org.apache.axis2.description.Parameter) OMElement(org.apache.axiom.om.OMElement) SynapseConfiguration(org.apache.synapse.config.SynapseConfiguration) Test(org.junit.Test)

Example 10 with URI

use of org.apache.axis2.databinding.types.URI in project wso2-synapse by wso2.

the class TemplateDeployerTest method testUpdateForEndpoint.

/**
 * Test updating an endpoint
 *
 * @throws Exception
 */
@Test
public void testUpdateForEndpoint() throws Exception {
    String inputXML = "<template name = \"TestTemplate\" xmlns=\"http://ws.apache.org/ns/synapse\">" + "              <endpoint name = \"sampleEP\" >" + "                  <address uri=\"http://localhost:9000/services/SimpleStockQuoteService\" >" + "</address>" + "              </endpoint>" + "          </template>";
    OMElement inputElement = AXIOMUtil.stringToOM(inputXML);
    TemplateDeployer templateDeployer = new TemplateDeployer();
    SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
    AxisConfiguration axisConfiguration = synapseConfiguration.getAxisConfiguration();
    ConfigurationContext cfgCtx = new ConfigurationContext(axisConfiguration);
    SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(cfgCtx, synapseConfiguration);
    axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment));
    axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_CONFIG, synapseConfiguration));
    cfgCtx.setAxisConfiguration(axisConfiguration);
    templateDeployer.init(cfgCtx);
    templateDeployer.deploySynapseArtifact(inputElement, "sampleFile", null);
    String inputUpdateXML = "<template name = \"TestTemplateUpdated\" xmlns=\"http://ws.apache.org/ns/synapse\">" + "              <endpoint name = \"sampleEP\" >" + "                  <address uri=\"http://localhost:9000/services/SimpleStockQuoteService\" >" + "</address>" + "              </endpoint>" + "          </template>";
    OMElement updatedElement = AXIOMUtil.stringToOM(inputUpdateXML);
    String response = templateDeployer.updateSynapseArtifact(updatedElement, "sampleUpdateFile", "TestTemplate", null);
    Assert.assertEquals("Endpoint template not updated!", "TestTemplateUpdated", response);
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) SynapseEnvironment(org.apache.synapse.core.SynapseEnvironment) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) Parameter(org.apache.axis2.description.Parameter) OMElement(org.apache.axiom.om.OMElement) SynapseConfiguration(org.apache.synapse.config.SynapseConfiguration) Test(org.junit.Test)

Aggregations

AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)16 SynapseConfiguration (org.apache.synapse.config.SynapseConfiguration)15 OMElement (org.apache.axiom.om.OMElement)13 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)13 Parameter (org.apache.axis2.description.Parameter)11 SynapseEnvironment (org.apache.synapse.core.SynapseEnvironment)10 URI (java.net.URI)9 Axis2SynapseEnvironment (org.apache.synapse.core.axis2.Axis2SynapseEnvironment)9 Test (org.junit.Test)9 EndpointReference (org.apache.axis2.addressing.EndpointReference)8 URI (org.apache.axis2.databinding.types.URI)7 IOException (java.io.IOException)5 SynapseException (org.apache.synapse.SynapseException)5 MalformedURLException (java.net.MalformedURLException)4 Calendar (java.util.Calendar)4 HumanTaskRuntimeException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)4 InputStream (java.io.InputStream)3 URISyntaxException (java.net.URISyntaxException)3 URL (java.net.URL)3 HashMap (java.util.HashMap)3