You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ch...@apache.org on 2007/09/17 19:00:16 UTC
svn commit: r576522 [3/3] - in /activemq/camel/trunk/components/camel-cxf:
./ src/main/java/org/apache/camel/component/cxf/
src/main/java/org/apache/camel/component/cxf/interceptors/
src/main/java/org/apache/camel/component/cxf/invoker/ src/main/java/o...
Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/FaultPayloadPhaseManagerImpl.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/FaultPayloadPhaseManagerImpl.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/FaultPayloadPhaseManagerImpl.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/FaultPayloadPhaseManagerImpl.java Mon Sep 17 10:00:08 2007
@@ -0,0 +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.camel.component.cxf.phase;
+import java.util.SortedSet;
+import org.apache.cxf.common.util.SortedArraySet;
+
+
+import org.apache.cxf.phase.Phase;
+
+public class FaultPayloadPhaseManagerImpl extends AbstractPhaseManagerImpl {
+
+ protected SortedSet<Phase> createInPhases() {
+
+ SortedSet<Phase> inPhases = new SortedArraySet<Phase>();
+
+ int i = 0;
+
+ inPhases.add(new Phase(Phase.RECEIVE, ++i * 1000));
+
+ inPhases.add(new Phase(Phase.PRE_STREAM, ++i * 1000));
+ inPhases.add(new Phase(Phase.USER_STREAM, ++i * 1000));
+ inPhases.add(new Phase(Phase.POST_STREAM, ++i * 1000));
+
+ inPhases.add(new Phase(Phase.READ, ++i * 1000));
+
+ inPhases.add(new Phase(Phase.PRE_PROTOCOL, ++i * 1000));
+ inPhases.add(new Phase(Phase.USER_PROTOCOL, ++i * 1000));
+ inPhases.add(new Phase(Phase.POST_PROTOCOL, ++i * 1000));
+
+ inPhases.add(new Phase(Phase.UNMARSHAL, ++i * 1000));
+ return inPhases;
+ }
+
+ protected SortedSet<Phase> createOutPhases() {
+ SortedSet<Phase> outPhases = new SortedArraySet<Phase>();
+
+ int i = 0;
+ outPhases.add(new Phase(Phase.PREPARE_SEND, ++i * 1000));
+ outPhases.add(new Phase(Phase.PRE_STREAM, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.PRE_PROTOCOL, ++i * 1000));
+ outPhases.add(new Phase(Phase.USER_PROTOCOL, ++i * 1000));
+ outPhases.add(new Phase(Phase.POST_PROTOCOL, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.WRITE, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.MARSHAL, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.USER_STREAM, ++i * 1000));
+ outPhases.add(new Phase(Phase.POST_STREAM, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.SEND, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.SEND_ENDING, ++i * 1000));
+ outPhases.add(new Phase(Phase.POST_STREAM_ENDING, ++i * 1000));
+ outPhases.add(new Phase(Phase.USER_STREAM_ENDING, ++i * 1000));
+ outPhases.add(new Phase(Phase.POST_PROTOCOL_ENDING, ++i * 1000));
+ outPhases.add(new Phase(Phase.USER_PROTOCOL_ENDING, ++i * 1000));
+ outPhases.add(new Phase(Phase.WRITE_ENDING, ++i * 1000));
+ outPhases.add(new Phase(Phase.PRE_PROTOCOL_ENDING, ++i * 1000));
+ outPhases.add(new Phase(Phase.PRE_STREAM_ENDING, ++i * 1000));
+ outPhases.add(new Phase(Phase.PREPARE_SEND_ENDING, ++i * 1000));
+
+ return outPhases;
+ }
+
+}
+
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/FaultPayloadPhaseManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/FaultPayloadPhaseManagerImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImpl.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImpl.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImpl.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImpl.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,83 @@
+/**
+ * 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.camel.component.cxf.phase;
+
+
+import java.util.SortedSet;
+
+import org.apache.cxf.common.util.SortedArraySet;
+import org.apache.cxf.phase.Phase;
+
+public class PayloadPhaseManagerImpl extends AbstractPhaseManagerImpl {
+
+ protected SortedSet<Phase> createInPhases() {
+ SortedSet<Phase> inPhases = new SortedArraySet<Phase>();
+
+ int i = 0;
+ inPhases.add(new Phase(Phase.RECEIVE, ++i * 1000));
+
+ inPhases.add(new Phase(Phase.PRE_STREAM, ++i * 1000));
+ inPhases.add(new Phase(Phase.USER_STREAM, ++i * 1000));
+ inPhases.add(new Phase(Phase.POST_STREAM, ++i * 1000));
+
+ inPhases.add(new Phase(Phase.PRE_PROTOCOL, ++i * 1000));
+ inPhases.add(new Phase(Phase.USER_PROTOCOL, ++i * 1000));
+ inPhases.add(new Phase(Phase.POST_PROTOCOL, ++i * 1000));
+
+ inPhases.add(new Phase(Phase.READ, ++i * 1000));
+
+ return inPhases;
+ }
+
+ protected SortedSet<Phase> createOutPhases() {
+ SortedSet<Phase> outPhases = new SortedArraySet<Phase>();
+
+ int i = 0;
+ outPhases.add(new Phase(Phase.PREPARE_SEND, ++i * 1000));
+ outPhases.add(new Phase(Phase.PRE_STREAM, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.PRE_PROTOCOL, ++i * 1000));
+ outPhases.add(new Phase(Phase.USER_PROTOCOL, ++i * 1000));
+ outPhases.add(new Phase(Phase.POST_PROTOCOL, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.WRITE, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.USER_STREAM, ++i * 1000));
+ outPhases.add(new Phase(Phase.POST_STREAM, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.SEND, ++i * 1000));
+ outPhases.add(new Phase(Phase.SEND_ENDING, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.POST_STREAM_ENDING, ++i * 1000));
+ outPhases.add(new Phase(Phase.USER_STREAM_ENDING, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.POST_PROTOCOL_ENDING, ++i * 1000));
+ outPhases.add(new Phase(Phase.USER_PROTOCOL_ENDING, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.WRITE_ENDING, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.PRE_PROTOCOL_ENDING, ++i * 1000));
+ outPhases.add(new Phase(Phase.PRE_STREAM_ENDING, ++i * 1000));
+
+ outPhases.add(new Phase(Phase.PREPARE_SEND_ENDING, ++i * 1000));
+
+
+ return outPhases;
+ }
+
+}
+
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImpl.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImpl.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImpl.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImpl.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,48 @@
+/**
+ * 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.camel.component.cxf.phase;
+
+
+import java.util.SortedSet;
+import org.apache.cxf.common.util.SortedArraySet;
+import org.apache.cxf.phase.Phase;
+
+public class RawMessagePhaseManagerImpl extends AbstractPhaseManagerImpl {
+
+ protected SortedSet<Phase> createInPhases() {
+ SortedSet<Phase> inPhases = new SortedArraySet<Phase>();
+
+ int i = 0;
+
+ inPhases.add(new Phase(Phase.RECEIVE, ++i * 1000));
+
+ return inPhases;
+ }
+
+ protected SortedSet<Phase> createOutPhases() {
+ SortedSet<Phase> outPhases = new SortedArraySet<Phase>();
+
+ int i = 0;
+ outPhases.add(new Phase(Phase.PREPARE_SEND, ++i * 1000));
+ outPhases.add(new Phase(Phase.WRITE, ++i * 1000));
+ outPhases.add(new Phase(Phase.SEND, ++i * 1000));
+ outPhases.add(new Phase(Phase.PREPARE_SEND_ENDING, ++i * 1000));
+
+ return outPhases;
+ }
+}
+
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/package.html
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/package.html?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/package.html (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/package.html Mon Sep 17 10:00:08 2007
@@ -0,0 +1,25 @@
+<!--
+ 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.
+-->
+<html>
+<head>
+</head>
+<body>
+
+Defines the CXF Component's phase
+
+</body>
+</html>
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/package.html
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/package.html
------------------------------------------------------------------------------
svn:mime-type = text/html
Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,205 @@
+/**
+ * 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.camel.component.cxf.util;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.logging.Logger;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+
+import org.apache.camel.CamelException;
+import org.apache.camel.component.cxf.CxfEndpoint;
+import org.apache.camel.component.cxf.CxfMessage;
+import org.apache.camel.component.cxf.DataFormat;
+
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.frontend.ClientFactoryBean;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.jaxws.JaxWsClientFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.factory.AbstractServiceFactoryBean;
+import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.wsdl11.WSDLServiceFactory;
+
+
+public final class CxfEndpointUtils {
+ public static final String PROP_NAME_PORT = "port";
+ public static final String PROP_NAME_SERVICE = "service";
+ public static final String PROP_NAME_SERVICECLASS = "serviceClass";
+ public static final String PROP_NAME_DATAFORMAT = "dataFormat";
+ public static final String DATAFORMAT_POJO = "pojo";
+ public static final String DATAFORMAT_MESSAGE = "message";
+ public static final String DATAFORMAT_PAYLOAD = "payload";
+ private static final Logger LOG = LogUtils.getL7dLogger(CxfEndpointUtils.class);
+
+ private CxfEndpointUtils() {
+ // not constructed
+ }
+
+ public static QName getQName(final String name) {
+ QName qName = null;
+ if (name != null) {
+ try {
+ qName = QName.valueOf(name);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ return qName;
+ }
+
+ public static String getServiceName(final CxfEndpoint endpoint) {
+ return endpoint.getServiceName();
+ }
+
+ public static EndpointInfo getEndpointInfo(final Service service, final CxfEndpoint endpoint) {
+ EndpointInfo endpointInfo = null;
+ final java.util.Collection<EndpointInfo> endpoints = service.getServiceInfos().get(0).getEndpoints();
+ if (endpoints.size() == 1) {
+ endpointInfo = endpoints.iterator().next();
+ } else {
+ final String port = endpoint.getPortName();
+ if (port != null) {
+ final QName endpointName = QName.valueOf(port);
+ endpointInfo = service.getServiceInfos().get(0).getEndpoint(endpointName);
+ }
+ //TBD may be delegate to the EndpointUri params.
+ }
+
+ return endpointInfo;
+ }
+
+ public static boolean hasWebServiceAnnotation(Class<?> cls) {
+ if (cls == null) {
+ return false;
+ }
+ if (null != cls.getAnnotation(WebService.class)) {
+ return true;
+ }
+ for (Class<?> inf : cls.getInterfaces()) {
+ if (null != inf.getAnnotation(WebService.class)) {
+ return true;
+ }
+ }
+
+ return hasWebServiceAnnotation(cls.getSuperclass());
+ }
+
+ public static ServerFactoryBean getServerFactoryBean(Class<?> cls) throws CamelException {
+
+ try {
+ boolean isJSR181SEnabled = CxfEndpointUtils.hasWebServiceAnnotation(cls);
+ ServerFactoryBean serverFactory = isJSR181SEnabled ? new JaxWsServerFactoryBean()
+ : new ServerFactoryBean();
+ return serverFactory;
+ } catch (Exception e) {
+ throw new CamelException(e);
+ }
+
+ }
+
+ public static ClientFactoryBean getClientFactoryBean(Class<?> cls) throws CamelException {
+ try {
+ boolean isJSR181SEnabled = CxfEndpointUtils.hasWebServiceAnnotation(cls);
+ ClientFactoryBean clientFactory = isJSR181SEnabled ? new JaxWsClientFactoryBean()
+ : new ClientFactoryBean();
+ return clientFactory;
+ } catch (Exception e) {
+ throw new CamelException(e);
+ }
+ }
+
+ //TODO check the CxfEndpoint information integration
+ public static void checkEndpiontIntegration(CxfEndpoint endpoint, Bus bus) throws CamelException {
+
+ String wsdlLocation = endpoint.getWsdlURL();
+ QName serviceQName = CxfEndpointUtils.getQName(endpoint.getServiceName());
+ String serviceClassName = endpoint.getServiceClass();
+ DataFormat dataFormat = CxfEndpointUtils.getDataFormat(endpoint);
+ URL wsdlUrl = null;
+ if (wsdlLocation != null) {
+ try {
+ wsdlUrl = UriUtils.getWsdlUrl(new URI(wsdlLocation));
+ } catch (Exception e) {
+ throw new CamelException(e);
+ }
+ }
+ if (serviceQName == null) {
+ throw new CamelException(new Message("SVC_QNAME_NOT_FOUND_X", LOG, endpoint.getServiceName()).toString());
+ }
+
+ if (serviceClassName == null && dataFormat == DataFormat.POJO) {
+ throw new CamelException(new Message("SVC_CLASS_PROP_IS_REQUIRED_X", LOG).toString());
+ }
+ AbstractServiceFactoryBean serviceFactory = null;
+ try {
+
+ if (serviceClassName != null) {
+ Class<?> cls = ClassLoaderUtils.loadClass(serviceClassName, CxfEndpointUtils.class);
+
+ boolean isJSR181SEnabled = CxfEndpointUtils.hasWebServiceAnnotation(cls);
+
+ serviceFactory = isJSR181SEnabled
+ ? new JaxWsServiceFactoryBean() : new ReflectionServiceFactoryBean();
+ serviceFactory.setBus(bus);
+ if (wsdlUrl != null) {
+ ((ReflectionServiceFactoryBean)serviceFactory).setWsdlURL(wsdlUrl);
+ }
+ if (serviceQName != null) {
+ ((ReflectionServiceFactoryBean)serviceFactory).setServiceName(serviceQName);
+ }
+ ((ReflectionServiceFactoryBean)serviceFactory).setServiceClass(cls);
+
+ } else {
+ if (wsdlUrl == null) {
+ throw new CamelException(new Message("SVC_WSDL_URL_IS_NULL_X", LOG, wsdlLocation).toString());
+ }
+ serviceFactory = new WSDLServiceFactory(bus, wsdlUrl, serviceQName);
+ }
+
+ } catch (ClassNotFoundException cnfe) {
+ throw new CamelException(new Message("CLASS_X_NOT_FOUND ", LOG, serviceClassName).toString(), cnfe);
+ } catch (Exception e) {
+ throw new CamelException(e);
+ }
+ }
+
+ public static DataFormat getDataFormat(CxfEndpoint endpoint) throws CamelException {
+ String dataFormatString = endpoint.getDataFormat();
+ DataFormat retval = DataFormat.POJO;
+
+ if (dataFormatString != null) {
+ try {
+ retval = DataFormat.valueOf(dataFormatString.toUpperCase());
+ } catch (IllegalArgumentException iae) {
+ throw new CamelException(new Message("INVALID_MESSAGE_FORMAT_XXXX", LOG, dataFormatString).toString()
+ , iae);
+ }
+ }
+ return retval;
+ }
+}
+
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/UriUtils.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/UriUtils.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/UriUtils.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/UriUtils.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,59 @@
+/**
+ * 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.camel.component.cxf.util;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.apache.camel.component.cxf.CxfConstants;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
+
+public final class UriUtils {
+
+ private UriUtils() {
+ // not constructred
+ }
+
+ static URL getWsdlUrl(final URI uri) throws MalformedURLException {
+ URL wsdlUrl = null;
+
+ if (uri.getScheme().equals(CxfConstants.PROTOCOL_NAME_RES)) {
+ if (uri.getPath() != null) {
+ String path = uri.isAbsolute() ? getRelativePath(uri) : uri.getPath();
+ wsdlUrl = ClassLoaderUtils.getResource(path, UriUtils.class);
+ }
+ } else {
+ wsdlUrl = new URL(uri.getScheme(), uri.getHost(), uri.getPort(), uri.getPath());
+ }
+
+ return wsdlUrl;
+ }
+
+ private static String getRelativePath(URI uri) {
+ URI base = null;
+ try {
+ base = new URI(CxfConstants.PROTOCOL_NAME_RES, "", "/", "");
+ } catch (URISyntaxException e) {
+ // this shouldn't fail
+ e.printStackTrace();
+ }
+ return base.relativize(uri).getPath();
+ }
+}
+
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/UriUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/UriUtils.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/interceptors/Messages.properties
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/interceptors/Messages.properties?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/interceptors/Messages.properties (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/interceptors/Messages.properties Mon Sep 17 10:00:08 2007
@@ -0,0 +1,30 @@
+#
+#
+# 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.
+#
+#
+STREAM_CREATE_EXC = Could not create XMLStreamReader.
+STAX_READ_EXC = Could not read from XMLStreamReader.
+STAX_WRITE_EXC = Could not write from XMLStreamReader.
+NO_OPERATION_ELEMENT=There must be an operation element.
+NO_OPERATION=No such operation: {0}
+UNKNOWN_EXCEPTION=Could not recogonize exception type: {0}
+REQ_NOT_UNDERSTOOD=Could not read request. Operation {0} is unknown.
+ILLEAGAL_XMLFAULT_FORMAT=Illeagal xml fault message format.
+MULTIPLE_HDR_PARTS=Multiple header parts found for part name {0}.
+NOT_SUPPORTED_MESSAGE=Message {0} not supported in Payload mode Routing.
\ No newline at end of file
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/interceptors/Messages.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/interceptors/Messages.properties
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/interceptors/Messages.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/util/Messages.properties
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/util/Messages.properties?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/util/Messages.properties (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/util/Messages.properties Mon Sep 17 10:00:08 2007
@@ -0,0 +1,25 @@
+#
+#
+# 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.
+#
+#
+SVC_WSDL_URL_IS_NULL_X = Unable to locate WSDL from URI {0} due to WSDL not found.
+CLASS_X_NOT_FOUND = Failed to load service class due to {0}.
+SVC_QNAME_NOT_FOUND_X = Service QName is not provided in the URI {0} nor in the endpoint's property.
+INVALID_MESSAGE_FORMAT_XXXX = {0} is an invalid value for messageFormat. Please choose from: POJO, PAYLOAD, or MESSAGE.
+SVC_CLASS_PROP_IS_REQUIRED_X = serviceClass property is expected for this endpoint {0}
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/util/Messages.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/util/Messages.properties
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/util/Messages.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,31 @@
+/**
+ * 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.camel.component.cxf;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class CxfPayLoadMessageRouterTest extends CxfRouterTest {
+ private String routerEndpointURI = "cxf://" + ROUTER_ADDRESS + "?" + SERVICE_CLASS + "&dataFormat=PAYLOAD";
+ private String serviceEndpointURI = "cxf://" + SERVICE_ADDRESS + "?" + SERVICE_CLASS + "&dataFormat=PAYLOAD";
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from(routerEndpointURI).to(serviceEndpointURI);
+ }
+ };
+ }
+}
Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java?rev=576522&r1=576521&r2=576522&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java Mon Sep 17 10:00:08 2007
@@ -19,6 +19,8 @@
import java.util.ArrayList;
import java.util.List;
+import javax.xml.ws.Endpoint;
+
import junit.framework.TestCase;
import org.apache.camel.CamelContext;
@@ -31,6 +33,8 @@
import org.apache.cxf.bus.CXFBusFactory;
import org.apache.cxf.endpoint.ServerImpl;
import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.hello_world_soap_http.GreeterImpl;
/**
* @version $Revision$
@@ -40,52 +44,83 @@
protected CamelContext camelContext = new DefaultCamelContext();
protected CamelTemplate<CxfExchange> template = new CamelTemplate<CxfExchange>(camelContext);
- private final String transportAddress = "http://localhost:28080/test";
- private final String operation = "echo";
- private final String testMessage = "Hello World!";
- private ServerImpl server;
+ private final static String SIMPLE_SERVER_ADDRESS = "http://localhost:28080/test";
+ private final static String JAXWS_SERVER_ADDRESS = "http://localhost:28081/test";
+ private final static String ECHO_OPERATION = "echo";
+ private final static String GREET_ME_OPERATION ="greetMe";
+ private final static String TEST_MESSAGE = "Hello World!";
+ private ServerImpl simpleServer;
+ private Endpoint jaxwsEndpoint;
@Override
protected void setUp() throws Exception {
- // start a service
+ // start a simple front service
ServerFactoryBean svrBean = new ServerFactoryBean();
-
- svrBean.setAddress(transportAddress);
+ svrBean.setAddress(SIMPLE_SERVER_ADDRESS);
svrBean.setServiceClass(HelloService.class);
svrBean.setServiceBean(new HelloServiceImpl());
svrBean.setBus(CXFBusFactory.getDefaultBus());
- server = (ServerImpl)svrBean.create();
- server.start();
+ simpleServer = (ServerImpl)svrBean.create();
+ simpleServer.start();
+
+ GreeterImpl greeterImpl = new GreeterImpl();
+ jaxwsEndpoint = Endpoint.publish(JAXWS_SERVER_ADDRESS, greeterImpl);
+
}
@Override
protected void tearDown() throws Exception {
- if (server != null) {
- server.stop();
+ if (simpleServer != null) {
+ simpleServer.stop();
+ }
+ if (jaxwsEndpoint != null) {
+ jaxwsEndpoint.stop();
}
}
- public void testInvokingServerWithParams() throws Exception {
+ public void testInvokingSimpleServerWithParams() throws Exception {
- CxfExchange exchange = (CxfExchange)template.send(getUri(), new Processor() {
+ CxfExchange exchange = (CxfExchange)template.send(getSimpleEndpointUri(), new Processor() {
+ public void process(final Exchange exchange) {
+ final List<String> params = new ArrayList<String>();
+ params.add(TEST_MESSAGE);
+ exchange.getIn().setBody(params);
+ exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, ECHO_OPERATION);
+ }
+ });
+
+ org.apache.camel.Message out = exchange.getOut();
+ Object[] output = (Object[])out.getBody();
+ LOG.info("Received output text: " + output[0]);
+ assertEquals("reply body on Camel", TEST_MESSAGE, output[0]);
+ }
+
+
+ public void testInvokingJawsServerWithParams() throws Exception {
+ CxfExchange exchange = (CxfExchange)template.send(getJaxwsEndpointUri(), new Processor() {
public void process(final Exchange exchange) {
- final List<String> params = new ArrayList<String>();
- params.add(operation);
- params.add(testMessage);
+ final List<String> params = new ArrayList<String>();
+ params.add(TEST_MESSAGE);
exchange.getIn().setBody(params);
+ exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, GREET_ME_OPERATION);
}
});
org.apache.camel.Message out = exchange.getOut();
Object[] output = (Object[])out.getBody();
LOG.info("Received output text: " + output[0]);
- assertEquals("reply body on Camel", testMessage, output[0]);
+ assertEquals("reply body on Camel", "Hello " + TEST_MESSAGE, output[0]);
}
- private String getUri() {
- return "cxf://" + transportAddress
+ private String getSimpleEndpointUri() {
+ return "cxf://" + SIMPLE_SERVER_ADDRESS
+ "?serviceClass=org.apache.camel.component.cxf.HelloService";
+ }
+
+ private String getJaxwsEndpointUri() {
+ return "cxf://" + JAXWS_SERVER_ADDRESS + "?serviceClass=org.apache.hello_world_soap_http.Greeter";
+
}
}
Added: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,31 @@
+/**
+ * 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.camel.component.cxf;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class CxfRawMessageRouterTest extends CxfRouterTest {
+ private String routerEndpointURI = "cxf://" + ROUTER_ADDRESS + "?" + SERVICE_CLASS + "&dataFormat=MESSAGE";
+ private String serviceEndpointURI = "cxf://" + SERVICE_ADDRESS + "?" + SERVICE_CLASS + "&dataFormat=MESSAGE";
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from(routerEndpointURI).to(serviceEndpointURI);
+ }
+ };
+ }
+}
Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java?rev=576522&r1=576521&r2=576522&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java Mon Sep 17 10:00:08 2007
@@ -38,12 +38,12 @@
import junit.framework.TestCase;
public class CxfRouterTest extends ContextTestSupport {
- private static final String ROUTER_ADDRESS = "http://localhost:9000/router";
- private static final String SERVICE_ADDRESS = "http://localhost:9002/helloworld";
- private static final String SERVICE_CLASS = "serviceClass=org.apache.camel.component.cxf.HelloService";
+ protected static final String ROUTER_ADDRESS = "http://localhost:9000/router";
+ protected static final String SERVICE_ADDRESS = "http://localhost:9002/helloworld";
+ protected static final String SERVICE_CLASS = "serviceClass=org.apache.camel.component.cxf.HelloService";
- private String routerEndpointURI = "cxf://" + ROUTER_ADDRESS + "?" + SERVICE_CLASS + "&invoker=true";
- private String serviceEndpointURI = "cxf://" + SERVICE_ADDRESS + "?" + SERVICE_CLASS + "&invoker=true";
+ private String routerEndpointURI = "cxf://" + ROUTER_ADDRESS + "?" + SERVICE_CLASS + "&dataFormat=POJO";
+ private String serviceEndpointURI = "cxf://" + SERVICE_ADDRESS + "?" + SERVICE_CLASS + "&dataFormat=POJO";
//private Endpoint routerEndpoint;
//private Endpoint resultEndpoint;
private ServerImpl server;
@@ -52,9 +52,7 @@
@Override
protected void setUp() throws Exception {
super.setUp();
- //routerEndpoint = resolveMandatoryEndpoint(routerEndpointURI);
- //resultEndpoint = resolveMandatoryEndpoint(serviceEndpointURI);
-
+
startService();
}
@@ -103,6 +101,8 @@
HelloService client = (HelloService) proxyFactory.create();
String result = client.echo("hello world");
assertEquals("we should get the right answer from router", "hello world", result);
+
+ //Thread.sleep(200000);
}
}
Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java?rev=576522&r1=576521&r2=576522&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java Mon Sep 17 10:00:08 2007
@@ -18,6 +18,7 @@
public class HelloServiceImpl implements HelloService {
public String echo(String text) {
+ System.out.println("call for echo with " + text);
return text;
}
Added: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImplTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImplTest.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImplTest.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImplTest.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,59 @@
+/**
+ * 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.camel.component.cxf.phase;
+
+import java.util.SortedSet;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.phase.PhaseManager;
+
+
+public class PayloadPhaseManagerImplTest extends TestCase {
+
+
+ public void testGetInPhases() throws Exception {
+ PhaseManager pm = new PayloadPhaseManagerImpl();
+ SortedSet<Phase> pl = pm.getInPhases();
+ assertNotNull(pl);
+
+ assertEquals(Phase.RECEIVE, pl.first().getName());
+ assertEquals(Phase.READ, pl.last().getName());
+ }
+
+
+ public void testGetOutPhases() throws Exception {
+ PhaseManager pm = new PayloadPhaseManagerImpl();
+ SortedSet<Phase> pl = pm.getOutPhases();
+ assertNotNull(pl);
+
+ assertEquals(Phase.PREPARE_SEND, pl.first().getName());
+
+ boolean hasWritePhase = false;
+ for (Phase p : pl) {
+
+ if (Phase.WRITE.equals(p.getName())) {
+ hasWritePhase = true;
+ break;
+ }
+ }
+
+ assertTrue(hasWritePhase);
+ assertEquals(Phase.PREPARE_SEND_ENDING, pl.last().getName());
+ }
+}
Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImplTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImplTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImplTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImplTest.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImplTest.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImplTest.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,53 @@
+/**
+ * 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.camel.component.cxf.phase;
+
+
+import java.util.SortedSet;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.phase.PhaseManager;
+
+
+public class RawMessagePhaseManagerImplTest extends TestCase {
+
+
+ public void testGetInPhases() throws Exception {
+ PhaseManager pm = new RawMessagePhaseManagerImpl();
+ SortedSet<Phase> pl = pm.getInPhases();
+ assertNotNull(pl);
+ assertEquals(1, pl.size());
+ assertEquals(Phase.RECEIVE, pl.first().getName());
+ }
+
+
+ public void testGetOutPhases() throws Exception {
+ PhaseManager pm = new RawMessagePhaseManagerImpl();
+ SortedSet<Phase> pl = pm.getOutPhases();
+ assertNotNull(pl);
+ assertEquals(4, pl.size());
+
+ Object[] phaseArray;
+ phaseArray = pl.toArray();
+ assertEquals(Phase.PREPARE_SEND, ((Phase)phaseArray[0]).getName());
+ assertEquals(Phase.WRITE, ((Phase)phaseArray[1]).getName());
+ assertEquals(Phase.SEND, ((Phase)phaseArray[2]).getName());
+ assertEquals(Phase.PREPARE_SEND_ENDING, ((Phase)phaseArray[3]).getName());
+ }
+}
Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImplTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImplTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,54 @@
+/**
+ * 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.camel.component.cxf.util;
+
+import javax.xml.namespace.QName;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.cxf.CxfComponent;
+import org.apache.camel.component.cxf.CxfEndpoint;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.easymock.classextension.EasyMock;
+import junit.framework.TestCase;
+
+public class CxfEndpointUtilsTest extends TestCase {
+ // setup the
+ private static final QName SERVICE_NAME =
+ new QName("http://www.example.com/test", "ServiceName");
+ //private static final QName PORT_NAME =
+ // new QName("http://www.example.com/test", "PortName");
+ static final String CXF_BASE_URI = "cxf://http://www.example.com/testaddress"
+ + "?serviceClass=org.apache.camel.component.cxf.HelloService"
+ + "&portName=%7bhttp://www.example.com/test%7dPortName"
+ + "&serviceName=%7bhttp://www.example.com/test%7dServiceName";
+
+
+ CxfEndpoint cxfEndpoint;
+
+ protected void createEndpoint(String uri) throws Exception {
+ CamelContext context = new DefaultCamelContext();
+ cxfEndpoint = (CxfEndpoint)new CxfComponent(context).createEndpoint(uri);
+ }
+
+ public void testGetQName() throws Exception {
+ createEndpoint(CXF_BASE_URI);
+ QName service = CxfEndpointUtils.getQName(cxfEndpoint.getServiceName());
+ assertEquals("We should get the right service name", service, SERVICE_NAME);
+ }
+
+
+}
Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date