summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-05-11 07:11:56 (EDT)
committerEike Stepper2008-05-11 07:11:56 (EDT)
commit4b0a9726955bcca76bba07bc6f30ece1ecf83720 (patch)
tree22f3e291b150a543d3ba7a2cd07f9f14dd3bf3cb
parent56c8d531c3970c261276f98fb7ef96a4924a8113 (diff)
downloadcdo-4b0a9726955bcca76bba07bc6f30ece1ecf83720.zip
cdo-4b0a9726955bcca76bba07bc6f30ece1ecf83720.tar.gz
cdo-4b0a9726955bcca76bba07bc6f30ece1ecf83720.tar.bz2
Added store test framework
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCommitCompany.txt146
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateMango.txt33
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateModel1.txt138
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateModel2.txt155
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateModel3.txt27
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/DBStoreHorizontalTest.java157
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/TestLogic.java107
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/IDBSchema.java7
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java58
12 files changed, 817 insertions, 54 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
index ea998be..b9bca93 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
@@ -204,8 +204,7 @@ public class DBStore extends LongIDStore implements IDBStore
if (createdTables.contains(CDODBSchema.REPOSITORY))
{
// First start
- DBUtil.insertRow(connection, dbAdapter, CDODBSchema.REPOSITORY, 1, System.currentTimeMillis(), 0, CRASHED,
- CRASHED);
+ DBUtil.insertRow(connection, dbAdapter, CDODBSchema.REPOSITORY, 1, getStartupTime(), 0, CRASHED, CRASHED);
MappingStrategy mappingStrategy = (MappingStrategy)getMappingStrategy();
@@ -238,7 +237,7 @@ public class DBStore extends LongIDStore implements IDBStore
builder.append("+1, ");
builder.append(CDODBSchema.REPOSITORY_STARTED);
builder.append("=");
- builder.append(System.currentTimeMillis());
+ builder.append(getStartupTime());
builder.append(", ");
builder.append(CDODBSchema.REPOSITORY_STOPPED);
builder.append("=0, ");
@@ -286,7 +285,7 @@ public class DBStore extends LongIDStore implements IDBStore
builder.append(" SET ");
builder.append(CDODBSchema.REPOSITORY_STOPPED);
builder.append("=");
- builder.append(System.currentTimeMillis());
+ builder.append(getShutdownTime());
builder.append(", ");
builder.append(CDODBSchema.REPOSITORY_NEXT_CDOID);
builder.append("=");
@@ -340,6 +339,16 @@ public class DBStore extends LongIDStore implements IDBStore
return new DBSchema(name);
}
+ protected long getStartupTime()
+ {
+ return System.currentTimeMillis();
+ }
+
+ protected long getShutdownTime()
+ {
+ return System.currentTimeMillis();
+ }
+
public static DBType getDBType(CDOType type)
{
if (type == CDOType.BOOLEAN || type == CDOType.BOOLEAN_OBJECT)
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
index 0e99e0c..e821ae9 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
@@ -168,6 +168,25 @@ public class Session extends Container<IView> implements ISession, CDOIDProvider
return view;
}
+ /**
+ * For tests only.
+ */
+ public Transaction openTransaction(int viewID, final long timeStamp)
+ {
+ Transaction transaction = new Transaction(this, viewID)
+ {
+ @Override
+ protected long createTimeStamp()
+ {
+ return timeStamp;
+ }
+ };
+
+ views.put(viewID, transaction);
+ fireElementAddedEvent(transaction);
+ return transaction;
+ }
+
private IView createView(int viewID, CDOProtocolView.Type type)
{
if (type == CDOProtocolView.Type.TRANSACTION)
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java
index cc494db..dcd21de 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java
@@ -164,7 +164,7 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
public void commit(CDOPackage[] newPackages, CDORevision[] newObjects, CDORevisionDelta[] dirtyObjectDeltas)
{
- timeStamp = System.currentTimeMillis();
+ timeStamp = createTimeStamp();
this.newPackages = newPackages;
this.newObjects = newObjects;
this.dirtyObjectDeltas = dirtyObjectDeltas;
@@ -187,6 +187,11 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
}
}
+ protected long createTimeStamp()
+ {
+ return System.currentTimeMillis();
+ }
+
public void postCommit(boolean success)
{
try
diff --git a/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCommitCompany.txt b/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCommitCompany.txt
new file mode 100644
index 0000000..aa42472
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCommitCompany.txt
@@ -0,0 +1,146 @@
+CDOResource
+===========
+[1, 0, -2, 12345, 0, 0, 0, 0, /res1]
+
+Company
+=======
+[2, 0, 2, 12345, 0, 0, 0, 0, Sympedia, Homestr. 17, Berlin]
+
+cdo_classes
+===========
+[1, 1, 0, Address, false]
+[2, 1, 1, Company, false]
+[3, 1, 2, Supplier, false]
+[4, 1, 3, Customer, false]
+[5, 1, 4, Order, false]
+[6, 1, 5, OrderDetail, false]
+[7, 1, 6, PurchaseOrder, false]
+[8, 1, 7, SalesOrder, false]
+[9, 1, 8, Category, false]
+[10, 1, 9, Product, false]
+[11, 1, 10, OrderAddress, false]
+
+cdo_supertypes
+==============
+[2, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 0]
+[3, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 0]
+[4, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 0]
+[7, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 4]
+[8, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 4]
+[11, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 0]
+[11, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 4]
+[11, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 5]
+
+cdo_features
+============
+[1, 1, 0, name, 50, null, 0, false, false, 0]
+[2, 1, 1, street, 50, null, 0, false, false, 1]
+[3, 1, 2, city, 50, null, 0, false, false, 2]
+[4, 2, 3, categories, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 8, true, true, 3]
+[5, 2, 4, suppliers, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 2, true, true, 4]
+[6, 2, 5, customers, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 3, true, true, 5]
+[7, 2, 6, purchaseOrders, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 6, true, true, 6]
+[8, 2, 7, salesOrders, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 7, true, true, 7]
+[9, 3, 3, purchaseOrders, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 6, true, false, 3]
+[10, 3, 4, preferred, 22, null, 0, false, false, 4]
+[11, 4, 3, salesOrders, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 7, true, false, 3]
+[12, 5, 0, orderDetails, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 5, true, true, 0]
+[13, 6, 0, order, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 4, false, false, 0]
+[14, 6, 1, product, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 9, false, false, 1]
+[15, 6, 2, price, 37, null, 0, false, false, 2]
+[16, 7, 1, date, 29, null, 0, false, false, 1]
+[17, 7, 2, supplier, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 2, false, false, 2]
+[18, 8, 1, id, 39, null, 0, false, false, 1]
+[19, 8, 2, customer, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 3, false, false, 2]
+[20, 9, 0, name, 50, null, 0, false, false, 0]
+[21, 9, 1, categories, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 8, true, true, 1]
+[22, 9, 2, products, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 9, true, true, 2]
+[23, 10, 0, name, 50, null, 0, false, false, 0]
+[24, 10, 1, orderDetails, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 5, true, false, 1]
+[25, 10, 2, vat, 999, null, 0, false, false, 2]
+[26, 11, 7, testAttribute, 22, null, 0, false, false, 7]
+
+cdo_repository
+==============
+[1, 1, 0, -1, -1]
+
+cdo_packages
+============
+[1, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, model1, <?xml version="1.0" encoding="ASCII"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model1" nsURI="http://www.eclipse.org/emf/CDO/tests/model1/1.0.0" nsPrefix="model1">
+ <eClassifiers xsi:type="ecore:EClass" name="Address">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="street">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="city">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Company" eSuperTypes="//Address">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="categories" upperBound="-1" eType="//Category" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="suppliers" upperBound="-1" eType="//Supplier" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="customers" upperBound="-1" eType="//Customer" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="purchaseOrders" upperBound="-1" eType="//PurchaseOrder" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="salesOrders" upperBound="-1" eType="//SalesOrder" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Supplier" eSuperTypes="//Address">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="purchaseOrders" upperBound="-1" eType="//PurchaseOrder" eOpposite="//PurchaseOrder/supplier"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="preferred" defaultValueLiteral="true">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EBoolean"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Customer" eSuperTypes="//Address">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="salesOrders" unique="false" upperBound="-1" eType="//SalesOrder" eOpposite="//SalesOrder/customer"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Order">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="orderDetails" upperBound="-1" eType="//OrderDetail" containment="true" resolveProxies="false" eOpposite="//OrderDetail/order"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="OrderDetail">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="order" lowerBound="1" eType="//Order" resolveProxies="false" eOpposite="//Order/orderDetails"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="product" eType="//Product" eOpposite="//Product/orderDetails"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="price">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EFloat"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="PurchaseOrder" eSuperTypes="//Order">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="date">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EDate"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="supplier" lowerBound="1" eType="//Supplier" eOpposite="//Supplier/purchaseOrders"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="SalesOrder" eSuperTypes="//Order">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="id">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="customer" lowerBound="1" eType="//Customer" eOpposite="//Customer/salesOrders"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Category">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="categories" upperBound="-1" eType="//Category" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="products" upperBound="-1" eType="//Product" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Product">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="orderDetails" upperBound="-1" eType="//OrderDetail" eOpposite="//OrderDetail/product"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="vat" eType="//VAT" defaultValueLiteral="vat15"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="OrderAddress" eSuperTypes="//Address //Order //OrderDetail">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="testAttribute">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EBoolean"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="VAT">
+ <eLiterals name="vat0"/>
+ <eLiterals name="vat7" value="7"/>
+ <eLiterals name="vat15" value="15"/>
+ </eClassifiers>
+</ecore:EPackage>
+, false, 1, 76, null]
+
diff --git a/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateMango.txt b/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateMango.txt
new file mode 100644
index 0000000..759a095
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateMango.txt
@@ -0,0 +1,33 @@
+cdo_classes
+===========
+[1, 1, 0, ValueList, false]
+[2, 1, 1, Value, false]
+
+cdo_features
+============
+[1, 1, 0, name, 50, null, 0, false, false, 0]
+[2, 1, 1, values, 10, http://www.eclipse.org/emf/CDO/tests/mango, 1, true, false, 1]
+[3, 2, 0, name, 50, null, 0, false, false, 0]
+
+cdo_repository
+==============
+[1, 1, 0, -1, -1]
+
+cdo_packages
+============
+[1, http://www.eclipse.org/emf/CDO/tests/mango, mango, <?xml version="1.0" encoding="ASCII"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mango" nsURI="http://www.eclipse.org/emf/CDO/tests/mango" nsPrefix="mango">
+ <eClassifiers xsi:type="ecore:EClass" name="ValueList">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
+ <eType xsi:type="ecore:EDataType" href="../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="values" upperBound="-1" eType="//Value"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Value">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
+ <eType xsi:type="ecore:EDataType" href="../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+</ecore:EPackage>
+, false, 1, 9, null]
+
diff --git a/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateModel1.txt b/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateModel1.txt
new file mode 100644
index 0000000..d0239b5
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateModel1.txt
@@ -0,0 +1,138 @@
+cdo_classes
+===========
+[1, 1, 0, Address, false]
+[2, 1, 1, Company, false]
+[3, 1, 2, Supplier, false]
+[4, 1, 3, Customer, false]
+[5, 1, 4, Order, false]
+[6, 1, 5, OrderDetail, false]
+[7, 1, 6, PurchaseOrder, false]
+[8, 1, 7, SalesOrder, false]
+[9, 1, 8, Category, false]
+[10, 1, 9, Product, false]
+[11, 1, 10, OrderAddress, false]
+
+cdo_supertypes
+==============
+[2, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 0]
+[3, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 0]
+[4, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 0]
+[7, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 4]
+[8, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 4]
+[11, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 0]
+[11, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 4]
+[11, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 5]
+
+cdo_features
+============
+[1, 1, 0, name, 50, null, 0, false, false, 0]
+[2, 1, 1, street, 50, null, 0, false, false, 1]
+[3, 1, 2, city, 50, null, 0, false, false, 2]
+[4, 2, 3, categories, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 8, true, true, 3]
+[5, 2, 4, suppliers, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 2, true, true, 4]
+[6, 2, 5, customers, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 3, true, true, 5]
+[7, 2, 6, purchaseOrders, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 6, true, true, 6]
+[8, 2, 7, salesOrders, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 7, true, true, 7]
+[9, 3, 3, purchaseOrders, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 6, true, false, 3]
+[10, 3, 4, preferred, 22, null, 0, false, false, 4]
+[11, 4, 3, salesOrders, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 7, true, false, 3]
+[12, 5, 0, orderDetails, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 5, true, true, 0]
+[13, 6, 0, order, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 4, false, false, 0]
+[14, 6, 1, product, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 9, false, false, 1]
+[15, 6, 2, price, 37, null, 0, false, false, 2]
+[16, 7, 1, date, 29, null, 0, false, false, 1]
+[17, 7, 2, supplier, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 2, false, false, 2]
+[18, 8, 1, id, 39, null, 0, false, false, 1]
+[19, 8, 2, customer, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 3, false, false, 2]
+[20, 9, 0, name, 50, null, 0, false, false, 0]
+[21, 9, 1, categories, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 8, true, true, 1]
+[22, 9, 2, products, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 9, true, true, 2]
+[23, 10, 0, name, 50, null, 0, false, false, 0]
+[24, 10, 1, orderDetails, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 5, true, false, 1]
+[25, 10, 2, vat, 999, null, 0, false, false, 2]
+[26, 11, 7, testAttribute, 22, null, 0, false, false, 7]
+
+cdo_repository
+==============
+[1, 1, 0, -1, -1]
+
+cdo_packages
+============
+[1, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, model1, <?xml version="1.0" encoding="ASCII"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model1" nsURI="http://www.eclipse.org/emf/CDO/tests/model1/1.0.0" nsPrefix="model1">
+ <eClassifiers xsi:type="ecore:EClass" name="Address">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="street">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="city">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Company" eSuperTypes="//Address">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="categories" upperBound="-1" eType="//Category" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="suppliers" upperBound="-1" eType="//Supplier" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="customers" upperBound="-1" eType="//Customer" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="purchaseOrders" upperBound="-1" eType="//PurchaseOrder" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="salesOrders" upperBound="-1" eType="//SalesOrder" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Supplier" eSuperTypes="//Address">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="purchaseOrders" upperBound="-1" eType="//PurchaseOrder" eOpposite="//PurchaseOrder/supplier"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="preferred" defaultValueLiteral="true">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EBoolean"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Customer" eSuperTypes="//Address">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="salesOrders" unique="false" upperBound="-1" eType="//SalesOrder" eOpposite="//SalesOrder/customer"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Order">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="orderDetails" upperBound="-1" eType="//OrderDetail" containment="true" resolveProxies="false" eOpposite="//OrderDetail/order"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="OrderDetail">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="order" lowerBound="1" eType="//Order" resolveProxies="false" eOpposite="//Order/orderDetails"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="product" eType="//Product" eOpposite="//Product/orderDetails"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="price">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EFloat"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="PurchaseOrder" eSuperTypes="//Order">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="date">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EDate"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="supplier" lowerBound="1" eType="//Supplier" eOpposite="//Supplier/purchaseOrders"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="SalesOrder" eSuperTypes="//Order">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="id">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="customer" lowerBound="1" eType="//Customer" eOpposite="//Customer/salesOrders"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Category">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="categories" upperBound="-1" eType="//Category" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="products" upperBound="-1" eType="//Product" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Product">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="orderDetails" upperBound="-1" eType="//OrderDetail" eOpposite="//OrderDetail/product"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="vat" eType="//VAT" defaultValueLiteral="vat15"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="OrderAddress" eSuperTypes="//Address //Order //OrderDetail">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="testAttribute">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EBoolean"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="VAT">
+ <eLiterals name="vat0"/>
+ <eLiterals name="vat7" value="7"/>
+ <eLiterals name="vat15" value="15"/>
+ </eClassifiers>
+</ecore:EPackage>
+, false, 1, 76, null]
+
diff --git a/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateModel2.txt b/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateModel2.txt
new file mode 100644
index 0000000..d74e472
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateModel2.txt
@@ -0,0 +1,155 @@
+cdo_classes
+===========
+[1, 1, 0, Address, false]
+[2, 1, 1, Company, false]
+[3, 1, 2, Supplier, false]
+[4, 1, 3, Customer, false]
+[5, 1, 4, Order, false]
+[6, 1, 5, OrderDetail, false]
+[7, 1, 6, PurchaseOrder, false]
+[8, 1, 7, SalesOrder, false]
+[9, 1, 8, Category, false]
+[10, 1, 9, Product, false]
+[11, 1, 10, OrderAddress, false]
+[12, 2, 0, SpecialPurchaseOrder, false]
+
+cdo_supertypes
+==============
+[2, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 0]
+[3, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 0]
+[4, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 0]
+[7, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 4]
+[8, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 4]
+[11, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 0]
+[11, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 4]
+[11, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 5]
+[12, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 6]
+
+cdo_features
+============
+[1, 1, 0, name, 50, null, 0, false, false, 0]
+[2, 1, 1, street, 50, null, 0, false, false, 1]
+[3, 1, 2, city, 50, null, 0, false, false, 2]
+[4, 2, 3, categories, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 8, true, true, 3]
+[5, 2, 4, suppliers, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 2, true, true, 4]
+[6, 2, 5, customers, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 3, true, true, 5]
+[7, 2, 6, purchaseOrders, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 6, true, true, 6]
+[8, 2, 7, salesOrders, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 7, true, true, 7]
+[9, 3, 3, purchaseOrders, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 6, true, false, 3]
+[10, 3, 4, preferred, 22, null, 0, false, false, 4]
+[11, 4, 3, salesOrders, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 7, true, false, 3]
+[12, 5, 0, orderDetails, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 5, true, true, 0]
+[13, 6, 0, order, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 4, false, false, 0]
+[14, 6, 1, product, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 9, false, false, 1]
+[15, 6, 2, price, 37, null, 0, false, false, 2]
+[16, 7, 1, date, 29, null, 0, false, false, 1]
+[17, 7, 2, supplier, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 2, false, false, 2]
+[18, 8, 1, id, 39, null, 0, false, false, 1]
+[19, 8, 2, customer, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 3, false, false, 2]
+[20, 9, 0, name, 50, null, 0, false, false, 0]
+[21, 9, 1, categories, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 8, true, true, 1]
+[22, 9, 2, products, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 9, true, true, 2]
+[23, 10, 0, name, 50, null, 0, false, false, 0]
+[24, 10, 1, orderDetails, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 5, true, false, 1]
+[25, 10, 2, vat, 999, null, 0, false, false, 2]
+[26, 11, 7, testAttribute, 22, null, 0, false, false, 7]
+[27, 12, 3, discountCode, 50, null, 0, false, false, 3]
+[28, 12, 4, shippingAddress, 10, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, 0, false, true, 4]
+
+cdo_repository
+==============
+[1, 1, 0, -1, -1]
+
+cdo_packages
+============
+[1, http://www.eclipse.org/emf/CDO/tests/model1/1.0.0, model1, <?xml version="1.0" encoding="ASCII"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model1" nsURI="http://www.eclipse.org/emf/CDO/tests/model1/1.0.0" nsPrefix="model1">
+ <eClassifiers xsi:type="ecore:EClass" name="Address">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="street">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="city">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Company" eSuperTypes="//Address">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="categories" upperBound="-1" eType="//Category" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="suppliers" upperBound="-1" eType="//Supplier" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="customers" upperBound="-1" eType="//Customer" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="purchaseOrders" upperBound="-1" eType="//PurchaseOrder" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="salesOrders" upperBound="-1" eType="//SalesOrder" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Supplier" eSuperTypes="//Address">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="purchaseOrders" upperBound="-1" eType="//PurchaseOrder" eOpposite="//PurchaseOrder/supplier"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="preferred" defaultValueLiteral="true">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EBoolean"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Customer" eSuperTypes="//Address">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="salesOrders" unique="false" upperBound="-1" eType="//SalesOrder" eOpposite="//SalesOrder/customer"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Order">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="orderDetails" upperBound="-1" eType="//OrderDetail" containment="true" resolveProxies="false" eOpposite="//OrderDetail/order"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="OrderDetail">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="order" lowerBound="1" eType="//Order" resolveProxies="false" eOpposite="//Order/orderDetails"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="product" eType="//Product" eOpposite="//Product/orderDetails"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="price">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EFloat"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="PurchaseOrder" eSuperTypes="//Order">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="date">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EDate"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="supplier" lowerBound="1" eType="//Supplier" eOpposite="//Supplier/purchaseOrders"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="SalesOrder" eSuperTypes="//Order">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="id">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EInt"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="customer" lowerBound="1" eType="//Customer" eOpposite="//Customer/salesOrders"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Category">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="categories" upperBound="-1" eType="//Category" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="products" upperBound="-1" eType="//Product" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Product">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="orderDetails" upperBound="-1" eType="//OrderDetail" eOpposite="//OrderDetail/product"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="vat" eType="//VAT" defaultValueLiteral="vat15"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="OrderAddress" eSuperTypes="//Address //Order //OrderDetail">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="testAttribute">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EBoolean"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="VAT">
+ <eLiterals name="vat0"/>
+ <eLiterals name="vat7" value="7"/>
+ <eLiterals name="vat15" value="15"/>
+ </eClassifiers>
+</ecore:EPackage>
+, false, 1, 76, null]
+[2, http://www.eclipse.org/emf/CDO/tests/model2/1.0.0, model2, <?xml version="1.0" encoding="ASCII"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model2" nsURI="http://www.eclipse.org/emf/CDO/tests/model2/1.0.0" nsPrefix="model2">
+ <eClassifiers xsi:type="ecore:EClass" name="SpecialPurchaseOrder">
+ <eSuperTypes href="../model1/1.0.0#//PurchaseOrder"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="discountCode">
+ <eType xsi:type="ecore:EDataType" href="../../../2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="shippingAddress" containment="true" resolveProxies="false">
+ <eType xsi:type="ecore:EClass" href="../model1/1.0.0#//Address"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+</ecore:EPackage>
+, false, 77, 83, null]
+
diff --git a/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateModel3.txt b/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateModel3.txt
new file mode 100644
index 0000000..93dcfee
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/defs/horizontal/verifyCreateModel3.txt
@@ -0,0 +1,27 @@
+cdo_classes
+===========
+[1, 1, 0, Class1, false]
+
+cdo_features
+============
+[1, 1, 0, class2, 10, http://www.eclipse.org/emf/CDO/tests/subpackage/1.0.0, 0, true, false, 0]
+
+cdo_repository
+==============
+[1, 1, 0, -1, -1]
+
+cdo_packages
+============
+[1, http://www.eclipse.org/emf/CDO/tests/model3/1.0.0, model3, <?xml version="1.0" encoding="ASCII"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model3" nsURI="http://www.eclipse.org/emf/CDO/tests/model3/1.0.0" nsPrefix="model3">
+ <eClassifiers xsi:type="ecore:EClass" name="Class1">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="class2" upperBound="-1" eType="//subpackage/Class2" eOpposite="//subpackage/Class2/class1"/>
+ </eClassifiers>
+ <eSubpackages name="subpackage" nsURI="http://www.eclipse.org/emf/CDO/tests/subpackage/1.0.0" nsPrefix="subpackage">
+ <eClassifiers xsi:type="ecore:EClass" name="Class2">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="class1" upperBound="-1" eType="//Class1" eOpposite="//Class1/class2"/>
+ </eClassifiers>
+ </eSubpackages>
+</ecore:EPackage>
+, false, 1, 8, null]
+
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/DBStoreHorizontalTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/DBStoreHorizontalTest.java
index 25a9c21..df3be6f 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/DBStoreHorizontalTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/DBStoreHorizontalTest.java
@@ -24,8 +24,18 @@ import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.hsqldb.HSQLDBDataSource;
import org.eclipse.net4j.db.internal.hsqldb.HSQLDBAdapter;
import org.eclipse.net4j.internal.db.DataSourceConnectionProvider;
+import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.WrappedException;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
@@ -37,6 +47,8 @@ import java.util.Map;
*/
public class DBStoreHorizontalTest extends TestLogic
{
+ private static final String DEFINITION_MODE = "";
+
private HorizontalMappingStrategy mappingStrategy;
private HSQLDBAdapter dbAdapter;
@@ -64,7 +76,15 @@ public class DBStoreHorizontalTest extends TestLogic
dbAdapter = createDBAdapter();
dbConnectionProvider = createDBConnectionProvider();
- store = new DBStore();
+ store = new DBStore()
+ {
+ @Override
+ protected long getStartupTime()
+ {
+ return 1;
+ }
+ };
+
store.setMappingStrategy(mappingStrategy);
store.setDbAdapter(dbAdapter);
store.setDbConnectionProvider(dbConnectionProvider);
@@ -96,13 +116,71 @@ public class DBStoreHorizontalTest extends TestLogic
return mappingStrategy;
}
- private void verifyRowCount(int expectedRows, String tableName)
+ private void defineOrCompare(String fileName) throws IOException
{
- int actuaRowsl = query("select count(*) from " + tableName);
- assertEquals("Rows in " + tableName.toUpperCase(), expectedRows, actuaRowsl);
+ File file = new File(fileName + ".txt");
+ if (fileName.equals(DEFINITION_MODE) || "*".equals(DEFINITION_MODE))
+ {
+ file.getParentFile().mkdirs();
+ PrintStream out = new PrintStream(file);
+ exportDatabase(out);
+ out.close();
+ }
+ else
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ exportDatabase(new PrintStream(baos));
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ FileInputStream fis = new FileInputStream(file);
+ compareLines(fileName, fis, bais);
+ }
}
- private int query(String sql)
+ private void compareLines(String fileName, InputStream expectedStream, InputStream actualStream) throws IOException
+ {
+ BufferedReader expectedReader = new BufferedReader(new InputStreamReader(expectedStream));
+ BufferedReader actualReader = new BufferedReader(new InputStreamReader(actualStream));
+
+ int line = 1;
+ while (true)
+ {
+ String expectedLine = expectedReader.readLine();
+ String actualLine = actualReader.readLine();
+ if (!ObjectUtil.equals(expectedLine, actualLine))
+ {
+ throw new IllegalStateException("Mismatch at (" + fileName + ":" + line + ")\n" + expectedLine + "\n"
+ + actualLine);
+ }
+
+ if (expectedLine == null)
+ {
+ break;
+ }
+
+ ++line;
+ }
+ }
+
+ private void exportDatabase(PrintStream out)
+ {
+ store.getDBSchema().export(dbConnectionProvider, out);
+ CDODBSchema.INSTANCE.export(dbConnectionProvider, out);
+ }
+
+ private void assertRowCount(int expectedRows, String tableName)
+ {
+ int actualRowsl = (Integer)query("select count(*) from " + tableName);
+ assertEquals("Rows in " + tableName.toUpperCase(), expectedRows, actualRowsl);
+ }
+
+ private void assertFieldValue(Object expectedValue, String sql)
+ {
+ Object actualValue = query(sql);
+ assertEquals("Field in " + sql, expectedValue, actualValue);
+ }
+
+ private Object query(String sql)
{
Connection connection = null;
Statement statement = null;
@@ -115,10 +193,10 @@ public class DBStoreHorizontalTest extends TestLogic
resultSet = statement.executeQuery(sql);
if (!resultSet.next())
{
- return 0;
+ throw new IllegalStateException("No row: " + sql.toUpperCase());
}
- return resultSet.getInt(1);
+ return resultSet.getObject(1);
}
catch (Exception ex)
{
@@ -133,42 +211,59 @@ public class DBStoreHorizontalTest extends TestLogic
}
@Override
- protected void verifyCreateModel1(Transaction transaction)
+ protected void verifyCreateModel1(Transaction transaction) throws Exception
+ {
+ defineOrCompare("defs/horizontal/verifyCreateModel1");
+ // assertRowCount(1, "cdo_repository");
+ // assertRowCount(1, "cdo_packages");
+ // assertRowCount(11, "cdo_classes");
+ // assertRowCount(8, "cdo_supertypes");
+ // assertRowCount(26, "cdo_features");
+ }
+
+ @Override
+ protected void verifyCreateModel2(Transaction transaction) throws Exception
{
- verifyRowCount(1, "cdo_repository");
- verifyRowCount(1, "cdo_packages");
- verifyRowCount(11, "cdo_classes");
- verifyRowCount(8, "cdo_supertypes");
- verifyRowCount(26, "cdo_features");
+ defineOrCompare("defs/horizontal/verifyCreateModel2");
+ // assertRowCount(1, "cdo_repository");
+ // assertRowCount(2, "cdo_packages");
+ // assertRowCount(12, "cdo_classes");
+ // assertRowCount(9, "cdo_supertypes");
+ // assertRowCount(28, "cdo_features");
}
@Override
- protected void verifyCreateModel2(Transaction transaction)
+ protected void verifyCreateModel3(Transaction transaction) throws Exception
{
- verifyRowCount(1, "cdo_repository");
- verifyRowCount(2, "cdo_packages");
- verifyRowCount(12, "cdo_classes");
- verifyRowCount(9, "cdo_supertypes");
- verifyRowCount(28, "cdo_features");
+ defineOrCompare("defs/horizontal/verifyCreateModel3");
+ // assertRowCount(1, "cdo_repository");
+ // assertRowCount(1, "cdo_packages");
+ // assertRowCount(1, "cdo_classes");
+ // assertRowCount(0, "cdo_supertypes");
+ // assertRowCount(1, "cdo_features");
}
@Override
- protected void verifyCreateModel3(Transaction transaction)
+ protected void verifyCreateMango(Transaction transaction) throws Exception
{
- verifyRowCount(1, "cdo_repository");
- verifyRowCount(1, "cdo_packages");
- verifyRowCount(1, "cdo_classes");
- verifyRowCount(0, "cdo_supertypes");
- verifyRowCount(1, "cdo_features");
+ defineOrCompare("defs/horizontal/verifyCreateMango");
+ // assertRowCount(1, "cdo_repository");
+ // assertRowCount(1, "cdo_packages");
+ // assertRowCount(2, "cdo_classes");
+ // assertRowCount(0, "cdo_supertypes");
+ // assertRowCount(3, "cdo_features");
}
@Override
- protected void verifyCreateMango(Transaction transaction)
+ protected void verifyCommitCompany(Transaction transaction) throws Exception
{
- verifyRowCount(1, "cdo_repository");
- verifyRowCount(1, "cdo_packages");
- verifyRowCount(2, "cdo_classes");
- verifyRowCount(0, "cdo_supertypes");
- verifyRowCount(3, "cdo_features");
+ defineOrCompare("defs/horizontal/verifyCommitCompany");
+ // assertRowCount(1, "CDOResource");
+ // assertFieldValue("/res1", "select path_0 from CDOResource where cdo_id=1 and cdo_version=1");
+ //
+ // assertRowCount(1, "Company");
+ // assertFieldValue("Sympedia", "select name from Company where cdo_id=1 and cdo_version=1");
+ // assertFieldValue("Homestr. 17", "select street from Company where cdo_id=1 and cdo_version=1");
+ // assertFieldValue("Berlin", "select city from Company where cdo_id=1 and cdo_version=1");
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/TestLogic.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/TestLogic.java
index 489f659..6b56251 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/TestLogic.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/TestLogic.java
@@ -10,15 +10,22 @@
**************************************************************************/
package org.eclipse.emf.cdo.tests.store;
+import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.internal.server.Repository;
import org.eclipse.emf.cdo.internal.server.Session;
import org.eclipse.emf.cdo.internal.server.Transaction;
import org.eclipse.emf.cdo.internal.server.Transaction.TransactionPackageManager;
import org.eclipse.emf.cdo.internal.server.protocol.CDOServerProtocol;
-import org.eclipse.emf.cdo.protocol.CDOProtocolView;
+import org.eclipse.emf.cdo.protocol.id.CDOID;
import org.eclipse.emf.cdo.protocol.id.CDOIDMetaRange;
+import org.eclipse.emf.cdo.protocol.id.CDOIDTemp;
+import org.eclipse.emf.cdo.protocol.id.CDOIDUtil;
+import org.eclipse.emf.cdo.protocol.model.CDOClass;
+import org.eclipse.emf.cdo.protocol.model.CDOFeature;
import org.eclipse.emf.cdo.protocol.model.CDOModelUtil;
import org.eclipse.emf.cdo.protocol.model.CDOPackage;
+import org.eclipse.emf.cdo.protocol.model.resource.CDOResourceClass;
+import org.eclipse.emf.cdo.protocol.model.resource.CDOResourcePackage;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.emf.cdo.protocol.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.server.IStore;
@@ -34,6 +41,7 @@ import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.net4j.tests.AbstractOMTest;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EcorePackage;
@@ -110,7 +118,7 @@ public abstract class TestLogic extends AbstractOMTest
template.dispose();
}
- protected abstract void verifyCreateModel1(Transaction transaction);
+ protected abstract void verifyCreateModel1(Transaction transaction) throws Exception;
public void testCreateModel2() throws Exception
{
@@ -122,7 +130,7 @@ public abstract class TestLogic extends AbstractOMTest
template.dispose();
}
- protected abstract void verifyCreateModel2(Transaction transaction);
+ protected abstract void verifyCreateModel2(Transaction transaction) throws Exception;
public void testCreateModel3() throws Exception
{
@@ -133,7 +141,7 @@ public abstract class TestLogic extends AbstractOMTest
template.dispose();
}
- protected abstract void verifyCreateModel3(Transaction transaction);
+ protected abstract void verifyCreateModel3(Transaction transaction) throws Exception;
public void testCreateMango() throws Exception
{
@@ -144,7 +152,27 @@ public abstract class TestLogic extends AbstractOMTest
template.dispose();
}
- protected abstract void verifyCreateMango(Transaction transaction);
+ protected abstract void verifyCreateMango(Transaction transaction) throws Exception;
+
+ public void testCommitCompany() throws Exception
+ {
+ CommitTemplate template = new CommitTemplate();
+ template.addNewPackage(Model1Package.eINSTANCE);
+
+ Revision resource = template.addNewResource(1);
+ resource.set("path", "/res1");
+
+ Revision company = template.addNewObject(2, Model1Package.eINSTANCE.getCompany());
+ company.set("name", "Sympedia");
+ company.set("street", "Homestr. 17");
+ company.set("city", "Berlin");
+
+ Transaction transaction = template.run();
+ verifyCommitCompany(transaction);
+ template.dispose();
+ }
+
+ protected abstract void verifyCommitCompany(Transaction transaction) throws Exception;
/**
* @author Eike Stepper
@@ -153,6 +181,8 @@ public abstract class TestLogic extends AbstractOMTest
{
private int viewID;
+ private long timeStamp;
+
private CDOServerProtocol protocol;
private Session session;
@@ -167,7 +197,13 @@ public abstract class TestLogic extends AbstractOMTest
public CommitTemplate()
{
- this(1);
+ this(1, 12345);
+ }
+
+ public CommitTemplate(int viewID, long timeStamp)
+ {
+ this.viewID = viewID;
+ this.timeStamp = timeStamp;
protocol = createProtocol();
session = repository.getSessionManager().openSession(protocol, true);
protocol.setInfraStructure(session);
@@ -175,11 +211,6 @@ public abstract class TestLogic extends AbstractOMTest
transaction.preCommit();
}
- public CommitTemplate(int viewID)
- {
- this.viewID = viewID;
- }
-
public Session getSession()
{
return session;
@@ -217,16 +248,34 @@ public abstract class TestLogic extends AbstractOMTest
}
TransactionPackageManager packageManager = transaction.getPackageManager();
- CDOPackage cdoPackage = CDOModelUtil.createPackage(packageManager, uri, name, ecore, dynamic, idRange, parentURI);
- ModelUtil.initializeCDOPackage(ePackage, cdoPackage);
- packageManager.addPackage(cdoPackage);
- newPackages.add(cdoPackage);
- return cdoPackage;
+ CDOPackage newPackage = CDOModelUtil.createPackage(packageManager, uri, name, ecore, dynamic, idRange, parentURI);
+ ModelUtil.initializeCDOPackage(ePackage, newPackage);
+ packageManager.addPackage(newPackage);
+ newPackages.add(newPackage);
+ return newPackage;
}
- public void addNewObject(CDORevision newObject)
+ public Revision addNewResource(int id)
{
+ CDOResourcePackage resourcePackage = repository.getPackageManager().getCDOResourcePackage();
+ CDOResourceClass resourceClass = resourcePackage.getCDOResourceClass();
+ return addRevision(id, resourceClass);
+ }
+
+ public Revision addNewObject(int id, EClass eClass)
+ {
+ String uri = eClass.getEPackage().getNsURI();
+ CDOPackage cdoPackage = transaction.getPackageManager().lookupPackage(uri);
+ CDOClass cdoClass = cdoPackage.lookupClass(eClass.getClassifierID());
+ return addRevision(id, cdoClass);
+ }
+
+ private Revision addRevision(int id, CDOClass cdoClass)
+ {
+ CDOIDTemp tempID = CDOIDUtil.createCDOIDTempObject(id);
+ Revision newObject = new Revision(cdoClass, tempID);
newObjects.add(newObject);
+ return newObject;
}
public void addDirtyObjectDelta(CDORevisionDelta dirtyObjectDelta)
@@ -241,7 +290,7 @@ public abstract class TestLogic extends AbstractOMTest
protected Transaction createTransaction(Session session)
{
- return (Transaction)session.openView(viewID, CDOProtocolView.Type.TRANSACTION);
+ return session.openTransaction(viewID, timeStamp);
}
private CDOPackage[] getNewPackages()
@@ -259,4 +308,26 @@ public abstract class TestLogic extends AbstractOMTest
return dirtyObjectDeltas.toArray(new CDORevisionDelta[dirtyObjectDeltas.size()]);
}
}
+
+ /**
+ * @author Eike Stepper
+ */
+ protected class Revision extends CDORevisionImpl
+ {
+ public Revision(CDOClass cdoClass, CDOID id)
+ {
+ super(repository.getRevisionManager(), cdoClass, id);
+ }
+
+ public void set(String featureName, Object value)
+ {
+ set(featureName, 0, value);
+ }
+
+ public void set(String featureName, int index, Object value)
+ {
+ CDOFeature cdoFeature = getCDOClass().lookupFeature(featureName);
+ set(cdoFeature, index, value);
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/IDBSchema.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/IDBSchema.java
index c4b4c65..fc82187 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/IDBSchema.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/IDBSchema.java
@@ -16,6 +16,7 @@ import org.eclipse.net4j.db.IDBConnectionProvider;
import javax.sql.DataSource;
+import java.io.PrintStream;
import java.sql.Connection;
import java.util.Set;
@@ -41,4 +42,10 @@ public interface IDBSchema extends IDBSchemaElement
public void drop(IDBAdapter dbAdapter, DataSource dataSource) throws DBException;
public void drop(IDBAdapter dbAdapter, IDBConnectionProvider connectionProvider) throws DBException;
+
+ public void export(Connection connection, PrintStream out) throws DBException;
+
+ public void export(DataSource dataSource, PrintStream out) throws DBException;
+
+ public void export(IDBConnectionProvider connectionProvider, PrintStream out) throws DBException;
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java
index d3e281e..93a0a70 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java
@@ -14,12 +14,15 @@ import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
+import org.eclipse.net4j.db.IDBRowHandler;
import org.eclipse.net4j.db.ddl.IDBSchema;
import org.eclipse.net4j.db.ddl.IDBTable;
import javax.sql.DataSource;
+import java.io.PrintStream;
import java.sql.Connection;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -138,6 +141,61 @@ public class DBSchema extends DBSchemaElement implements IDBSchema
}
}
+ public void export(Connection connection, PrintStream out) throws DBException
+ {
+ for (DBTable table : getTables())
+ {
+ export(table, connection, out);
+ }
+ }
+
+ private void export(final DBTable table, Connection connection, final PrintStream out)
+ {
+ if (DBUtil.select(connection, new IDBRowHandler()
+ {
+ public boolean handle(int row, Object... values)
+ {
+ if (row == 0)
+ {
+ String tableName = table.getName();
+ out.println(tableName);
+ for (int i = 0; i < tableName.length(); i++)
+ {
+ out.print("=");
+ }
+
+ out.println();
+ }
+
+ out.println(Arrays.asList(values));
+ return true;
+ }
+ }, table.getFields()) > 0)
+ {
+ out.println();
+ }
+ }
+
+ public void export(DataSource dataSource, PrintStream out) throws DBException
+ {
+ export(DBUtil.createConnectionProvider(dataSource), out);
+ }
+
+ public void export(IDBConnectionProvider connectionProvider, PrintStream out) throws DBException
+ {
+ Connection connection = null;
+
+ try
+ {
+ connection = connectionProvider.getConnection();
+ export(connection, out);
+ }
+ finally
+ {
+ DBUtil.close(connection);
+ }
+ }
+
void assertUnlocked() throws DBException
{
if (locked)