summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Efftinge2011-08-04 04:41:19 (EDT)
committerEd Merks2011-08-04 04:44:57 (EDT)
commitb60600e8875e61978bbb2ed59edf68d279321260 (patch)
tree3c82f9340df3a09676d015ed7e53f03c53e57082
parent03b63e3485f2874340ad6548e45bf992ab1e7a1e (diff)
downloadorg.eclipse.emf-b60600e8875e61978bbb2ed59edf68d279321260.zip
org.eclipse.emf-b60600e8875e61978bbb2ed59edf68d279321260.tar.gz
org.eclipse.emf-b60600e8875e61978bbb2ed59edf68d279321260.tar.bz2
fixed creation of QualifiedNames
-rw-r--r--org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/scoping/LazyCreationProxyUriConverterTest.java23
-rw-r--r--org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/LazyCreationProxyUriConverter.java8
2 files changed, 25 insertions, 6 deletions
diff --git a/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/scoping/LazyCreationProxyUriConverterTest.java b/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/scoping/LazyCreationProxyUriConverterTest.java
index 6822892..3989cdb 100644
--- a/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/scoping/LazyCreationProxyUriConverterTest.java
+++ b/org.eclipse.emf.ecore.xcore.tests/src/org/eclipse/emf/ecore/xcore/tests/scoping/LazyCreationProxyUriConverterTest.java
@@ -6,22 +6,31 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.xcore.XcoreInjectorProvider;
import org.eclipse.emf.ecore.xcore.scoping.LazyCreationProxyUriConverter;
import org.eclipse.xtext.common.types.JvmGenericType;
import org.eclipse.xtext.common.types.TypesFactory;
+import org.eclipse.xtext.junit4.InjectWith;
+import org.eclipse.xtext.junit4.XtextRunner;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.util.Pair;
import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.google.inject.Inject;
import static junit.framework.Assert.*;
+@RunWith(XtextRunner.class)
+@InjectWith(XcoreInjectorProvider.class)
public class LazyCreationProxyUriConverterTest
{
+ @Inject LazyCreationProxyUriConverter converter;
@Test
public void testUriConversion_1() throws Exception
{
- LazyCreationProxyUriConverter converter = new LazyCreationProxyUriConverter();
+ LazyCreationProxyUriConverter converter = getProxyUriConverter();
GenClass genClass = GenModelFactory.eINSTANCE.createGenClass();
final QualifiedName name = QualifiedName.create("foo.bar", "Baz");
@@ -32,10 +41,14 @@ public class LazyCreationProxyUriConverterTest
assertEquals(name.toString(), proxyInfo.getSecond().toString());
}
+ protected LazyCreationProxyUriConverter getProxyUriConverter() {
+ return converter;
+ }
+
@Test
public void testUriConversion_2() throws Exception
{
- LazyCreationProxyUriConverter converter = new LazyCreationProxyUriConverter();
+ LazyCreationProxyUriConverter converter = getProxyUriConverter();
EClass eClass = EcoreFactory.eINSTANCE.createEClass();
final QualifiedName name = QualifiedName.create("foo.bar", "Baz");
@@ -49,7 +62,7 @@ public class LazyCreationProxyUriConverterTest
@Test
public void testUriConversion_3() throws Exception
{
- LazyCreationProxyUriConverter converter = new LazyCreationProxyUriConverter();
+ LazyCreationProxyUriConverter converter = getProxyUriConverter();
JvmGenericType genericType = TypesFactory.eINSTANCE.createJvmGenericType();
final QualifiedName name = QualifiedName.create("foo.bar", "Baz");
@@ -63,7 +76,7 @@ public class LazyCreationProxyUriConverterTest
@Test
public void testUriConversion_4() throws Exception
{
- LazyCreationProxyUriConverter converter = new LazyCreationProxyUriConverter();
+ LazyCreationProxyUriConverter converter = getProxyUriConverter();
EOperation op = EcoreFactory.eINSTANCE.createEOperation();
final QualifiedName name = QualifiedName.create("foo.bar", "Baz");
@@ -80,7 +93,7 @@ public class LazyCreationProxyUriConverterTest
@Test
public void testUriConversion_5() throws Exception
{
- LazyCreationProxyUriConverter converter = new LazyCreationProxyUriConverter();
+ LazyCreationProxyUriConverter converter = getProxyUriConverter();
JvmGenericType genericType = TypesFactory.eINSTANCE.createJvmGenericType();
try
diff --git a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/LazyCreationProxyUriConverter.java b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/LazyCreationProxyUriConverter.java
index 8dcd96c..fce8b7a 100644
--- a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/LazyCreationProxyUriConverter.java
+++ b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/LazyCreationProxyUriConverter.java
@@ -9,13 +9,19 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.xtext.common.types.TypesPackage;
+import org.eclipse.xtext.naming.IQualifiedNameConverter;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.util.Pair;
import org.eclipse.xtext.util.Tuples;
+import com.google.inject.Inject;
+
import static com.google.common.collect.Maps.*;
public class LazyCreationProxyUriConverter {
+
+ @Inject
+ private IQualifiedNameConverter nameConverter;
private Map<String, EClass> types = newHashMap();
{
@@ -74,7 +80,7 @@ public class LazyCreationProxyUriConverter {
String[] segments = fragment.split(DELIM);
if (segments.length == 2) {
String clazzName = segments[0];
- QualifiedName name = QualifiedName.create(segments[1]);
+ QualifiedName name = nameConverter.toQualifiedName(segments[1]);
if (types.containsKey(clazzName)) {
return Tuples.create(types.get(clazzName), name);
}