You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2006/03/16 11:48:26 UTC

svn commit: r386304 - in /webservices/axis2/trunk/java/modules: adb/src/org/apache/axis2/databinding/utils/ integration/test/org/apache/axis2/rpc/

Author: deepal
Date: Thu Mar 16 02:48:24 2006
New Revision: 386304

URL: http://svn.apache.org/viewcvs?rev=386304&view=rev
Log:
-fixed 493

Added:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java
Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java?rev=386304&r1=386303&r2=386304&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java Thu Mar 16 02:48:24 2006
@@ -177,7 +177,7 @@
                 // if parts/@href != null then need to find element with id and deserialize.
                 // before that first check whether we already have it in the hashtable
                 String partsLocalName = parts.getLocalName();
-                PropertyDescriptor prty = (PropertyDescriptor) properties.get(partsLocalName.toLowerCase());
+                PropertyDescriptor prty = (PropertyDescriptor) properties.get(partsLocalName);
                 if (prty != null) {
                     Class parameters = prty.getPropertyType();
                     if (prty.equals("class"))
@@ -209,7 +209,9 @@
         return beanObj;
     }
 
-    public static Object deserialize(Class beanClass, OMElement beanElement, MultirefHelper helper) throws AxisFault {
+    public static Object deserialize(Class beanClass,
+                                     OMElement beanElement,
+                                     MultirefHelper helper) throws AxisFault {
         Object beanObj;
         try {
             HashMap properties = new HashMap();

Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java?rev=386304&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java Thu Mar 16 02:48:24 2006
@@ -0,0 +1,76 @@
+package org.apache.axis2.rpc;
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*
+*
+*/
+
+public class Mail {
+    
+    private String id = null;
+    private String from = null;
+    private String to = null;
+    private String subject = null;
+    private String body = null;
+    private String contentType = null;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getBody() {
+        return body;
+    }
+
+    public void setBody(String body) {
+        this.body = body;
+    }
+
+    public String getFrom() {
+        return from;
+    }
+
+    public void setFrom(String from) {
+        this.from = from;
+    }
+
+    public String getSubject() {
+        return subject;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+    }
+
+    public String getTo() {
+        return to;
+    }
+
+    public void setTo(String to) {
+        this.to = to;
+    }
+
+    public String getContentType() {
+        return contentType;
+    }
+
+    public void setContentType(String contentType) {
+        this.contentType = contentType;
+    }
+}

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java?rev=386304&r1=386303&r2=386304&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java Thu Mar 16 02:48:24 2006
@@ -177,6 +177,37 @@
         assertEquals(resBean.getAge(), 100);
     }
 
+    public void testechoMail() throws AxisFault {
+        configureSystem("echoMail");
+
+        Options options = new Options();
+        options.setTo(targetEPR);
+        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+
+        ConfigurationContext configContext =
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
+        RPCServiceClient sender = new RPCServiceClient(configContext, null);
+        sender.setOptions(options);
+
+        Mail mail = new Mail();
+        mail.setBody("My Body");
+        mail.setContentType("ContentType");
+        mail.setFrom("From");
+        mail.setId("ID");
+        mail.setSubject("Subject");
+        mail.setTo("To");
+
+        ArrayList args = new ArrayList();
+        args.add(mail);
+
+
+        OMElement response = sender.invokeBlocking(operationName, args.toArray());
+        Mail resBean = (Mail) BeanUtil.deserialize(Mail.class, response.getFirstElement());
+//        MyBean resBean =(MyBean) new  BeanSerializer(MyBean.class,response).deserilze();
+        assertNotNull(resBean);
+        assertEquals(resBean.getBody(), "My Body");
+    }
+
 
     public void testEchoString() throws AxisFault {
         configureSystem("echoString");
@@ -329,6 +360,98 @@
         sender.invokeBlocking(operationName, args.toArray());
     }
 
+
+    public void testtestCompany() throws AxisFault {
+        configureSystem("testCompanyArray");
+
+        Options options = new Options();
+        options.setTo(targetEPR);
+        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+
+        ConfigurationContext configContext =
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
+        RPCServiceClient sender = new RPCServiceClient(configContext, null);
+        sender.setOptions(options);
+
+        Company com = new Company();
+        com.setName("MyCompany");
+
+        ArrayList ps = new ArrayList();
+
+        Person p1 = new Person();
+        p1.setAge(10);
+        p1.setName("P1");
+        ps.add(p1);
+
+        Person p2 = new Person();
+        p2.setAge(15);
+        p2.setName("P2");
+        ps.add(p2);
+
+        Person p3 = new Person();
+        p3.setAge(20);
+        p3.setName("P3");
+        ps.add(p3);
+
+        com.setPersons(ps);
+        ArrayList args = new ArrayList();
+        args.add(com);
+        args.add(com);
+        args.add(com);
+        args.add(com);
+
+        ArrayList req = new ArrayList();
+        req.add(args.toArray());
+        OMElement value = sender.invokeBlocking(operationName, req.toArray());
+        assertEquals("4", value.getFirstElement().getText());
+    }
+
+    public void testCompanyArray() throws AxisFault {
+        configureSystem("CompanyArray");
+
+        Options options = new Options();
+        options.setTo(targetEPR);
+        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+
+        ConfigurationContext configContext =
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
+        RPCServiceClient sender = new RPCServiceClient(configContext, null);
+        sender.setOptions(options);
+
+        Company com = new Company();
+        com.setName("MyCompany");
+
+        ArrayList ps = new ArrayList();
+
+        Person p1 = new Person();
+        p1.setAge(10);
+        p1.setName("P1");
+        ps.add(p1);
+
+        Person p2 = new Person();
+        p2.setAge(15);
+        p2.setName("P2");
+        ps.add(p2);
+
+        Person p3 = new Person();
+        p3.setAge(20);
+        p3.setName("P3");
+        ps.add(p3);
+
+        com.setPersons(ps);
+        ArrayList args = new ArrayList();
+        args.add(com);
+        args.add(com);
+        args.add(com);
+        args.add(com);
+
+        ArrayList req = new ArrayList();
+        req.add(args.toArray());
+        OMElement value = sender.invokeBlocking(operationName, req.toArray());
+        assertEquals("MyCompany", value.getFirstElement().getFirstElement().getText());
+    }
+
+
     public void testEchoOM() throws AxisFault {
         configureSystem("echoOM");
 
@@ -487,7 +610,8 @@
         args.add("foo");
 
 
-        sender.invokeBlocking(operationName, args.toArray());
+        OMElement element = sender.invokeBlocking(operationName, args.toArray());
+        System.out.println("element = " + element);
 //        assertEquals(response.getFirstElement().getText(), "foo");
     }
 
@@ -506,6 +630,40 @@
 
         OMElement elem = sender.sendReceive(getpayLoad());
         assertEquals(elem.getFirstElement().getText(), "abcdefghiklm10");
+    }
+
+    public void testomElementArray() throws AxisFault {
+        configureSystem("omElementArray");
+        String str = "<req:omElementArray xmlns:req=\"http://org.apache.axis2/xsd\">\n" +
+                "    <arg0><abc>vaue1</abc></arg0>\n" +
+                "    <arg0><abc>vaue2</abc></arg0>\n" +
+                "    <arg0><abc>vaue3</abc></arg0>\n" +
+                "    <arg0><abc>vaue4</abc></arg0>\n" +
+                "</req:omElementArray>";
+        StAXOMBuilder staxOMBuilder;
+        try {
+            XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(new
+                    ByteArrayInputStream(str.getBytes()));
+            OMFactory fac = OMAbstractFactory.getOMFactory();
+
+            staxOMBuilder = new
+                    StAXOMBuilder(fac, xmlReader);
+        } catch (XMLStreamException e) {
+            throw new AxisFault(e);
+        } catch (FactoryConfigurationError factoryConfigurationError) {
+            throw new AxisFault(factoryConfigurationError);
+        }
+        Options options = new Options();
+        options.setTo(targetEPR);
+        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+
+        ConfigurationContext configContext =
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
+        RPCServiceClient sender = new RPCServiceClient(configContext, null);
+        sender.setOptions(options);
+
+        OMElement elem = sender.sendReceive(staxOMBuilder.getDocumentElement());
+        assertEquals("4", elem.getFirstElement().getText());
     }
 
     private OMElement getpayLoad() throws AxisFault {

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java?rev=386304&r1=386303&r2=386304&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java Thu Mar 16 02:48:24 2006
@@ -147,6 +147,19 @@
         return em;
     }
 
+    public int testCompanyArray(Company [] com) {
+        return com.length;
+    }
+
+    public Company [] CompanyArray(Company [] com) {
+        ArrayList res = new ArrayList();
+        for (int i = 0; i < com.length; i++) {
+            Company company = com[i];
+            res.add(company);
+        }
+        return (Company []) res.toArray(new Company[res.size()]);
+    }
+
 
     public Company echoCompany(Company com) throws AxisFault {
         ArrayList pss = com.getPersons();
@@ -168,4 +181,11 @@
         return value.length > 0;
     }
 
+    public int omElementArray(OMElement [] omElement) {
+        return omElement.length;
+    }
+
+    public Mail echoMail(Mail mail) {
+        return mail;
+    }
 }



