Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2012-05-02 12:43:32 +0000
committerStefan Winkler2012-05-02 12:43:32 +0000
commit1962c1f5fb57cecb27c26955ef1dd0eadbc524ce (patch)
tree172fac4f380a73c50a873a83e27dc75b07150c43 /plugins/org.eclipse.emf.cdo.tests.db
parentd0d768d4f034ff8bf7c1e6859e5867e87fe1c59e (diff)
downloadcdo-1962c1f5fb57cecb27c26955ef1dd0eadbc524ce.tar.gz
cdo-1962c1f5fb57cecb27c26955ef1dd0eadbc524ce.tar.xz
cdo-1962c1f5fb57cecb27c26955ef1dd0eadbc524ce.zip
[377727] [DB] rawReplication of BLOB in mySQL wrong
https://bugs.eclipse.org/bugs/show_bug.cgi?id=377727 Created Testcase to reproduce the issue
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/Bugzilla_377727_Test.java104
1 files changed, 104 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_377727_Test.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_377727_Test.java
new file mode 100644
index 0000000000..5a74d99886
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/Bugzilla_377727_Test.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2004 - 2012 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.common.CDOCommonRepository;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig;
+import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig.OfflineConfig;
+import org.eclipse.emf.cdo.tests.model1.Category;
+import org.eclipse.emf.cdo.tests.model3.Class1;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.net4j.util.concurrent.ConcurrencyUtil;
+import org.eclipse.net4j.util.io.IOUtil;
+
+import java.util.Map;
+
+/**
+ * @author Stefan Winkler
+ */
+public class Bugzilla_377727_Test extends AbstractCDOTest
+{
+ @Override
+ public synchronized Map<String, Object> getTestProperties()
+ {
+ Map<String, Object> testProperties = super.getTestProperties();
+ testProperties.put(OfflineConfig.PROP_TEST_RAW_REPLICATION, Boolean.TRUE);
+ return testProperties;
+ }
+
+ @Requires(RepositoryConfig.CAPABILITY_OFFLINE)
+ @CleanRepositoriesBefore
+ public void testAsyncPackages() throws Exception
+ {
+ CDOID id1;
+ CDOID id2;
+
+ IOUtil.OUT().println("=== Disconnect clone ===");
+
+ // disconnect clone from master
+ ((OfflineConfig)getRepositoryConfig()).stopMasterTransport();
+ ConcurrencyUtil.sleep(1000L);
+ while (getRepository().getState() == CDOCommonRepository.State.ONLINE)
+ {
+ ConcurrencyUtil.sleep(250L);
+ }
+
+ IOUtil.OUT().println("=== Clone is disconnected ===");
+
+ {
+ // on disconnected master
+ CDOSession session = openSession("master");
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource(getResourcePath("test"));
+
+ Class1 c1 = getModel3Factory().createClass1();
+ resource.getContents().add(c1);
+ id1 = CDOUtil.getCDOObject(c1).cdoID();
+
+ Category cat1 = getModel1Factory().createCategory();
+ cat1.setName("Test");
+ resource.getContents().add(cat1);
+ id2 = CDOUtil.getCDOObject(cat1).cdoID();
+
+ transaction.commit();
+ transaction.close();
+ session.close();
+ }
+
+ // reconnect clone and let sync
+ IOUtil.OUT().println("=== reconnect clone ===");
+
+ ((OfflineConfig)getRepositoryConfig()).startMasterTransport();
+ while (getRepository().getState() != CDOCommonRepository.State.ONLINE)
+ {
+ ConcurrencyUtil.sleep(250L);
+ }
+
+ IOUtil.OUT().println("=== Clone is reconnected ===");
+
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+ CDOResource resource = view.getResource(getResourcePath("test"));
+
+ Class1 c1 = (Class1)resource.getContents().get(0);
+ assertEquals(id1, CDOUtil.getCDOObject(c1).cdoID());
+
+ Category cat = (Category)resource.getContents().get(1);
+ assertEquals(id2, CDOUtil.getCDOObject(cat).cdoID());
+ }
+}

Back to the top