/** * Get the default axis2 configuration context for a client * @return * @throws Exception */ protected ConfigurationContext getClientCfgCtx() throws Exception { AxisConfiguration axisCfg = new AxisConfiguration(); ConfigurationContext cfgCtx = new ConfigurationContext(axisCfg); return cfgCtx; }
/** * Get the default axis2 configuration context for a client * @return * @throws Exception */ protected ConfigurationContext getClientCfgCtx() throws Exception { AxisConfiguration axisCfg = new AxisConfiguration(); ConfigurationContext cfgCtx = new ConfigurationContext(axisCfg); return cfgCtx; }
/** * Get the default axis2 configuration context for a client * @return * @throws Exception */ protected ConfigurationContext getClientCfgCtx() throws Exception { AxisConfiguration axisCfg = new AxisConfiguration(); ConfigurationContext cfgCtx = new ConfigurationContext(axisCfg); return cfgCtx; }
/** * Create a mock SynapseEnvironment object. * * @return Axis2SynapseEnvironment instance * @throws AxisFault on creating/mocking object */ private Axis2SynapseEnvironment getMockedSynapseEnvironment() throws AxisFault { Axis2SynapseEnvironment synapseEnvironment = PowerMockito.mock(Axis2SynapseEnvironment.class); ConfigurationContext axis2ConfigurationContext = new ConfigurationContext(new AxisConfiguration()); Mockito.when(synapseEnvironment.getAxis2ConfigurationContext()).thenReturn(axis2ConfigurationContext); return synapseEnvironment; }
/** * Create a mock SynapseEnvironment object * * @return Axis2SynapseEnvironment instance * @throws AxisFault on creating/mocking object */ private Axis2SynapseEnvironment getMockedSynapseEnvironment() throws AxisFault { Axis2SynapseEnvironment synapseEnvironment = PowerMockito.mock(Axis2SynapseEnvironment.class); ConfigurationContext axis2ConfigurationContext = new ConfigurationContext(new AxisConfiguration()); Mockito.when(synapseEnvironment.getAxis2ConfigurationContext()).thenReturn(axis2ConfigurationContext); return synapseEnvironment; }
/** * creates an empty configuration context. * * @return Returns ConfigurationContext. */ public static ConfigurationContext createEmptyConfigurationContext() throws AxisFault { AxisConfiguration axisConfiguration = new AxisConfiguration(); ConfigurationContext configContext = new ConfigurationContext(axisConfiguration); if (axisConfiguration.getClusteringAgent() != null) { configContext.initCluster(); } setContextPaths(axisConfiguration, configContext); return configContext; }
/** * creates an empty configuration context. * * @return Returns ConfigurationContext. */ public static ConfigurationContext createEmptyConfigurationContext() throws AxisFault { AxisConfiguration axisConfiguration = new AxisConfiguration(); ConfigurationContext configContext = new ConfigurationContext(axisConfiguration); if (axisConfiguration.getClusteringAgent() != null) { configContext.initCluster(); } setContextPaths(axisConfiguration, configContext); return configContext; }
public static MessageContext createMessageContext(OMElement payload, OMElement topic, int tenantId) throws EventBrokerException { MessageContext mc = new MessageContext(); mc.setConfigurationContext(new ConfigurationContext(new AxisConfiguration())); SuperTenantCarbonContext.getCurrentContext(mc).setTenantId(tenantId); SOAPFactory soapFactory = new SOAP12Factory(); SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); envelope.getBody().addChild(payload); if (topic != null) { envelope.getHeader().addChild(topic); } try { mc.setEnvelope(envelope); } catch (Exception e) { throw new EventBrokerException("Unable to generate event.", e); } return mc; }
/** * Create a mock SynapseEnvironment object * * @return Axis2SynapseEnvironment instance * @throws AxisFault on creating/mocking object */ private Axis2SynapseEnvironment getMockedSynapseEnvironment() throws AxisFault { Axis2SynapseEnvironment synapseEnvironment = PowerMockito.mock(Axis2SynapseEnvironment.class); ConfigurationContext axis2ConfigurationContext = new ConfigurationContext(new AxisConfiguration()); axis2ConfigurationContext.getAxisConfiguration().addParameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment); Mockito.when(synapseEnvironment.getAxis2ConfigurationContext()).thenReturn(axis2ConfigurationContext); return synapseEnvironment; }
/** * Create a mock SynapseEnvironment object * * @return Axis2SynapseEnvironment instance * @throws AxisFault on creating/mocking object */ private Axis2SynapseEnvironment getMockedSynapseEnvironment() throws AxisFault { Axis2SynapseEnvironment synapseEnvironment = PowerMockito.mock(Axis2SynapseEnvironment.class); ConfigurationContext axis2ConfigurationContext = new ConfigurationContext(new AxisConfiguration()); axis2ConfigurationContext.getAxisConfiguration().addParameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment); Mockito.when(synapseEnvironment.getAxis2ConfigurationContext()).thenReturn(axis2ConfigurationContext); return synapseEnvironment; }
/** * The default configuration of HolodeckB2B distribution is added to * src/test/resources/cfg dir to test config initialization. */ @BeforeClass public static void setUpClass() { repoUrl = ConfigTest.class.getClassLoader().getResource("cfg/repo"); AxisConfiguration ac = new AxisConfiguration(); ac.setRepository(repoUrl); cc = new ConfigurationContext(ac); }
/** * Test a proxy service with recursive imports and without a {@link ResourceMap}. * Regression test for SYNAPSE-442. */ public void testRecursiveImports2() throws Exception { ProxyService testService = new ProxyService("mytest"); SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration axisCfg = new AxisConfiguration(); testService.setWsdlURI(getClass().getResource("SimpleStockService.wsdl").toURI()); testService.buildAxisService(synCfg, axisCfg); }
/** * Test that a proxy service without publishWSDL will produce a meaningful WSDL. * This is a regression test for SYNAPSE-366. */ public void testWSDLWithoutPublishWSDL() throws Exception { // Build the proxy service SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration axisCfg = new AxisConfiguration(); ProxyService proxyService = new ProxyService("Test"); AxisService axisService = proxyService.buildAxisService(synCfg, axisCfg); // Serialize the WSDL ByteArrayOutputStream baos = new ByteArrayOutputStream(); axisService.printWSDL(baos); // Check that the produced WSDL can be read by WSDL4J WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader(); wsdlReader.readWSDL(null, new InputSource(new ByteArrayInputStream(baos.toByteArray()))); }
/** * 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); }
@Override protected void setUp() throws Exception { service = new AxisService(); outputStream = new ByteArrayOutputStream(); schemas = new ArrayList<XmlSchema>(); loadSampleSchemaFile(schemas); service.addSchema(schemas); AxisConfiguration axisConfiguration = new AxisConfiguration(); service.setName("test_service"); axisConfiguration.addChild(service); axisConfiguration.addService(service); configurationContext = new ConfigurationContext(axisConfiguration); configurationContext.setServicePath("test_service"); configurationContext.setContextRoot("test/context"); messageContext.setConfigurationContext(configurationContext); }
protected void setUp() throws Exception { super.setUp(); SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration config = new AxisConfiguration(); testCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(), synCfg, new Axis2SynapseEnvironment(new ConfigurationContext(config), synCfg)); ((Axis2MessageContext) testCtx).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config)); }
protected void setUp() throws Exception { super.setUp(); SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration config = new AxisConfiguration(); testCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(), synCfg, new Axis2SynapseEnvironment(new ConfigurationContext(config), synCfg)); ((Axis2MessageContext) testCtx).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config)); }
protected void setUp() throws Exception { super.setUp(); SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration config = new AxisConfiguration(); testCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(), synCfg, new Axis2SynapseEnvironment(new ConfigurationContext(config), synCfg)); ((Axis2MessageContext) testCtx).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config)); SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(); envelope.getBody().addChild(createOMElement("<describeSObjects/>")); testCtx.setEnvelope(envelope); }
protected void setUp() throws Exception { super.setUp(); SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration config = new AxisConfiguration(); testCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(), synCfg, new Axis2SynapseEnvironment(new ConfigurationContext(config), synCfg)); ((Axis2MessageContext) testCtx).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config)); SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(); envelope.getBody().addChild(createOMElement("<sendEmail/>")); testCtx.setEnvelope(envelope); }
protected void setUp() throws Exception { super.setUp(); SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration config = new AxisConfiguration(); testCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(), synCfg, new Axis2SynapseEnvironment(new ConfigurationContext(config), synCfg)); ((Axis2MessageContext) testCtx).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config)); SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(); envelope.getBody().addChild(createOMElement("<queryResponse>" + "<result>" + "<done>false</done><queryLocator>01g9000000MVzggAAD-200</queryLocator>" + "<size>370</size>" + "</result>" + "</queryResponse>")); testCtx.setEnvelope(envelope); }