001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019:
020: package org.apache.axis2.engine;
021:
022: import org.apache.axiom.om.OMAbstractFactory;
023: import org.apache.axiom.soap.SOAPFactory;
024: import org.apache.axis2.AxisFault;
025: import org.apache.axis2.addressing.EndpointReference;
026: import org.apache.axis2.context.ConfigurationContext;
027: import org.apache.axis2.context.MessageContext;
028: import org.apache.axis2.context.OperationContext;
029: import org.apache.axis2.context.ServiceGroupContext;
030: import org.apache.axis2.context.ServiceContext;
031: import org.apache.axis2.description.AxisOperation;
032: import org.apache.axis2.description.AxisService;
033: import org.apache.axis2.description.InOutAxisOperation;
034: import org.apache.axis2.description.TransportInDescription;
035: import org.apache.axis2.description.TransportOutDescription;
036: import org.apache.axis2.description.AxisServiceGroup;
037: import org.apache.axis2.transport.http.CommonsHTTPTransportSender;
038:
039: import javax.xml.namespace.QName;
040:
041: public class EngineWithoutPhaseResolvingTest extends AbstractEngineTest {
042: private MessageContext mc;
043: private QName serviceName = new QName("axis2/services/NullService");
044: private QName operationName = new QName("NullOperation");
045: private ConfigurationContext configContext;
046:
047: public EngineWithoutPhaseResolvingTest() {
048: }
049:
050: public EngineWithoutPhaseResolvingTest(String arg0) {
051: super (arg0);
052: }
053:
054: protected void setUp() throws Exception {
055:
056: AxisConfiguration engineRegistry = new AxisConfiguration();
057: configContext = new ConfigurationContext(engineRegistry);
058:
059: TransportOutDescription transport = new TransportOutDescription(
060: "null");
061: transport.setSender(new CommonsHTTPTransportSender());
062:
063: TransportInDescription transportIn = new TransportInDescription(
064: "null");
065: AxisOperation axisOp = new InOutAxisOperation(operationName);
066:
067: AxisService service = new AxisService(serviceName
068: .getLocalPart());
069: axisOp.setMessageReceiver(new MessageReceiver() {
070: public void receive(MessageContext messageCtx)
071: throws AxisFault {
072: // TODO Auto-generated method stub
073:
074: }
075: });
076: engineRegistry.addService(service);
077: service.addOperation(axisOp);
078:
079: mc = configContext.createMessageContext();
080: mc.setTransportIn(transportIn);
081: mc.setTransportOut(transport);
082:
083: ServiceGroupContext sgc = configContext
084: .createServiceGroupContext(service
085: .getAxisServiceGroup());
086: ServiceContext sc = sgc.getServiceContext(service);
087:
088: OperationContext opContext = sc.createOperationContext(axisOp);
089:
090: mc.setOperationContext(opContext);
091: mc.setTransportOut(transport);
092: mc.setProperty(MessageContext.TRANSPORT_OUT, System.out);
093: mc.setServerSide(true);
094: SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory();
095: mc.setEnvelope(omFac.getDefaultEnvelope());
096:
097: mc.setWSAAction(operationName.getLocalPart());
098: mc.setSoapAction(operationName.getLocalPart());
099: System.out.flush();
100: }
101:
102: public void testServerReceive() throws Exception {
103: mc.setTo(new EndpointReference("axis2/services/NullService"));
104: AxisEngine engine = new AxisEngine(configContext);
105: mc.setServerSide(true);
106: engine.receive(mc);
107: }
108: }
|