Search in sources :

Example 26 with AxisConfiguration

use of org.apache.axis2.engine.AxisConfiguration in project wso2-synapse by wso2.

the class MetricsAggregatorModuleTest method testInit.

/**
 * Initializing metricsAggregationModule and assert for the returned counter obj
 * @throws AxisFault
 */
public void testInit() throws AxisFault {
    AxisConfiguration axisConfiguration = new AxisConfiguration();
    ConfigurationContext configurationContext = new ConfigurationContext(axisConfiguration);
    metricsAggregatorModule.init(configurationContext, null);
    Counter counter = (Counter) axisConfiguration.getParameter(MetricsConstants.GLOBAL_REQUEST_COUNTER).getValue();
    Assert.assertEquals("Counter should be 0", counter.getCount(), 0);
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) ConfigurationContext(org.apache.axis2.context.ConfigurationContext)

Example 27 with AxisConfiguration

use of org.apache.axis2.engine.AxisConfiguration in project wso2-synapse by wso2.

the class ServerConfigurationInformationFactory method getAxis2ParameterValue.

/**
 * Helper method to get a value of a parameters in the AxisConfiguration
 *
 * @param axisConfiguration AxisConfiguration instance
 * @param paramKey The name / key of the parameter
 * @return The value of the parameter
 */
private static String getAxis2ParameterValue(AxisConfiguration axisConfiguration, String paramKey) {
    Parameter parameter = axisConfiguration.getParameter(paramKey);
    if (parameter == null) {
        return null;
    }
    Object value = parameter.getValue();
    if (value != null && value instanceof String) {
        return (String) parameter.getValue();
    } else {
        return null;
    }
}
Also used : Parameter(org.apache.axis2.description.Parameter)

Example 28 with AxisConfiguration

use of org.apache.axis2.engine.AxisConfiguration in project wso2-synapse by wso2.

the class SynapseObserverTest method testSimpleObserver.

public void testSimpleObserver() {
    SynapseConfiguration synapseConfig = new SynapseConfiguration();
    synapseConfig.setAxisConfiguration(new AxisConfiguration());
    synapseConfig.registerObserver(observer);
    Endpoint epr = new AddressEndpoint();
    epr.setName("endpoint1");
    synapseConfig.addEndpoint(epr.getName(), epr);
    assertItemAdded(epr.getName(), ENDPOINT);
    synapseConfig.removeEndpoint(epr.getName());
    assertItemRemoved(epr.getName(), ENDPOINT);
    SequenceMediator seq = new SequenceMediator();
    seq.setName("sequence1");
    synapseConfig.addSequence(seq.getName(), seq);
    assertItemAdded(seq.getName(), SEQUENCE);
    synapseConfig.removeSequence(seq.getName());
    assertItemRemoved(seq.getName(), SEQUENCE);
    TemplateMediator template = new TemplateMediator();
    template.setName("template1");
    synapseConfig.addSequenceTemplate(template.getName(), template);
    assertItemAdded(template.getName(), SEQUENCE_TEMPLATE);
    synapseConfig.removeSequenceTemplate(template.getName());
    assertItemRemoved(template.getName(), SEQUENCE_TEMPLATE);
    Entry entry = new Entry();
    entry.setKey("entry1");
    synapseConfig.addEntry(entry.getKey(), entry);
    assertItemAdded(entry.getKey(), ENTRY);
    synapseConfig.removeEntry(entry.getKey());
    assertItemRemoved(entry.getKey(), ENTRY);
    ProxyService proxy = new ProxyService("proxy1");
    synapseConfig.addProxyService(proxy.getName(), proxy);
    assertItemAdded(proxy.getName(), PROXY);
    synapseConfig.removeProxyService(proxy.getName());
    assertItemRemoved(proxy.getName(), PROXY);
    Startup startup = new StartUpController();
    startup.setName("startup1");
    synapseConfig.addStartup(startup);
    assertItemAdded(startup.getName(), STARTUP);
    synapseConfig.removeStartup(startup.getName());
    assertItemRemoved(startup.getName(), STARTUP);
    SynapseEventSource eventSrc = new SynapseEventSource("eventSrc1");
    synapseConfig.addEventSource(eventSrc.getName(), eventSrc);
    assertItemAdded(eventSrc.getName(), EVENT_SRC);
    synapseConfig.removeEventSource(eventSrc.getName());
    assertItemRemoved(eventSrc.getName(), EVENT_SRC);
    PriorityExecutor exec = new PriorityExecutor();
    exec.setName("exec1");
    synapseConfig.addPriorityExecutor(exec.getName(), exec);
    assertItemAdded(exec.getName(), EXECUTOR);
    synapseConfig.removeExecutor(exec.getName());
    assertItemRemoved(exec.getName(), EXECUTOR);
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) StartUpController(org.apache.synapse.startup.quartz.StartUpController) AddressEndpoint(org.apache.synapse.endpoints.AddressEndpoint) AddressEndpoint(org.apache.synapse.endpoints.AddressEndpoint) Endpoint(org.apache.synapse.endpoints.Endpoint) InboundEndpoint(org.apache.synapse.inbound.InboundEndpoint) TemplateMediator(org.apache.synapse.mediators.template.TemplateMediator) SynapseEventSource(org.apache.synapse.eventing.SynapseEventSource) ProxyService(org.apache.synapse.core.axis2.ProxyService) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator) PriorityExecutor(org.apache.synapse.commons.executors.PriorityExecutor) Startup(org.apache.synapse.Startup)

