You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2008/03/14 21:06:20 UTC
svn commit: r637238 - in /webservices/axis2/trunk/java/modules:
jaxws-integration/ jaxws-integration/test/org/apache/axis2/jaxws/injection/
jaxws-integration/test/org/apache/axis2/jaxws/resourceinjection/
jaxws-integration/test/org/apache/axis2/jaxws/s...
Author: scheu
Date: Fri Mar 14 13:06:18 2008
New Revision: 637238
URL: http://svn.apache.org/viewvc?rev=637238&view=rev
Log:
Cleaned up and improved the JAXWS ResourceInjection testing
Added:
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/ResourceInjectionTests.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/ResourceInjectionPortTypeImpl.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionPortType.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionService.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/
- copied from r636918, webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/injection/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl1.java
- copied unchanged from r637234, webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl1.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl2.java
- copied unchanged from r637234, webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl2.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl3.java
- copied unchanged from r637234, webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl3.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl4.java
- copied unchanged from r637234, webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl4.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl5.java
- copied unchanged from r637234, webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/injection/ResourceInjectionTestImpl5.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTests.java
- copied, changed from r637234, webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/injection/ResourceInjectionTests.java
Removed:
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/injection/
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/resourceinjection/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/
webservices/axis2/trunk/java/modules/jaxws/test/server/
Modified:
webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/lifecycle/EndpointLifecycleTests.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/misc/ConvertUtilsTest.java
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml?rev=637238&r1=637237&r2=637238&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml Fri Mar 14 13:06:18 2008
@@ -993,10 +993,10 @@
<copy toDir="target/test-classes/servicejars/ResourceInjectionService/">
<fileset dir="target/test-classes">
- <include name="org/apache/axis2/jaxws/resourceinjection/**"/>
- <exclude name="org/apache/axis2/jaxws/resourceinjection/META-INF/services.xml"/>
+ <include name="org/apache/axis2/jaxws/sample/resourceinjection/**"/>
+ <exclude name="org/apache/axis2/jaxws/sample/resourceinjection/META-INF/services.xml"/>
</fileset>
- <fileset dir="test/org/apache/axis2/jaxws/resourceinjection">
+ <fileset dir="test/org/apache/axis2/jaxws/sample/resourceinjection">
<include name="META-INF/**"/>
<exclude name="META-INF/services.xml"/>
</fileset>
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/ResourceInjectionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/ResourceInjectionTests.java?rev=637238&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/ResourceInjectionTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/ResourceInjectionTests.java Fri Mar 14 13:06:18 2008
@@ -0,0 +1,64 @@
+/*
+ * 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.jaxws.sample;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.axis2.jaxws.TestLogger;
+import org.apache.axis2.jaxws.context.WebServiceContextImpl;
+import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.apache.axis2.jaxws.framework.StopServer;
+import org.apache.axis2.jaxws.sample.resourceinjection.sei.ResourceInjectionPortType;
+import org.apache.axis2.jaxws.sample.resourceinjection.sei.ResourceInjectionService;
+import org.apache.axis2.jaxws.server.endpoint.injection.ResourceInjector;
+import org.apache.axis2.jaxws.server.endpoint.injection.factory.ResourceInjectionFactory;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceContext;
+
+public class ResourceInjectionTests extends AbstractTestCase {
+ String axisEndpoint = "http://localhost:6060/axis2/services/ResourceInjectionService.ResourceInjectionPortTypeImplPort";
+
+ public static Test suite() {
+ return getTestSetup(new TestSuite(ResourceInjectionTests.class));
+ }
+
+ public ResourceInjectionPortType getProxy() {
+ ResourceInjectionService service = new ResourceInjectionService();
+ ResourceInjectionPortType proxy = service.getResourceInjectionPort();
+ BindingProvider p = (BindingProvider) proxy;
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ return proxy;
+ }
+
+ /**
+ * This test ensures that an endpoint with an inject WebServiceContext
+ * can successfully get and query the web service.
+ */
+ public void testEchoWithResourceInjectionAndLifecycleMethods() throws Exception {
+
+ ResourceInjectionPortType proxy = getProxy();
+ String response = proxy.testInjection("sample");
+ assertTrue("The response was null", response != null);
+ assertTrue("The response was not succesful: " + response,
+ response.indexOf("SUCCESS") >= 0);
+
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/ResourceInjectionPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/ResourceInjectionPortTypeImpl.java?rev=637238&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/ResourceInjectionPortTypeImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/ResourceInjectionPortTypeImpl.java Fri Mar 14 13:06:18 2008
@@ -0,0 +1,90 @@
+/*
+ * 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.jaxws.sample.resourceinjection;
+
+import org.apache.axis2.jaxws.TestLogger;
+import org.apache.axis2.jaxws.sample.resourceinjection.sei.ResourceInjectionPortType;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+/**
+ * Sample Resource Injection Endpoint
+ *
+ */
+@WebService(serviceName="ResourceInjectionService",
+ endpointInterface="org.apache.axis2.jaxws.sample.resourceinjection.sei.ResourceInjectionPortType")
+ public class ResourceInjectionPortTypeImpl implements ResourceInjectionPortType {
+
+ // The ctx variable is marked with the @Resource annotation.
+ // The runtime will automatically inject (set) this variable to the
+ // current WebServiceContext
+ @Resource
+ public WebServiceContext ctx = null;
+
+ /**
+ * Sample method that ensures that WebServiceContext was properly set.
+ */
+ public String testInjection(String arg) {
+
+
+ if (ctx == null) {
+ return "FAILURE: The WebServiceContext was not set";
+ }
+
+ MessageContext msgContext = ctx.getMessageContext();
+ if (msgContext == null) {
+ return "FAILURE: The WebServiceContext does not have a MessageContext";
+ }
+
+ String initCalledValue = (String) msgContext.get("INIT_CALLED");
+ if (initCalledValue == null) {
+ return "FAILURE: The @PostConstruct initialize method was not invoked";
+ }
+ QName wsdlOperation = (QName) msgContext.get(MessageContext.WSDL_OPERATION);
+
+ if (wsdlOperation == null) {
+ return "FAILURE: The WebServiceContext's MessageContext " +
+ "does not have the correct wsdlOperation";
+ }
+ return "SUCCESS: " + wsdlOperation.getLocalPart();
+ }
+
+ @PostConstruct
+ public void initialize(){
+ //Called after resource injection and before a method is called.
+ if (ctx != null && ctx.getMessageContext() != null) {
+ ctx.getMessageContext().put("INIT_CALLED", "INIT_CALLED_VALUE");
+ }
+ }
+
+ @PreDestroy
+ public void distructor(){
+ //Called before the scope of request or session or application ends.
+
+ TestLogger.logger.debug("Calling PreDestroy ");
+
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionPortType.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionPortType.java?rev=637238&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionPortType.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionPortType.java Fri Mar 14 13:06:18 2008
@@ -0,0 +1,47 @@
+
+/*
+ * 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.jaxws.sample.resourceinjection.sei;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+@WebService(name = "ResourceInjectionPortType", targetNamespace = "http://resourceinjection.sample.test.org")
+public interface ResourceInjectionPortType {
+
+
+ /**
+ *
+ * @param arg
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(action = "http://resourceinjection.sample.test.org/NewOperation")
+ @WebResult(name = "response", targetNamespace = "")
+ @RequestWrapper(localName = "testInjection", targetNamespace = "http://resourceinjection.sample.test.org", className = "org.test.sample.resourceinjection.TestInjection")
+ @ResponseWrapper(localName = "testInjectionResponse", targetNamespace = "http://resourceinjection.sample.test.org", className = "org.test.sample.resourceinjection.TestInjectionResponse")
+ public String testInjection(
+ @WebParam(name = "arg", targetNamespace = "")
+ String arg);
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionService.java?rev=637238&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionService.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/resourceinjection/sei/ResourceInjectionService.java Fri Mar 14 13:06:18 2008
@@ -0,0 +1,73 @@
+
+/*
+ * 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.jaxws.sample.resourceinjection.sei;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+@WebServiceClient(name = "ResourceInjectionService", targetNamespace = "http://resourceinjection.sample.test.org", wsdlLocation = "resourceinjection.wsdl")
+public class ResourceInjectionService
+ extends Service
+{
+
+ private final static URL RESOURCEINJECTIONSERVICE_WSDL_LOCATION;
+
+ private static String wsdlLocation="/test/org/apache/axis2/jaxws/sample/resourceinjection/META-INF/resourceinjection.wsdl";
+ static {
+ URL url = null;
+ try {
+ try{
+ String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+ wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ File file = new File(wsdlLocation);
+ url = file.toURL();
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ RESOURCEINJECTIONSERVICE_WSDL_LOCATION = url;
+ }
+
+ public ResourceInjectionService(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+ public ResourceInjectionService() {
+ super(RESOURCEINJECTIONSERVICE_WSDL_LOCATION, new QName("http://resourceinjection.sample.test.org", "ResourceInjectionService"));
+ }
+
+ /**
+ *
+ * @return
+ * returns ResourceInjectionPortType
+ */
+ @WebEndpoint(name = "ResourceInjectionPort")
+ public ResourceInjectionPortType getResourceInjectionPort() {
+ return (ResourceInjectionPortType)super.getPort(new QName("http://resourceinjection.sample.test.org", "ResourceInjectionPort"), ResourceInjectionPortType.class);
+ }
+
+}
Copied: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTests.java (from r637234, webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/injection/ResourceInjectionTests.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTests.java?p2=webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTests.java&p1=webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/injection/ResourceInjectionTests.java&r1=637234&r2=637238&rev=637238&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/injection/ResourceInjectionTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/injection/ResourceInjectionTests.java Fri Mar 14 13:06:18 2008
@@ -18,131 +18,104 @@
*/
package org.apache.axis2.jaxws.injection;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
import org.apache.axis2.jaxws.context.WebServiceContextImpl;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
-import org.apache.axis2.jaxws.framework.StopServer;
-import org.apache.axis2.jaxws.resourceinjection.sei.ResourceInjectionPortType;
-import org.apache.axis2.jaxws.resourceinjection.sei.ResourceInjectionService;
import org.apache.axis2.jaxws.server.endpoint.injection.ResourceInjector;
import org.apache.axis2.jaxws.server.endpoint.injection.factory.ResourceInjectionFactory;
-import javax.xml.ws.BindingProvider;
import javax.xml.ws.WebServiceContext;
-public class ResourceInjectionTests extends AbstractTestCase {
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class ResourceInjectionTests extends TestCase {
String axisEndpoint = "http://localhost:6060/axis2/services/ResourceInjectionService.ResourceInjectionPortTypeImplPort";
- private Object resource = new WebServiceContextImpl();
-
- public static Test suite() {
- return getTestSetup(new TestSuite(ResourceInjectionTests.class));
- }
-
- public void testInjectionOnField(){
- Object serviceInstance = new ResourceInjectionTestImpl1();
+ private Object resource = new WebServiceContextImpl();
+
+ public void testInjectionOnField(){
+ Object serviceInstance = new ResourceInjectionTestImpl1();
TestLogger.logger.debug("------------------------------");
TestLogger.logger.debug("Test : " + getName());
- try{
- ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
- injector.inject(resource, serviceInstance);
- ResourceInjectionTestImpl1 serviceImpl =(ResourceInjectionTestImpl1)serviceInstance;
- assertNotNull(serviceImpl.ctx);
+ try{
+ ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
+ injector.inject(resource, serviceInstance);
+ ResourceInjectionTestImpl1 serviceImpl =(ResourceInjectionTestImpl1)serviceInstance;
+ assertNotNull(serviceImpl.ctx);
TestLogger.logger.debug("Resource Injected on Field");
TestLogger.logger.debug("------------------------------");
- }catch(Exception e){
- e.printStackTrace();
- fail();
- }
- }
-
- public void testInjectionOnMethod(){
- Object serviceInstance = new ResourceInjectionTestImpl2();
+ }catch(Exception e){
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ public void testInjectionOnMethod(){
+ Object serviceInstance = new ResourceInjectionTestImpl2();
TestLogger.logger.debug("------------------------------");
TestLogger.logger.debug("Test : " + getName());
- try{
- ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
- injector.inject(resource, serviceInstance);
- ResourceInjectionTestImpl2 serviceImpl =(ResourceInjectionTestImpl2)serviceInstance;
- assertNotNull(serviceImpl.ctx);
+ try{
+ ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
+ injector.inject(resource, serviceInstance);
+ ResourceInjectionTestImpl2 serviceImpl =(ResourceInjectionTestImpl2)serviceInstance;
+ assertNotNull(serviceImpl.ctx);
TestLogger.logger.debug("Resource Injected on Method");
TestLogger.logger.debug("------------------------------");
- }catch(Exception e){
- e.printStackTrace();
- fail();
- }
- }
-
- public void testInjectionOnPrivateField(){
- Object serviceInstance = new ResourceInjectionTestImpl3();
+ }catch(Exception e){
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ public void testInjectionOnPrivateField(){
+ Object serviceInstance = new ResourceInjectionTestImpl3();
TestLogger.logger.debug("------------------------------");
TestLogger.logger.debug("Test : " + getName());
- try{
- ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
- injector.inject(resource, serviceInstance);
- ResourceInjectionTestImpl3 serviceImpl =(ResourceInjectionTestImpl3)serviceInstance;
- assertNotNull(serviceImpl.getCtx());
+ try{
+ ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
+ injector.inject(resource, serviceInstance);
+ ResourceInjectionTestImpl3 serviceImpl =(ResourceInjectionTestImpl3)serviceInstance;
+ assertNotNull(serviceImpl.getCtx());
TestLogger.logger.debug("Resource Injected on Private Field");
TestLogger.logger.debug("------------------------------");
- }catch(Exception e){
- e.printStackTrace();
- fail();
- }
- }
-
- public void testInjectionOnProvateMethod(){
- Object serviceInstance = new ResourceInjectionTestImpl4();
+ }catch(Exception e){
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ public void testInjectionOnProvateMethod(){
+ Object serviceInstance = new ResourceInjectionTestImpl4();
TestLogger.logger.debug("------------------------------");
TestLogger.logger.debug("Test : " + getName());
- try{
- ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
- injector.inject(resource, serviceInstance);
- ResourceInjectionTestImpl4 serviceImpl =(ResourceInjectionTestImpl4)serviceInstance;
- assertNotNull(serviceImpl.getCtx());
+ try{
+ ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
+ injector.inject(resource, serviceInstance);
+ ResourceInjectionTestImpl4 serviceImpl =(ResourceInjectionTestImpl4)serviceInstance;
+ assertNotNull(serviceImpl.getCtx());
TestLogger.logger.debug("Resource Injected using private Method");
TestLogger.logger.debug("------------------------------");
- }catch(Exception e){
- e.printStackTrace();
- fail();
- }
- }
-
- public void testTypedResourceInjectionOnField(){
- Object serviceInstance = new ResourceInjectionTestImpl5();
- TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
- try{
- ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
- injector.inject(resource, serviceInstance);
- ResourceInjectionTestImpl5 serviceImpl =(ResourceInjectionTestImpl5)serviceInstance;
- assertNotNull(serviceImpl.ctx);
- TestLogger.logger.debug("Resource Injected on Field");
- TestLogger.logger.debug("------------------------------");
- }catch(Exception e){
- e.printStackTrace();
- fail();
- }
- }
+ }catch(Exception e){
+ e.printStackTrace();
+ fail();
+ }
+ }
-
- public void testEchoWithResourceInjectionAndLifecycleMethods(){
+ public void testTypedResourceInjectionOnField(){
+ Object serviceInstance = new ResourceInjectionTestImpl5();
TestLogger.logger.debug("------------------------------");
TestLogger.logger.debug("Test : " + getName());
- try{
- ResourceInjectionService service = new ResourceInjectionService();
- ResourceInjectionPortType proxy = service.getResourceInjectionPort();
- BindingProvider p = (BindingProvider) proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
-
- String response = proxy.echo("echo Request");
- TestLogger.logger.debug("Response String = " + response);
+ try{
+ ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
+ injector.inject(resource, serviceInstance);
+ ResourceInjectionTestImpl5 serviceImpl =(ResourceInjectionTestImpl5)serviceInstance;
+ assertNotNull(serviceImpl.ctx);
+ TestLogger.logger.debug("Resource Injected on Field");
TestLogger.logger.debug("------------------------------");
- }catch(Exception e){
- e.printStackTrace();
- fail();
- }
- }
-
+ }catch(Exception e){
+ e.printStackTrace();
+ fail();
+ }
+ }
}
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/lifecycle/EndpointLifecycleTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/lifecycle/EndpointLifecycleTests.java?rev=637238&r1=637237&r2=637238&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/lifecycle/EndpointLifecycleTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/lifecycle/EndpointLifecycleTests.java Fri Mar 14 13:06:18 2008
@@ -20,84 +20,88 @@
import junit.framework.TestCase;
import org.apache.axis2.jaxws.registry.FactoryRegistry;
-import org.apache.axis2.jaxws.resourceinjection.ResourceInjectionPortTypeImpl;
+import org.apache.axis2.jaxws.injection.ResourceInjectionTestImpl1;
import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleManager;
import org.apache.axis2.jaxws.server.endpoint.lifecycle.factory.EndpointLifecycleManagerFactory;
import org.apache.axis2.jaxws.TestLogger;
+/**
+ * Unit Tests for lifecycle creatoin
+ *
+ */
public class EndpointLifecycleTests extends TestCase {
- Object endpointInstance = new ResourceInjectionPortTypeImpl();
- Object badObject = new Object();
- public EndpointLifecycleTests() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param arg0
- */
- public EndpointLifecycleTests(String arg0) {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
-
- public void testPostConstruct(){
+ Object endpointInstance = new ResourceInjectionTestImpl1();
+ Object badObject = new Object();
+ public EndpointLifecycleTests() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ */
+ public EndpointLifecycleTests(String arg0) {
+ super(arg0);
+ // TODO Auto-generated constructor stub
+ }
+
+ public void testPostConstruct(){
TestLogger.logger.debug("------------------------------");
TestLogger.logger.debug("Test : " + getName());
- try{
- EndpointLifecycleManagerFactory elmf = (EndpointLifecycleManagerFactory)FactoryRegistry.getFactory(EndpointLifecycleManagerFactory.class);
- assertNotNull(elmf);
- EndpointLifecycleManager elm = elmf.createEndpointLifecycleManager(endpointInstance);
- assertNotNull(elmf);
- elm.invokePostConstruct();
+ try{
+ EndpointLifecycleManagerFactory elmf = (EndpointLifecycleManagerFactory)FactoryRegistry.getFactory(EndpointLifecycleManagerFactory.class);
+ assertNotNull(elmf);
+ EndpointLifecycleManager elm = elmf.createEndpointLifecycleManager(endpointInstance);
+ assertNotNull(elmf);
+ elm.invokePostConstruct();
TestLogger.logger.debug("------------------------------");
- }catch(Exception e){
- fail(e.getMessage());
- }
- }
+ }catch(Exception e){
+ fail(e.getMessage());
+ }
+ }
- public void testPreDestroy(){
+ public void testPreDestroy(){
TestLogger.logger.debug("------------------------------");
TestLogger.logger.debug("Test : " + getName());
- try{
- EndpointLifecycleManagerFactory elmf = (EndpointLifecycleManagerFactory)FactoryRegistry.getFactory(EndpointLifecycleManagerFactory.class);
- assertNotNull(elmf);
- EndpointLifecycleManager elm = elmf.createEndpointLifecycleManager(endpointInstance);
- assertNotNull(elm);
- elm.invokePreDestroy();
+ try{
+ EndpointLifecycleManagerFactory elmf = (EndpointLifecycleManagerFactory)FactoryRegistry.getFactory(EndpointLifecycleManagerFactory.class);
+ assertNotNull(elmf);
+ EndpointLifecycleManager elm = elmf.createEndpointLifecycleManager(endpointInstance);
+ assertNotNull(elm);
+ elm.invokePreDestroy();
TestLogger.logger.debug("------------------------------");
- }catch(Exception e){
- fail(e.getMessage());
- }
- }
-
- public void testBadPostConstruct(){
+ }catch(Exception e){
+ fail(e.getMessage());
+ }
+ }
+
+ public void testBadPostConstruct(){
TestLogger.logger.debug("------------------------------");
TestLogger.logger.debug("Test : " + getName());
- try{
- EndpointLifecycleManagerFactory elmf = (EndpointLifecycleManagerFactory)FactoryRegistry.getFactory(EndpointLifecycleManagerFactory.class);
- assertNotNull(elmf);
- EndpointLifecycleManager elm = elmf.createEndpointLifecycleManager(badObject);
- assertNotNull(elmf);
- elm.invokePostConstruct();
+ try{
+ EndpointLifecycleManagerFactory elmf = (EndpointLifecycleManagerFactory)FactoryRegistry.getFactory(EndpointLifecycleManagerFactory.class);
+ assertNotNull(elmf);
+ EndpointLifecycleManager elm = elmf.createEndpointLifecycleManager(badObject);
+ assertNotNull(elmf);
+ elm.invokePostConstruct();
TestLogger.logger.debug("------------------------------");
- }catch(Exception e){
- fail(e.getMessage());
- }
- }
+ }catch(Exception e){
+ fail(e.getMessage());
+ }
+ }
- public void testBadPreDestroy(){
+ public void testBadPreDestroy(){
TestLogger.logger.debug("------------------------------");
TestLogger.logger.debug("Test : " + getName());
- try{
- EndpointLifecycleManagerFactory elmf = (EndpointLifecycleManagerFactory)FactoryRegistry.getFactory(EndpointLifecycleManagerFactory.class);
- assertNotNull(elmf);
- EndpointLifecycleManager elm = elmf.createEndpointLifecycleManager(badObject);
- assertNotNull(elm);
- elm.invokePreDestroy();
+ try{
+ EndpointLifecycleManagerFactory elmf = (EndpointLifecycleManagerFactory)FactoryRegistry.getFactory(EndpointLifecycleManagerFactory.class);
+ assertNotNull(elmf);
+ EndpointLifecycleManager elm = elmf.createEndpointLifecycleManager(badObject);
+ assertNotNull(elm);
+ elm.invokePreDestroy();
TestLogger.logger.debug("------------------------------");
- }catch(Exception e){
- fail(e.getMessage());
- }
- }
+ }catch(Exception e){
+ fail(e.getMessage());
+ }
+ }
}
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/misc/ConvertUtilsTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/misc/ConvertUtilsTest.java?rev=637238&r1=637237&r2=637238&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/misc/ConvertUtilsTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/misc/ConvertUtilsTest.java Fri Mar 14 13:06:18 2008
@@ -27,7 +27,7 @@
*/
public class ConvertUtilsTest extends TestCase {
- public void test() throws Exception {
+ public void test1() throws Exception {
Byte[] input = new Byte[3];
input[0] = new Byte((byte) 0);
input[1] = new Byte((byte) 1);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org