Re: svn commit: r386304 - in /webservices/axis2/trunk/java/modules: adb/src/org/apache/axis2/databinding/utils/ integration/test/org/apache/axis2/rpc/

Posted by Eran Chinthaka <ch...@opensource.lk>.
Did you get the build successful before committing this ?



deepal@apache.org wrote:
> Author: deepal
> Date: Thu Mar 16 02:48:24 2006
> New Revision: 386304
>
> URL: http://svn.apache.org/viewcvs?rev=386304&view=rev
> Log:
> -fixed 493
>
> Added:
>     webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java
> Modified:
>     webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
>     webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java
>     webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java
>
> Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
> URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java?rev=386304&r1=386303&r2=386304&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java (original)
> +++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java Thu Mar 16 02:48:24 2006
> @@ -177,7 +177,7 @@
>                  // if parts/@href != null then need to find element with id and deserialize.
>                  // before that first check whether we already have it in the hashtable
>                  String partsLocalName = parts.getLocalName();
> -                PropertyDescriptor prty = (PropertyDescriptor) properties.get(partsLocalName.toLowerCase());
> +                PropertyDescriptor prty = (PropertyDescriptor) properties.get(partsLocalName);
>                  if (prty != null) {
>                      Class parameters = prty.getPropertyType();
>                      if (prty.equals("class"))
> @@ -209,7 +209,9 @@
>          return beanObj;
>      }
>  
> -    public static Object deserialize(Class beanClass, OMElement beanElement, MultirefHelper helper) throws AxisFault {
> +    public static Object deserialize(Class beanClass,
> +                                     OMElement beanElement,
> +                                     MultirefHelper helper) throws AxisFault {
>          Object beanObj;
>          try {
>              HashMap properties = new HashMap();
>
> Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java
> URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java?rev=386304&view=auto
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java (added)
> +++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java Thu Mar 16 02:48:24 2006
> @@ -0,0 +1,76 @@
> +package org.apache.axis2.rpc;
> +/*
> +* Copyright 2004,2005 The Apache Software Foundation.
> +*
> +* Licensed 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.
> +*
> +*
> +*/
> +
> +public class Mail {
> +    
> +    private String id = null;
> +    private String from = null;
> +    private String to = null;
> +    private String subject = null;
> +    private String body = null;
> +    private String contentType = null;
> +
> +    public String getId() {
> +        return id;
> +    }
> +
> +    public void setId(String id) {
> +        this.id = id;
> +    }
> +
> +    public String getBody() {
> +        return body;
> +    }
> +
> +    public void setBody(String body) {
> +        this.body = body;
> +    }
> +
> +    public String getFrom() {
> +        return from;
> +    }
> +
> +    public void setFrom(String from) {
> +        this.from = from;
> +    }
> +
> +    public String getSubject() {
> +        return subject;
> +    }
> +
> +    public void setSubject(String subject) {
> +        this.subject = subject;
> +    }
> +
> +    public String getTo() {
> +        return to;
> +    }
> +
> +    public void setTo(String to) {
> +        this.to = to;
> +    }
> +
> +    public String getContentType() {
> +        return contentType;
> +    }
> +
> +    public void setContentType(String contentType) {
> +        this.contentType = contentType;
> +    }
> +}
>
> Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java
> URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java?rev=386304&r1=386303&r2=386304&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java (original)
> +++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java Thu Mar 16 02:48:24 2006
> @@ -177,6 +177,37 @@
>          assertEquals(resBean.getAge(), 100);
>      }
>  
> +    public void testechoMail() throws AxisFault {
> +        configureSystem("echoMail");
> +
> +        Options options = new Options();
> +        options.setTo(targetEPR);
> +        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> +
> +        ConfigurationContext configContext =
> +                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
> +        RPCServiceClient sender = new RPCServiceClient(configContext, null);
> +        sender.setOptions(options);
> +
> +        Mail mail = new Mail();
> +        mail.setBody("My Body");
> +        mail.setContentType("ContentType");
> +        mail.setFrom("From");
> +        mail.setId("ID");
> +        mail.setSubject("Subject");
> +        mail.setTo("To");
> +
> +        ArrayList args = new ArrayList();
> +        args.add(mail);
> +
> +
> +        OMElement response = sender.invokeBlocking(operationName, args.toArray());
> +        Mail resBean = (Mail) BeanUtil.deserialize(Mail.class, response.getFirstElement());
> +//        MyBean resBean =(MyBean) new  BeanSerializer(MyBean.class,response).deserilze();
> +        assertNotNull(resBean);
> +        assertEquals(resBean.getBody(), "My Body");
> +    }
> +
>  
>      public void testEchoString() throws AxisFault {
>          configureSystem("echoString");
> @@ -329,6 +360,98 @@
>          sender.invokeBlocking(operationName, args.toArray());
>      }
>  
> +
> +    public void testtestCompany() throws AxisFault {
> +        configureSystem("testCompanyArray");
> +
> +        Options options = new Options();
> +        options.setTo(targetEPR);
> +        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> +
> +        ConfigurationContext configContext =
> +                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
> +        RPCServiceClient sender = new RPCServiceClient(configContext, null);
> +        sender.setOptions(options);
> +
> +        Company com = new Company();
> +        com.setName("MyCompany");
> +
> +        ArrayList ps = new ArrayList();
> +
> +        Person p1 = new Person();
> +        p1.setAge(10);
> +        p1.setName("P1");
> +        ps.add(p1);
> +
> +        Person p2 = new Person();
> +        p2.setAge(15);
> +        p2.setName("P2");
> +        ps.add(p2);
> +
> +        Person p3 = new Person();
> +        p3.setAge(20);
> +        p3.setName("P3");
> +        ps.add(p3);
> +
> +        com.setPersons(ps);
> +        ArrayList args = new ArrayList();
> +        args.add(com);
> +        args.add(com);
> +        args.add(com);
> +        args.add(com);
> +
> +        ArrayList req = new ArrayList();
> +        req.add(args.toArray());
> +        OMElement value = sender.invokeBlocking(operationName, req.toArray());
> +        assertEquals("4", value.getFirstElement().getText());
> +    }
> +
> +    public void testCompanyArray() throws AxisFault {
> +        configureSystem("CompanyArray");
> +
> +        Options options = new Options();
> +        options.setTo(targetEPR);
> +        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> +
> +        ConfigurationContext configContext =
> +                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
> +        RPCServiceClient sender = new RPCServiceClient(configContext, null);
> +        sender.setOptions(options);
> +
> +        Company com = new Company();
> +        com.setName("MyCompany");
> +
> +        ArrayList ps = new ArrayList();
> +
> +        Person p1 = new Person();
> +        p1.setAge(10);
> +        p1.setName("P1");
> +        ps.add(p1);
> +
> +        Person p2 = new Person();
> +        p2.setAge(15);
> +        p2.setName("P2");
> +        ps.add(p2);
> +
> +        Person p3 = new Person();
> +        p3.setAge(20);
> +        p3.setName("P3");
> +        ps.add(p3);
> +
> +        com.setPersons(ps);
> +        ArrayList args = new ArrayList();
> +        args.add(com);
> +        args.add(com);
> +        args.add(com);
> +        args.add(com);
> +
> +        ArrayList req = new ArrayList();
> +        req.add(args.toArray());
> +        OMElement value = sender.invokeBlocking(operationName, req.toArray());
> +        assertEquals("MyCompany", value.getFirstElement().getFirstElement().getText());
> +    }
> +
> +
>      public void testEchoOM() throws AxisFault {
>          configureSystem("echoOM");
>  
> @@ -487,7 +610,8 @@
>          args.add("foo");
>  
>  
> -        sender.invokeBlocking(operationName, args.toArray());
> +        OMElement element = sender.invokeBlocking(operationName, args.toArray());
> +        System.out.println("element = " + element);
>  //        assertEquals(response.getFirstElement().getText(), "foo");
>      }
>  
> @@ -506,6 +630,40 @@
>  
>          OMElement elem = sender.sendReceive(getpayLoad());
>          assertEquals(elem.getFirstElement().getText(), "abcdefghiklm10");
> +    }
> +
> +    public void testomElementArray() throws AxisFault {
> +        configureSystem("omElementArray");
> +        String str = "<req:omElementArray xmlns:req=\"http://org.apache.axis2/xsd\">\n" +
> +                "    <arg0><abc>vaue1</abc></arg0>\n" +
> +                "    <arg0><abc>vaue2</abc></arg0>\n" +
> +                "    <arg0><abc>vaue3</abc></arg0>\n" +
> +                "    <arg0><abc>vaue4</abc></arg0>\n" +
> +                "</req:omElementArray>";
> +        StAXOMBuilder staxOMBuilder;
> +        try {
> +            XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(new
> +                    ByteArrayInputStream(str.getBytes()));
> +            OMFactory fac = OMAbstractFactory.getOMFactory();
> +
> +            staxOMBuilder = new
> +                    StAXOMBuilder(fac, xmlReader);
> +        } catch (XMLStreamException e) {
> +            throw new AxisFault(e);
> +        } catch (FactoryConfigurationError factoryConfigurationError) {
> +            throw new AxisFault(factoryConfigurationError);
> +        }
> +        Options options = new Options();
> +        options.setTo(targetEPR);
> +        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> +
> +        ConfigurationContext configContext =
> +                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
> +        RPCServiceClient sender = new RPCServiceClient(configContext, null);
> +        sender.setOptions(options);
> +
> +        OMElement elem = sender.sendReceive(staxOMBuilder.getDocumentElement());
> +        assertEquals("4", elem.getFirstElement().getText());
>      }
>  
>      private OMElement getpayLoad() throws AxisFault {
>
> Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java
> URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java?rev=386304&r1=386303&r2=386304&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java (original)
> +++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java Thu Mar 16 02:48:24 2006
> @@ -147,6 +147,19 @@
>          return em;
>      }
>  
> +    public int testCompanyArray(Company [] com) {
> +        return com.length;
> +    }
> +
> +    public Company [] CompanyArray(Company [] com) {
> +        ArrayList res = new ArrayList();
> +        for (int i = 0; i < com.length; i++) {
> +            Company company = com[i];
> +            res.add(company);
> +        }
> +        return (Company []) res.toArray(new Company[res.size()]);
> +    }
> +
>  
>      public Company echoCompany(Company com) throws AxisFault {
>          ArrayList pss = com.getPersons();
> @@ -168,4 +181,11 @@
>          return value.length > 0;
>      }
>  
> +    public int omElementArray(OMElement [] omElement) {
> +        return omElement.length;
> +    }
> +
> +    public Mail echoMail(Mail mail) {
> +        return mail;
> +    }
>  }
>
>
>
>   


