You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ce...@apache.org on 2005/09/09 01:18:48 UTC
svn commit: r279672 [8/8] - in /xmlbeans/trunk/test/perf: ./ bin/ cases/
cases/xsd/ src/org/apache/xmlbeans/test/performance/jaxb/
src/org/apache/xmlbeans/test/performance/jaxb2/
src/org/apache/xmlbeans/test/performance/parsers/ src/org/apache/xmlbeans...
Added: xmlbeans/trunk/test/perf/src/org/apache/xmlbeans/test/performance/parsers/XmlBeansTests.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/perf/src/org/apache/xmlbeans/test/performance/parsers/XmlBeansTests.java?rev=279672&view=auto
==============================================================================
--- xmlbeans/trunk/test/perf/src/org/apache/xmlbeans/test/performance/parsers/XmlBeansTests.java (added)
+++ xmlbeans/trunk/test/perf/src/org/apache/xmlbeans/test/performance/parsers/XmlBeansTests.java Thu Sep 8 16:18:37 2005
@@ -0,0 +1,167 @@
+/* Copyright 2004 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.
+ */
+package org.apache.xmlbeans.test.performance.parsers;
+
+import java.io.File;
+import java.math.BigDecimal;
+
+import org.openuri.easypo.PurchaseOrderDocument;
+import org.openuri.easypo.LineItem;
+import org.openuri.easypo.Customer;
+import org.openuri.easypo.Shipper;
+import org.apache.xmlbeans.XmlCalendar;
+
+/**
+ * @author Cezar Andrei (cezar.andrei at bea.com)
+ * Date: Aug 24, 2005
+ */
+public class XmlBeansTests
+{
+ public static class LoadOnly
+ extends Utils.ParseFile
+ {
+ public void execute(String file)
+ throws Exception
+ {
+ PurchaseOrderDocument.Factory.parse(new File(file));
+ }
+ }
+
+ public static class LoadAndTraverseArray
+ extends Utils.ParseFile
+ {
+ public void execute(String file)
+ throws Exception
+ {
+ PurchaseOrderDocument poDoc = PurchaseOrderDocument.Factory.parse(new File(file));
+ PurchaseOrderDocument.PurchaseOrder po = poDoc.getPurchaseOrder();
+
+ //System.out.println("Cust name: " + po.getCustomer().getName());
+ //System.out.println(" address: " + po.getCustomer().getAddress());
+ //System.out.println("Date: " + po.getDate());
+ //System.out.println("Shipper name: " + po.getShipper().getName());
+ //System.out.println(" perOunceRate: " + po.getShipper().getPerOunceRate());
+
+ LineItem[] lineItems = po.getLineItemArray();
+ for (int i = 0; i < lineItems.length; i++)
+ {
+ LineItem lineItem = lineItems[i];
+ double price = lineItem.getPrice();
+ int quantity = lineItem.getQuantity();
+ BigDecimal perUnitOunces = lineItem.getPerUnitOunces();
+ String description = lineItem.getDescription();
+
+// System.out.println(" Line item: " + price + " " + quantity + " " + perUnitOunces + " " + description);
+ }
+ }
+ }
+
+ public static class LoadAndTraverseItem
+ extends Utils.ParseFile
+ {
+ public void execute(String file)
+ throws Exception
+ {
+ PurchaseOrderDocument poDoc = PurchaseOrderDocument.Factory.parse(new File(file));
+ PurchaseOrderDocument.PurchaseOrder po = poDoc.getPurchaseOrder();
+
+// System.out.println("Cust name: " + po.getCustomer().getName());
+// System.out.println(" address: " + po.getCustomer().getAddress());
+// System.out.println("Date: " + po.getDate());
+// System.out.println("Shipper name: " + po.getShipper().getName());
+// System.out.println(" perOunceRate: " + po.getShipper().getPerOunceRate());
+
+ int liSize = po.sizeOfLineItemArray();
+ for (int i = 0; i<liSize; i++)
+ {
+ LineItem lineItem = po.getLineItemArray(i);
+ double price = lineItem.getPrice();
+ int quantity = lineItem.getQuantity();
+ BigDecimal perUnitOunces = lineItem.getPerUnitOunces();
+ String description = lineItem.getDescription();
+
+// System.out.println(" Line item: " + price + " " + quantity + " " + perUnitOunces + " " + description);
+ }
+ }
+ }
+
+ public static class CreateOnly
+ extends Utils.ParseFile
+ {
+ public void execute(String numberOfLineItems)
+ throws Exception
+ {
+ PurchaseOrderDocument poDoc = PurchaseOrderDocument.Factory.newInstance();
+ PurchaseOrderDocument.PurchaseOrder po = poDoc.addNewPurchaseOrder();
+
+ Shipper shipper = po.addNewShipper();
+ shipper.setPerOunceRate(new BigDecimal(0.744325345));
+ shipper.setName("ZipShip: twenty four characters");
+
+ int liNo = Integer.parseInt(numberOfLineItems);
+ for(int i = 0; i<liNo; i++)
+ {
+ LineItem lineItem = po.addNewLineItem();
+ lineItem.setQuantity(2);
+ lineItem.setPrice(21.7945342);
+ lineItem.setPerUnitOunces(new BigDecimal(5));
+ lineItem.setDescription("Fischer Black and the Revolutionary Idea of Finance");
+ }
+
+ Customer cust = po.addNewCustomer();
+ cust.setAddress("12314 Murkyloshevichy, Anytown, PA");
+ cust.setName("Gladys Kravitz Steve Kilisky, Senior Product Manager, AdobeEffects");
+
+ po.setDate(new XmlCalendar("2003-01-07T14:16:00-05:00"));
+
+// System.out.println("CreateOnly: " + poDoc);
+ }
+ }
+
+ public static class CreateAndSave
+ extends Utils.ParseFile
+ {
+ public void execute(String numberOfLineItems)
+ throws Exception
+ {
+ PurchaseOrderDocument poDoc = PurchaseOrderDocument.Factory.newInstance();
+ PurchaseOrderDocument.PurchaseOrder po = poDoc.addNewPurchaseOrder();
+
+ Shipper shipper = po.addNewShipper();
+ shipper.setPerOunceRate(new BigDecimal(0.744325345));
+ shipper.setName("ZipShip: twenty four characters");
+
+ int liNo = Integer.parseInt(numberOfLineItems);
+ for(int i = 0; i<liNo; i++)
+ {
+ LineItem lineItem = po.addNewLineItem();
+ lineItem.setQuantity(2);
+ lineItem.setPrice(21.7945342);
+ lineItem.setPerUnitOunces(new BigDecimal(5));
+ lineItem.setDescription("Fischer Black and the Revolutionary Idea of Finance");
+ }
+
+ Customer cust = po.addNewCustomer();
+ cust.setAddress("12314 Murkyloshevichy, Anytown, PA");
+ cust.setName("Gladys Kravitz Steve Kilisky, Senior Product Manager, AdobeEffects");
+
+ po.setDate(new XmlCalendar("2003-01-07T14:16:00-05:00"));
+
+// System.out.println("CreateOnly: " + poDoc);
+
+ poDoc.save(new Utils.NullOutputStream());
+ }
+ }
+}
Modified: xmlbeans/trunk/test/perf/src/org/apache/xmlbeans/test/performance/utils/Constants.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/perf/src/org/apache/xmlbeans/test/performance/utils/Constants.java?rev=279672&r1=279671&r2=279672&view=diff
==============================================================================
--- xmlbeans/trunk/test/perf/src/org/apache/xmlbeans/test/performance/utils/Constants.java (original)
+++ xmlbeans/trunk/test/perf/src/org/apache/xmlbeans/test/performance/utils/Constants.java Thu Sep 8 16:18:37 2005
@@ -36,6 +36,7 @@
// schema instances
public static final String XSD_DIR = System.getProperty("PERF_ROOT")+P+"cases"+P+"xsd";
+ public static final String XML_DIR = System.getProperty("PERF_ROOT")+P+"cases"+P+"xml";
public static final String PO_XSD = XSD_DIR+P+"purchase-order.xsd";
public static final String PO_INSTANCE_1 = XSD_DIR+P+"purchase-order-1.xml";
public static final String PO_INSTANCE_2 = XSD_DIR+P+"purchase-order-2.xml";
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org