You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ke...@apache.org on 2007/04/11 12:23:50 UTC

svn commit: r527446 - /incubator/tuscany/tags/java/sdo/1.0-incubator-M3/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/JavaSerializeDeserializeTestCase.java

Author: kelvingoodson
Date: Wed Apr 11 03:23:45 2007
New Revision: 527446

URL: http://svn.apache.org/viewvc?view=rev&rev=527446
Log:
Port test case mod for TUSCANY-1205 to M3 tag (code fix was done in port of T-1200)

Modified:
    incubator/tuscany/tags/java/sdo/1.0-incubator-M3/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/JavaSerializeDeserializeTestCase.java

Modified: incubator/tuscany/tags/java/sdo/1.0-incubator-M3/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/JavaSerializeDeserializeTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/tags/java/sdo/1.0-incubator-M3/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/JavaSerializeDeserializeTestCase.java?view=diff&rev=527446&r1=527445&r2=527446
==============================================================================
--- incubator/tuscany/tags/java/sdo/1.0-incubator-M3/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/JavaSerializeDeserializeTestCase.java (original)
+++ incubator/tuscany/tags/java/sdo/1.0-incubator-M3/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/JavaSerializeDeserializeTestCase.java Wed Apr 11 03:23:45 2007
@@ -56,6 +56,62 @@
         
         runSerializeDeserializeWithDataGraph(testDO, hc);
     }
+    
+    private String xsdString = "<xsd:schema targetNamespace=\"http://www.example.com/simple\" " +
+        "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " + 
+        "xmlns:simple=\"http://www.example.com/simple\">" +
+        "<xsd:element name=\"company\" type=\"simple:Company\"/>" +
+        "<xsd:complexType name=\"Company\">" +
+        "<xsd:sequence>" +
+        "<xsd:element name=\"symbol\" type=\"xsd:string\"/>" +
+        "<xsd:element name=\"companyName\" type=\"xsd:string\"/>" +
+        "<xsd:element name=\"employees\" type=\"simple:Employee\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>" +
+        "</xsd:sequence>" +
+        "</xsd:complexType>" +
+        
+        "<xsd:complexType name=\"Employee\">" +
+        "<xsd:sequence>" +
+        "<xsd:element name=\"employeeID\" type=\"xsd:string\"/>" +
+        "<xsd:element name=\"employeeName\" type=\"xsd:string\"/>" +
+        "</xsd:sequence>" +
+        "</xsd:complexType>" +       
+        "</xsd:schema>";
+    
+    public void testLargePayload()
+    {
+        HelperContext hc = SDOUtil.createHelperContext();
+        hc.getXSDHelper().define(xsdString);
+        DataObject company = hc.getDataFactory().create("http://www.example.com/simple", "Company");
+        company.setString("symbol", "EXAMPLE");
+        company.setString("companyName", "Example Inc.");
+        List employees = company.getList("employees");
+        DataObject employee;
+        for (int i=0; i<1000; i++) {
+            employee = hc.getDataFactory().create("http://www.example.com/simple", "Employee");
+            employee.setString("employeeID", "ID #" + i);
+            employee.setString("employeeName", "Empoyee #" + i);
+            employees.add(employee);
+        }
+        try {
+            ByteArrayOutputStream bos = new ByteArrayOutputStream();
+            ObjectOutputStream oos = SDOUtil.createObjectOutputStream(bos, hc);
+            oos.writeObject(company);
+            oos.flush();
+            byte[] bytes = bos.toByteArray();
+            oos.close();
+            bos.close();
+            
+            ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
+            ObjectInputStream ois = SDOUtil.createObjectInputStream(bis, hc);
+            ois.readObject();
+            ois.close();
+            bis.close();
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            fail("An Exception occurred while deserializing the output of the serialization: "  + e.toString());
+        }
+    }
 	
         
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org