Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-10-08 04:31:31 +0000
committerEike Stepper2011-10-08 04:31:31 +0000
commit075cb3c4d329ee29b7375c7b253e0ba9894f55d9 (patch)
treec7d7c772c17a53af3d2fbb450bc72c08af369421 /plugins/org.eclipse.emf.cdo.tests.db
parent634e32e5d2d8f586e204a0f2e83cf9d9ac2e806c (diff)
downloadcdo-075cb3c4d329ee29b7375c7b253e0ba9894f55d9.tar.gz
cdo-075cb3c4d329ee29b7375c7b253e0ba9894f55d9.tar.xz
cdo-075cb3c4d329ee29b7375c7b253e0ba9894f55d9.zip
[351078] [DB] Support raw replication in HorizontalBranchingMappingStrategyWithRanges
https://bugs.eclipse.org/bugs/show_bug.cgi?id=351078
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests.db')
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_351078_DB_Test.java77
2 files changed, 78 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java
index f7bd71af25..f5f207c5ff 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java
@@ -18,7 +18,6 @@ import org.eclipse.emf.cdo.tests.offline.Bugzilla_325097_Test;
import org.eclipse.emf.cdo.tests.offline.Bugzilla_326047_Test;
import org.eclipse.emf.cdo.tests.offline.Bugzilla_328352_Test;
import org.eclipse.emf.cdo.tests.offline.Bugzilla_329014_Test;
-import org.eclipse.emf.cdo.tests.offline.Bugzilla_351078_Test;
import org.eclipse.emf.cdo.tests.offline.FailoverTest;
import org.eclipse.emf.cdo.tests.offline.OfflineDelayedTest;
import org.eclipse.emf.cdo.tests.offline.OfflineLockRawReplicationTest;
@@ -65,7 +64,7 @@ public class AllTestsDBH2Offline extends DBConfigs
testClasses.add(Bugzilla_326047_Test.class);
testClasses.add(Bugzilla_325097_Test.class);
testClasses.add(Bugzilla_319552_Test.class);
- testClasses.add(Bugzilla_351078_Test.class);
+ testClasses.add(Bugzilla_351078_DB_Test.class);
testClasses.add(FailoverTest.class);
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_351078_DB_Test.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_351078_DB_Test.java
new file mode 100644
index 0000000000..3d3499e20f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_351078_DB_Test.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.db;
+
+import org.eclipse.emf.cdo.server.db.IDBStore;
+import org.eclipse.emf.cdo.server.db.mapping.IClassMapping;
+import org.eclipse.emf.cdo.server.db.mapping.IListMapping;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
+import org.eclipse.emf.cdo.tests.model1.Company;
+import org.eclipse.emf.cdo.tests.offline.Bugzilla_351078_Test;
+
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.ddl.IDBTable;
+import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+
+import java.io.ByteArrayOutputStream;
+import java.sql.Connection;
+import java.util.Arrays;
+
+/**
+ * @author Eike Stepper
+ */
+public class Bugzilla_351078_DB_Test extends Bugzilla_351078_Test
+{
+ @Override
+ protected void check(InternalRepository master, Company masterCompany, String when)
+ {
+ super.check(master, masterCompany, when);
+
+ H2OfflineConfig config = (H2OfflineConfig)getRepositoryConfig();
+ if (config.isWithRanges())
+ {
+ byte[] masterTable = readTable(master);
+ byte[] cloneTable = readTable(getRepository());
+
+ assertEquals(true, Arrays.equals(masterTable, cloneTable));
+ }
+ }
+
+ protected byte[] readTable(InternalRepository repository)
+ {
+ IDBStore store = (IDBStore)repository.getStore();
+ IClassMapping classMapping = store.getMappingStrategy().getClassMapping(getModel1Package().getCompany());
+ IListMapping listMapping = classMapping.getListMapping(getModel1Package().getCompany_Categories());
+ IDBTable table = listMapping.getDBTables().iterator().next();
+
+ Connection connection = null;
+
+ try
+ {
+ connection = store.getConnection();
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ DBUtil.serializeTable(new ExtendedDataOutputStream(out), connection, table, null,
+ " ORDER BY CDO_SOURCE, CDO_BRANCH, CDO_VERSION_ADDED, CDO_IDX");
+
+ return out.toByteArray();
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ finally
+ {
+ DBUtil.close(connection);
+ }
+ }
+}

Back to the top