Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-09-20 16:39:13 +0000
committerEike Stepper2013-09-20 16:39:13 +0000
commita42e1b10073b77337c499323320bf683fdca8aad (patch)
treef3b720a237997ed6e685baa9364d579d1bab89e3
parent4c8b4bb1696df763e64923ab155162496ad47298 (diff)
downloadcdo-a42e1b10073b77337c499323320bf683fdca8aad.tar.gz
cdo-a42e1b10073b77337c499323320bf683fdca8aad.tar.xz
cdo-a42e1b10073b77337c499323320bf683fdca8aad.zip
Use createUniquePackage() in tests that need dynamic packages
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/CustomTypeMappingTest.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreTest.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DynamicPackageTest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DynamicXSDTest.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FeatureMapTest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MartinsPerformanceTest.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/UnsetTest.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246442_Test.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_258933_Test.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_306998_Test.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_308895_Test.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_326743_Test.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_331619_Test.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_333299_Test.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_333950_Test.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_334608_Test.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_335675_Test.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_350137_Test.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_351921_Test.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_403681_Test.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_416474_Test.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java67
28 files changed, 143 insertions, 162 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/CustomTypeMappingTest.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/CustomTypeMappingTest.java
index b7fb4e7e05..a46faa803c 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/CustomTypeMappingTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/CustomTypeMappingTest.java
@@ -56,8 +56,9 @@ public class CustomTypeMappingTest extends AbstractCDOTest
try
{
- EPackage pkg = EMFUtil.createEPackage("underscoreTest2", "uct2",
- "http://cdo.eclipse.org/tests/underscoreTest2.ecore");
+ String uniqueName = getClass().getSimpleName() + "_" + getName();
+ EPackage pkg = EMFUtil.createEPackage(uniqueName, "anyprefix", "http://" + uniqueName);
+
EClass cls = EMFUtil.createEClass(pkg, "foo", false, false);
EAttribute att = EMFUtil.createEAttribute(cls, "bar", EcorePackage.eINSTANCE.getEInt());
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreTest.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreTest.java
index 66a7dcc19c..869fb82eb6 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/DBStoreTest.java
@@ -123,7 +123,8 @@ public class DBStoreTest extends AbstractCDOTest
public void testStoreCustom() throws CommitException
{
- EPackage pkg = EMFUtil.createEPackage("customTest", "ct", "http://tests.cdo.emf.eclipse.org/customTest");
+ String uniqueName = getClass().getSimpleName() + "_" + getName();
+ EPackage pkg = EMFUtil.createEPackage(uniqueName, "anyprefix", "http://" + uniqueName);
EDataType dt = EcoreFactory.eINSTANCE.createEDataType();
dt.setName("custom");
@@ -282,7 +283,8 @@ public class DBStoreTest extends AbstractCDOTest
public void testUnderscoreFeature() throws Exception
{
- EPackage pkg = EMFUtil.createEPackage("underscoreTest", "uct", "http://cdo.eclipse.org/tests/underscoreTest.ecore");
+ String uniqueName = getClass().getSimpleName() + "_" + getName();
+ EPackage pkg = EMFUtil.createEPackage(uniqueName, "anyprefix", "http://" + uniqueName);
EClass cls = EMFUtil.createEClass(pkg, "foo", false, false);
EAttribute att = EMFUtil.createEAttribute(cls, "_bar", EcorePackage.eINSTANCE.getEString());
@@ -304,7 +306,8 @@ public class DBStoreTest extends AbstractCDOTest
public void testUnderscoreClass() throws Exception
{
- EPackage pkg = EMFUtil.createEPackage("underscoreTest", "uct", "http://cdo.eclipse.org/tests/underscoreTest.ecore");
+ String uniqueName = getClass().getSimpleName() + "_" + getName();
+ EPackage pkg = EMFUtil.createEPackage(uniqueName, "anyprefix", "http://" + uniqueName);
EClass cls = EMFUtil.createEClass(pkg, "foo", false, false);
EAttribute att = EMFUtil.createEAttribute(cls, "_bar", EcorePackage.eINSTANCE.getEString());
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java
index 8eaab9e8c3..0e84b4679c 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java
@@ -106,7 +106,6 @@ public class AttributeTest extends AbstractCDOTest
}
}
- @CleanRepositoriesBefore(reason = "Dynamic package")
public void testByteArray() throws Exception
{
byte saveByteArray[] = new byte[] { 0, 1, 2, 3, 0, 1, 0, 100 };
@@ -148,7 +147,6 @@ public class AttributeTest extends AbstractCDOTest
}
}
- @CleanRepositoriesBefore(reason = "Dynamic package")
public void testByteArrayEmpty() throws Exception
{
byte saveByteArray[] = new byte[0];
@@ -184,7 +182,6 @@ public class AttributeTest extends AbstractCDOTest
}
}
- @CleanRepositoriesBefore(reason = "Dynamic package")
public void testByteArrayNull() throws Exception
{
byte saveByteArray[] = null;
@@ -220,7 +217,6 @@ public class AttributeTest extends AbstractCDOTest
}
}
- @CleanRepositoriesBefore(reason = "Dynamic package")
public void testBigDecimalAndBigInteger() throws Exception
{
BigDecimal bigDecimal = new BigDecimal(10);
@@ -327,10 +323,7 @@ public class AttributeTest extends AbstractCDOTest
schoolBookEClass.getEStructuralFeatures().add(level);
// Create a new EPackage and add the new EClasses
- EPackage schoolPackage = efactory.createEPackage();
- schoolPackage.setName("EPackageTest");
- schoolPackage.setNsPrefix("EPackageTest");
- schoolPackage.setNsURI("http:///www.cdo.org/testcase");
+ EPackage schoolPackage = createUniquePackage();
schoolPackage.getEClassifiers().add(schoolBookEClass);
return schoolPackage;
}
@@ -370,10 +363,7 @@ public class AttributeTest extends AbstractCDOTest
schoolBookEClass.getEStructuralFeatures().add(attrBigInteger);
// Create a new EPackage and add the new EClasses
- EPackage schoolPackage = efactory.createEPackage();
- schoolPackage.setName("EPackageTest");
- schoolPackage.setNsPrefix("EPackageTest");
- schoolPackage.setNsURI("http:///www.cdo.org/testcase");
+ EPackage schoolPackage = createUniquePackage();
schoolPackage.getEClassifiers().add(schoolBookEClass);
return schoolPackage;
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java
index f1da645b96..2a44cc885d 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java
@@ -548,10 +548,7 @@ public class ContainmentTest extends AbstractCDOTest
schoolBookEClass.getEStructuralFeatures().add(element);
// Create a new EPackage and add the new EClasses
- EPackage schoolPackage = efactory.createEPackage();
- schoolPackage.setName("elv");
- schoolPackage.setNsPrefix("elv");
- schoolPackage.setNsURI("http:///www.elver.org/School");
+ EPackage schoolPackage = createUniquePackage();
schoolPackage.getEClassifiers().add(schoolBookEClass);
if (!isConfig(LEGACY))
{
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DynamicPackageTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DynamicPackageTest.java
index 07317b4e2b..e3e68ba304 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DynamicPackageTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DynamicPackageTest.java
@@ -64,11 +64,7 @@ public class DynamicPackageTest extends AbstractCDOTest
mapContainerEClass = theCoreFactory.createEClass();
mapContainerEClass.setName("MapContainer");
- EPackage dynamicMapEPackage = theCoreFactory.createEPackage();
- dynamicMapEPackage.setName("DynamicMapPackage");
- dynamicMapEPackage.setNsPrefix("dynamicmap");
- dynamicMapEPackage.setNsURI("http:///org.mftech.examples.emf.dynamic.map");
-
+ EPackage dynamicMapEPackage = createUniquePackage();
dynamicMapEPackage.getEClassifiers().add(mapContainerEClass);
EStructuralFeature name = theCoreFactory.createEAttribute();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DynamicXSDTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DynamicXSDTest.java
index 222fd15da2..b6ca1512e9 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DynamicXSDTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DynamicXSDTest.java
@@ -65,10 +65,9 @@ public class DynamicXSDTest extends AbstractCDOTest
}
}
- private static EPackage createPackage()
+ private EPackage createPackage()
{
- EPackage result = EMFUtil.createEPackage("xsdmodel", "xsdmodel",
- "http://www.eclipse.org/emf/CDO/tests/xsdmodel/1.0.0");
+ EPackage result = createUniquePackage();
EClass company = EMFUtil.createEClass(result, "Company", false, false);
ExtendedMetaData.INSTANCE.setName(company, "Company");
ExtendedMetaData.INSTANCE.setContentKind(company, ExtendedMetaData.ELEMENT_ONLY_CONTENT);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java
index 8591d751a5..109e7b070d 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java
@@ -533,10 +533,7 @@ public class ExternalReferenceTest extends AbstractCDOTest
schoolBookEClass.getEStructuralFeatures().add(level);
// Create a new EPackage and add the new EClasses
- EPackage schoolPackage = eFactory.createEPackage();
- schoolPackage.setName("elv");
- schoolPackage.setNsPrefix("elv");
- schoolPackage.setNsURI("http:///www.elver.org/School");
+ EPackage schoolPackage = createUniquePackage();
schoolPackage.getEClassifiers().add(schoolBookEClass);
return schoolPackage;
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FeatureMapTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FeatureMapTest.java
index 4676154ee4..82acd18372 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FeatureMapTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FeatureMapTest.java
@@ -76,7 +76,9 @@ public class FeatureMapTest extends AbstractCDOTest
super.doSetUp();
final EcorePackage epackage = EcorePackage.eINSTANCE;
- pkg = EMFUtil.createEPackage("fmaps", "fmaps", "http://cdo.emf.eclipse.org/fmaps");
+
+ pkg = createUniquePackage();
+
dummy = EMFUtil.createEClass(pkg, "Dummy", false, false);
name = EMFUtil.createEAttribute(dummy, "name", epackage.getEString());
fmapContainer = EMFUtil.createEClass(pkg, "FMapContainer", false, false);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java
index 3dc2be6997..18337ff625 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java
@@ -715,7 +715,7 @@ public class InitialTest extends AbstractCDOTest
{
Resource resource1 = new XMLResourceImpl();
- EPackage p = EcoreFactory.eINSTANCE.createEPackage();
+ EPackage p = createUniquePackage();
EClass c = EcoreFactory.eINSTANCE.createEClass();
resource1.getContents().add(p);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MartinsPerformanceTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MartinsPerformanceTest.java
index e628eea22d..204650b08f 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MartinsPerformanceTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MartinsPerformanceTest.java
@@ -290,10 +290,7 @@ public class MartinsPerformanceTest extends AbstractCDOTest
mapContainerEClass = theCoreFactory.createEClass();
mapContainerEClass.setName("MapContainer");
- EPackage dynamicMapEPackage = theCoreFactory.createEPackage();
- dynamicMapEPackage.setName("DynamicMapPackage");
- dynamicMapEPackage.setNsPrefix("dynamicmap");
- dynamicMapEPackage.setNsURI("http:///org.mftech.examples.emf.dynamic.map");
+ EPackage dynamicMapEPackage = createUniquePackage();
dynamicMapEPackage.getEClassifiers().add(mapContainerEClass);
EStructuralFeature name = theCoreFactory.createEAttribute();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java
index badd05f59c..d465db81a1 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java
@@ -253,15 +253,11 @@ public class PackageRegistryTest extends AbstractCDOTest
*/
public void testGlobalDynamicPackageEager() throws Exception
{
- String nsURI = "http://dynamic";
+ EPackage p = createUniquePackage();
+ String nsURI = p.getNsURI();
try
{
- EPackage p = EcoreFactory.eINSTANCE.createEPackage();
- p.setName("dynamic");
- p.setNsPrefix("dynamic");
- p.setNsURI(nsURI);
-
EClass c = EcoreFactory.eINSTANCE.createEClass();
c.setName("DClass");
@@ -293,15 +289,11 @@ public class PackageRegistryTest extends AbstractCDOTest
*/
public void testGlobalDynamicPackage() throws Exception
{
- String nsURI = "http://dynamic";
+ EPackage p = createUniquePackage();
+ String nsURI = p.getNsURI();
try
{
- EPackage p = EcoreFactory.eINSTANCE.createEPackage();
- p.setName("dynamic");
- p.setNsPrefix("dynamic");
- p.setNsURI(nsURI);
-
EClass c = EcoreFactory.eINSTANCE.createEClass();
c.setName("DClass");
@@ -577,15 +569,11 @@ public class PackageRegistryTest extends AbstractCDOTest
public void testPopulator() throws Exception
{
- String nsURI = "http://dynamic";
EPackage.Registry registry = new EPackageRegistryImpl();
+ EPackage p = createUniquePackage();
+ String nsURI = p.getNsURI();
{
- EPackage p = EcoreFactory.eINSTANCE.createEPackage();
- p.setName("dynamic");
- p.setNsPrefix("dynamic");
- p.setNsURI(nsURI);
-
EClass c = EcoreFactory.eINSTANCE.createEClass();
c.setName("DClass");
@@ -615,17 +603,13 @@ public class PackageRegistryTest extends AbstractCDOTest
public void testPopulatorGlobal() throws Exception
{
- String nsURI = "http://dynamic";
EPackage.Registry registry = EPackage.Registry.INSTANCE;
+ EPackage p = createUniquePackage();
+ String nsURI = p.getNsURI();
try
{
{
- EPackage p = EcoreFactory.eINSTANCE.createEPackage();
- p.setName("dynamic");
- p.setNsPrefix("dynamic");
- p.setNsURI(nsURI);
-
EClass c = EcoreFactory.eINSTANCE.createEClass();
c.setName("DClass");
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/UnsetTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/UnsetTest.java
index bc756cd4f7..4aef204262 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/UnsetTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/UnsetTest.java
@@ -403,8 +403,7 @@ public class UnsetTest extends AbstractCDOTest
public void testUnsettableBaseTypeVsObjectType() throws Exception
{
- EPackage pkg = EMFUtil.createEPackage("unsettablePackage", "unset",
- "http://cdo.eclipse.org/unsettablePackage.ecore");
+ EPackage pkg = createUniquePackage();
EClass cls = EMFUtil.createEClass(pkg, "unsettableClass", false, false);
EAttribute baseElement = EMFUtil.createEAttribute(cls, "baseElement", EcorePackage.eINSTANCE.getEInt());
baseElement.setUnsettable(true);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java
index 60a525504c..7d40594ef9 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XRefTest.java
@@ -138,8 +138,8 @@ public class XRefTest extends AbstractCDOTest
public void testXRefsToMany() throws Exception
{
// create model
- EPackage pkg = EMFUtil.createEPackage("xreftest", "xreftest",
- "http://cdo.emf.eclipse.org/TestModels/XRefTestToMany.ecore");
+ EPackage pkg = createUniquePackage();
+
EClass cls1 = EMFUtil.createEClass(pkg, "referencer", false, false);
EAttribute id1 = EMFUtil.createEAttribute(cls1, "id", EcorePackage.eINSTANCE.getEInt());
@@ -255,12 +255,11 @@ public class XRefTest extends AbstractCDOTest
session2.close();
}
- @CleanRepositoriesBefore(reason = "Dynamic package")
public void testXRefsToOne() throws Exception
{
// create model
- EPackage pkg = EMFUtil.createEPackage("xreftest", "xreftest",
- "http://cdo.emf.eclipse.org/TestModels/XRefTestToOne.ecore");
+ EPackage pkg = createUniquePackage();
+
EClass cls1 = EMFUtil.createEClass(pkg, "referencer", false, false);
EAttribute id1 = EMFUtil.createEAttribute(cls1, "id", EcorePackage.eINSTANCE.getEInt());
@@ -384,10 +383,7 @@ public class XRefTest extends AbstractCDOTest
EReference bb7 = addReference(b, b, false);
EReference bb8 = addReference(b, b, false);
- EPackage xref = EcoreFactory.eINSTANCE.createEPackage();
- xref.setName("xref");
- xref.setNsPrefix("xref");
- xref.setNsURI("http://xref");
+ EPackage xref = createUniquePackage();
xref.getEClassifiers().add(a);
xref.getEClassifiers().add(b);
@@ -462,10 +458,7 @@ public class XRefTest extends AbstractCDOTest
EReference bb7 = addReference(b, b, false);
EReference bb8 = addReference(b, b, false);
- EPackage xref = EcoreFactory.eINSTANCE.createEPackage();
- xref.setName("xref");
- xref.setNsPrefix("xref");
- xref.setNsURI("http://xref");
+ EPackage xref = createUniquePackage();
xref.getEClassifiers().add(a);
xref.getEClassifiers().add(b);
@@ -535,10 +528,7 @@ public class XRefTest extends AbstractCDOTest
EReference bb7 = addReference(b, b, false);
EReference bb8 = addReference(b, b, false);
- EPackage xref = EcoreFactory.eINSTANCE.createEPackage();
- xref.setName("xref");
- xref.setNsPrefix("xref");
- xref.setNsURI("http://xref");
+ EPackage xref = createUniquePackage();
xref.getEClassifiers().add(a);
xref.getEClassifiers().add(b);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246442_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246442_Test.java
index d2aad85677..6353f65263 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246442_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246442_Test.java
@@ -99,15 +99,9 @@ public class Bugzilla_246442_Test extends AbstractCDOTest
final EcorePackage epackage = EcorePackage.eINSTANCE;
// Create a new EPackage and add the new EClasses
- EPackage topPackage = efactory.createEPackage();
- topPackage.setName("toppackage");
- topPackage.setNsPrefix("toppackage");
- topPackage.setNsURI("http:///www.elver.org/toppackage");
-
- EPackage subPackage1 = efactory.createEPackage();
- subPackage1.setName("subPackage1");
- subPackage1.setNsPrefix("subPackage1");
- subPackage1.setNsURI("http:///www.elver.org/subPackage1");
+ EPackage topPackage = createUniquePackage("top");
+ EPackage subPackage1 = createUniquePackage("sub1");
+ topPackage.getESubpackages().add(subPackage1);
{
EClass schoolBookEClass = efactory.createEClass();
@@ -144,12 +138,6 @@ public class Bugzilla_246442_Test extends AbstractCDOTest
subPackage1.getEClassifiers().add(schoolBookEClass);
}
- EPackage subPackage2 = efactory.createEPackage();
- subPackage2.setName("subPackage2");
- subPackage2.setNsPrefix("subPackage2");
- subPackage2.setNsURI("http:///www.elver.org/subPackage2");
-
- topPackage.getESubpackages().add(subPackage1);
return topPackage;
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_258933_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_258933_Test.java
index f4143f5844..f59dab9e78 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_258933_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_258933_Test.java
@@ -37,10 +37,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
*/
public class Bugzilla_258933_Test extends AbstractCDOTest
{
- private static final String TOP_PACKAGE_URI = "http:///www.elver.org/toppackage";
-
- private static final String SUB_PACKAGE_URI = "http:///www.elver.org/subPackage1";
-
private static final Object NIL = new Object();
@CleanRepositoriesBefore(reason = "Dynamic packages")
@@ -101,9 +97,9 @@ public class Bugzilla_258933_Test extends AbstractCDOTest
private void testWithValue(String featureName, Object initializeValue, boolean isSet) throws Exception
{
- {
- EPackage topPackage = createDynamicEPackage();
+ EPackage topPackage = createDynamicEPackage();
+ {
EPackage subpackage1 = topPackage.getESubpackages().get(0);
EClass class1Class = (EClass)subpackage1.getEClassifier("class1");
EStructuralFeature feature = class1Class.getEStructuralFeature(featureName);
@@ -139,7 +135,7 @@ public class Bugzilla_258933_Test extends AbstractCDOTest
((org.eclipse.emf.cdo.net4j.CDONet4jSession)session).options().getNet4jProtocol().setTimeout(2000L);
}
- EPackage subpackage1 = session.getPackageRegistry().getEPackage(SUB_PACKAGE_URI);
+ EPackage subpackage1 = session.getPackageRegistry().getEPackage(topPackage.getESubpackages().get(0).getNsURI());
EClass class1Class = (EClass)subpackage1.getEClassifier("class1");
EStructuralFeature feature = class1Class.getEStructuralFeature(featureName);
@@ -197,15 +193,8 @@ public class Bugzilla_258933_Test extends AbstractCDOTest
final EcorePackage epackage = EcorePackage.eINSTANCE;
// Create a new EPackage and add the new EClasses
- EPackage topPackage = efactory.createEPackage();
- topPackage.setName("toppackage");
- topPackage.setNsPrefix("toppackage");
- topPackage.setNsURI(TOP_PACKAGE_URI);
-
- EPackage subPackage1 = efactory.createEPackage();
- subPackage1.setName("subPackage1");
- subPackage1.setNsPrefix("subPackage1");
- subPackage1.setNsURI(SUB_PACKAGE_URI);
+ EPackage topPackage = createUniquePackage("top");
+ EPackage subPackage1 = createUniquePackage("sub");
{
EClass schoolBookEClass = efactory.createEClass();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_306998_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_306998_Test.java
index 4be2314a05..4cc3b0e3e8 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_306998_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_306998_Test.java
@@ -34,7 +34,7 @@ public class Bugzilla_306998_Test extends AbstractCDOTest
{
public void testValidEENumLiteral() throws CommitException
{
- EPackage pkg = EMFUtil.createEPackage("pkg", "pkg", "http://cdo.eclipse.org/Bugzilla_306998_Test_1.ecore");
+ EPackage pkg = createUniquePackage();
EClass cls = EMFUtil.createEClass(pkg, "cls", false, false);
EAttribute att = EMFUtil.createEAttribute(cls, "att", Model1Package.eINSTANCE.getVAT());
att.setDefaultValueLiteral("vat7");
@@ -71,10 +71,9 @@ public class Bugzilla_306998_Test extends AbstractCDOTest
// does not affect MemStore!
@Skips("MEM")
- @CleanRepositoriesBefore(reason = "Dynamic package")
public void testInalidEENumLiteral() throws CommitException
{
- EPackage pkg = EMFUtil.createEPackage("pkg", "pkg", "http://cdo.eclipse.org/Bugzilla_306998_Test_1.ecore");
+ EPackage pkg = createUniquePackage();
EClass cls = EMFUtil.createEClass(pkg, "cls", false, false);
EAttribute att = EMFUtil.createEAttribute(cls, "att", Model1Package.eINSTANCE.getVAT());
att.setDefaultValueLiteral("vat8");
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_308895_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_308895_Test.java
index b1b69ec43a..2dc7ae171b 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_308895_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_308895_Test.java
@@ -43,7 +43,8 @@ public class Bugzilla_308895_Test extends AbstractCDOTest
{
super.setUp();
- pkg = EMFUtil.createEPackage("customTest", "ct", "http://cdo.emf.eclipse.org/customTest.ecore");
+ pkg = createUniquePackage();
+
EDataType custom = EcoreFactory.eINSTANCE.createEDataType();
custom.setInstanceClass(CustomType.class);
custom.setName("CustomType");
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_326743_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_326743_Test.java
index eb95151ef1..987a326c0a 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_326743_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_326743_Test.java
@@ -44,7 +44,7 @@ public class Bugzilla_326743_Test extends AbstractCDOTest
{
super.setUp();
- pkg = EMFUtil.createEPackage("customTest", "ct", "http://cdo.emf.eclipse.org/customTest.ecore");
+ pkg = createUniquePackage();
EDataType customPrimitive = EcoreFactory.eINSTANCE.createEDataType();
customPrimitive.setInstanceTypeName("boolean");
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_331619_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_331619_Test.java
index 5f8c0c85a6..1238be510c 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_331619_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_331619_Test.java
@@ -43,7 +43,7 @@ public class Bugzilla_331619_Test extends AbstractCDOTest
skipStoreWithoutQueryXRefs();
// set up model
- EPackage pkg = EMFUtil.createEPackage("test", "test", "http://www.eclipse.org/CDO/Tests/331619.ecore");
+ EPackage pkg = createUniquePackage();
EClass ref = EMFUtil.createEClass(pkg, "referencee", false, false);
EAttribute refName = EMFUtil.createEAttribute(ref, "refname", EcorePackage.eINSTANCE.getEString());
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_333299_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_333299_Test.java
index bc68d49c14..798963f555 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_333299_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_333299_Test.java
@@ -35,7 +35,7 @@ public class Bugzilla_333299_Test extends AbstractCDOTest
CDOTransaction transaction = session.openTransaction();
CDOResource resource = transaction.createResource(getResourcePath("/res1"));
- EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
+ EPackage ePackage = createUniquePackage();
EClass eClass = EcoreFactory.eINSTANCE.createEClass();
eClass.setName("clazz1");
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_333950_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_333950_Test.java
index 009825e456..bbfedcaf69 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_333950_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_333950_Test.java
@@ -32,22 +32,19 @@ public class Bugzilla_333950_Test extends AbstractCDOTest
{
public void testOpposites() throws Exception
{
- EPackage pkg1 = null;
+ EPackage pkg = null;
{
// create ECore metamodel. Major aspect is to create two classes, which has linked opposite EReferences and one of
// reference is not persistence
- pkg1 = EcoreFactory.eINSTANCE.createEPackage();
- pkg1.setNsURI("http://test.com/custom");
- pkg1.setName("test");
- pkg1.setNsPrefix("t");
+ pkg = createUniquePackage();
EClass customClassA = EcoreFactory.eINSTANCE.createEClass();
customClassA.setName("A");
- pkg1.getEClassifiers().add(customClassA);
+ pkg.getEClassifiers().add(customClassA);
EClass customClassB = EcoreFactory.eINSTANCE.createEClass();
customClassB.setName("B");
- pkg1.getEClassifiers().add(customClassB);
+ pkg.getEClassifiers().add(customClassB);
createOpposites(customClassA, customClassB);
}
@@ -58,8 +55,8 @@ public class Bugzilla_333950_Test extends AbstractCDOTest
CDOTransaction openTransaction = openSession.openTransaction();
CDOResource createResource = openTransaction.createResource(getResourcePath("test"));
- EClass classAClass = (EClass)pkg1.getEClassifier("A");
- EClass classBClass = (EClass)pkg1.getEClassifier("B");
+ EClass classAClass = (EClass)pkg.getEClassifier("A");
+ EClass classBClass = (EClass)pkg.getEClassifier("B");
EObject instanceA = EcoreUtil.create(classAClass);
EObject instanceB = EcoreUtil.create(classBClass);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_334608_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_334608_Test.java
index 096cb195b6..97b336f8dc 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_334608_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_334608_Test.java
@@ -35,23 +35,19 @@ import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext;
*/
public class Bugzilla_334608_Test extends AbstractCDOTest
{
- @CleanRepositoriesBefore(reason = "Dynamic package")
public void testOpposites() throws Exception
{
- EPackage pkg1 = null;
+ EPackage pkg = null;
{
- pkg1 = EcoreFactory.eINSTANCE.createEPackage();
- pkg1.setNsURI("http://test.com/custom");
- pkg1.setName("test");
- pkg1.setNsPrefix("t");
+ pkg = createUniquePackage();
EClass customClassA = EcoreFactory.eINSTANCE.createEClass();
customClassA.setName("A");
- pkg1.getEClassifiers().add(customClassA);
+ pkg.getEClassifiers().add(customClassA);
EClass customClassB = EcoreFactory.eINSTANCE.createEClass();
customClassB.setName("B");
- pkg1.getEClassifiers().add(customClassB);
+ pkg.getEClassifiers().add(customClassB);
createOpposites(customClassA, customClassB);
}
@@ -62,8 +58,8 @@ public class Bugzilla_334608_Test extends AbstractCDOTest
CDOTransaction transaction = openSession.openTransaction();
CDOResource resource = transaction.createResource(getResourcePath("test"));
- EClass classAClass = (EClass)pkg1.getEClassifier("A");
- EClass classBClass = (EClass)pkg1.getEClassifier("B");
+ EClass classAClass = (EClass)pkg.getEClassifier("A");
+ EClass classBClass = (EClass)pkg.getEClassifier("B");
EObject instanceA = EcoreUtil.create(classAClass);
EObject instanceB = EcoreUtil.create(classBClass);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_335675_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_335675_Test.java
index 7812f918de..67ce700194 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_335675_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_335675_Test.java
@@ -39,7 +39,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
*/
public class Bugzilla_335675_Test extends AbstractCDOTest
{
- @CleanRepositoriesBefore(reason = "Dynamic package")
public void test0() throws Exception
{
EPackage pkg = null;
@@ -51,10 +50,7 @@ public class Bugzilla_335675_Test extends AbstractCDOTest
EClass classA = null;
{
- pkg = EcoreFactory.eINSTANCE.createEPackage();
- pkg.setNsURI("http://test.com/custom");
- pkg.setName("test");
- pkg.setNsPrefix("t");
+ pkg = createUniquePackage();
classA = EcoreFactory.eINSTANCE.createEClass();
classA.setName("A");
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_350137_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_350137_Test.java
index 2ca43ace4f..d41baff5f8 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_350137_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_350137_Test.java
@@ -34,7 +34,7 @@ public class Bugzilla_350137_Test extends AbstractCDOTest
*/
public void testDefault() throws Exception
{
- EPackage pkg = EMFUtil.createEPackage("Test", "t", "http://cdo.eclipse.org/tests/Bugzilla350137_Test1.ecore");
+ EPackage pkg = createUniquePackage();
EClass cls = EMFUtil.createEClass(pkg, "foo", false, false);
@SuppressWarnings("unused")
@@ -63,7 +63,7 @@ public class Bugzilla_350137_Test extends AbstractCDOTest
*/
public void testExplicitZero() throws Exception
{
- EPackage pkg = EMFUtil.createEPackage("Test", "t", "http://cdo.eclipse.org/tests/Bugzilla350137_Test2.ecore");
+ EPackage pkg = createUniquePackage();
EClass cls = EMFUtil.createEClass(pkg, "foo2", false, false);
EAttribute att = EMFUtil.createEAttribute(cls, "bar", EcorePackage.eINSTANCE.getEChar());
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_351921_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_351921_Test.java
index 1fafbf70e4..78cb3cee92 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_351921_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_351921_Test.java
@@ -14,7 +14,6 @@ import org.eclipse.emf.cdo.common.model.EMFUtil;
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.ConfigTest.CleanRepositoriesBefore;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.util.CommitException;
@@ -31,7 +30,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
/**
* @author Stefan Winkler
*/
-@CleanRepositoriesBefore(reason = "Dynamic package")
public class Bugzilla_351921_Test extends AbstractCDOTest
{
private EPackage pkg;
@@ -45,7 +43,8 @@ public class Bugzilla_351921_Test extends AbstractCDOTest
{
super.setUp();
- pkg = EMFUtil.createEPackage("customTest", "ct", "http://cdo.emf.eclipse.org/customTest.ecore");
+ pkg = createUniquePackage();
+
EDataType custom = EcoreFactory.eINSTANCE.createEDataType();
custom.setInstanceClass(CustomType.class);
custom.setName("CustomType");
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_403681_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_403681_Test.java
index 4fe30efda2..356269d37d 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_403681_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_403681_Test.java
@@ -67,10 +67,7 @@ public class Bugzilla_403681_Test extends AbstractCDOTest
protected EPackage createTestPackage()
{
- EPackage result = EcoreFactory.eINSTANCE.createEPackage();
- result.setName("localtest");
- result.setNsPrefix("ltest");
- result.setNsURI("http://www.eclipse.org/schema/cdo/test/localtest");
+ EPackage result = createUniquePackage();
EClass classA = EcoreFactory.eINSTANCE.createEClass();
classA.setName("A");
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_416474_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_416474_Test.java
index af0d3e744b..086c2f8aa8 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_416474_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_416474_Test.java
@@ -35,11 +35,11 @@ public class Bugzilla_416474_Test extends AbstractCDOTest
{
public void testAllProperContentsNoTypeFilter() throws Exception
{
- EPackage root = createPackage("root", "root", "http://www.eclipse.org/CDO/test/bug416474/Root");
+ EPackage root = createPackage("root", "root", "http://www.eclipse.org/CDO/test1/bug416474/Root");
EClass a = createClass(root, "RootA");
EClass b = createClass(root, "RootB");
- EPackage nested = createPackage("nested", "nested", "http://www.eclipse.org/CDO/test/bug416474/Nested");
+ EPackage nested = createPackage("nested", "nested", "http://www.eclipse.org/CDO/test1/bug416474/Nested");
createClass(nested, "NestedA");
createClass(nested, "NestedB");
root.getESubpackages().add(nested);
@@ -70,11 +70,11 @@ public class Bugzilla_416474_Test extends AbstractCDOTest
public void testAllProperContentsTypeFilter() throws Exception
{
- EPackage root = createPackage("root", "root", "http://www.eclipse.org/CDO/test/bug416474/Root");
+ EPackage root = createPackage("root", "root", "http://www.eclipse.org/CDO/test2/bug416474/Root");
createClass(root, "RootA");
createClass(root, "RootB");
- EPackage nested = createPackage("nested", "nested", "http://www.eclipse.org/CDO/test/bug416474/Nested");
+ EPackage nested = createPackage("nested", "nested", "http://www.eclipse.org/CDO/test2/bug416474/Nested");
createClass(nested, "NestedA");
createClass(nested, "NestedB");
root.getESubpackages().add(nested);
@@ -104,11 +104,11 @@ public class Bugzilla_416474_Test extends AbstractCDOTest
public void testMatchesAnyStringAttribute() throws Exception
{
- EPackage root = createPackage("root", "root", "http://www.eclipse.org/CDO/test/bug416474/Root");
+ EPackage root = createPackage("root", "root", "http://www.eclipse.org/CDO/test3/bug416474/Root");
createClass(root, "RootA");
createClass(root, "RootB");
- EPackage nested = createPackage("nested", "nested", "http://www.eclipse.org/CDO/test/bug416474/Nested");
+ EPackage nested = createPackage("nested", "nested", "http://www.eclipse.org/CDO/test3/bug416474/Nested");
EClass a1 = createClass(nested, "NestedA");
EClass b1 = createClass(nested, "NestedB");
root.getESubpackages().add(nested);
@@ -154,6 +154,9 @@ public class Bugzilla_416474_Test extends AbstractCDOTest
assertEquals(3, results.size());
}
+ /**
+ * {@link #createUniquePackage()} would be better but {@link #testMatchesAnyStringAttribute()} relies on particular values.
+ */
private EPackage createPackage(String name, String nsPrefix, String nsURI)
{
EPackage result = EcoreFactory.eINSTANCE.createEPackage();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java
index f9f57dfaec..a25603b259 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.tests.config.impl;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.session.CDOSession;
@@ -48,6 +49,7 @@ import org.eclipse.emf.cdo.tests.model5.Model5Package;
import org.eclipse.emf.cdo.tests.model6.Model6Factory;
import org.eclipse.emf.cdo.tests.model6.Model6Package;
+import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.container.IManagedContainer;
@@ -55,6 +57,11 @@ import org.eclipse.net4j.util.io.IOUtil;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.tests.AbstractOMTest;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EcorePackage;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -576,9 +583,8 @@ public abstract class ConfigTest extends AbstractOMTest implements IConstants
* resource level.
*
* @param resourceName
- * - the test-local name of the resource (or null if one wants to receive the path of the test-local resource
- * folder
- * @return the full path of the resource
+ * the test-local name of the resource or <code>null</code> for the path of the test-local root resource.
+ * @return the full path of the resource.
*/
public final String getResourcePath(String resourceName)
{
@@ -601,6 +607,61 @@ public abstract class ConfigTest extends AbstractOMTest implements IConstants
return builder.toString();
}
+ /**
+ * Constructs a test-specific EPackage of the format "TestClass_testMethod_name". Using this instead of
+ * (just) a hardcoded name for the test package, ensures that the test method is isolated from all others.
+ *
+ * @param name
+ * the test-local name of the package or <code>null</code> .
+ * @return the created package.
+ * @see #createUniquePackage()
+ */
+ public final EPackage createUniquePackage(String name)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getClass().getSimpleName()); // Name of this test class
+ builder.append('_');
+ builder.append(getName()); // Name of the executing test method
+
+ if (name != null)
+ {
+ builder.append('_');
+ builder.append(name);
+ }
+
+ final String uniqueName = builder.toString();
+
+ EPackage ePackage = EMFUtil.createEPackage(uniqueName, uniqueName, "http://" + uniqueName);
+ ePackage.eAdapters().add(new AdapterImpl()
+ {
+ @Override
+ public void notifyChanged(Notification msg)
+ {
+ if (msg.isTouch())
+ {
+ return;
+ }
+
+ Object feature = msg.getFeature();
+ if (feature == EcorePackage.Literals.EPACKAGE__NS_PREFIX || feature == EcorePackage.Literals.EPACKAGE__NS_URI
+ || feature == EcorePackage.Literals.ENAMED_ELEMENT__NAME)
+ {
+ throw new ImplementationError("Don't change the unique package " + uniqueName);
+ }
+ }
+ });
+
+ return ePackage;
+ }
+
+ /**
+ * @see #createUniquePackage(String)
+ */
+ public final EPackage createUniquePackage()
+ {
+ return createUniquePackage(null);
+ }
+
protected boolean isConfig(Config config)
{
return ObjectUtil.equals(getRepositoryConfig(), config) //

Back to the top