Example 29 with AxisConfiguration

use of org.apache.axis2.engine.AxisConfiguration in project wso2-synapse by wso2.

the class HessianMessageBuilderTest method testProcessDocumentFaultWithSynEnv.

public void testProcessDocumentFaultWithSynEnv() throws IOException {
    SynapseEnvironment synEnv = new Axis2SynapseEnvironment(new ConfigurationContext(new AxisConfiguration()), new SynapseConfiguration());
    testProcessDocumentFault(synEnv);
}
Also used : Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) SynapseEnvironment(org.apache.synapse.core.SynapseEnvironment) SynapseConfiguration(org.apache.synapse.config.SynapseConfiguration)

Example 30 with AxisConfiguration

use of org.apache.axis2.engine.AxisConfiguration in project wso2-synapse by wso2.

the class HessianMessageBuilderTest method testProcessDocumentWithSynEnv.

public void testProcessDocumentWithSynEnv() throws IOException {
    SynapseEnvironment synEnv = new Axis2SynapseEnvironment(new ConfigurationContext(new AxisConfiguration()), new SynapseConfiguration());
    testProcessDocument(synEnv);
}
Also used : Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) Axis2SynapseEnvironment(org.apache.synapse.core.axis2.Axis2SynapseEnvironment) SynapseEnvironment(org.apache.synapse.core.SynapseEnvironment) SynapseConfiguration(org.apache.synapse.config.SynapseConfiguration)

Aggregations

AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)161 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)115 SynapseConfiguration (org.apache.synapse.config.SynapseConfiguration)74 Test (org.junit.Test)68 Axis2SynapseEnvironment (org.apache.synapse.core.axis2.Axis2SynapseEnvironment)61 Parameter (org.apache.axis2.description.Parameter)50 SynapseEnvironment (org.apache.synapse.core.SynapseEnvironment)49 OMElement (org.apache.axiom.om.OMElement)36 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)35 MessageContext (org.apache.synapse.MessageContext)31 AxisService (org.apache.axis2.description.AxisService)28 Axis2MessageContext (org.apache.synapse.core.axis2.Axis2MessageContext)25 TransportOutDescription (org.apache.axis2.description.TransportOutDescription)19 AxisFault (org.apache.axis2.AxisFault)17 ArrayList (java.util.ArrayList)14 HashMap (java.util.HashMap)13 SynapseException (org.apache.synapse.SynapseException)13 Map (java.util.Map)12 MessageContext (org.apache.axis2.context.MessageContext)12 ServiceContext (org.apache.axis2.context.ServiceContext)12