http://git-wip-us.apache.org/repos/asf/tomee/blob/6d74b263/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBEJBInvoker.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBEJBInvoker.java b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBEJBInvoker.java index 967c6ac..a23bcca 100644 --- a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBEJBInvoker.java +++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBEJBInvoker.java @@ -1,115 +1,115 @@ -/* - * 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.openejb.server.cxf.rs; - -import org.apache.cxf.jaxrs.JAXRSInvoker; -import org.apache.cxf.message.Exchange; -import org.apache.openejb.ApplicationException; -import org.apache.openejb.BeanContext; -import org.apache.openejb.InvalidateReferenceException; -import org.apache.openejb.core.interceptor.InterceptorData; -import org.apache.openejb.monitoring.StatsInterceptor; -import org.apache.openejb.util.proxy.BeanContextInvocationHandler; -import org.apache.openejb.util.proxy.LocalBeanProxyFactory; -import org.apache.openejb.util.proxy.ProxyManager; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.rmi.RemoteException; -import java.util.*; -import javax.ejb.EJBException; - -public class OpenEJBEJBInvoker extends JAXRSInvoker { - private final Map<Class<?>, Collection<Class<?>>> contextTypes = new HashMap<Class<?>, Collection<Class<?>>>(); - - public OpenEJBEJBInvoker(final Collection<BeanContext> restEjbs) { - for (final BeanContext context : restEjbs) { - final Collection<Class<?>> classes = new HashSet<Class<?>>(); - Contexts.findContextFields(context.getBeanClass(), classes); - for (final Collection<InterceptorData> list : - Arrays.asList( - context.getInterceptorData(), - context.getInstanceScopedInterceptors(), - context.getCallbackInterceptors())) { - for (final InterceptorData id : list) { - final Class<?> interceptorClass = id.getInterceptorClass(); - if (!StatsInterceptor.class.equals(interceptorClass)) { - Contexts.findContextFields(interceptorClass, classes); - } - } - } - contextTypes.put(context.getBeanClass(), classes); - } - } - - @Override - public Object invoke(final Exchange exchange, final Object request, final Object resourceObject) { - Contexts.bind(exchange, getContextTypes(resourceObject)); - return super.invoke(exchange, request, resourceObject); - } - - private Collection<Class<?>> getContextTypes(final Object resourceObject) { - if (!ProxyManager.isProxyClass(resourceObject.getClass()) - && !LocalBeanProxyFactory.isProxy(resourceObject.getClass())) { - return Collections.emptySet(); - } - - final InvocationHandler handler = ProxyManager.getInvocationHandler(resourceObject); - if (!(handler instanceof BeanContextInvocationHandler)) { - return Collections.emptySet(); - } - - final BeanContext beanContext = ((BeanContextInvocationHandler) handler).getBeanContext(); - - if (beanContext == null) { - return Collections.emptySet(); - } - return contextTypes.get(beanContext.getBeanClass()); - } - - @Override - protected Object performInvocation(final Exchange exchange, final Object serviceObject, - final Method m, final Object[] paramArray) throws Exception { - try { - final Object[] args = super.insertExchange(m, paramArray, exchange); - return m.invoke(serviceObject, args); - } catch (final InvocationTargetException ite) { - Throwable cause = ite.getTargetException(); - // unwrap to get ExceptionMapper working - if (cause instanceof InvalidateReferenceException) { - cause = cause.getCause(); - if (cause instanceof RemoteException) { - cause = cause.getCause(); - } - } - - if (EJBException.class.isInstance(cause)) { - cause = EJBException.class.cast(cause).getCause(); - } - - if (ApplicationException.class.isInstance(cause) && Exception.class.isInstance(cause.getCause())) { - throw Exception.class.cast(ApplicationException.class.cast(cause).getCause()); - } - - if (cause instanceof Exception) { - throw (Exception) cause; - } - throw ite; - } - } -} +/* + * 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.openejb.server.cxf.rs; + +import org.apache.cxf.jaxrs.JAXRSInvoker; +import org.apache.cxf.message.Exchange; +import org.apache.openejb.ApplicationException; +import org.apache.openejb.BeanContext; +import org.apache.openejb.InvalidateReferenceException; +import org.apache.openejb.core.interceptor.InterceptorData; +import org.apache.openejb.monitoring.StatsInterceptor; +import org.apache.openejb.util.proxy.BeanContextInvocationHandler; +import org.apache.openejb.util.proxy.LocalBeanProxyFactory; +import org.apache.openejb.util.proxy.ProxyManager; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.rmi.RemoteException; +import java.util.*; +import javax.ejb.EJBException; + +public class OpenEJBEJBInvoker extends JAXRSInvoker { + private final Map<Class<?>, Collection<Class<?>>> contextTypes = new HashMap<Class<?>, Collection<Class<?>>>(); + + public OpenEJBEJBInvoker(final Collection<BeanContext> restEjbs) { + for (final BeanContext context : restEjbs) { + final Collection<Class<?>> classes = new HashSet<Class<?>>(); + Contexts.findContextFields(context.getBeanClass(), classes); + for (final Collection<InterceptorData> list : + Arrays.asList( + context.getInterceptorData(), + context.getInstanceScopedInterceptors(), + context.getCallbackInterceptors())) { + for (final InterceptorData id : list) { + final Class<?> interceptorClass = id.getInterceptorClass(); + if (!StatsInterceptor.class.equals(interceptorClass)) { + Contexts.findContextFields(interceptorClass, classes); + } + } + } + contextTypes.put(context.getBeanClass(), classes); + } + } + + @Override + public Object invoke(final Exchange exchange, final Object request, final Object resourceObject) { + Contexts.bind(exchange, getContextTypes(resourceObject)); + return super.invoke(exchange, request, resourceObject); + } + + private Collection<Class<?>> getContextTypes(final Object resourceObject) { + if (!ProxyManager.isProxyClass(resourceObject.getClass()) + && !LocalBeanProxyFactory.isProxy(resourceObject.getClass())) { + return Collections.emptySet(); + } + + final InvocationHandler handler = ProxyManager.getInvocationHandler(resourceObject); + if (!(handler instanceof BeanContextInvocationHandler)) { + return Collections.emptySet(); + } + + final BeanContext beanContext = ((BeanContextInvocationHandler) handler).getBeanContext(); + + if (beanContext == null) { + return Collections.emptySet(); + } + return contextTypes.get(beanContext.getBeanClass()); + } + + @Override + protected Object performInvocation(final Exchange exchange, final Object serviceObject, + final Method m, final Object[] paramArray) throws Exception { + try { + final Object[] args = super.insertExchange(m, paramArray, exchange); + return m.invoke(serviceObject, args); + } catch (final InvocationTargetException ite) { + Throwable cause = ite.getTargetException(); + // unwrap to get ExceptionMapper working + if (cause instanceof InvalidateReferenceException) { + cause = cause.getCause(); + if (cause instanceof RemoteException) { + cause = cause.getCause(); + } + } + + if (EJBException.class.isInstance(cause)) { + cause = EJBException.class.cast(cause).getCause(); + } + + if (ApplicationException.class.isInstance(cause) && Exception.class.isInstance(cause.getCause())) { + throw Exception.class.cast(ApplicationException.class.cast(cause).getCause()); + } + + if (cause instanceof Exception) { + throw (Exception) cause; + } + throw ite; + } + } +}
http://git-wip-us.apache.org/repos/asf/tomee/blob/6d74b263/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/DynamicSubclassEjbDeploymentTest.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/DynamicSubclassEjbDeploymentTest.java b/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/DynamicSubclassEjbDeploymentTest.java index 626919e..e86d3a6 100644 --- a/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/DynamicSubclassEjbDeploymentTest.java +++ b/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/DynamicSubclassEjbDeploymentTest.java @@ -1,130 +1,130 @@ -/* - * 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.openejb.server.cxf.rs; - -import org.apache.cxf.jaxrs.client.WebClient; -import org.apache.openejb.OpenEjbContainer; -import org.apache.openejb.config.DeploymentFilterable; -import org.apache.openejb.server.cxf.rs.beans.SimpleEJB; -import org.apache.openejb.util.NetworkUtil; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import javax.ejb.EJB; -import javax.ejb.Stateless; -import javax.ejb.embeddable.EJBContainer; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Request; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.util.Properties; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -public class DynamicSubclassEjbDeploymentTest { - - private static EJBContainer container; - private static RESTIsVeryCool service; - private static int port = -1; - - @BeforeClass - public static void start() throws Exception { - port = NetworkUtil.getNextAvailablePort(); - final Properties properties = new Properties(); - properties.setProperty("httpejbd.port", Integer.toString(port)); - properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf-rs.*"); - properties.setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true"); - container = EJBContainer.createEJBContainer(properties); - service = (RESTIsVeryCool) container.getContext().lookup("java:/global/openejb-cxf-rs/RESTIsVeryCool"); - } - - @AfterClass - public static void close() throws Exception { - if (container != null) { - container.close(); - } - } - - @Test - public void normal() { - assertNotNull(service); - assertEquals("ok", service.normal()); - } - - @Test - public void rest() { - final String response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/rest").get(String.class); - assertEquals("ok", response); - } - - @Test - public void restParameterInjected() { - String response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/param").get(String.class); - assertEquals("true", response); - - response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/param").query("arg", "foo").get(String.class); - assertEquals("foo", response); - } - - @Test - public void restFieldInjected() { - final Boolean response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/field").get(Boolean.class); - assertEquals(true, response); - } - - @Stateless - @Path("/ejb") - public abstract static class RESTIsVeryCool implements InvocationHandler { - - @EJB - private SimpleEJB simpleEJB; - - @javax.ws.rs.core.Context - Request request; - - @Path("/normal") - @GET - public abstract String normal(); - - @Path("/rest") - @GET - public abstract String rest(); - - @Path("/param") - @GET - public String param(@QueryParam("arg") @DefaultValue("true") final String p) { - return p; - } - - @Path("/field") - @GET - public boolean field() { - return "GET".equals(request.getMethod()); - } - - @Override - public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { - return simpleEJB.ok(); - } - } -} +/* + * 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.openejb.server.cxf.rs; + +import org.apache.cxf.jaxrs.client.WebClient; +import org.apache.openejb.OpenEjbContainer; +import org.apache.openejb.config.DeploymentFilterable; +import org.apache.openejb.server.cxf.rs.beans.SimpleEJB; +import org.apache.openejb.util.NetworkUtil; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.ejb.embeddable.EJBContainer; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Request; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.util.Properties; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class DynamicSubclassEjbDeploymentTest { + + private static EJBContainer container; + private static RESTIsVeryCool service; + private static int port = -1; + + @BeforeClass + public static void start() throws Exception { + port = NetworkUtil.getNextAvailablePort(); + final Properties properties = new Properties(); + properties.setProperty("httpejbd.port", Integer.toString(port)); + properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf-rs.*"); + properties.setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true"); + container = EJBContainer.createEJBContainer(properties); + service = (RESTIsVeryCool) container.getContext().lookup("java:/global/openejb-cxf-rs/RESTIsVeryCool"); + } + + @AfterClass + public static void close() throws Exception { + if (container != null) { + container.close(); + } + } + + @Test + public void normal() { + assertNotNull(service); + assertEquals("ok", service.normal()); + } + + @Test + public void rest() { + final String response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/rest").get(String.class); + assertEquals("ok", response); + } + + @Test + public void restParameterInjected() { + String response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/param").get(String.class); + assertEquals("true", response); + + response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/param").query("arg", "foo").get(String.class); + assertEquals("foo", response); + } + + @Test + public void restFieldInjected() { + final Boolean response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/field").get(Boolean.class); + assertEquals(true, response); + } + + @Stateless + @Path("/ejb") + public abstract static class RESTIsVeryCool implements InvocationHandler { + + @EJB + private SimpleEJB simpleEJB; + + @javax.ws.rs.core.Context + Request request; + + @Path("/normal") + @GET + public abstract String normal(); + + @Path("/rest") + @GET + public abstract String rest(); + + @Path("/param") + @GET + public String param(@QueryParam("arg") @DefaultValue("true") final String p) { + return p; + } + + @Path("/field") + @GET + public boolean field() { + return "GET".equals(request.getMethod()); + } + + @Override + public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { + return simpleEJB.ok(); + } + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/6d74b263/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/EJBAccessExceptionMapperTest.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/EJBAccessExceptionMapperTest.java b/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/EJBAccessExceptionMapperTest.java index dba3957..2841ec7 100644 --- a/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/EJBAccessExceptionMapperTest.java +++ b/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/EJBAccessExceptionMapperTest.java @@ -1,110 +1,110 @@ -/* - * 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.openejb.server.cxf.rs; - -import org.apache.cxf.jaxrs.client.WebClient; -import org.apache.openejb.OpenEjbContainer; -import org.apache.openejb.config.DeploymentFilterable; -import org.apache.openejb.server.cxf.rs.beans.SimpleEJB; -import org.apache.openejb.util.NetworkUtil; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import javax.annotation.security.RolesAllowed; -import javax.ejb.EJB; -import javax.ejb.Lock; -import javax.ejb.LockType; -import javax.ejb.Singleton; -import javax.ejb.embeddable.EJBContainer; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Request; -import javax.ws.rs.core.Response; -import java.util.Properties; - -import static org.junit.Assert.assertEquals; - -@SuppressWarnings("FieldCanBeLocal") -public class EJBAccessExceptionMapperTest { - private static EJBContainer container; - private static RESTIsCoolOne service; - private static int port = -1; - - @BeforeClass - public static void start() throws Exception { - port = NetworkUtil.getNextAvailablePort(); - final Properties properties = new Properties(); - properties.setProperty("httpejbd.port", Integer.toString(port)); - properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf-rs.*"); - properties.setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true"); - container = EJBContainer.createEJBContainer(properties); - service = (RESTIsCoolOne) container.getContext().lookup("java:/global/openejb-cxf-rs/RESTIsCoolOne"); - } - - @AfterClass - public static void close() throws Exception { - if (container != null) { - container.close(); - } - } - - - @Test - public void rest() { - final Response response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejbsecu/rest").get(); - assertEquals(403, response.getStatus()); - } - - - @Singleton - @RolesAllowed("Something that does not exit at all") - @Lock(LockType.READ) - @Path("/ejbsecu") - public static class RESTIsCoolOne { - @EJB - private SimpleEJB simpleEJB; - @javax.ws.rs.core.Context - Request request; - - @Path("/normal") - @GET - public String normal() { - return simpleEJB.ok(); - } - - @Path("/rest") - @GET - public String rest() { - return simpleEJB.ok(); - } - - @Path("/param") - @GET - public String param(@QueryParam("arg") @DefaultValue("true") final String p) { - return p; - } - - @Path("/field") - @GET - public boolean field() { - return "GET".equals(request.getMethod()); - } - } -} +/* + * 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.openejb.server.cxf.rs; + +import org.apache.cxf.jaxrs.client.WebClient; +import org.apache.openejb.OpenEjbContainer; +import org.apache.openejb.config.DeploymentFilterable; +import org.apache.openejb.server.cxf.rs.beans.SimpleEJB; +import org.apache.openejb.util.NetworkUtil; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import javax.annotation.security.RolesAllowed; +import javax.ejb.EJB; +import javax.ejb.Lock; +import javax.ejb.LockType; +import javax.ejb.Singleton; +import javax.ejb.embeddable.EJBContainer; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Request; +import javax.ws.rs.core.Response; +import java.util.Properties; + +import static org.junit.Assert.assertEquals; + +@SuppressWarnings("FieldCanBeLocal") +public class EJBAccessExceptionMapperTest { + private static EJBContainer container; + private static RESTIsCoolOne service; + private static int port = -1; + + @BeforeClass + public static void start() throws Exception { + port = NetworkUtil.getNextAvailablePort(); + final Properties properties = new Properties(); + properties.setProperty("httpejbd.port", Integer.toString(port)); + properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf-rs.*"); + properties.setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true"); + container = EJBContainer.createEJBContainer(properties); + service = (RESTIsCoolOne) container.getContext().lookup("java:/global/openejb-cxf-rs/RESTIsCoolOne"); + } + + @AfterClass + public static void close() throws Exception { + if (container != null) { + container.close(); + } + } + + + @Test + public void rest() { + final Response response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejbsecu/rest").get(); + assertEquals(403, response.getStatus()); + } + + + @Singleton + @RolesAllowed("Something that does not exit at all") + @Lock(LockType.READ) + @Path("/ejbsecu") + public static class RESTIsCoolOne { + @EJB + private SimpleEJB simpleEJB; + @javax.ws.rs.core.Context + Request request; + + @Path("/normal") + @GET + public String normal() { + return simpleEJB.ok(); + } + + @Path("/rest") + @GET + public String rest() { + return simpleEJB.ok(); + } + + @Path("/param") + @GET + public String param(@QueryParam("arg") @DefaultValue("true") final String p) { + return p; + } + + @Path("/field") + @GET + public boolean field() { + return "GET".equals(request.getMethod()); + } + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/6d74b263/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/EjbDeploymentTest.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/EjbDeploymentTest.java b/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/EjbDeploymentTest.java index 94816ba..2eb9a87 100644 --- a/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/EjbDeploymentTest.java +++ b/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/EjbDeploymentTest.java @@ -1,123 +1,123 @@ -/* - * 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.openejb.server.cxf.rs; - -import org.apache.cxf.jaxrs.client.WebClient; -import org.apache.openejb.OpenEjbContainer; -import org.apache.openejb.config.DeploymentFilterable; -import org.apache.openejb.server.cxf.rs.beans.SimpleEJB; -import org.apache.openejb.util.NetworkUtil; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import javax.ejb.EJB; -import javax.ejb.Stateless; -import javax.ejb.embeddable.EJBContainer; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Request; -import java.util.Properties; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -public class EjbDeploymentTest { - private static EJBContainer container; - private static RESTIsCoolTwo service; - private static int port = -1; - - @BeforeClass - public static void start() throws Exception { - port = NetworkUtil.getNextAvailablePort(); - final Properties properties = new Properties(); - properties.setProperty("httpejbd.port", Integer.toString(port)); - properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf-rs.*"); - properties.setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true"); - container = EJBContainer.createEJBContainer(properties); - service = (RESTIsCoolTwo) container.getContext().lookup("java:/global/openejb-cxf-rs/RESTIsCoolTwo"); - } - - @AfterClass - public static void close() throws Exception { - if (container != null) { - container.close(); - } - } - - @Test - public void normal() { - assertNotNull(service); - assertEquals("ok", service.normal()); - } - - @Test - public void rest() { - final String response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/rest").get(String.class); - assertEquals("ok", response); - } - - @Test - public void restParameterInjected() { - String response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/param").get(String.class); - assertEquals("true", response); - - response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/param").query("arg", "foo").get(String.class); - assertEquals("foo", response); - } - - @Test - public void restFieldInjected() { - final Boolean response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/field").get(Boolean.class); - assertEquals(true, response); - } - - @Stateless - @Path("/ejb") - public static class RESTIsCoolTwo { - @EJB - private SimpleEJB simpleEJB; - @javax.ws.rs.core.Context - Request request; - - @Path("/normal") - @GET - public String normal() { - return simpleEJB.ok(); - } - - @Path("/rest") - @GET - public String rest() { - return simpleEJB.ok(); - } - - @Path("/param") - @GET - public String param(@QueryParam("arg") @DefaultValue("true") final String p) { - return p; - } - - @Path("/field") - @GET - public boolean field() { - return "GET".equals(request.getMethod()); - } - } -} +/* + * 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.openejb.server.cxf.rs; + +import org.apache.cxf.jaxrs.client.WebClient; +import org.apache.openejb.OpenEjbContainer; +import org.apache.openejb.config.DeploymentFilterable; +import org.apache.openejb.server.cxf.rs.beans.SimpleEJB; +import org.apache.openejb.util.NetworkUtil; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import javax.ejb.EJB; +import javax.ejb.Stateless; +import javax.ejb.embeddable.EJBContainer; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Request; +import java.util.Properties; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class EjbDeploymentTest { + private static EJBContainer container; + private static RESTIsCoolTwo service; + private static int port = -1; + + @BeforeClass + public static void start() throws Exception { + port = NetworkUtil.getNextAvailablePort(); + final Properties properties = new Properties(); + properties.setProperty("httpejbd.port", Integer.toString(port)); + properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf-rs.*"); + properties.setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true"); + container = EJBContainer.createEJBContainer(properties); + service = (RESTIsCoolTwo) container.getContext().lookup("java:/global/openejb-cxf-rs/RESTIsCoolTwo"); + } + + @AfterClass + public static void close() throws Exception { + if (container != null) { + container.close(); + } + } + + @Test + public void normal() { + assertNotNull(service); + assertEquals("ok", service.normal()); + } + + @Test + public void rest() { + final String response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/rest").get(String.class); + assertEquals("ok", response); + } + + @Test + public void restParameterInjected() { + String response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/param").get(String.class); + assertEquals("true", response); + + response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/param").query("arg", "foo").get(String.class); + assertEquals("foo", response); + } + + @Test + public void restFieldInjected() { + final Boolean response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/ejb/field").get(Boolean.class); + assertEquals(true, response); + } + + @Stateless + @Path("/ejb") + public static class RESTIsCoolTwo { + @EJB + private SimpleEJB simpleEJB; + @javax.ws.rs.core.Context + Request request; + + @Path("/normal") + @GET + public String normal() { + return simpleEJB.ok(); + } + + @Path("/rest") + @GET + public String rest() { + return simpleEJB.ok(); + } + + @Path("/param") + @GET + public String param(@QueryParam("arg") @DefaultValue("true") final String p) { + return p; + } + + @Path("/field") + @GET + public boolean field() { + return "GET".equals(request.getMethod()); + } + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/6d74b263/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/PathParamAtClassLevelTest.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/PathParamAtClassLevelTest.java b/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/PathParamAtClassLevelTest.java index 3d6de65..86b0efc 100644 --- a/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/PathParamAtClassLevelTest.java +++ b/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/PathParamAtClassLevelTest.java @@ -1,74 +1,74 @@ -/* - * 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.openejb.server.cxf.rs; - -import org.apache.cxf.jaxrs.client.WebClient; -import org.apache.openejb.OpenEjbContainer; -import org.apache.openejb.config.DeploymentFilterable; -import org.apache.openejb.util.NetworkUtil; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import javax.ejb.Stateless; -import javax.ejb.embeddable.EJBContainer; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import java.util.Properties; - -import static org.junit.Assert.assertEquals; - -public class PathParamAtClassLevelTest { - private static EJBContainer container; - - private static int port = -1; - - @BeforeClass - public static void start() throws Exception { - port = NetworkUtil.getNextAvailablePort(); - final Properties properties = new Properties(); - properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf-rs.*"); - properties.setProperty("httpejbd.port", Integer.toString(port)); - properties.setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true"); - container = EJBContainer.createEJBContainer(properties); - } - - @AfterClass - public static void close() throws Exception { - if (container != null) { - container.close(); - } - } - - @Test - public void rest() { - final String response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/match/openejb/test/normal").get(String.class); - assertEquals("openejb", response); - } - - @Stateless - @Path("/match/{name}/test") - public static class DoesItMatchWithPathParamAtClassLevel { - @Path("/normal") - @GET - public String normal(@PathParam("name") final String name) { - return name; - } - } -} +/* + * 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.openejb.server.cxf.rs; + +import org.apache.cxf.jaxrs.client.WebClient; +import org.apache.openejb.OpenEjbContainer; +import org.apache.openejb.config.DeploymentFilterable; +import org.apache.openejb.util.NetworkUtil; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import javax.ejb.Stateless; +import javax.ejb.embeddable.EJBContainer; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import java.util.Properties; + +import static org.junit.Assert.assertEquals; + +public class PathParamAtClassLevelTest { + private static EJBContainer container; + + private static int port = -1; + + @BeforeClass + public static void start() throws Exception { + port = NetworkUtil.getNextAvailablePort(); + final Properties properties = new Properties(); + properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf-rs.*"); + properties.setProperty("httpejbd.port", Integer.toString(port)); + properties.setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true"); + container = EJBContainer.createEJBContainer(properties); + } + + @AfterClass + public static void close() throws Exception { + if (container != null) { + container.close(); + } + } + + @Test + public void rest() { + final String response = WebClient.create("http://localhost:" + port + "/openejb-cxf-rs").path("/match/openejb/test/normal").get(String.class); + assertEquals("openejb", response); + } + + @Stateless + @Path("/match/{name}/test") + public static class DoesItMatchWithPathParamAtClassLevel { + @Path("/normal") + @GET + public String normal(@PathParam("name") final String name) { + return name; + } + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/6d74b263/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/WSSPassThroughInterceptor.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/WSSPassThroughInterceptor.java b/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/WSSPassThroughInterceptor.java index 058a9b0..1d05d9c 100644 --- a/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/WSSPassThroughInterceptor.java +++ b/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/WSSPassThroughInterceptor.java @@ -1,66 +1,66 @@ -/** - * 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.openejb.server.cxf; - -import org.apache.cxf.binding.soap.SoapMessage; -import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; -import org.apache.cxf.phase.Phase; -import org.apache.ws.security.WSConstants; - -import javax.xml.namespace.QName; -import java.util.HashSet; -import java.util.Set; - -/** - * When using JAX-WS Handler, the {@link org.apache.openejb.server.cxf.ejb.EjbInterceptor} - * adds the {@link org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor}. OpenEJB now supports - * WS Security out of the box, so it must indicates WS Security headers have been treated. That is simply done - * using that fake interceptor. - * <p/> - * $Id$ - */ -public class WSSPassThroughInterceptor extends AbstractSoapInterceptor { - private static final Set<QName> HEADERS = new HashSet<QName>(); - - static { - HEADERS.add(new QName(WSConstants.WSSE_NS, WSConstants.WSSE_LN)); - HEADERS.add(new QName(WSConstants.WSSE11_NS, WSConstants.WSSE_LN)); - HEADERS.add(new QName(WSConstants.ENC_NS, WSConstants.ENC_DATA_LN)); - } - - public WSSPassThroughInterceptor() { - super(Phase.PRE_PROTOCOL); - } - - public WSSPassThroughInterceptor(final String phase) { - super(phase); - } - - @Override - public Set<QName> getUnderstoodHeaders() { - return HEADERS; - } - - public void handleMessage(final SoapMessage soapMessage) { - // do nothing - - // this interceptor simply returns all WS-Security headers in its getUnderstoodHeaders() - // method, so that CXF does not complain that they have not been "processed" - // this is useful if you only need to look at the non-encrypted XML - } - -} +/** + * 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.openejb.server.cxf; + +import org.apache.cxf.binding.soap.SoapMessage; +import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; +import org.apache.cxf.phase.Phase; +import org.apache.ws.security.WSConstants; + +import javax.xml.namespace.QName; +import java.util.HashSet; +import java.util.Set; + +/** + * When using JAX-WS Handler, the {@link org.apache.openejb.server.cxf.ejb.EjbInterceptor} + * adds the {@link org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor}. OpenEJB now supports + * WS Security out of the box, so it must indicates WS Security headers have been treated. That is simply done + * using that fake interceptor. + * <p/> + * $Id$ + */ +public class WSSPassThroughInterceptor extends AbstractSoapInterceptor { + private static final Set<QName> HEADERS = new HashSet<QName>(); + + static { + HEADERS.add(new QName(WSConstants.WSSE_NS, WSConstants.WSSE_LN)); + HEADERS.add(new QName(WSConstants.WSSE11_NS, WSConstants.WSSE_LN)); + HEADERS.add(new QName(WSConstants.ENC_NS, WSConstants.ENC_DATA_LN)); + } + + public WSSPassThroughInterceptor() { + super(Phase.PRE_PROTOCOL); + } + + public WSSPassThroughInterceptor(final String phase) { + super(phase); + } + + @Override + public Set<QName> getUnderstoodHeaders() { + return HEADERS; + } + + public void handleMessage(final SoapMessage soapMessage) { + // do nothing + + // this interceptor simply returns all WS-Security headers in its getUnderstoodHeaders() + // method, so that CXF does not complain that they have not been "processed" + // this is useful if you only need to look at the non-encrypted XML + } + +} http://git-wip-us.apache.org/repos/asf/tomee/blob/6d74b263/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java b/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java index 9c09ca0..9c89346 100644 --- a/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java +++ b/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java @@ -1,62 +1,62 @@ -/** - * 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.openejb.server.cxf.ejb; - -import javax.xml.ws.EndpointReference; -import javax.xml.ws.WebServiceException; -import javax.xml.ws.wsaddressing.W3CEndpointReference; -import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder; - -import org.apache.cxf.endpoint.Endpoint; -import org.apache.cxf.jaxws.context.WrappedMessageContext; -import org.apache.cxf.message.Message; -import org.apache.openejb.core.webservices.AddressingSupport; -import org.w3c.dom.Element; - -public class EjbMessageContext extends WrappedMessageContext implements AddressingSupport { - - public EjbMessageContext(final Message m, final Scope defScope) { - super(m, defScope); - } - - public EndpointReference getEndpointReference(final Element... referenceParameters) { - final org.apache.cxf.message.Message msg = getWrappedMessage(); - final Endpoint ep = msg.getExchange().get(Endpoint.class); - - final W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder(); - builder.address(ep.getEndpointInfo().getAddress()); - builder.serviceName(ep.getService().getName()); - builder.endpointName(ep.getEndpointInfo().getName()); - - if (referenceParameters != null) { - for (final Element referenceParameter : referenceParameters) { - builder.referenceParameter(referenceParameter); - } - } - - return builder.build(); - } - - public <T extends EndpointReference> T getEndpointReference(final Class<T> clazz, final Element... referenceParameters) { - if (W3CEndpointReference.class.isAssignableFrom(clazz)) { - return clazz.cast(getEndpointReference(referenceParameters)); - } else { - throw new WebServiceException("Endpoint reference type not supported: " + clazz); - } - } - -} +/** + * 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.openejb.server.cxf.ejb; + +import javax.xml.ws.EndpointReference; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.wsaddressing.W3CEndpointReference; +import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder; + +import org.apache.cxf.endpoint.Endpoint; +import org.apache.cxf.jaxws.context.WrappedMessageContext; +import org.apache.cxf.message.Message; +import org.apache.openejb.core.webservices.AddressingSupport; +import org.w3c.dom.Element; + +public class EjbMessageContext extends WrappedMessageContext implements AddressingSupport { + + public EjbMessageContext(final Message m, final Scope defScope) { + super(m, defScope); + } + + public EndpointReference getEndpointReference(final Element... referenceParameters) { + final org.apache.cxf.message.Message msg = getWrappedMessage(); + final Endpoint ep = msg.getExchange().get(Endpoint.class); + + final W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder(); + builder.address(ep.getEndpointInfo().getAddress()); + builder.serviceName(ep.getService().getName()); + builder.endpointName(ep.getEndpointInfo().getName()); + + if (referenceParameters != null) { + for (final Element referenceParameter : referenceParameters) { + builder.referenceParameter(referenceParameter); + } + } + + return builder.build(); + } + + public <T extends EndpointReference> T getEndpointReference(final Class<T> clazz, final Element... referenceParameters) { + if (W3CEndpointReference.class.isAssignableFrom(clazz)) { + return clazz.cast(getEndpointReference(referenceParameters)); + } else { + throw new WebServiceException("Endpoint reference type not supported: " + clazz); + } + } + +} http://git-wip-us.apache.org/repos/asf/tomee/blob/6d74b263/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java index b63a211..13a5289 100644 --- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java +++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java @@ -1,137 +1,137 @@ -/** - * 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.openejb.server.cxf; - -import junit.framework.TestCase; -import org.apache.openejb.config.DeploymentFilterable; -import org.apache.openejb.server.cxf.fault.AuthenticatorService; -import org.apache.openejb.server.cxf.fault.WrongPasswordException; -import org.apache.openejb.server.cxf.fault.WrongPasswordRuntimeException; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.Properties; - -/** - * @version $Rev$ - */ -public class CxfJaxWsProviderTest extends TestCase { - - //START SNIPPET: setup - private InitialContext initialContext; - - //Random port to avoid test conflicts - private static final int port = Integer.parseInt(System.getProperty("httpejbd.port", "" + org.apache.openejb.util.NetworkUtil.getNextAvailablePort())); - - protected void setUp() throws Exception { - final Properties properties = new Properties(); - properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf.*"); - properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); - properties.setProperty("openejb.embedded.remotable", "true"); - - //Just for this test we change the default port from 4204 to avoid conflicts - properties.setProperty("httpejbd.port", "" + port); - - initialContext = new InitialContext(properties); - } - //END SNIPPET: setup - - public void test00_runCheckedException() { - try { - final AuthenticatorService withHandler = Service.create( - new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBean?wsdl"), - new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanService")) - .getPort(AuthenticatorService.class); - assertNotNull(withHandler); - - final AuthenticatorService noHandler = Service.create( - new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBeanNoHandler?wsdl"), - new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanNoHandlerService")) - .getPort(AuthenticatorService.class); - assertNotNull(noHandler); - - try { - withHandler.authenticate("John", "Doe"); - } catch (final WrongPasswordException e) { - System.out.println("My lovely checked exception..."); - } catch (final Throwable e) { - e.printStackTrace(); - fail("A throwable instead of a checked exception..."); - } - - try { - noHandler.authenticate("John", "Doe"); - } catch (final WrongPasswordException e) { - System.out.println("My lovely checked exception..."); - } catch (final Throwable e) { - e.printStackTrace(); - fail("A throwable instead of a checked exception..."); - } - - } catch (final MalformedURLException e) { - e.printStackTrace(); - fail("?!? invalid URL ???"); - } - - } - - public void test01_runRuntimeException() { - try { - final AuthenticatorService withHandler = Service.create( - new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBean?wsdl"), - new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanService")) - .getPort(AuthenticatorService.class); - assertNotNull(withHandler); - - final AuthenticatorService noHandler = Service.create( - new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBeanNoHandler?wsdl"), - new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanNoHandlerService")) - .getPort(AuthenticatorService.class); - assertNotNull(noHandler); - - try { - withHandler.authenticateRuntime("John", "Doe"); - } catch (final WrongPasswordRuntimeException e) { - e.printStackTrace(); - fail("My checked exception instead of a throwableS..."); - } catch (final Throwable e) { - System.out.println("A throwable exception..."); - } - - - try { - noHandler.authenticateRuntime("John", "Doe"); - } catch (final WrongPasswordRuntimeException e) { - e.printStackTrace(); - fail("My checked exception instead of a throwableS..."); - } catch (final Throwable e) { - System.out.println("A throwable exception..."); - } - - } catch (final MalformedURLException e) { - e.printStackTrace(); - fail("?!? invalid URL ???"); - } - - } - -} +/** + * 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.openejb.server.cxf; + +import junit.framework.TestCase; +import org.apache.openejb.config.DeploymentFilterable; +import org.apache.openejb.server.cxf.fault.AuthenticatorService; +import org.apache.openejb.server.cxf.fault.WrongPasswordException; +import org.apache.openejb.server.cxf.fault.WrongPasswordRuntimeException; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.util.Properties; + +/** + * @version $Rev$ + */ +public class CxfJaxWsProviderTest extends TestCase { + + //START SNIPPET: setup + private InitialContext initialContext; + + //Random port to avoid test conflicts + private static final int port = Integer.parseInt(System.getProperty("httpejbd.port", "" + org.apache.openejb.util.NetworkUtil.getNextAvailablePort())); + + protected void setUp() throws Exception { + final Properties properties = new Properties(); + properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf.*"); + properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); + properties.setProperty("openejb.embedded.remotable", "true"); + + //Just for this test we change the default port from 4204 to avoid conflicts + properties.setProperty("httpejbd.port", "" + port); + + initialContext = new InitialContext(properties); + } + //END SNIPPET: setup + + public void test00_runCheckedException() { + try { + final AuthenticatorService withHandler = Service.create( + new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBean?wsdl"), + new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanService")) + .getPort(AuthenticatorService.class); + assertNotNull(withHandler); + + final AuthenticatorService noHandler = Service.create( + new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBeanNoHandler?wsdl"), + new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanNoHandlerService")) + .getPort(AuthenticatorService.class); + assertNotNull(noHandler); + + try { + withHandler.authenticate("John", "Doe"); + } catch (final WrongPasswordException e) { + System.out.println("My lovely checked exception..."); + } catch (final Throwable e) { + e.printStackTrace(); + fail("A throwable instead of a checked exception..."); + } + + try { + noHandler.authenticate("John", "Doe"); + } catch (final WrongPasswordException e) { + System.out.println("My lovely checked exception..."); + } catch (final Throwable e) { + e.printStackTrace(); + fail("A throwable instead of a checked exception..."); + } + + } catch (final MalformedURLException e) { + e.printStackTrace(); + fail("?!? invalid URL ???"); + } + + } + + public void test01_runRuntimeException() { + try { + final AuthenticatorService withHandler = Service.create( + new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBean?wsdl"), + new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanService")) + .getPort(AuthenticatorService.class); + assertNotNull(withHandler); + + final AuthenticatorService noHandler = Service.create( + new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBeanNoHandler?wsdl"), + new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanNoHandlerService")) + .getPort(AuthenticatorService.class); + assertNotNull(noHandler); + + try { + withHandler.authenticateRuntime("John", "Doe"); + } catch (final WrongPasswordRuntimeException e) { + e.printStackTrace(); + fail("My checked exception instead of a throwableS..."); + } catch (final Throwable e) { + System.out.println("A throwable exception..."); + } + + + try { + noHandler.authenticateRuntime("John", "Doe"); + } catch (final WrongPasswordRuntimeException e) { + e.printStackTrace(); + fail("My checked exception instead of a throwableS..."); + } catch (final Throwable e) { + System.out.println("A throwable exception..."); + } + + } catch (final MalformedURLException e) { + e.printStackTrace(); + fail("?!? invalid URL ???"); + } + + } + +} http://git-wip-us.apache.org/repos/asf/tomee/blob/6d74b263/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java index 807d73c..5a8ed5a 100644 --- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java +++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java @@ -1,43 +1,43 @@ -/** - * 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.openejb.server.cxf.fault; - -import javax.ejb.Stateless; -import javax.jws.HandlerChain; -import javax.jws.WebService; - -/** - * @version $Rev$ - */ -@Stateless -@WebService(targetNamespace = "http://superbiz.org/wsdl") -@HandlerChain(file = "handler.xml") -public class AuthenticatorServiceBean implements AuthenticatorService { - - public boolean authenticate(final String name, final String password) throws WrongPasswordException { - System.out.println(String.format("AuthenticatorServiceBean.authenticate(%s, %s)", - name, password)); - throw new WrongPasswordException("Checked exception"); - } - - public boolean authenticateRuntime(final String name, final String password) { - System.out.println(String.format("AuthenticatorServiceBean.authenticateRuntime(%s, %s)", - name, password)); - throw new WrongPasswordRuntimeException("Runtime exception"); - } - +/** + * 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.openejb.server.cxf.fault; + +import javax.ejb.Stateless; +import javax.jws.HandlerChain; +import javax.jws.WebService; + +/** + * @version $Rev$ + */ +@Stateless +@WebService(targetNamespace = "http://superbiz.org/wsdl") +@HandlerChain(file = "handler.xml") +public class AuthenticatorServiceBean implements AuthenticatorService { + + public boolean authenticate(final String name, final String password) throws WrongPasswordException { + System.out.println(String.format("AuthenticatorServiceBean.authenticate(%s, %s)", + name, password)); + throw new WrongPasswordException("Checked exception"); + } + + public boolean authenticateRuntime(final String name, final String password) { + System.out.println(String.format("AuthenticatorServiceBean.authenticateRuntime(%s, %s)", + name, password)); + throw new WrongPasswordRuntimeException("Runtime exception"); + } + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/6d74b263/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java index 3a3cb43..41b82ae 100644 --- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java +++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java @@ -1,42 +1,42 @@ -/** - * 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.openejb.server.cxf.fault; - -import javax.ejb.Stateless; -import javax.jws.WebService; - -/** - * @version $Rev$ - */ -@Stateless -@WebService(targetNamespace = "http://superbiz.org/wsdl") -// @HandlerChain(file="handler.xml") -public class AuthenticatorServiceBeanNoHandler implements AuthenticatorService { - - public boolean authenticate(final String name, final String password) throws WrongPasswordException { - System.out.println(String.format("AuthenticatorServiceBeanNoHandler.authenticate(%s, %s)", - name, password)); - throw new WrongPasswordException("Checked exception"); - } - - public boolean authenticateRuntime(final String name, final String password) { - System.out.println(String.format("AuthenticatorServiceBeanNoHandler.authenticateRuntime(%s, %s)", - name, password)); - throw new WrongPasswordRuntimeException("Runtime exception"); - } - +/** + * 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.openejb.server.cxf.fault; + +import javax.ejb.Stateless; +import javax.jws.WebService; + +/** + * @version $Rev$ + */ +@Stateless +@WebService(targetNamespace = "http://superbiz.org/wsdl") +// @HandlerChain(file="handler.xml") +public class AuthenticatorServiceBeanNoHandler implements AuthenticatorService { + + public boolean authenticate(final String name, final String password) throws WrongPasswordException { + System.out.println(String.format("AuthenticatorServiceBeanNoHandler.authenticate(%s, %s)", + name, password)); + throw new WrongPasswordException("Checked exception"); + } + + public boolean authenticateRuntime(final String name, final String password) { + System.out.println(String.format("AuthenticatorServiceBeanNoHandler.authenticateRuntime(%s, %s)", + name, password)); + throw new WrongPasswordRuntimeException("Runtime exception"); + } + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/6d74b263/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java index d12465b..e1e54b7 100644 --- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java +++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java @@ -1,49 +1,49 @@ -/** - * 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.openejb.server.cxf.fault; - -import java.util.Collections; -import java.util.Set; - -import javax.xml.namespace.QName; -import javax.xml.ws.handler.MessageContext; -import javax.xml.ws.handler.soap.SOAPHandler; -import javax.xml.ws.handler.soap.SOAPMessageContext; - -/** - * @version $Rev$ - */ -public class DummyInterceptor implements SOAPHandler<SOAPMessageContext> { - public DummyInterceptor() { - super(); - } - - public Set<QName> getHeaders() { - return Collections.emptySet(); - } - - public void close(final MessageContext mc) { - } - - public boolean handleFault(final SOAPMessageContext mc) { - return true; - } - - public boolean handleMessage(final SOAPMessageContext mc) { - return true; - } +/** + * 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.openejb.server.cxf.fault; + +import java.util.Collections; +import java.util.Set; + +import javax.xml.namespace.QName; +import javax.xml.ws.handler.MessageContext; +import javax.xml.ws.handler.soap.SOAPHandler; +import javax.xml.ws.handler.soap.SOAPMessageContext; + +/** + * @version $Rev$ + */ +public class DummyInterceptor implements SOAPHandler<SOAPMessageContext> { + public DummyInterceptor() { + super(); + } + + public Set<QName> getHeaders() { + return Collections.emptySet(); + } + + public void close(final MessageContext mc) { + } + + public boolean handleFault(final SOAPMessageContext mc) { + return true; + } + + public boolean handleMessage(final SOAPMessageContext mc) { + return true; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/6d74b263/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java index beacfe8..10bcf7a 100644 --- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java +++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java @@ -1,42 +1,42 @@ -/** - * 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.openejb.server.cxf.fault; - -import javax.xml.ws.WebFault; - -/** - * @version $Rev$ - */ -@WebFault -public class WrongPasswordException extends Exception { - - public WrongPasswordException() { - super(); - } - - public WrongPasswordException(final String message, final Throwable cause) { - super(message, cause); - } - - public WrongPasswordException(final String message) { - super(message); - } - - public WrongPasswordException(final Throwable cause) { - super(cause); - } +/** + * 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.openejb.server.cxf.fault; + +import javax.xml.ws.WebFault; + +/** + * @version $Rev$ + */ +@WebFault +public class WrongPasswordException extends Exception { + + public WrongPasswordException() { + super(); + } + + public WrongPasswordException(final String message, final Throwable cause) { + super(message, cause); + } + + public WrongPasswordException(final String message) { + super(message); + } + + public WrongPasswordException(final Throwable cause) { + super(cause); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/6d74b263/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java index 5900996..b02a40b 100644 --- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java +++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java @@ -1,43 +1,43 @@ -/** - * 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.openejb.server.cxf.fault; - -import javax.ejb.ApplicationException; - -/** - * @version $Rev$ - */ -@ApplicationException -// @WebFault // Not possible: a web fault must by a checked exception -public class WrongPasswordRuntimeException extends RuntimeException { - - public WrongPasswordRuntimeException() { - super(); - } - - public WrongPasswordRuntimeException(final String message, final Throwable cause) { - super(message, cause); - } - - public WrongPasswordRuntimeException(final String message) { - super(message); - } - - public WrongPasswordRuntimeException(final Throwable cause) { - super(cause); - } +/** + * 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.openejb.server.cxf.fault; + +import javax.ejb.ApplicationException; + +/** + * @version $Rev$ + */ +@ApplicationException +// @WebFault // Not possible: a web fault must by a checked exception +public class WrongPasswordRuntimeException extends RuntimeException { + + public WrongPasswordRuntimeException() { + super(); + } + + public WrongPasswordRuntimeException(final String message, final Throwable cause) { + super(message, cause); + } + + public WrongPasswordRuntimeException(final String message) { + super(message); + } + + public WrongPasswordRuntimeException(final Throwable cause) { + super(cause); + } } \ No newline at end of file