You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/12/15 19:14:50 UTC
svn commit: r726753 [2/3] - in /cxf/branches/2.1.x-fixes: ./
common/common/src/test/java/org/apache/cxf/helpers/
distribution/src/main/release/samples/configuration_interceptor/
distribution/src/main/release/samples/configuration_interceptor/src/demo/s...
Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java Mon Dec 15 10:14:38 2008
@@ -1,82 +1,82 @@
-/**
- * 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.cxf.transport.jms;
-
-import java.util.logging.Logger;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.configuration.ConfigurationException;
-import org.apache.cxf.endpoint.Client;
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.feature.AbstractFeature;
-import org.apache.cxf.transport.Conduit;
-import org.apache.cxf.transport.Destination;
-import org.springframework.beans.factory.annotation.Required;
-
-/**
- * Allows to configure the JMSConfiguration directly at the Client or Server. Simply add this class to the
- * Features and reference a JMSConfiguration. The configuration inside this class takes precedence over a
- * configuration that is generated from the old configuration style.
- */
-public class JMSConfigFeature extends AbstractFeature {
- static final Logger LOG = LogUtils.getL7dLogger(JMSConfigFeature.class);
-
- JMSConfiguration jmsConfig;
-
- @Override
- public void initialize(Client client, Bus bus) {
- checkJmsConfig();
- Conduit conduit = client.getConduit();
- if (!(conduit instanceof JMSConduit)) {
- throw new ConfigurationException(new Message("JMSCONFIGFEATURE_ONLY_JMS", LOG));
- }
- JMSConduit jmsConduit = (JMSConduit)conduit;
- jmsConduit.setJmsConfig(jmsConfig);
- super.initialize(client, bus);
- }
-
- @Override
- public void initialize(Server server, Bus bus) {
- checkJmsConfig();
- Destination destination = server.getDestination();
- if (!(destination instanceof JMSDestination)) {
- throw new ConfigurationException(new Message("JMSCONFIGFEATURE_ONLY_JMS", LOG));
- }
- JMSDestination jmsDestination = (JMSDestination)destination;
- jmsDestination.setJmsConfig(jmsConfig);
- super.initialize(server, bus);
- }
-
- public JMSConfiguration getJmsConfig() {
- return jmsConfig;
- }
-
- @Required
- public void setJmsConfig(JMSConfiguration jmsConfig) {
- this.jmsConfig = jmsConfig;
- }
-
- private void checkJmsConfig() {
- if (jmsConfig == null) {
- throw new ConfigurationException(new Message("JMSCONFIG_REQUIRED", LOG));
- }
- }
-}
+/**
+ * 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.cxf.transport.jms;
+
+import java.util.logging.Logger;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.configuration.ConfigurationException;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.Destination;
+import org.springframework.beans.factory.annotation.Required;
+
+/**
+ * Allows to configure the JMSConfiguration directly at the Client or Server. Simply add this class to the
+ * Features and reference a JMSConfiguration. The configuration inside this class takes precedence over a
+ * configuration that is generated from the old configuration style.
+ */
+public class JMSConfigFeature extends AbstractFeature {
+ static final Logger LOG = LogUtils.getL7dLogger(JMSConfigFeature.class);
+
+ JMSConfiguration jmsConfig;
+
+ @Override
+ public void initialize(Client client, Bus bus) {
+ checkJmsConfig();
+ Conduit conduit = client.getConduit();
+ if (!(conduit instanceof JMSConduit)) {
+ throw new ConfigurationException(new Message("JMSCONFIGFEATURE_ONLY_JMS", LOG));
+ }
+ JMSConduit jmsConduit = (JMSConduit)conduit;
+ jmsConduit.setJmsConfig(jmsConfig);
+ super.initialize(client, bus);
+ }
+
+ @Override
+ public void initialize(Server server, Bus bus) {
+ checkJmsConfig();
+ Destination destination = server.getDestination();
+ if (!(destination instanceof JMSDestination)) {
+ throw new ConfigurationException(new Message("JMSCONFIGFEATURE_ONLY_JMS", LOG));
+ }
+ JMSDestination jmsDestination = (JMSDestination)destination;
+ jmsDestination.setJmsConfig(jmsConfig);
+ super.initialize(server, bus);
+ }
+
+ public JMSConfiguration getJmsConfig() {
+ return jmsConfig;
+ }
+
+ @Required
+ public void setJmsConfig(JMSConfiguration jmsConfig) {
+ this.jmsConfig = jmsConfig;
+ }
+
+ private void checkJmsConfig() {
+ if (jmsConfig == null) {
+ throw new ConfigurationException(new Message("JMSCONFIG_REQUIRED", LOG));
+ }
+ }
+}
Propchange: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java Mon Dec 15 10:14:38 2008
@@ -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.cxf.transport.jms;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.MessageListener;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-
-import org.springframework.jms.core.JmsTemplate;
-import org.springframework.jms.core.JmsTemplate102;
-import org.springframework.jms.core.SessionCallback;
-import org.springframework.jms.listener.DefaultMessageListenerContainer;
-import org.springframework.jms.listener.DefaultMessageListenerContainer102;
-import org.springframework.jms.support.destination.DestinationResolver;
-
-/**
- * Factory to create JmsTemplates and JmsListeners from configuration and context information
- */
-public final class JMSFactory {
-
- private JMSFactory() {
- }
-
- /**
- * Create JmsTemplate from configuration information. Most settings are taken from jmsConfig. The QoS
- * settings in headers override the settings from jmsConfig
- *
- * @param jmsConfig configuration information
- * @param headers context headers
- * @return
- */
- public static JmsTemplate createJmsTemplate(JMSConfiguration jmsConfig, JMSMessageHeadersType headers) {
- JmsTemplate jmsTemplate = jmsConfig.isUseJms11() ? new JmsTemplate() : new JmsTemplate102();
- jmsTemplate.setConnectionFactory(jmsConfig.getConnectionFactory());
- jmsTemplate.setPubSubDomain(jmsConfig.isPubSubDomain());
- jmsTemplate.setReceiveTimeout(jmsConfig.getReceiveTimeout());
- jmsTemplate.setTimeToLive(jmsConfig.getTimeToLive());
- int priority = (headers != null && headers.isSetJMSPriority())
- ? headers.getJMSPriority() : jmsConfig.getPriority();
- jmsTemplate.setPriority(priority);
- int deliveryMode = (headers != null && headers.isSetJMSDeliveryMode()) ? headers
- .getJMSDeliveryMode() : jmsConfig.getDeliveryMode();
- jmsTemplate.setDeliveryMode(deliveryMode);
- jmsTemplate.setExplicitQosEnabled(jmsConfig.isExplicitQosEnabled());
- jmsTemplate.setSessionTransacted(jmsConfig.isSessionTransacted());
- if (jmsConfig.getDestinationResolver() != null) {
- jmsTemplate.setDestinationResolver(jmsConfig.getDestinationResolver());
- }
- return jmsTemplate;
- }
-
- /**
- * Create and start listener using configuration information from jmsConfig. Uses
- * resolveOrCreateDestination to determine the destination for the listener.
- *
- * @param jmsConfig configuration information
- * @param listenerHandler object to be called when a message arrives
- * @param destinationName null for temp dest or a destination name
- * @return
- */
- public static DefaultMessageListenerContainer createJmsListener(JMSConfiguration jmsConfig,
- MessageListener listenerHandler,
- String destinationName) {
- DefaultMessageListenerContainer jmsListener = jmsConfig.isUseJms11()
- ? new DefaultMessageListenerContainer() : new DefaultMessageListenerContainer102();
- jmsListener.setConcurrentConsumers(jmsConfig.getConcurrentConsumers());
- jmsListener.setMaxConcurrentConsumers(jmsConfig.getMaxConcurrentConsumers());
- jmsListener.setPubSubDomain(jmsConfig.isPubSubDomain());
- jmsListener.setAutoStartup(true);
- jmsListener.setConnectionFactory(jmsConfig.getConnectionFactory());
- jmsListener.setMessageSelector(jmsConfig.getMessageSelector());
- jmsListener.setDurableSubscriptionName(jmsConfig.getDurableSubscriptionName());
- jmsListener.setSessionTransacted(jmsConfig.isSessionTransacted());
- jmsListener.setTransactionManager(jmsConfig.getTransactionManager());
- jmsListener.setMessageListener(listenerHandler);
- if (jmsConfig.getDestinationResolver() != null) {
- jmsListener.setDestinationResolver(jmsConfig.getDestinationResolver());
- }
- if (jmsConfig.getTaskExecutor() != null) {
- jmsListener.setTaskExecutor(jmsConfig.getTaskExecutor());
- }
- JmsTemplate jmsTemplate = createJmsTemplate(jmsConfig, null);
- Destination dest = JMSFactory.resolveOrCreateDestination(jmsTemplate, destinationName, jmsConfig
- .isPubSubDomain());
- jmsListener.setDestination(dest);
- jmsListener.initialize();
- return jmsListener;
- }
-
- /**
- * If the destinationName given is null then a temporary destination is created else the destination name
- * is resolved using the resolver from the jmsConfig
- *
- * @param jmsTemplate template to use for session and resolver
- * @param replyToDestinationName null for temporary destination or a destination name
- * @param pubSubDomain true=pubSub, false=Queues
- * @return resolved destination
- */
- private static Destination resolveOrCreateDestination(final JmsTemplate jmsTemplate,
- final String replyToDestinationName,
- final boolean pubSubDomain) {
- return (Destination)jmsTemplate.execute(new SessionCallback() {
- public Object doInJms(Session session) throws JMSException {
- if (replyToDestinationName == null) {
- if (session instanceof QueueSession) {
- // For JMS 1.0.2
- return ((QueueSession)session).createTemporaryQueue();
- } else {
- // For JMS 1.1
- return session.createTemporaryQueue();
- }
- }
- DestinationResolver resolv = jmsTemplate.getDestinationResolver();
- return resolv.resolveDestinationName(session, replyToDestinationName, pubSubDomain);
- }
- });
- }
-
-}
+/**
+ * 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.cxf.transport.jms;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageListener;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+
+import org.springframework.jms.core.JmsTemplate;
+import org.springframework.jms.core.JmsTemplate102;
+import org.springframework.jms.core.SessionCallback;
+import org.springframework.jms.listener.DefaultMessageListenerContainer;
+import org.springframework.jms.listener.DefaultMessageListenerContainer102;
+import org.springframework.jms.support.destination.DestinationResolver;
+
+/**
+ * Factory to create JmsTemplates and JmsListeners from configuration and context information
+ */
+public final class JMSFactory {
+
+ private JMSFactory() {
+ }
+
+ /**
+ * Create JmsTemplate from configuration information. Most settings are taken from jmsConfig. The QoS
+ * settings in headers override the settings from jmsConfig
+ *
+ * @param jmsConfig configuration information
+ * @param headers context headers
+ * @return
+ */
+ public static JmsTemplate createJmsTemplate(JMSConfiguration jmsConfig, JMSMessageHeadersType headers) {
+ JmsTemplate jmsTemplate = jmsConfig.isUseJms11() ? new JmsTemplate() : new JmsTemplate102();
+ jmsTemplate.setConnectionFactory(jmsConfig.getConnectionFactory());
+ jmsTemplate.setPubSubDomain(jmsConfig.isPubSubDomain());
+ jmsTemplate.setReceiveTimeout(jmsConfig.getReceiveTimeout());
+ jmsTemplate.setTimeToLive(jmsConfig.getTimeToLive());
+ int priority = (headers != null && headers.isSetJMSPriority())
+ ? headers.getJMSPriority() : jmsConfig.getPriority();
+ jmsTemplate.setPriority(priority);
+ int deliveryMode = (headers != null && headers.isSetJMSDeliveryMode()) ? headers
+ .getJMSDeliveryMode() : jmsConfig.getDeliveryMode();
+ jmsTemplate.setDeliveryMode(deliveryMode);
+ jmsTemplate.setExplicitQosEnabled(jmsConfig.isExplicitQosEnabled());
+ jmsTemplate.setSessionTransacted(jmsConfig.isSessionTransacted());
+ if (jmsConfig.getDestinationResolver() != null) {
+ jmsTemplate.setDestinationResolver(jmsConfig.getDestinationResolver());
+ }
+ return jmsTemplate;
+ }
+
+ /**
+ * Create and start listener using configuration information from jmsConfig. Uses
+ * resolveOrCreateDestination to determine the destination for the listener.
+ *
+ * @param jmsConfig configuration information
+ * @param listenerHandler object to be called when a message arrives
+ * @param destinationName null for temp dest or a destination name
+ * @return
+ */
+ public static DefaultMessageListenerContainer createJmsListener(JMSConfiguration jmsConfig,
+ MessageListener listenerHandler,
+ String destinationName) {
+ DefaultMessageListenerContainer jmsListener = jmsConfig.isUseJms11()
+ ? new DefaultMessageListenerContainer() : new DefaultMessageListenerContainer102();
+ jmsListener.setConcurrentConsumers(jmsConfig.getConcurrentConsumers());
+ jmsListener.setMaxConcurrentConsumers(jmsConfig.getMaxConcurrentConsumers());
+ jmsListener.setPubSubDomain(jmsConfig.isPubSubDomain());
+ jmsListener.setAutoStartup(true);
+ jmsListener.setConnectionFactory(jmsConfig.getConnectionFactory());
+ jmsListener.setMessageSelector(jmsConfig.getMessageSelector());
+ jmsListener.setDurableSubscriptionName(jmsConfig.getDurableSubscriptionName());
+ jmsListener.setSessionTransacted(jmsConfig.isSessionTransacted());
+ jmsListener.setTransactionManager(jmsConfig.getTransactionManager());
+ jmsListener.setMessageListener(listenerHandler);
+ if (jmsConfig.getDestinationResolver() != null) {
+ jmsListener.setDestinationResolver(jmsConfig.getDestinationResolver());
+ }
+ if (jmsConfig.getTaskExecutor() != null) {
+ jmsListener.setTaskExecutor(jmsConfig.getTaskExecutor());
+ }
+ JmsTemplate jmsTemplate = createJmsTemplate(jmsConfig, null);
+ Destination dest = JMSFactory.resolveOrCreateDestination(jmsTemplate, destinationName, jmsConfig
+ .isPubSubDomain());
+ jmsListener.setDestination(dest);
+ jmsListener.initialize();
+ return jmsListener;
+ }
+
+ /**
+ * If the destinationName given is null then a temporary destination is created else the destination name
+ * is resolved using the resolver from the jmsConfig
+ *
+ * @param jmsTemplate template to use for session and resolver
+ * @param replyToDestinationName null for temporary destination or a destination name
+ * @param pubSubDomain true=pubSub, false=Queues
+ * @return resolved destination
+ */
+ private static Destination resolveOrCreateDestination(final JmsTemplate jmsTemplate,
+ final String replyToDestinationName,
+ final boolean pubSubDomain) {
+ return (Destination)jmsTemplate.execute(new SessionCallback() {
+ public Object doInJms(Session session) throws JMSException {
+ if (replyToDestinationName == null) {
+ if (session instanceof QueueSession) {
+ // For JMS 1.0.2
+ return ((QueueSession)session).createTemporaryQueue();
+ } else {
+ // For JMS 1.1
+ return session.createTemporaryQueue();
+ }
+ }
+ DestinationResolver resolv = jmsTemplate.getDestinationResolver();
+ return resolv.resolveDestinationName(session, replyToDestinationName, pubSubDomain);
+ }
+ });
+ }
+
+}
Propchange: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AbstractSpringServer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AbstractSpringServer.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AbstractSpringServer.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AbstractSpringServer.java Mon Dec 15 10:14:38 2008
@@ -1,95 +1,95 @@
-/**
- * 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.cxf.systest.jaxrs;
-
-import java.net.URISyntaxException;
-
-import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
-
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.handler.DefaultHandler;
-import org.mortbay.jetty.handler.HandlerCollection;
-import org.mortbay.jetty.nio.SelectChannelConnector;
-import org.mortbay.jetty.webapp.WebAppContext;
-
-public abstract class AbstractSpringServer extends AbstractBusTestServerBase {
-
- private org.mortbay.jetty.Server server;
- private String resourcePath;
- private String contextPath;
- private int port;
-
- protected AbstractSpringServer(String path) {
- this(path, "/", 9080);
- }
-
- protected AbstractSpringServer(String path, int portNumber) {
- this(path, "/", portNumber);
- }
-
- protected AbstractSpringServer(String path, String cPath, int portNumber) {
- resourcePath = path;
- contextPath = "/";
- port = portNumber;
- }
-
- protected void run() {
- System.out.println("Starting Server");
-
- server = new org.mortbay.jetty.Server();
-
- SelectChannelConnector connector = new SelectChannelConnector();
- connector.setPort(port);
- server.setConnectors(new Connector[] {connector});
-
- WebAppContext webappcontext = new WebAppContext();
- webappcontext.setContextPath(contextPath);
-
- String warPath = null;
- try {
- warPath = getClass().getResource(resourcePath).toURI().getPath();
- } catch (URISyntaxException e1) {
- e1.printStackTrace();
- }
-
- webappcontext.setWar(warPath);
-
- HandlerCollection handlers = new HandlerCollection();
- handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
-
- server.setHandler(handlers);
- try {
- server.start();
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- if (server != null) {
- server.stop();
- server.destroy();
- server = null;
- }
- }
-}
+/**
+ * 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.cxf.systest.jaxrs;
+
+import java.net.URISyntaxException;
+
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.handler.DefaultHandler;
+import org.mortbay.jetty.handler.HandlerCollection;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.webapp.WebAppContext;
+
+public abstract class AbstractSpringServer extends AbstractBusTestServerBase {
+
+ private org.mortbay.jetty.Server server;
+ private String resourcePath;
+ private String contextPath;
+ private int port;
+
+ protected AbstractSpringServer(String path) {
+ this(path, "/", 9080);
+ }
+
+ protected AbstractSpringServer(String path, int portNumber) {
+ this(path, "/", portNumber);
+ }
+
+ protected AbstractSpringServer(String path, String cPath, int portNumber) {
+ resourcePath = path;
+ contextPath = "/";
+ port = portNumber;
+ }
+
+ protected void run() {
+ System.out.println("Starting Server");
+
+ server = new org.mortbay.jetty.Server();
+
+ SelectChannelConnector connector = new SelectChannelConnector();
+ connector.setPort(port);
+ server.setConnectors(new Connector[] {connector});
+
+ WebAppContext webappcontext = new WebAppContext();
+ webappcontext.setContextPath(contextPath);
+
+ String warPath = null;
+ try {
+ warPath = getClass().getResource(resourcePath).toURI().getPath();
+ } catch (URISyntaxException e1) {
+ e1.printStackTrace();
+ }
+
+ webappcontext.setWar(warPath);
+
+ HandlerCollection handlers = new HandlerCollection();
+ handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
+
+ server.setHandler(handlers);
+ try {
+ server.start();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ if (server != null) {
+ server.stop();
+ server.destroy();
+ server = null;
+ }
+ }
+}
Propchange: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/AbstractSpringServer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java Mon Dec 15 10:14:38 2008
@@ -1,71 +1,71 @@
-/**
- * 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.cxf.systest.jaxrs.security;
-
-import java.io.InputStream;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.cxf.common.util.Base64Utility;
-import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.io.CachedOutputStream;
-import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
-
-public abstract class AbstractSpringSecurityTest extends AbstractBusClientServerTestBase {
-
- private String getStringFromInputStream(InputStream in) throws Exception {
- CachedOutputStream bos = new CachedOutputStream();
- IOUtils.copy(in, bos);
- in.close();
- bos.close();
- //System.out.println(bos.getOut().toString());
- return bos.getOut().toString();
- }
-
- private String base64Encode(String value) {
- return Base64Utility.encode(value.getBytes());
- }
-
- protected void getBook(String endpointAddress, String user, String password,
- int expectedStatus)
- throws Exception {
-
- GetMethod get = new GetMethod(endpointAddress);
- get.setRequestHeader("Accept", "application/xml");
- get.setRequestHeader("Authorization",
- "Basic " + base64Encode(user + ":" + password));
- HttpClient httpClient = new HttpClient();
- try {
- int result = httpClient.executeMethod(get);
- assertEquals(expectedStatus, result);
- if (expectedStatus == 200) {
- String content = getStringFromInputStream(get.getResponseBodyAsStream());
- String resource = "/org/apache/cxf/systest/jaxrs/resources/expected_get_book123.txt";
- InputStream expected = getClass().getResourceAsStream(resource);
- assertEquals("Expected value is wrong",
- getStringFromInputStream(expected), content);
- }
- } finally {
- get.releaseConnection();
- }
-
- }
-
-}
+/**
+ * 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.cxf.systest.jaxrs.security;
+
+import java.io.InputStream;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.cxf.common.util.Base64Utility;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.io.CachedOutputStream;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
+public abstract class AbstractSpringSecurityTest extends AbstractBusClientServerTestBase {
+
+ private String getStringFromInputStream(InputStream in) throws Exception {
+ CachedOutputStream bos = new CachedOutputStream();
+ IOUtils.copy(in, bos);
+ in.close();
+ bos.close();
+ //System.out.println(bos.getOut().toString());
+ return bos.getOut().toString();
+ }
+
+ private String base64Encode(String value) {
+ return Base64Utility.encode(value.getBytes());
+ }
+
+ protected void getBook(String endpointAddress, String user, String password,
+ int expectedStatus)
+ throws Exception {
+
+ GetMethod get = new GetMethod(endpointAddress);
+ get.setRequestHeader("Accept", "application/xml");
+ get.setRequestHeader("Authorization",
+ "Basic " + base64Encode(user + ":" + password));
+ HttpClient httpClient = new HttpClient();
+ try {
+ int result = httpClient.executeMethod(get);
+ assertEquals(expectedStatus, result);
+ if (expectedStatus == 200) {
+ String content = getStringFromInputStream(get.getResponseBodyAsStream());
+ String resource = "/org/apache/cxf/systest/jaxrs/resources/expected_get_book123.txt";
+ InputStream expected = getClass().getResourceAsStream(resource);
+ assertEquals("Expected value is wrong",
+ getStringFromInputStream(expected), content);
+ }
+ } finally {
+ get.releaseConnection();
+ }
+
+ }
+
+}
Propchange: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/AbstractSpringSecurityTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringClass.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringClass.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringClass.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringClass.java Mon Dec 15 10:14:38 2008
@@ -1,44 +1,44 @@
-/**
- * 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.cxf.systest.jaxrs.security;
-
-import org.apache.cxf.systest.jaxrs.AbstractSpringServer;
-
-
-
-public class BookServerSecuritySpringClass extends AbstractSpringServer {
-
- public BookServerSecuritySpringClass() {
- super("/jaxrs_security");
- }
-
- public static void main(String args[]) {
- try {
- BookServerSecuritySpringClass s = new BookServerSecuritySpringClass();
- s.start();
- } catch (Exception ex) {
- ex.printStackTrace();
- System.exit(-1);
- } finally {
- System.out.println("done!");
- }
- }
-
-}
+/**
+ * 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.cxf.systest.jaxrs.security;
+
+import org.apache.cxf.systest.jaxrs.AbstractSpringServer;
+
+
+
+public class BookServerSecuritySpringClass extends AbstractSpringServer {
+
+ public BookServerSecuritySpringClass() {
+ super("/jaxrs_security");
+ }
+
+ public static void main(String args[]) {
+ try {
+ BookServerSecuritySpringClass s = new BookServerSecuritySpringClass();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ } finally {
+ System.out.println("done!");
+ }
+ }
+
+}
Propchange: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringClass.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringInterface.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringInterface.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringInterface.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringInterface.java Mon Dec 15 10:14:38 2008
@@ -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.cxf.systest.jaxrs.security;
-
-import org.apache.cxf.systest.jaxrs.AbstractSpringServer;
-
-
-public class BookServerSecuritySpringInterface extends AbstractSpringServer {
-
- public BookServerSecuritySpringInterface() {
- super("/jaxrs_security_cglib");
- }
-
- public static void main(String args[]) {
- try {
- BookServerSecuritySpringInterface s = new BookServerSecuritySpringInterface();
- s.start();
- } catch (Exception ex) {
- ex.printStackTrace();
- System.exit(-1);
- } finally {
- System.out.println("done!");
- }
- }
-
-}
+/**
+ * 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.cxf.systest.jaxrs.security;
+
+import org.apache.cxf.systest.jaxrs.AbstractSpringServer;
+
+
+public class BookServerSecuritySpringInterface extends AbstractSpringServer {
+
+ public BookServerSecuritySpringInterface() {
+ super("/jaxrs_security_cglib");
+ }
+
+ public static void main(String args[]) {
+ try {
+ BookServerSecuritySpringInterface s = new BookServerSecuritySpringInterface();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ } finally {
+ System.out.println("done!");
+ }
+ }
+
+}
Propchange: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringInterface.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringNoAnnotations.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringNoAnnotations.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringNoAnnotations.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringNoAnnotations.java Mon Dec 15 10:14:38 2008
@@ -1,44 +1,44 @@
-/**
- * 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.cxf.systest.jaxrs.security;
-
-import org.apache.cxf.systest.jaxrs.AbstractSpringServer;
-
-
-
-public class BookServerSecuritySpringNoAnnotations extends AbstractSpringServer {
-
- public BookServerSecuritySpringNoAnnotations() {
- super("/jaxrs_security_no_annotations");
- }
-
- public static void main(String args[]) {
- try {
- BookServerSecuritySpringNoAnnotations s = new BookServerSecuritySpringNoAnnotations();
- s.start();
- } catch (Exception ex) {
- ex.printStackTrace();
- System.exit(-1);
- } finally {
- System.out.println("done!");
- }
- }
-
-}
+/**
+ * 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.cxf.systest.jaxrs.security;
+
+import org.apache.cxf.systest.jaxrs.AbstractSpringServer;
+
+
+
+public class BookServerSecuritySpringNoAnnotations extends AbstractSpringServer {
+
+ public BookServerSecuritySpringNoAnnotations() {
+ super("/jaxrs_security_no_annotations");
+ }
+
+ public static void main(String args[]) {
+ try {
+ BookServerSecuritySpringNoAnnotations s = new BookServerSecuritySpringNoAnnotations();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ } finally {
+ System.out.println("done!");
+ }
+ }
+
+}
Propchange: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/BookServerSecuritySpringNoAnnotations.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java Mon Dec 15 10:14:38 2008
@@ -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.cxf.systest.jaxrs.security;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class JAXRSSpringSecurityClassTest extends AbstractSpringSecurityTest {
-
- @BeforeClass
- public static void startServers() throws Exception {
- assertTrue("server did not launch correctly",
- launchServer(BookServerSecuritySpringClass.class));
- }
-
- @Test
- public void testFailedAuthentication() throws Exception {
- String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123";
- getBook(endpointAddress, "foo", "ba", 401);
- }
-
- @Test
- public void testGetBookUserAdmin() throws Exception {
- String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123";
- getBook(endpointAddress, "foo", "bar", 200);
- getBook(endpointAddress, "bob", "bobspassword", 200);
- }
-
-
- @Test
- public void testGetBookUser() throws Exception {
- String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123/123";
- getBook(endpointAddress, "foo", "bar", 200);
- getBook(endpointAddress, "bob", "bobspassword", 200);
- }
-
- @Test
- public void testGetBookAdmin() throws Exception {
- String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks";
- getBook(endpointAddress, "foo", "bar", 200);
- getBook(endpointAddress, "bob", "bobspassword", 403);
- }
-
-
-}
+/**
+ * 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.cxf.systest.jaxrs.security;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JAXRSSpringSecurityClassTest extends AbstractSpringSecurityTest {
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ assertTrue("server did not launch correctly",
+ launchServer(BookServerSecuritySpringClass.class));
+ }
+
+ @Test
+ public void testFailedAuthentication() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks/123";
+ getBook(endpointAddress, "foo", "ba", 401);
+ }
+
+ @Test
+ public void testGetBookUserAdmin() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks/123";
+ getBook(endpointAddress, "foo", "bar", 200);
+ getBook(endpointAddress, "bob", "bobspassword", 200);
+ }
+
+
+ @Test
+ public void testGetBookUser() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks/123/123";
+ getBook(endpointAddress, "foo", "bar", 200);
+ getBook(endpointAddress, "bob", "bobspassword", 200);
+ }
+
+ @Test
+ public void testGetBookAdmin() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks";
+ getBook(endpointAddress, "foo", "bar", 200);
+ getBook(endpointAddress, "bob", "bobspassword", 403);
+ }
+
+
+}
Propchange: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java Mon Dec 15 10:14:38 2008
@@ -1,65 +1,65 @@
-/**
- * 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.cxf.systest.jaxrs.security;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class JAXRSSpringSecurityInterfaceTest extends AbstractSpringSecurityTest {
-
- @BeforeClass
- public static void startServers() throws Exception {
- assertTrue("server did not launch correctly",
- launchServer(BookServerSecuritySpringInterface.class));
- }
-
- @Test
- public void testFailedAuthentication() throws Exception {
- String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123";
- getBook(endpointAddress, "foo", "ba", 401);
- }
-
- @Test
- public void testGetBookUserAdmin() throws Exception {
- String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123";
- getBook(endpointAddress, "foo", "bar", 200);
- getBook(endpointAddress, "bob", "bobspassword", 200);
- }
-
- @Test
- public void testGetBookUser() throws Exception {
- String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123/123";
- getBook(endpointAddress, "foo", "bar", 200);
- getBook(endpointAddress, "bob", "bobspassword", 200);
- }
-
- @Test
- public void testGetBookAdmin() throws Exception {
- String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks";
- getBook(endpointAddress, "foo", "bar", 200);
- getBook(endpointAddress, "bob", "bobspassword", 403);
- }
-
-
-}
+/**
+ * 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.cxf.systest.jaxrs.security;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JAXRSSpringSecurityInterfaceTest extends AbstractSpringSecurityTest {
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ assertTrue("server did not launch correctly",
+ launchServer(BookServerSecuritySpringInterface.class));
+ }
+
+ @Test
+ public void testFailedAuthentication() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks/123";
+ getBook(endpointAddress, "foo", "ba", 401);
+ }
+
+ @Test
+ public void testGetBookUserAdmin() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks/123";
+ getBook(endpointAddress, "foo", "bar", 200);
+ getBook(endpointAddress, "bob", "bobspassword", 200);
+ }
+
+ @Test
+ public void testGetBookUser() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks/123/123";
+ getBook(endpointAddress, "foo", "bar", 200);
+ getBook(endpointAddress, "bob", "bobspassword", 200);
+ }
+
+ @Test
+ public void testGetBookAdmin() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks";
+ getBook(endpointAddress, "foo", "bar", 200);
+ getBook(endpointAddress, "bob", "bobspassword", 403);
+ }
+
+
+}
Propchange: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityNoAnnotationsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityNoAnnotationsTest.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityNoAnnotationsTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityNoAnnotationsTest.java Mon Dec 15 10:14:38 2008
@@ -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.cxf.systest.jaxrs.security;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class JAXRSSpringSecurityNoAnnotationsTest extends AbstractSpringSecurityTest {
-
- @BeforeClass
- public static void startServers() throws Exception {
- assertTrue("server did not launch correctly",
- launchServer(BookServerSecuritySpringNoAnnotations.class));
- }
-
- @Test
- public void testFailedAuthentication() throws Exception {
- String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123";
- getBook(endpointAddress, "foo", "ba", 401);
- }
-
- @Test
- public void testGetBookUserAdmin() throws Exception {
- String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123";
- getBook(endpointAddress, "foo", "bar", 200);
- getBook(endpointAddress, "bob", "bobspassword", 200);
- }
-
-
- @Test
- public void testGetBookUser() throws Exception {
- String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123/123";
- getBook(endpointAddress, "foo", "bar", 200);
- getBook(endpointAddress, "bob", "bobspassword", 200);
- }
-
- @Test
- public void testGetBookAdmin() throws Exception {
- String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks";
- getBook(endpointAddress, "foo", "bar", 200);
- getBook(endpointAddress, "bob", "bobspassword", 403);
- }
-
-
-}
+/**
+ * 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.cxf.systest.jaxrs.security;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JAXRSSpringSecurityNoAnnotationsTest extends AbstractSpringSecurityTest {
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ assertTrue("server did not launch correctly",
+ launchServer(BookServerSecuritySpringNoAnnotations.class));
+ }
+
+ @Test
+ public void testFailedAuthentication() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks/123";
+ getBook(endpointAddress, "foo", "ba", 401);
+ }
+
+ @Test
+ public void testGetBookUserAdmin() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks/123";
+ getBook(endpointAddress, "foo", "bar", 200);
+ getBook(endpointAddress, "bob", "bobspassword", 200);
+ }
+
+
+ @Test
+ public void testGetBookUser() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks/123/123";
+ getBook(endpointAddress, "foo", "bar", 200);
+ getBook(endpointAddress, "bob", "bobspassword", 200);
+ }
+
+ @Test
+ public void testGetBookAdmin() throws Exception {
+ String endpointAddress =
+ "http://localhost:9080/bookstorestorage/thosebooks";
+ getBook(endpointAddress, "foo", "bar", 200);
+ getBook(endpointAddress, "bob", "bobspassword", 403);
+ }
+
+
+}
Propchange: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityNoAnnotationsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java Mon Dec 15 10:14:38 2008
@@ -1,52 +1,52 @@
-/**
- * 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.cxf.systest.jaxrs.security;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.ProduceMime;
-
-import org.apache.cxf.systest.jaxrs.Book;
-import org.apache.cxf.systest.jaxrs.BookNotFoundFault;
-import org.springframework.security.annotation.Secured;
-
-public interface SecureBookInterface {
-
- @GET
- @Path("/thosebooks/{bookId}/")
- @ProduceMime("application/xml")
- @Secured({"ROLE_USER", "ROLE_ADMIN" })
- Book getThatBook(@PathParam("bookId") Long id) throws BookNotFoundFault;
-
-
- @GET
- @Path("/thosebooks/{bookId}/{id}")
- @ProduceMime("application/xml")
- @Secured("ROLE_USER")
- Book getThatBook(@PathParam("bookId") Long id, @PathParam("id") String s) throws BookNotFoundFault;
-
- @GET
- @Path("/thosebooks")
- @ProduceMime("application/xml")
- @Secured("ROLE_ADMIN")
- Book getThatBook() throws BookNotFoundFault;
-
-}
+/**
+ * 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.cxf.systest.jaxrs.security;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.ProduceMime;
+
+import org.apache.cxf.systest.jaxrs.Book;
+import org.apache.cxf.systest.jaxrs.BookNotFoundFault;
+import org.springframework.security.annotation.Secured;
+
+public interface SecureBookInterface {
+
+ @GET
+ @Path("/thosebooks/{bookId}/")
+ @ProduceMime("application/xml")
+ @Secured({"ROLE_USER", "ROLE_ADMIN" })
+ Book getThatBook(@PathParam("bookId") Long id) throws BookNotFoundFault;
+
+
+ @GET
+ @Path("/thosebooks/{bookId}/{id}")
+ @ProduceMime("application/xml")
+ @Secured("ROLE_USER")
+ Book getThatBook(@PathParam("bookId") Long id, @PathParam("id") String s) throws BookNotFoundFault;
+
+ @GET
+ @Path("/thosebooks")
+ @ProduceMime("application/xml")
+ @Secured("ROLE_ADMIN")
+ Book getThatBook() throws BookNotFoundFault;
+
+}
Propchange: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStore.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStore.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStore.java Mon Dec 15 10:14:38 2008
@@ -1,55 +1,55 @@
-/**
- * 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.cxf.systest.jaxrs.security;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.Path;
-
-import org.apache.cxf.systest.jaxrs.Book;
-import org.apache.cxf.systest.jaxrs.BookNotFoundFault;
-
-@Path("/bookstorestorage/")
-public class SecureBookStore implements SecureBookInterface {
- private Map<Long, Book> books = new HashMap<Long, Book>();
-
- public SecureBookStore() {
- Book book = new Book();
- book.setId(123L);
- book.setName("CXF in Action");
- books.put(book.getId(), book);
- }
-
- public Book getThatBook(Long id) {
- return books.get(id);
- }
-
- public Book getThatBook(Long id, String s) {
- if (s == null) {
- throw new RuntimeException();
- }
- return books.get(id);
- }
-
- public Book getThatBook() throws BookNotFoundFault {
- return books.get(123L);
- }
-}
+/**
+ * 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.cxf.systest.jaxrs.security;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.Path;
+
+import org.apache.cxf.systest.jaxrs.Book;
+import org.apache.cxf.systest.jaxrs.BookNotFoundFault;
+
+@Path("/bookstorestorage/")
+public class SecureBookStore implements SecureBookInterface {
+ private Map<Long, Book> books = new HashMap<Long, Book>();
+
+ public SecureBookStore() {
+ Book book = new Book();
+ book.setId(123L);
+ book.setName("CXF in Action");
+ books.put(book.getId(), book);
+ }
+
+ public Book getThatBook(Long id) {
+ return books.get(id);
+ }
+
+ public Book getThatBook(Long id, String s) {
+ if (s == null) {
+ throw new RuntimeException();
+ }
+ return books.get(id);
+ }
+
+ public Book getThatBook() throws BookNotFoundFault {
+ return books.get(123L);
+ }
+}
Propchange: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStore.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoAnnotations.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoAnnotations.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoAnnotations.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoAnnotations.java Mon Dec 15 10:14:38 2008
@@ -1,56 +1,56 @@
-/**
- * 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.cxf.systest.jaxrs.security;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.Path;
-
-import org.apache.cxf.systest.jaxrs.Book;
-import org.apache.cxf.systest.jaxrs.BookInterface;
-import org.apache.cxf.systest.jaxrs.BookNotFoundFault;
-
-@Path("/bookstorestorage/")
-public class SecureBookStoreNoAnnotations implements BookInterface {
- private Map<Long, Book> books = new HashMap<Long, Book>();
-
- public SecureBookStoreNoAnnotations() {
- Book book = new Book();
- book.setId(123L);
- book.setName("CXF in Action");
- books.put(book.getId(), book);
- }
-
- public Book getThatBook(Long id) {
- return books.get(id);
- }
-
- public Book getThatBook(Long id, String s) {
- if (s == null) {
- throw new RuntimeException();
- }
- return books.get(id);
- }
-
- public Book getThatBook() throws BookNotFoundFault {
- return books.get(123L);
- }
-}
+/**
+ * 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.cxf.systest.jaxrs.security;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.Path;
+
+import org.apache.cxf.systest.jaxrs.Book;
+import org.apache.cxf.systest.jaxrs.BookInterface;
+import org.apache.cxf.systest.jaxrs.BookNotFoundFault;
+
+@Path("/bookstorestorage/")
+public class SecureBookStoreNoAnnotations implements BookInterface {
+ private Map<Long, Book> books = new HashMap<Long, Book>();
+
+ public SecureBookStoreNoAnnotations() {
+ Book book = new Book();
+ book.setId(123L);
+ book.setName("CXF in Action");
+ books.put(book.getId(), book);
+ }
+
+ public Book getThatBook(Long id) {
+ return books.get(id);
+ }
+
+ public Book getThatBook(Long id, String s) {
+ if (s == null) {
+ throw new RuntimeException();
+ }
+ return books.get(id);
+ }
+
+ public Book getThatBook() throws BookNotFoundFault {
+ return books.get(123L);
+ }
+}
Propchange: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoAnnotations.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java Mon Dec 15 10:14:38 2008
@@ -1,71 +1,71 @@
-/**
- * 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.cxf.systest.jaxrs.security;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.ProduceMime;
-
-import org.apache.cxf.systest.jaxrs.Book;
-import org.apache.cxf.systest.jaxrs.BookNotFoundFault;
-import org.springframework.security.annotation.Secured;
-
-@Path("/bookstorestorage/")
-public class SecureBookStoreNoInterface {
- private Map<Long, Book> books = new HashMap<Long, Book>();
-
- public SecureBookStoreNoInterface() {
- Book book = new Book();
- book.setId(123L);
- book.setName("CXF in Action");
- books.put(book.getId(), book);
- }
-
- @GET
- @Path("/thosebooks/{bookId}/{id}")
- @ProduceMime("application/xml")
- @Secured({"ROLE_USER", "ROLE_ADMIN" })
- public Book getThatBook(@PathParam("bookId") Long id, @PathParam("id") String s) {
- if (s == null) {
- throw new RuntimeException();
- }
- return books.get(id);
- }
-
- @GET
- @Path("/thosebooks/{bookId}/")
- @ProduceMime("application/xml")
- @Secured("ROLE_USER")
- public Book getThatBook(@PathParam("bookId") Long id) {
- return books.get(id);
- }
-
- @GET
- @Path("/thosebooks")
- @ProduceMime("application/xml")
- @Secured("ROLE_ADMIN")
- public Book getThatBook() throws BookNotFoundFault {
- return books.get(123L);
- }
-}
+/**
+ * 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.cxf.systest.jaxrs.security;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.ProduceMime;
+
+import org.apache.cxf.systest.jaxrs.Book;
+import org.apache.cxf.systest.jaxrs.BookNotFoundFault;
+import org.springframework.security.annotation.Secured;
+
+@Path("/bookstorestorage/")
+public class SecureBookStoreNoInterface {
+ private Map<Long, Book> books = new HashMap<Long, Book>();
+
+ public SecureBookStoreNoInterface() {
+ Book book = new Book();
+ book.setId(123L);
+ book.setName("CXF in Action");
+ books.put(book.getId(), book);
+ }
+
+ @GET
+ @Path("/thosebooks/{bookId}/{id}")
+ @ProduceMime("application/xml")
+ @Secured({"ROLE_USER", "ROLE_ADMIN" })
+ public Book getThatBook(@PathParam("bookId") Long id, @PathParam("id") String s) {
+ if (s == null) {
+ throw new RuntimeException();
+ }
+ return books.get(id);
+ }
+
+ @GET
+ @Path("/thosebooks/{bookId}/")
+ @ProduceMime("application/xml")
+ @Secured("ROLE_USER")
+ public Book getThatBook(@PathParam("bookId") Long id) {
+ return books.get(id);
+ }
+
+ @GET
+ @Path("/thosebooks")
+ @ProduceMime("application/xml")
+ @Secured("ROLE_ADMIN")
+ public Book getThatBook() throws BookNotFoundFault {
+ return books.get(123L);
+ }
+}
Propchange: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecurityExceptionMapper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecurityExceptionMapper.java?rev=726753&r1=726752&r2=726753&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecurityExceptionMapper.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecurityExceptionMapper.java Mon Dec 15 10:14:38 2008
@@ -1,33 +1,33 @@
-/**
- * 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.cxf.systest.jaxrs.security;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-
-import org.springframework.security.AccessDeniedException;
-
-public class SecurityExceptionMapper implements ExceptionMapper<AccessDeniedException> {
-
- public Response toResponse(AccessDeniedException exception) {
- return Response.status(Response.Status.FORBIDDEN).build();
- }
-
-}
+/**
+ * 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.cxf.systest.jaxrs.security;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+
+import org.springframework.security.AccessDeniedException;
+
+public class SecurityExceptionMapper implements ExceptionMapper<AccessDeniedException> {
+
+ public Response toResponse(AccessDeniedException exception) {
+ return Response.status(Response.Status.FORBIDDEN).build();
+ }
+
+}
Propchange: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecurityExceptionMapper.java
------------------------------------------------------------------------------
svn:eol-style = native