diff options
author | Eike Stepper | 2012-12-11 11:28:15 +0000 |
---|---|---|
committer | Eike Stepper | 2012-12-11 11:28:15 +0000 |
commit | 6d4520a902cb4ec6cda9d43de73278d83f7d556c (patch) | |
tree | cfb21ac3dcc51a41528fcd2c45b8db72c96d4379 | |
parent | 8927e12fd77288b72c3dc4928534e4f871d66093 (diff) | |
download | cdo-6d4520a902cb4ec6cda9d43de73278d83f7d556c.tar.gz cdo-6d4520a902cb4ec6cda9d43de73278d83f7d556c.tar.xz cdo-6d4520a902cb4ec6cda9d43de73278d83f7d556c.zip |
[395999] ResourceSet.getResource(URI,true) fails when called several
times
https://bugs.eclipse.org/bugs/show_bug.cgi?id=395999
-rw-r--r-- | plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_395999_Test.java | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_395999_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_395999_Test.java index c174498abc..f067c8fb62 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_395999_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_395999_Test.java @@ -10,8 +10,6 @@ */ package org.eclipse.emf.cdo.tests.bugzilla; -import org.eclipse.emf.cdo.eresource.CDOResourceFactory; -import org.eclipse.emf.cdo.net4j.CDONet4jUtil; import org.eclipse.emf.cdo.tests.AbstractCDOTest; import org.eclipse.emf.common.util.URI; @@ -31,30 +29,20 @@ public class Bugzilla_395999_Test extends AbstractCDOTest { public void testTwiceGetCDOResourceOnResourceSetImpl() throws Exception { - Resource.Factory.Registry registry = Resource.Factory.Registry.INSTANCE; - registry.getProtocolToFactoryMap().put(CDONet4jUtil.PROTOCOL_TCP, CDOResourceFactory.INSTANCE); - - try - { - URI uri = URI.createURI(getURIPrefix() + "/" + getRepository().getName() + getResourcePath("/res1") - + "?transactional=true"); + URI uri = URI.createURI(getURIPrefix() + "/" + getRepository().getName() + getResourcePath("/res1") + + "?transactional=true"); - ResourceSet resourceSet = new ResourceSetImpl(); - Resource resource = resourceSet.createResource(uri); - resource.save(Collections.emptyMap()); + ResourceSet resourceSet = new ResourceSetImpl(); + Resource resource = resourceSet.createResource(uri); + resource.save(Collections.emptyMap()); - loadTwiceAndSaveResource(uri); - } - finally - { - registry.getProtocolToFactoryMap().remove(CDONet4jUtil.PROTOCOL_TCP); - } + loadTwiceAndSaveResource(uri); } public void testTwiceGetXMIResourceOnResourceSetImpl() throws Exception { Resource.Factory.Registry registry = Resource.Factory.Registry.INSTANCE; - registry.getExtensionToFactoryMap().put("model1", new XMIResourceFactoryImpl()); + Object oldFactory = registry.getExtensionToFactoryMap().put("model1", new XMIResourceFactoryImpl()); try { @@ -68,7 +56,14 @@ public class Bugzilla_395999_Test extends AbstractCDOTest } finally { - registry.getExtensionToFactoryMap().remove("model1"); + if (oldFactory == null) + { + registry.getExtensionToFactoryMap().remove("model1"); + } + else + { + registry.getExtensionToFactoryMap().put("model1", oldFactory); + } } } |