Re: svn commit: r386304 - in /webservices/axis2/trunk/java/modules: adb/src/org/apache/axis2/databinding/utils/ integration/test/org/apache/axis2/rpc/

Posted by Eran Chinthaka <ch...@opensource.lk>.
Did you get the build successful before committing this ?



deepal@apache.org wrote:
> Author: deepal
> Date: Thu Mar 16 02:48:24 2006
> New Revision: 386304
>
> URL: http://svn.apache.org/viewcvs?rev=386304&view=rev
> Log:
> -fixed 493
>
> Added:
>     webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java
> Modified:
>     webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
>     webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java
>     webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java
>
> Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
> URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java?rev=386304&r1=386303&r2=386304&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java (original)
> +++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java Thu Mar 16 02:48:24 2006
> @@ -177,7 +177,7 @@
>                  // if parts/@href != null then need to find element with id and deserialize.
>                  // before that first check whether we already have it in the hashtable
>                  String partsLocalName = parts.getLocalName();
> -                PropertyDescriptor prty = (PropertyDescriptor) properties.get(partsLocalName.toLowerCase());
> +                PropertyDescriptor prty = (PropertyDescriptor) properties.get(partsLocalName);
>                  if (prty != null) {
>                      Class parameters = prty.getPropertyType();
>                      if (prty.equals("class"))
> @@ -209,7 +209,9 @@
>          return beanObj;
>      }
>  
> -    public static Object deserialize(Class beanClass, OMElement beanElement, MultirefHelper helper) throws AxisFault {
> +    public static Object deserialize(Class beanClass,
> +                                     OMElement beanElement,
> +                                     MultirefHelper helper) throws AxisFault {
>          Object beanObj;
>          try {
>              HashMap properties = new HashMap();
>
> Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java
> URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java?rev=386304&view=auto
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java (added)
> +++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/Mail.java Thu Mar 16 02:48:24 2006
> @@ -0,0 +1,76 @@
> +package org.apache.axis2.rpc;
> +/*
> +* Copyright 2004,2005 The Apache Software Foundation.
> +*
> +* Licensed 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.
> +*
> +*
> +*/
> +
> +public class Mail {
> +    
> +    private String id = null;
> +    private String from = null;
> +    private String to = null;
> +    private String subject = null;
> +    private String body = null;
> +    private String contentType = null;
> +
> +    public String getId() {
> +        return id;
> +    }
> +
> +    public void setId(String id) {
> +        this.id = id;
> +    }
> +
> +    public String getBody() {
> +        return body;
> +    }
> +
> +    public void setBody(String body) {
> +        this.body = body;
> +    }
> +
> +    public String getFrom() {
> +        return from;
> +    }
> +
> +    public void setFrom(String from) {
> +        this.from = from;
> +    }
> +
> +    public String getSubject() {
> +        return subject;
> +    }
> +
> +    public void setSubject(String subject) {
> +        this.subject = subject;
> +    }
> +
> +    public String getTo() {
> +        return to;
> +    }
> +
> +    public void setTo(String to) {
> +        this.to = to;
> +    }
> +
> +    public String getContentType() {
> +        return contentType;
> +    }
> +
> +    public void setContentType(String contentType) {
> +        this.contentType = contentType;
> +    }
> +}
>
> Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java
> URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java?rev=386304&r1=386303&r2=386304&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java (original)
> +++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java Thu Mar 16 02:48:24 2006
> @@ -177,6 +177,37 @@
>          assertEquals(resBean.getAge(), 100);
>      }
>  
> +    public void testechoMail() throws AxisFault {
> +        configureSystem("echoMail");
> +
> +        Options options = new Options();
> +        options.setTo(targetEPR);
> +        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> +
> +        ConfigurationContext configContext =
> +                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
> +        RPCServiceClient sender = new RPCServiceClient(configContext, null);
> +        sender.setOptions(options);
> +
> +        Mail mail = new Mail();
> +        mail.setBody("My Body");
> +        mail.setContentType("ContentType");
> +        mail.setFrom("From");
> +        mail.setId("ID");
> +        mail.setSubject("Subject");
> +        mail.setTo("To");
> +
> +        ArrayList args = new ArrayList();
> +        args.add(mail);
> +
> +
> +        OMElement response = sender.invokeBlocking(operationName, args.toArray());
> +        Mail resBean = (Mail) BeanUtil.deserialize(Mail.class, response.getFirstElement());
> +//        MyBean resBean =(MyBean) new  BeanSerializer(MyBean.class,response).deserilze();
> +        assertNotNull(resBean);
> +        assertEquals(resBean.getBody(), "My Body");
> +    }
> +
>  
>      public void testEchoString() throws AxisFault {
>          configureSystem("echoString");
> @@ -329,6 +360,98 @@
>          sender.invokeBlocking(operationName, args.toArray());
>      }
>  
> +
> +    public void testtestCompany() throws AxisFault {
> +        configureSystem("testCompanyArray");
> +
> +        Options options = new Options();
> +        options.setTo(targetEPR);
> +        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> +
> +        ConfigurationContext configContext =
> +                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
> +        RPCServiceClient sender = new RPCServiceClient(configContext, null);
> +        sender.setOptions(options);
> +
> +        Company com = new Company();
> +        com.setName("MyCompany");
> +
> +        ArrayList ps = new ArrayList();
> +
> +        Person p1 = new Person();
> +        p1.setAge(10);
> +        p1.setName("P1");
> +        ps.add(p1);
> +
> +        Person p2 = new Person();
> +        p2.setAge(15);
> +        p2.setName("P2");
> +        ps.add(p2);
> +
> +        Person p3 = new Person();
> +        p3.setAge(20);
> +        p3.setName("P3");
> +        ps.add(p3);
> +
> +        com.setPersons(ps);
> +        ArrayList args = new ArrayList();
> +        args.add(com);
> +        args.add(com);
> +        args.add(com);
> +        args.add(com);
> +
> +        ArrayList req = new ArrayList();
> +        req.add(args.toArray());
> +        OMElement value = sender.invokeBlocking(operationName, req.toArray());
> +        assertEquals("4", value.getFirstElement().getText());
> +    }
> +
> +    public void testCompanyArray() throws AxisFault {
> +        configureSystem("CompanyArray");
> +
> +        Options options = new Options();
> +        options.setTo(targetEPR);
> +        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> +
> +        ConfigurationContext configContext =
> +                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
> +        RPCServiceClient sender = new RPCServiceClient(configContext, null);
> +        sender.setOptions(options);
> +
> +        Company com = new Company();
> +        com.setName("MyCompany");
> +
> +        ArrayList ps = new ArrayList();
> +
> +        Person p1 = new Person();
> +        p1.setAge(10);
> +        p1.setName("P1");
> +        ps.add(p1);
> +
> +        Person p2 = new Person();
> +        p2.setAge(15);
> +        p2.setName("P2");
> +        ps.add(p2);
> +
> +        Person p3 = new Person();
> +        p3.setAge(20);
> +        p3.setName("P3");
> +        ps.add(p3);
> +
> +        com.setPersons(ps);
> +        ArrayList args = new ArrayList();
> +        args.add(com);
> +        args.add(com);
> +        args.add(com);
> +        args.add(com);
> +
> +        ArrayList req = new ArrayList();
> +        req.add(args.toArray());
> +        OMElement value = sender.invokeBlocking(operationName, req.toArray());
> +        assertEquals("MyCompany", value.getFirstElement().getFirstElement().getText());
> +    }
> +
> +
>      public void testEchoOM() throws AxisFault {
>          configureSystem("echoOM");
>  
> @@ -487,7 +610,8 @@
>          args.add("foo");
>  
>  
> -        sender.invokeBlocking(operationName, args.toArray());
> +        OMElement element = sender.invokeBlocking(operationName, args.toArray());
> +        System.out.println("element = " + element);
>  //        assertEquals(response.getFirstElement().getText(), "foo");
>      }
>  
> @@ -506,6 +630,40 @@
>  
>          OMElement elem = sender.sendReceive(getpayLoad());
>          assertEquals(elem.getFirstElement().getText(), "abcdefghiklm10");
> +    }
> +
> +    public void testomElementArray() throws AxisFault {
> +        configureSystem("omElementArray");
> +        String str = "<req:omElementArray xmlns:req=\"http://org.apache.axis2/xsd\">\n" +
> +                "    <arg0><abc>vaue1</abc></arg0>\n" +
> +                "    <arg0><abc>vaue2</abc></arg0>\n" +
> +                "    <arg0><abc>vaue3</abc></arg0>\n" +
> +                "    <arg0><abc>vaue4</abc></arg0>\n" +
> +                "</req:omElementArray>";
> +        StAXOMBuilder staxOMBuilder;
> +        try {
> +            XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(new
> +                    ByteArrayInputStream(str.getBytes()));
> +            OMFactory fac = OMAbstractFactory.getOMFactory();
> +
> +            staxOMBuilder = new
> +                    StAXOMBuilder(fac, xmlReader);
> +        } catch (XMLStreamException e) {
> +            throw new AxisFault(e);
> +        } catch (FactoryConfigurationError factoryConfigurationError) {
> +            throw new AxisFault(factoryConfigurationError);
> +        }
> +        Options options = new Options();
> +        options.setTo(targetEPR);
> +        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> +
> +        ConfigurationContext configContext =
> +                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
> +        RPCServiceClient sender = new RPCServiceClient(configContext, null);
> +        sender.setOptions(options);
> +
> +        OMElement elem = sender.sendReceive(staxOMBuilder.getDocumentElement());
> +        assertEquals("4", elem.getFirstElement().getText());
>      }
>  
>      private OMElement getpayLoad() throws AxisFault {
>
> Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java
> URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java?rev=386304&r1=386303&r2=386304&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java (original)
> +++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java Thu Mar 16 02:48:24 2006
> @@ -147,6 +147,19 @@
>          return em;
>      }
>  
> +    public int testCompanyArray(Company [] com) {
> +        return com.length;
> +    }
> +
> +    public Company [] CompanyArray(Company [] com) {
> +        ArrayList res = new ArrayList();
> +        for (int i = 0; i < com.length; i++) {
> +            Company company = com[i];
> +            res.add(company);
> +        }
> +        return (Company []) res.toArray(new Company[res.size()]);
> +    }
> +
>  
>      public Company echoCompany(Company com) throws AxisFault {
>          ArrayList pss = com.getPersons();
> @@ -168,4 +181,11 @@
>          return value.length > 0;
>      }
>  
> +    public int omElementArray(OMElement [] omElement) {
> +        return omElement.length;
> +    }
> +
> +    public Mail echoMail(Mail mail) {
> +        return mail;
> +    }
>  }
>
>
>
>