Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2018-04-24 00:54:08 -0400
committerEike Stepper2018-04-24 00:54:08 -0400
commit8d9891fd33bda115e575d274a04cf32746f3debc (patch)
tree39d4180a3e451a1089b50dd4431cf0420d39b4b8 /plugins/org.eclipse.emf.cdo.tests/src
parent5fe0848ec3ae550523f1204e11903f804adab999 (diff)
downloadcdo-8d9891fd33bda115e575d274a04cf32746f3debc.tar.gz
cdo-8d9891fd33bda115e575d274a04cf32746f3debc.tar.xz
cdo-8d9891fd33bda115e575d274a04cf32746f3debc.zip
[409351] CDOServerExporter throws IllegalArgumentException on DynamicValueHolder.NIL
https://bugs.eclipse.org/bugs/show_bug.cgi?id=409351
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BackupTest.java56
1 files changed, 55 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BackupTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BackupTest.java
index 25bdc07975..b3042e3a15 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BackupTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BackupTest.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.tests;
import org.eclipse.emf.cdo.common.lob.CDOBlob;
import org.eclipse.emf.cdo.common.lob.CDOClob;
+import org.eclipse.emf.cdo.common.revision.CDORevisionData;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.server.CDOServerExporter;
import org.eclipse.emf.cdo.server.CDOServerImporter;
@@ -21,6 +22,8 @@ import org.eclipse.emf.cdo.tests.bundle.OM;
import org.eclipse.emf.cdo.tests.model1.Customer;
import org.eclipse.emf.cdo.tests.model1.PurchaseOrder;
import org.eclipse.emf.cdo.tests.model1.SalesOrder;
+import org.eclipse.emf.cdo.tests.model2.Model2Package;
+import org.eclipse.emf.cdo.tests.model2.Unsettable1;
import org.eclipse.emf.cdo.tests.model3.File;
import org.eclipse.emf.cdo.tests.model3.Image;
import org.eclipse.emf.cdo.tests.model3.Point;
@@ -29,6 +32,7 @@ import org.eclipse.emf.cdo.tests.model5.Doctor;
import org.eclipse.emf.cdo.tests.model5.TestFeatureMap;
import org.eclipse.emf.cdo.tests.model6.UnsettableAttributes;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.util.CommitException;
import org.eclipse.emf.cdo.view.CDOView;
@@ -182,6 +186,26 @@ public class BackupTest extends AbstractCDOTest
exporter.exportRepository(baos);
}
+ public void testExportNIL() throws Exception
+ {
+ Unsettable1 object = getModel2Factory().createUnsettable1();
+ object.setUnsettableString(null);
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource(getResourcePath("/res1"));
+ resource.getContents().add(object);
+ transaction.commit();
+
+ assertEquals(CDORevisionData.NIL, CDOUtil.getCDOObject(object).cdoRevision().data().get(Model2Package.eINSTANCE.getUnsettable1_UnsettableString(), 0));
+
+ InternalRepository repo1 = getRepository();
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ CDOServerExporter.XML exporter = new CDOServerExporter.XML(repo1);
+ exporter.exportRepository(baos);
+ }
+
public void testExportCustomDataType() throws Exception
{
CDOSession session = openSession();
@@ -248,7 +272,8 @@ public class BackupTest extends AbstractCDOTest
TreeIterator<EObject> iter = transaction2.getRootResource().getAllContents();
while (iter.hasNext())
{
- iter.next();
+ EObject eObject = iter.next();
+ System.out.println(eObject);
}
// Add content from a new package
@@ -425,6 +450,35 @@ public class BackupTest extends AbstractCDOTest
}
@CleanRepositoriesBefore(reason = "Inactive repository required")
+ public void testImportNIL() throws Exception
+ {
+ Unsettable1 object = getModel2Factory().createUnsettable1();
+ object.setUnsettableString(null);
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource(getResourcePath("/res1"));
+ resource.getContents().add(object);
+ transaction.commit();
+
+ assertEquals(CDORevisionData.NIL, CDOUtil.getCDOObject(object).cdoRevision().data().get(Model2Package.eINSTANCE.getUnsettable1_UnsettableString(), 0));
+
+ InternalRepository repo1 = getRepository();
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ CDOServerExporter.XML exporter = new CDOServerExporter.XML(repo1);
+ exporter.exportRepository(baos);
+
+ InternalRepository repo2 = getRepository("repo2", false);
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ CDOServerImporter.XML importer = new CDOServerImporter.XML(repo2);
+ importer.importRepository(bais);
+
+ useAfterImport("repo2");
+ }
+
+ @CleanRepositoriesBefore(reason = "Inactive repository required")
public void testImportCustomDataType() throws Exception
{
CDOSession session = openSession();

Back to the top