You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by va...@apache.org on 2008/06/10 08:51:20 UTC

svn commit: r665990 - in /incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src: main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/ test/java/org/apache/tuscany/sca/itest/databindings/jaxb/

Author: vamsic007
Date: Mon Jun  9 23:51:20 2008
New Revision: 665990

URL: http://svn.apache.org/viewvc?rev=665990&view=rev
Log:
Make getNewObject change the input object.

Added:
    incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java   (with props)
Modified:
    incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java
    incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesDatabindingTestCase.java

Modified: incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java?rev=665990&r1=665989&r2=665990&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java (original)
+++ incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java Mon Jun  9 23:51:20 2008
@@ -146,8 +146,7 @@
     }
 
     public Object getNewObject(Object obj) {
-        //FIXME: transform the input
-        return obj;
+        return StandardTypesTransformer.getNewObject(obj);
     }
 
     public Object[] getNewObjectArray(Object[] objs) {

Added: incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java?rev=665990&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java (added)
+++ incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java Mon Jun  9 23:51:20 2008
@@ -0,0 +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.tuscany.sca.itest.databindings.jaxb.impl;
+
+
+
+/**
+ * StandardTypesTransformer class that provide for transforming input provided to StandardTypesService methods.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class StandardTypesTransformer {
+    
+    public static Object getNewObject(Object obj) {
+        if(obj instanceof String) {
+            return "Hello "+obj;
+        } else if(obj instanceof Integer) {
+            return new Integer(-((Integer)obj).intValue());
+        } else if(obj instanceof Double) {
+            return new Double(-((Double)obj).doubleValue());
+        }
+        
+        return obj;
+    }
+    
+}

Propchange: incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesDatabindingTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesDatabindingTestCase.java?rev=665990&r1=665989&r2=665990&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesDatabindingTestCase.java (original)
+++ incubator/tuscany/java/sca/itest/databindings/jaxb-bottom-up/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesDatabindingTestCase.java Mon Jun  9 23:51:20 2008
@@ -46,6 +46,7 @@
 
 import org.apache.tuscany.sca.databinding.xml.String2Node;
 import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.databindings.jaxb.impl.StandardTypesTransformer;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
@@ -261,7 +262,6 @@
      * Service method invoked is getNewObject.
      */
     @Test
-    // @Ignore("java.lang.RuntimeException: no data binding for null")
     public void testSCANewObject() throws Exception {
         StandardTypesServiceClient serviceClient =
             domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
@@ -273,7 +273,6 @@
      * Service method invoked is getNewObjectArray.
      */
     @Test
-    // @Ignore("java.lang.RuntimeException: no data binding for null")
     public void testSCANewObjectArray() throws Exception {
         StandardTypesServiceClient serviceClient =
             domain.getService(StandardTypesServiceClient.class, "StandardTypesServiceClientSCAComponent");
@@ -851,7 +850,6 @@
      * Service method invoked is getNewObject.
      */
     @Test
-    // @Ignore("java.lang.RuntimeException: no data binding for null")
     public void testSCALocalNewObject() throws Exception {
         StandardTypesServiceClient serviceClient =
             domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
@@ -863,7 +861,6 @@
      * Service method invoked is getNewObjectArray.
      */
     @Test
-    // @Ignore("java.lang.RuntimeException: no data binding for null")
     public void testSCALocalNewObjectArray() throws Exception {
         StandardTypesServiceClient serviceClient =
             domain.getService(StandardTypesServiceClient.class, "StandardTypesLocalServiceClientSCAComponent");
@@ -1179,8 +1176,9 @@
         objs[4] = null;
 
         for (int i = 0; i < objs.length; ++i) {
+            Object expected = StandardTypesTransformer.getNewObject(objs[i]);
             Object actual = serviceClient.getNewObjectForward(objs[i]);
-            Assert.assertEquals(objs[i], actual);
+            Assert.assertEquals(expected, actual);
         }
     }
 
@@ -1194,7 +1192,8 @@
 
         Object[] actual = serviceClient.getNewObjectArrayForward(objs);
         for (int i = 0; i < objs.length; ++i) {
-            Assert.assertEquals(objs[i], actual[i]);
+            Object expected = StandardTypesTransformer.getNewObject(objs[i]);
+            Assert.assertEquals(expected, actual[i]);
         }
     }