You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2008/08/01 03:54:12 UTC

svn commit: r681586 - in /cxf/trunk/rt/databinding/aegis/src: main/java/org/apache/cxf/aegis/databinding/ test/java/org/apache/cxf/aegis/client/

Author: bimargulies
Date: Thu Jul 31 18:54:11 2008
New Revision: 681586

URL: http://svn.apache.org/viewvc?rev=681586&view=rev
Log:
Start trying to make aegis service configuration work. This test passes, 
but I don't know why.

Added:
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisXmlServiceConfiguration.java   (with props)
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/ClientServiceConfigTest.java   (with props)
Modified:
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.aegis.xml
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.java
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/EchoImpl.java

Added: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisXmlServiceConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisXmlServiceConfiguration.java?rev=681586&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisXmlServiceConfiguration.java (added)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisXmlServiceConfiguration.java Thu Jul 31 18:54:11 2008
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.databinding;
+
+import java.lang.reflect.Method;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.aegis.AegisContext;
+import org.apache.cxf.aegis.type.TypeCreator;
+import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.service.factory.AbstractServiceConfiguration;
+import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
+import org.apache.cxf.service.model.OperationInfo;
+
+/**
+ * Configure the services based on information in a .aegis.xml file
+ * for the SEI or SEB.
+ */
+public class AegisXmlServiceConfiguration extends AbstractServiceConfiguration {
+    
+    private AegisContext context;
+    private TypeCreator creator;
+    @SuppressWarnings("unused")
+    private Class<?> serviceClass;
+    
+    private void getTypeCreator() {
+        if (creator != null) {
+            return;
+        }
+        DataBinding db = getServiceFactory().getDataBinding();
+        if (db instanceof AegisDatabinding) {
+            context = ((AegisDatabinding) db).getAegisContext();
+            serviceClass = getServiceFactory().getServiceClass();
+            creator = context.getTypeMapping().getTypeCreator();
+        }
+    }
+
+    @Override
+    public void setServiceFactory(ReflectionServiceFactoryBean serviceFactory) {
+        super.setServiceFactory(serviceFactory);
+    }
+
+    @Override
+    public QName getInParameterName(OperationInfo op, Method method, int paramNumber) {
+        getTypeCreator();
+        if (creator != null) {
+            QName paramName = creator.getElementName(method, paramNumber);
+            if (paramName != null) {
+                return paramName;
+            }
+        }
+
+        return super.getInParameterName(op, method, paramNumber);
+    }
+
+
+}
\ No newline at end of file

Propchange: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisXmlServiceConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisXmlServiceConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/ClientServiceConfigTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/ClientServiceConfigTest.java?rev=681586&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/ClientServiceConfigTest.java (added)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/ClientServiceConfigTest.java Thu Jul 31 18:54:11 2008
@@ -0,0 +1,80 @@
+/**
+ * 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.aegis.client;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cxf.aegis.AbstractAegisTest;
+import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.aegis.databinding.AegisXmlServiceConfiguration;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.service.factory.AbstractServiceConfiguration;
+import org.apache.cxf.service.factory.DefaultServiceConfiguration;
+import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
+import org.apache.cxf.service.invoker.BeanInvoker;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ClientServiceConfigTest extends AbstractAegisTest {
+
+    @Before
+    public void before() throws Exception {
+        super.setUp();
+
+        ReflectionServiceFactoryBean factory = new ReflectionServiceFactoryBean();
+        List<AbstractServiceConfiguration> configurations = 
+            new ArrayList<AbstractServiceConfiguration>();
+        configurations.add(new AegisXmlServiceConfiguration());
+        configurations.add(new DefaultServiceConfiguration());
+        factory.setConfigurations(configurations);
+        factory.setInvoker(new BeanInvoker(new EchoImpl()));
+        factory.setDataBinding(new AegisDatabinding());
+
+        ServerFactoryBean svrFac = new ServerFactoryBean();
+        svrFac.setAddress("local://Echo");
+        svrFac.setServiceFactory(factory);
+        svrFac.setServiceClass(Echo.class);
+        svrFac.setBus(getBus());
+        svrFac.create();
+    }
+    
+    @Test
+    public void ordinaryParamNameTest() throws Exception {
+        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
+        List<AbstractServiceConfiguration> configurations = 
+            new ArrayList<AbstractServiceConfiguration>();
+        configurations.add(new AegisXmlServiceConfiguration());
+        configurations.add(new DefaultServiceConfiguration());
+        ReflectionServiceFactoryBean factory = new ReflectionServiceFactoryBean();
+        proxyFac.setServiceFactory(factory);
+        proxyFac.setDataBinding(new AegisDatabinding());
+
+        proxyFac.setAddress("local://Echo");
+        proxyFac.setServiceClass(Echo.class);
+        proxyFac.setBus(getBus());
+
+        Echo echo = (Echo)proxyFac.create();
+        String boing = echo.simpleEcho("reflection");
+        assertEquals("reflection", boing);
+    }
+    
+}

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/ClientServiceConfigTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/ClientServiceConfigTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.aegis.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.aegis.xml?rev=681586&r1=681585&r2=681586&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.aegis.xml (original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.aegis.xml Thu Jul 31 18:54:11 2008
@@ -3,5 +3,8 @@
     <method name="echo" xmlns:e="urn:echo:header">
       <parameter index="1" componentType="java.lang.String"/>
     </method>
+    <method name="simpleEcho" xmlns:e="urn:echo:header">
+      <parameter index="0" mappedName="e:narcissus" />
+    </method>
   </mapping>
 </mappings>
\ No newline at end of file

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.java?rev=681586&r1=681585&r2=681586&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.java Thu Jul 31 18:54:11 2008
@@ -28,4 +28,6 @@
     String echo(String text,
                 @WebParam(mode = Mode.OUT)
                 Holder<String> textAgain);
+    
+    String simpleEcho(String text);
 }

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/EchoImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/EchoImpl.java?rev=681586&r1=681585&r2=681586&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/EchoImpl.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/EchoImpl.java Thu Jul 31 18:54:11 2008
@@ -25,4 +25,8 @@
         textAgain.value = "header2";
         return text;
     }
+
+    public String simpleEcho(String text) {
+        return text;
+    }
 }