Sameera has provided a patch [1] and these test cases already on Axis2 trunk. If you have any additional modification please let me know.
[1] - https://issues.apache.org/jira/browse/AXIS2-5235 Thanks ! On Tue, Apr 3, 2012 at 8:49 PM, Afkham Azeez <az...@wso2.com> wrote: > Please make sure that this makes it to the Axis2 trunk. Sagara please note. > > On Tue, Apr 3, 2012 at 12:28 PM, <same...@wso2.com> wrote: >> >> Author: sameera >> Date: Tue Apr 3 02:58:52 2012 >> New Revision: 124624 >> URL: http://wso2.org/svn/browse/wso2?view=rev&revision=124624 >> >> Log: >> Adding test cases for the Exposed transport update >> >> Added: >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/ >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/axis2.xml >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/ >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService1/ >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService1/META-INF/ >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService1/META-INF/services.xml >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService2/ >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService2/META-INF/ >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService2/META-INF/services.xml >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService3/ >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService3/META-INF/ >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService3/META-INF/services.xml >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test/org/apache/axis2/deployment/DummyTransportListener.java >> >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test/org/apache/axis2/deployment/ExposedTransportsTest.java >> >> Added: >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/axis2.xml >> URL: >> http://wso2.org/svn/browse/wso2/carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/axis2.xml?pathrev=124624 >> >> ============================================================================== >> --- (empty file) >> +++ >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/axis2.xml >> Tue Apr 3 02:58:52 2012 >> @@ -0,0 +1,114 @@ >> +<!-- >> + ~ Licensed to the Apache Software Foundation (ASF) under one >> + ~ or more contributor license agreements. See the NOTICE file >> + ~ distributed with this work for additional information >> + ~ regarding copyright ownership. The ASF licenses this file >> + ~ to you under the Apache License, Version 2.0 (the >> + ~ "License"); you may not use this file except in compliance >> + ~ with the License. You may obtain a copy of the License at >> + ~ >> + ~ http://www.apache.org/licenses/LICENSE-2.0 >> + ~ >> + ~ Unless required by applicable law or agreed to in writing, >> + ~ software distributed under the License is distributed on an >> + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >> + ~ KIND, either express or implied. See the License for the >> + ~ specific language governing permissions and limitations >> + ~ under the License. >> + --> >> + >> +<axisconfig name="AxisJava2.0"> >> + <!-- ================================================= --> >> + <!-- Parameters --> >> + <!-- ================================================= --> >> + <parameter name="hotdeployment">true</parameter> >> + <parameter name="hotupdate">false</parameter> >> + <parameter name="enableMTOM">true</parameter> >> + >> + <parameter name="userName">admin</parameter> >> + <parameter name="password">axis2</parameter> >> + >> + <parameter name="seralizeLocation">./target</parameter> >> + >> + >> + <!-- ================================================= --> >> + <!-- Message Receivers --> >> + <!-- ================================================= --> >> + <!-- This is the Deafult Message Receiver for the Request Response >> style Operations --> >> + <messageReceiver mep="INOUT" >> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> >> + >> + <!-- ================================================= --> >> + <!-- Transport Ins --> >> + <!-- ================================================= --> >> + <transportReceiver name="http" >> + >> class="org.apache.axis2.deployment.DummyTransportListener"> >> + <parameter name="port">6071</parameter> >> + <!--If you want to give your own host address for EPR >> generation--> >> + <!--uncomment following parameter , and set as you required.--> >> + <!--<parameter name="hostname">http://myApp.com/ws</parameter>--> >> + </transportReceiver> >> + >> + <transportReceiver name="jms" >> + >> class="org.apache.axis2.deployment.DummyTransportListener"> >> + <parameter name="port">6072</parameter> >> + <!--If you want to give your own host address for EPR >> generation--> >> + <!--uncomment following parameter , and set as you required.--> >> + <!--<parameter name="hostname">http://myApp.com/ws</parameter>--> >> + </transportReceiver> >> + >> + >> + <phaseOrder type="InFlow"> >> + <!-- System pre defined phases --> >> + <phase name="Transport"> >> + <handler name="RequestURIBasedDispatcher" >> + >> class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/> >> + <handler name="SOAPActionBasedDispatcher" >> + >> class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/> >> + </phase> >> + <phase name="Security"/> >> + <phase name="PreDispatch"/> >> + <phase name="Dispatch" >> class="org.apache.axis2.engine.DispatchPhase"> >> + <handler name="AddressingBasedDispatcher" >> + >> class="org.apache.axis2.dispatchers.AddressingBasedDispatcher"/> >> + >> + <handler name="SOAPMessageBodyBasedDispatcher" >> + >> class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/> >> + </phase> >> + <!-- System pre defined phases --> >> + <!-- After Postdispatch phase module author or or service >> author can add any phase he want --> >> + <phase name="OperationInPhase"/> >> + </phaseOrder> >> + <phaseOrder type="OutFlow"> >> + <!-- user can add his own phases to this area --> >> + <phase name="OperationOutPhase"/> >> + <!--system predefined phase--> >> + <!--these phase will run irrespective of the service--> >> + <phase name="PolicyDetermination"/> >> + <phase name="MessageOut"/> >> + </phaseOrder> >> + <phaseOrder type="InFaultFlow"> >> + <phase name="PreDispatch"/> >> + <phase name="Dispatch" >> class="org.apache.axis2.engine.DispatchPhase"> >> + <handler name="RequestURIBasedDispatcher" >> + >> class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/> >> + >> + <handler name="SOAPActionBasedDispatcher" >> + >> class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/> >> + >> + <handler name="AddressingBasedDispatcher" >> + >> class="org.apache.axis2.dispatchers.AddressingBasedDispatcher"/> >> + >> + <handler name="SOAPMessageBodyBasedDispatcher" >> + >> class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/> >> + </phase> >> + <!-- user can add his own phases to this area --> >> + <phase name="OperationInFaultPhase"/> >> + </phaseOrder> >> + <phaseOrder type="OutFaultFlow"> >> + <!-- user can add his own phases to this area --> >> + <phase name="OperationOutFaultPhase"/> >> + <phase name="PolicyDetermination"/> >> + <phase name="MessageOut"/> >> + </phaseOrder> >> +</axisconfig> >> + >> >> Added: >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService1/META-INF/services.xml >> URL: >> http://wso2.org/svn/browse/wso2/carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService1/META-INF/services.xml?pathrev=124624 >> >> ============================================================================== >> --- (empty file) >> +++ >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService1/META-INF/services.xml >> Tue Apr 3 02:58:52 2012 >> @@ -0,0 +1,34 @@ >> +<!-- >> + ~ Licensed to the Apache Software Foundation (ASF) under one >> + ~ or more contributor license agreements. See the NOTICE file >> + ~ distributed with this work for additional information >> + ~ regarding copyright ownership. The ASF licenses this file >> + ~ to you under the Apache License, Version 2.0 (the >> + ~ "License"); you may not use this file except in compliance >> + ~ with the License. You may obtain a copy of the License at >> + ~ >> + ~ http://www.apache.org/licenses/LICENSE-2.0 >> + ~ >> + ~ Unless required by applicable law or agreed to in writing, >> + ~ software distributed under the License is distributed on an >> + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >> + ~ KIND, either express or implied. See the License for the >> + ~ specific language governing permissions and limitations >> + ~ under the License. >> + --> >> + >> +<serviceGroup> >> + <!-- EchoService1 should only be exposed on http --> >> + <service name="EchoService1"> >> + <description> >> + This service echo the given input , and this was developed >> to text the axis system working >> + correctly >> + </description> >> + >> + <transports> >> + <transport>http</transport> >> + </transports> >> + >> + <parameter >> name="ServiceClass">org.apache.axis2.sample.echo.EchoImpl</parameter> >> + </service> >> +</serviceGroup> >> \ No newline at end of file >> >> Added: >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService2/META-INF/services.xml >> URL: >> http://wso2.org/svn/browse/wso2/carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService2/META-INF/services.xml?pathrev=124624 >> >> ============================================================================== >> --- (empty file) >> +++ >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService2/META-INF/services.xml >> Tue Apr 3 02:58:52 2012 >> @@ -0,0 +1,37 @@ >> +<!-- >> + ~ Licensed to the Apache Software Foundation (ASF) under one >> + ~ or more contributor license agreements. See the NOTICE file >> + ~ distributed with this work for additional information >> + ~ regarding copyright ownership. The ASF licenses this file >> + ~ to you under the Apache License, Version 2.0 (the >> + ~ "License"); you may not use this file except in compliance >> + ~ with the License. You may obtain a copy of the License at >> + ~ >> + ~ http://www.apache.org/licenses/LICENSE-2.0 >> + ~ >> + ~ Unless required by applicable law or agreed to in writing, >> + ~ software distributed under the License is distributed on an >> + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >> + ~ KIND, either express or implied. See the License for the >> + ~ specific language governing permissions and limitations >> + ~ under the License. >> + --> >> + >> +<serviceGroup> >> + <!-- https transport is not available in Axis2. But the deployment of >> the EchoService2 should not fail. >> + and also EchoService2 should be deployed in http --> >> + <service name="EchoService2"> >> + <description> >> + This service echo the given input , and this was developed >> to text the axis system working >> + correctly >> + </description> >> + >> + <transports> >> + <transport>http</transport> >> + <transport>https</transport> >> + <transport>jms</transport> >> + </transports> >> + >> + <parameter >> name="ServiceClass">org.apache.axis2.sample.echo.EchoImpl</parameter> >> + </service> >> +</serviceGroup> >> \ No newline at end of file >> >> Added: >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService3/META-INF/services.xml >> URL: >> http://wso2.org/svn/browse/wso2/carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService3/META-INF/services.xml?pathrev=124624 >> >> ============================================================================== >> --- (empty file) >> +++ >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test-resources/deployment/exposedTransportsRepo/services/echoService3/META-INF/services.xml >> Tue Apr 3 02:58:52 2012 >> @@ -0,0 +1,34 @@ >> +<!-- >> + ~ Licensed to the Apache Software Foundation (ASF) under one >> + ~ or more contributor license agreements. See the NOTICE file >> + ~ distributed with this work for additional information >> + ~ regarding copyright ownership. The ASF licenses this file >> + ~ to you under the Apache License, Version 2.0 (the >> + ~ "License"); you may not use this file except in compliance >> + ~ with the License. You may obtain a copy of the License at >> + ~ >> + ~ http://www.apache.org/licenses/LICENSE-2.0 >> + ~ >> + ~ Unless required by applicable law or agreed to in writing, >> + ~ software distributed under the License is distributed on an >> + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >> + ~ KIND, either express or implied. See the License for the >> + ~ specific language governing permissions and limitations >> + ~ under the License. >> + --> >> + >> +<serviceGroup> >> + <!-- https transport is not available in Axis2. Therefore the >> deployment of the EchoService2 should fail. --> >> + <service name="EchoService3"> >> + <description> >> + This service echo the given input , and this was developed >> to text the axis system working >> + correctly >> + </description> >> + >> + <transports> >> + <transport>https</transport> >> + </transports> >> + >> + <parameter >> name="ServiceClass">org.apache.axis2.sample.echo.EchoImpl</parameter> >> + </service> >> +</serviceGroup> >> \ No newline at end of file >> >> Added: >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test/org/apache/axis2/deployment/DummyTransportListener.java >> URL: >> http://wso2.org/svn/browse/wso2/carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test/org/apache/axis2/deployment/DummyTransportListener.java?pathrev=124624 >> >> ============================================================================== >> --- (empty file) >> +++ >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test/org/apache/axis2/deployment/DummyTransportListener.java >> Tue Apr 3 02:58:52 2012 >> @@ -0,0 +1,58 @@ >> +/* >> + * Licensed to the Apache Software Foundation (ASF) under one >> + * or more contributor license agreements. See the NOTICE file >> + * distributed with this work for additional information >> + * regarding copyright ownership. The ASF licenses this file >> + * to you under the Apache License, Version 2.0 (the >> + * "License"); you may not use this file except in compliance >> + * with the License. You may obtain a copy of the License at >> + * >> + * http://www.apache.org/licenses/LICENSE-2.0 >> + * >> + * Unless required by applicable law or agreed to in writing, >> + * software distributed under the License is distributed on an >> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >> + * KIND, either express or implied. See the License for the >> + * specific language governing permissions and limitations >> + * under the License. >> + */ >> + >> +package org.apache.axis2.deployment; >> + >> +import org.apache.axis2.AxisFault; >> +import org.apache.axis2.addressing.EndpointReference; >> +import org.apache.axis2.context.ConfigurationContext; >> +import org.apache.axis2.context.MessageContext; >> +import org.apache.axis2.context.SessionContext; >> +import org.apache.axis2.description.TransportInDescription; >> +import org.apache.axis2.transport.TransportListener; >> + >> +public class DummyTransportListener implements TransportListener { >> + public void init(ConfigurationContext axisConf, >> TransportInDescription transprtIn) throws AxisFault { >> + //To change body of implemented methods use File | Settings | >> File Templates. >> + } >> + >> + public void start() throws AxisFault { >> + //To change body of implemented methods use File | Settings | >> File Templates. >> + } >> + >> + public void stop() throws AxisFault { >> + //To change body of implemented methods use File | Settings | >> File Templates. >> + } >> + >> + public EndpointReference getEPRForService(String serviceName, String >> ip) throws AxisFault { >> + return null; //To change body of implemented methods use File | >> Settings | File Templates. >> + } >> + >> + public EndpointReference[] getEPRsForService(String serviceName, >> String ip) throws AxisFault { >> + return new EndpointReference[0]; //To change body of implemented >> methods use File | Settings | File Templates. >> + } >> + >> + public SessionContext getSessionContext(MessageContext >> messageContext) { >> + return null; //To change body of implemented methods use File | >> Settings | File Templates. >> + } >> + >> + public void destroy() { >> + //To change body of implemented methods use File | Settings | >> File Templates. >> + } >> +} >> >> Added: >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test/org/apache/axis2/deployment/ExposedTransportsTest.java >> URL: >> http://wso2.org/svn/browse/wso2/carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test/org/apache/axis2/deployment/ExposedTransportsTest.java?pathrev=124624 >> >> ============================================================================== >> --- (empty file) >> +++ >> carbon/kernel/trunk/dependencies/axis2/1.6.1-wso2v5/modules/kernel/test/org/apache/axis2/deployment/ExposedTransportsTest.java >> Tue Apr 3 02:58:52 2012 >> @@ -0,0 +1,99 @@ >> +/* >> + * Licensed to the Apache Software Foundation (ASF) under one >> + * or more contributor license agreements. See the NOTICE file >> + * distributed with this work for additional information >> + * regarding copyright ownership. The ASF licenses this file >> + * to you under the Apache License, Version 2.0 (the >> + * "License"); you may not use this file except in compliance >> + * with the License. You may obtain a copy of the License at >> + * >> + * http://www.apache.org/licenses/LICENSE-2.0 >> + * >> + * Unless required by applicable law or agreed to in writing, >> + * software distributed under the License is distributed on an >> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >> + * KIND, either express or implied. See the License for the >> + * specific language governing permissions and limitations >> + * under the License. >> + */ >> + >> +package org.apache.axis2.deployment; >> + >> +import junit.framework.TestCase; >> +import org.apache.axis2.AbstractTestCase; >> +import org.apache.axis2.AxisFault; >> +import org.apache.axis2.context.ConfigurationContextFactory; >> +import org.apache.axis2.description.AxisService; >> +import org.apache.axis2.engine.AxisConfiguration; >> + >> +import java.util.List; >> + >> +/** >> + * When you develop service, you can specify the list of transports on >> which you service should be exposed. >> + * This class will test this functionality. >> + */ >> +public class ExposedTransportsTest extends TestCase { >> + AxisConfiguration ar; >> + String repo = AbstractTestCase.basedir + >> "/test-resources/deployment/exposedTransportsRepo"; >> + >> + protected void setUp() throws Exception { >> + ar = >> ConfigurationContextFactory.createConfigurationContextFromFileSystem(repo, >> repo + "/axis2.xml") >> + .getAxisConfiguration(); >> + } >> + >> + /** >> + * EchoService1 should only be exposed on http >> + * @throws AxisFault in the case of an Error >> + */ >> + public void testExposedTransportsEchoService1() throws AxisFault { >> + AxisService service1 = ar.getService("EchoService1"); >> + assertNotNull(service1); >> + >> + List<String> exposedTransportsList = >> service1.getExposedTransports(); >> + assertFalse("Exposed Transports list should not be empty.", >> exposedTransportsList.isEmpty()); >> + >> + assertTrue("EchoService1 is not exposed on http.", >> checkExistenceInList(exposedTransportsList, "http")); >> + >> + assertEquals("EchoService1 should only be exposed on http.", 1, >> exposedTransportsList.size()); >> + } >> + >> + /** >> + * https transport is not available in Axis2. But the deployment of >> the EchoService2 should not fail. >> + * and also EchoService2 should be deployed in http >> + * @throws AxisFault in the case of an Error >> + */ >> + public void testExposedTransportsEchoService2() throws AxisFault { >> + >> + AxisService service1 = ar.getService("EchoService2"); >> + assertNotNull(service1); >> + >> + List<String> exposedTransportsList = >> service1.getExposedTransports(); >> + assertFalse("Exposed Transport list should not be empty.", >> exposedTransportsList.isEmpty()); >> + >> + assertFalse("EchoService2 should not be exposed on https.", >> checkExistenceInList(exposedTransportsList, "https")); >> + >> + assertTrue("EchoService2 is not exposed on http.", >> checkExistenceInList(exposedTransportsList, "http")); >> + >> + assertTrue("EchoService2 is not exposed on jms.", >> checkExistenceInList(exposedTransportsList, "jms")); >> + >> + assertEquals("EchoService1 should only be exposed on http.", 2, >> exposedTransportsList.size()); >> + } >> + >> + /** >> + * https transport is not available in Axis2. Therefore the >> deployment of the EchoService2 should fail. >> + * @throws AxisFault in the case of an Error >> + */ >> + public void testExposedTransportsEchoService3() throws AxisFault { >> + AxisService service1 = ar.getService("EchoService3"); >> + assertNull("EchoService3 deployment should fail, because it has >> been exposed in unavailable transports.", service1); >> + } >> + >> + private boolean checkExistenceInList(List<String> >> exposedTransportsList, String value){ >> + for(String transportName : exposedTransportsList){ >> + if(value.equalsIgnoreCase(transportName)) { >> + return true; >> + } >> + } >> + return false; >> + } >> +} >> _______________________________________________ >> Commits mailing list >> comm...@wso2.org >> http://wso2.org/cgi-bin/mailman/listinfo/commits > > > > > -- > Afkham Azeez > Director of Architecture; WSO2, Inc.; http://wso2.com > Member; Apache Software Foundation; http://www.apache.org/ > > email: az...@wso2.com cell: +94 77 3320919 > blog: http://blog.afkham.org > twitter: http://twitter.com/afkham_azeez > linked-in: http://lk.linkedin.com/in/afkhamazeez > > Lean . Enterprise . Middleware > -- Sagara Gunathunga Technical Lead; WSO2, Inc.; http://wso2.com Blog - http://ssagara.blogspot.com _______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev