org.eclipse.emf.ecore.resource.impl.ResourceImpl Java Examples
The following examples show how to use
org.eclipse.emf.ecore.resource.impl.ResourceImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JvmDeclaredTypeTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Test public void testFindFeaturesByName_03() { JvmDeclaredType type = getObjectUnderTest(); JvmGenericType superType = TypesFactory.eINSTANCE.createJvmGenericType(); ResourceImpl resource = new ResourceImpl(); resource.getContents().add(type); resource.getContents().add(superType); JvmOperation operation = TypesFactory.eINSTANCE.createJvmOperation(); operation.setSimpleName("foo"); superType.getMembers().add(operation); JvmParameterizedTypeReference reference = TypesFactory.eINSTANCE.createJvmParameterizedTypeReference(); reference.setType(superType); type.getSuperTypes().add(reference); Iterable<JvmFeature> iterable = type.findAllFeaturesByName("foo"); Iterator<JvmFeature> iterator = iterable.iterator(); assertTrue(iterator.hasNext()); assertSame(operation, iterator.next()); assertFalse(iterator.hasNext()); }
Example #2
Source File: ShortFragmentProviderTest.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
@BugTest(value = "DSL-601") public void testLongFragment() { int reps = 100; EObject root = EcoreUtil.create(testClass); EObject parent = root; for (int i = 0; i < reps; i++) { EObject child = EcoreUtil.create(testClass); parent.eSet(testReference, child); parent = child; } ResourceImpl resource = new ResourceImpl(); resource.getContents().add(root); String fragment = fragmentProvider.getFragment(parent, fragmentFallback); Assert.assertEquals("/0*" + (reps + 1), fragment); Assert.assertEquals(parent, fragmentProvider.getEObject(resource, fragment, fragmentFallback)); }
Example #3
Source File: LazyLinkerTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Test public void testManyValuedResolveProxiesReference() throws Exception { final EObject foo = newEObject("Foo"); final List<EObject> bars = Lists.newArrayList(newEObject("Bar"), newEObject("Bar")); final Iterator<EObject> barsIterator = bars.iterator(); final Resource resource = new ResourceImpl(URI.createURI("http://foo/bar.ecore")) { @Override public EObject getEObject(String uriFragment) { return barsIterator.next(); } }; resourceSet.getResources().add(resource); resource.getContents().add(foo); final EReference eReference = (EReference) foo.eClass().getEStructuralFeature("many"); assertFalse(eReference.isResolveProxies()); final INode leafNode = newCrossReferenceAssignmentNode(eReference.getName()); final INode leafNode2 = newCrossReferenceAssignmentNode(eReference.getName()); final ICompositeNode adapter = newSimpleNodeAdapter(leafNode, leafNode2); foo.eAdapters().add((Adapter) adapter); linker.linkModel(foo, new ListBasedDiagnosticConsumer()); assertEquals(bars, foo.eGet(eReference, false)); }
Example #4
Source File: LazyLinkerTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Test public void testSingleValuedResolveProxiesReference() throws Exception { final EObject foo = newEObject("Foo"); final EObject bar = newEObject("Bar"); final Resource resource = new ResourceImpl(URI.createURI("http://foo/bar.ecore")) { @Override public EObject getEObject(String uriFragment) { return bar; } }; resourceSet.getResources().add(resource); resource.getContents().add(foo); final EReference eReference = (EReference) foo.eClass().getEStructuralFeature("single"); assertFalse(eReference.isResolveProxies()); final INode leafNode = newCrossReferenceAssignmentNode(eReference.getName()); final ICompositeNode adapter = newSimpleNodeAdapter(leafNode); foo.eAdapters().add((Adapter) adapter); linker.linkModel(foo, new ListBasedDiagnosticConsumer()); assertEquals(bar, foo.eGet(eReference, false)); }
Example #5
Source File: OnChangeEvictingCacheAdapterTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Test public void testCacheSurvivesChangesToAdapters() throws Exception { EcoreFactory factory = EcoreFactory.eINSTANCE; EClass eClass = factory.createEClass(); Resource resource = new ResourceImpl(); resource.getContents().add(eClass); CacheAdapter ca = new OnChangeEvictingCache().getOrCreate(resource); setValue(ca); List<Adapter> adapters = resource.eAdapters(); assertIsSet(ca); AdapterImpl adapter = new AdapterImpl(); adapters.add(adapter); assertIsSet(ca); adapters.remove(adapter); assertIsSet(ca); }
Example #6
Source File: OnChangeEvictingCacheAdapterTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Test public void testAdapterIsCleared() throws Exception { EcoreFactory factory = EcoreFactory.eINSTANCE; EClass eClass = factory.createEClass(); Resource resource = new ResourceImpl(); resource.getContents().add(eClass); CacheAdapter ca = new OnChangeEvictingCache().getOrCreate(resource); setValue(ca); EAttribute attribute = factory.createEAttribute(); assertIsSet(ca); eClass.getEStructuralFeatures().add(attribute); assertIsNull(ca); setValue(ca); attribute.setName("Foo"); assertIsNull(ca); setValue(ca); }
Example #7
Source File: EcoreUtil2Test.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Test public void testPathFragment() { EClass foo = EcoreFactory.eINSTANCE.createEClass(); foo.setName("foo"); EClass bar = EcoreFactory.eINSTANCE.createEClass(); foo.setName("bar"); EPackage p = EcoreFactory.eINSTANCE.createEPackage(); bar.setName("p"); p.getEClassifiers().add(foo); p.getEClassifiers().add(bar); assertEquals("/-1", EcoreUtil2.getFragmentPath(foo)); assertEquals("/-1", EcoreUtil2.getFragmentPath(bar)); assertEquals("/-1", EcoreUtil2.getFragmentPath(p)); Resource resource = new ResourceImpl(URI.createURI("platform:/resource/res")); resource.getContents().add(p); assertEquals(URI.createURI("platform:/resource/res#//@eClassifiers.0"), EcoreUtil2.getFragmentPathURI(foo)); assertEquals(URI.createURI("platform:/resource/res#//@eClassifiers.1"), EcoreUtil2.getFragmentPathURI(bar)); assertEquals(URI.createURI("platform:/resource/res#/"), EcoreUtil2.getFragmentPathURI(p)); assertEquals(resource.getEObject("//@eClassifiers.0"), foo); assertEquals(resource.getEObject("//@eClassifiers.1"), bar); assertEquals(resource.getEObject("/"), p); }
Example #8
Source File: DefaultResourceDescriptionManagerTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Before public void setUp() throws Exception { EObject copy = EcoreUtil.copy(EcorePackage.eINSTANCE); resource = new ResourceImpl(); resource.getContents().add(copy); IQualifiedNameProvider nameProvider = new IQualifiedNameProvider.AbstractImpl() { @Override public QualifiedName getFullyQualifiedName(EObject obj) { if (obj instanceof ENamedElement) return QualifiedName.create(((ENamedElement) obj).getName()); return null; } }; DefaultResourceDescriptionStrategy descriptionStrategy = new DefaultResourceDescriptionStrategy(); descriptionStrategy.setQualifiedNameProvider(nameProvider); resourceDescription = new DefaultResourceDescription(resource, descriptionStrategy) { @Override public Iterable<QualifiedName> getImportedNames() { return importedNames; } }; manager = new DefaultResourceDescriptionManager(); importedNames = Collections.emptySet(); }
Example #9
Source File: DerivedResourceMarkerCopier.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
private int getMaxSeverity(IFile srcFile) { URI resourceURI = URI.createPlatformResourceURI(srcFile.getFullPath().toString(), true); IResourceServiceProvider serviceProvider = serviceProviderRegistry.getResourceServiceProvider(resourceURI); if (serviceProvider == null) return Integer.MAX_VALUE; IssueSeveritiesProvider severitiesProvider = serviceProvider.get(IssueSeveritiesProvider.class); Severity severity = severitiesProvider.getIssueSeverities(new ResourceImpl(resourceURI)).getSeverity( COPY_JAVA_PROBLEMS_ISSUECODE); switch (severity) { case WARNING: return IMarker.SEVERITY_WARNING; case ERROR: return IMarker.SEVERITY_ERROR; case INFO: case IGNORE: return Integer.MAX_VALUE; default: break; } return Integer.MAX_VALUE; }
Example #10
Source File: JdtBasedSimpleTypeScopeProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Before public void setUp() throws Exception { projectProvider = new MockJavaProjectProvider(); factory = new JdtTypeProviderFactory(projectProvider); IQualifiedNameConverter qualifiedNameConverter = new IQualifiedNameConverter.DefaultImpl(); scopeProvider = new JdtBasedSimpleTypeScopeProvider(factory, qualifiedNameConverter); resourceSet = new ResourceSetImpl(); resource = new ResourceImpl(); resource.setURI(URI.createURI("http://does/not/exist.file")); emptyResource = new ResourceImpl(); emptyResource.setURI(URI.createURI("http://does/not/exist.file2")); resourceSet.getResources().add(emptyResource); resourceSet.getResources().add(resource); field = TypesFactory.eINSTANCE.createJvmField(); resource.getContents().add(field); }
Example #11
Source File: GenconfUtilsTests.java From M2Doc with Eclipse Public License 1.0 | 6 votes |
@Test public void getOptionsNoOptions() { final Generation generation = GenconfPackage.eINSTANCE.getGenconfFactory().createGeneration(); final Resource resource = new ResourceImpl(URI.createFileURI("/generation.xmi")); resource.getContents().add(generation); generation.setTemplateFileName("template.docx"); generation.setResultFileName("result.docx"); generation.setValidationFileName("validation.docx"); final Map<String, String> options = GenconfUtils.getOptions(generation); assertEquals(4, options.size()); assertEquals("file:/generation.xmi", options.get(GenconfUtils.GENCONF_URI_OPTION)); assertEquals("file:/template.docx", options.get(M2DocUtils.TEMPLATE_URI_OPTION)); assertEquals("file:/result.docx", options.get(M2DocUtils.RESULT_URI_OPTION)); assertEquals("file:/validation.docx", options.get(M2DocUtils.VALIDATION_URI_OPTION)); }
Example #12
Source File: JvmDeclaredTypeTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Test public void testFindFeaturesByName_04() { JvmDeclaredType type = getObjectUnderTest(); JvmGenericType superType = TypesFactory.eINSTANCE.createJvmGenericType(); ResourceImpl resource = new ResourceImpl(); resource.getContents().add(type); resource.getContents().add(superType); JvmOperation operation = TypesFactory.eINSTANCE.createJvmOperation(); operation.setSimpleName("foo"); superType.getMembers().add(operation); JvmParameterizedTypeReference reference = TypesFactory.eINSTANCE.createJvmParameterizedTypeReference(); reference.setType(superType); type.getSuperTypes().add(reference); type.findAllFeaturesByName("foo"); operation.setSimpleName("bar"); Iterable<JvmFeature> iterable = type.findAllFeaturesByName("bar"); Iterator<JvmFeature> iterator = iterable.iterator(); assertTrue(iterator.hasNext()); assertSame(operation, iterator.next()); assertFalse(iterator.hasNext()); }
Example #13
Source File: JvmDeclaredTypeTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Test public void testGetAllFeatures_03() { JvmDeclaredType type = getObjectUnderTest(); JvmGenericType superType = TypesFactory.eINSTANCE.createJvmGenericType(); ResourceImpl resource = new ResourceImpl(); resource.getContents().add(type); resource.getContents().add(superType); JvmOperation operation = TypesFactory.eINSTANCE.createJvmOperation(); superType.getMembers().add(operation); JvmParameterizedTypeReference reference = TypesFactory.eINSTANCE.createJvmParameterizedTypeReference(); reference.setType(superType); type.getSuperTypes().add(reference); Iterable<JvmFeature> iterable = type.getAllFeatures(); Iterator<JvmFeature> iterator = iterable.iterator(); assertTrue(iterator.hasNext()); assertSame(operation, iterator.next()); assertFalse(iterator.hasNext()); }
Example #14
Source File: JvmDeclaredTypeTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Test public void testGetAllFeatures_04() { JvmDeclaredType type = getObjectUnderTest(); JvmGenericType superType = TypesFactory.eINSTANCE.createJvmGenericType(); ResourceImpl resource = new ResourceImpl(); resource.getContents().add(type); resource.getContents().add(superType); type.getAllFeatures(); JvmOperation operation = TypesFactory.eINSTANCE.createJvmOperation(); superType.getMembers().add(operation); JvmParameterizedTypeReference reference = TypesFactory.eINSTANCE.createJvmParameterizedTypeReference(); reference.setType(superType); type.getSuperTypes().add(reference); Iterable<JvmFeature> iterable = type.getAllFeatures(); Iterator<JvmFeature> iterator = iterable.iterator(); assertTrue(iterator.hasNext()); assertSame(operation, iterator.next()); assertFalse(iterator.hasNext()); }
Example #15
Source File: FindingsComposite.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public void setModel(FindingsTemplates model, boolean selectFirst){ Resource r = new ResourceImpl(); r.getContents().add(model); viewer.setInput(r); viewer.expandToLevel(2); if (selectFirst) { selectFirstTreeElement(); } }
Example #16
Source File: GenconfUtilsTests.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
@Test(expected = IllegalArgumentException.class) public void getResolvedRelativeResourceURI() { final Generation generation = GenconfPackage.eINSTANCE.getGenconfFactory().createGeneration(); final Resource resource = new ResourceImpl(URI.createURI("test/test.genconf")); resource.getContents().add(generation); final URI uri = GenconfUtils.getResolvedURI(generation, URI.createURI("test")); assertEquals("test", uri.toString()); }
Example #17
Source File: ContractInputTypeEditingSupportTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Test public void should_applyEditorValue_do_nothing_input_if_type_is_changed_to_primitive() throws Exception { final ContractInput contractInput = ProcessFactory.eINSTANCE.createContractInput(); final ResourceImpl res = new ResourceImpl(); res.getContents().add(contractInput); resourceSet.getResources().add(res); when(viewer.getSelection()).thenReturn(new StructuredSelection(Arrays.asList(contractInput))); contractInputTypeEditingSupport.setValue(contractInput, ContractInputType.INTEGER); contractInputTypeEditingSupport.applyEditorValue(); assertThat(contractInput.getInputs()).hasSize(0); }
Example #18
Source File: ContractInputTypeEditingSupportTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Test public void should_applyEditorValue_do_nothing_input_if_type_is_changed_to_complex_and_with_child() throws Exception { final ContractInput contractInput = ProcessFactory.eINSTANCE.createContractInput(); contractInput.getInputs().add(ProcessFactory.eINSTANCE.createContractInput()); final ResourceImpl res = new ResourceImpl(); res.getContents().add(contractInput); resourceSet.getResources().add(res); when(viewer.getSelection()).thenReturn(new StructuredSelection(Arrays.asList(contractInput))); contractInputTypeEditingSupport.setValue(contractInput, ContractInputType.COMPLEX); contractInputTypeEditingSupport.applyEditorValue(); assertThat(contractInput.getInputs()).hasSize(1); }
Example #19
Source File: ContractInputTypeEditingSupportTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Test public void should_applyEditorValue_add_child_input_if_type_is_changed_to_complex_and_has_no_child() throws Exception { final ContractInput contractInput = ProcessFactory.eINSTANCE.createContractInput(); final ResourceImpl res = new ResourceImpl(); res.getContents().add(contractInput); resourceSet.getResources().add(res); when(viewer.getSelection()).thenReturn(new StructuredSelection(Arrays.asList(contractInput))); contractInputTypeEditingSupport.setValue(contractInput, ContractInputType.COMPLEX); contractInputTypeEditingSupport.applyEditorValue(); verify(refactorOperation).run(any()); }
Example #20
Source File: ContractInputTypeEditingSupportTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Test public void should_setValue_setContractInput_and_refresh_viewer() throws Exception { final ContractInput contractInput = ProcessFactory.eINSTANCE.createContractInput(); final ResourceImpl res = new ResourceImpl(); res.getContents().add(contractInput); resourceSet.getResources().add(res); contractInputTypeEditingSupport.setValue(contractInput, ContractInputType.COMPLEX); assertThat(contractInputTypeEditingSupport.getContractInput()).isEqualTo(contractInput); verify(refactorOperation).run(any()); verify(contractInputTypeEditingSupport.getViewer()).refresh(true); }
Example #21
Source File: DiagramForElementRunnableTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { resource = new ResourceImpl(); element = ProcessFactory.eINSTANCE.createMainProcess(); element.setName("Diagram1"); diagram = NotationFactory.eINSTANCE.createDiagram(); diagram.setElement(element); resource.getContents().add(element); resource.getContents().add(diagram); }
Example #22
Source File: EditBusinessObjectDataWizardTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { final BusinessObjectModelRepositoryStore store = mock(BusinessObjectModelRepositoryStore.class); final MainProcess diagram = ProcessFactory.eINSTANCE.createMainProcess(); container = ProcessFactory.eINSTANCE.createPool(); container.setName("Test Process"); diagram.getElements().add(container); final DataType bType = ProcessFactory.eINSTANCE.createBusinessObjectType(); bType.setName(DataTypeLabels.businessObjectType); diagram.getDatatypes().add(bType); final BusinessObjectData data = ProcessFactory.eINSTANCE.createBusinessObjectData(); data.setName("testData"); data.setDataType(bType); data.setBusinessDataRepositoryId("fake"); data.setEClassName("Entity"); data.setClassName("org.bonitasoft.test.Entity"); container.getData().add(data); final BusinessObjectData data2 = ProcessFactory.eINSTANCE.createBusinessObjectData(); data2.setName("testData2"); data2.setDataType(bType); data2.setBusinessDataRepositoryId("fake"); data2.setEClassName("Entity2"); data2.setClassName("org.bonitasoft.test.Entity2"); container.getData().add(data2); final Resource r = new ResourceImpl(URI.createFileURI("test.proc")); r.getContents().clear(); r.getContents().add(diagram); final ResourceSet rSet = new ResourceSetImpl(); rSet.getResources().add(r); editingDomain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(rSet); wizardUnderTest = new EditBusinessObjectDataWizard(data, store, editingDomain); wizardUnderTest.setContainer(wizardContainer); }
Example #23
Source File: AbstractTypeSystem.java From statecharts with Eclipse Public License 1.0 | 5 votes |
public AbstractTypeSystem() { resource = new ResourceImpl(URI.createURI("types")) { @Override protected void doUnload() { // Unloading should not be performed for in memory resource } }; typeAnnotations = new TypeAnnotations(); initRegistries(); }
Example #24
Source File: OnChangeEvictingCacheAdapterTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testCacheSurvivesChangeToDiagnostics() throws Exception { EcoreFactory factory = EcoreFactory.eINSTANCE; EClass eClass = factory.createEClass(); Resource resource = new ResourceImpl(); resource.getContents().add(eClass); CacheAdapter ca = new OnChangeEvictingCache().getOrCreate(resource); setValue(ca); List<Diagnostic> errors = resource.getErrors(); assertIsSet(ca); errors.clear(); assertIsSet(ca); }
Example #25
Source File: GenconfUtilsTests.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
@Test public void getOptionsNullResourceURI() { final Generation generation = GenconfPackage.eINSTANCE.getGenconfFactory().createGeneration(); final Resource resource = new ResourceImpl(); resource.getContents().add(generation); final Map<String, String> options = GenconfUtils.getOptions(generation); assertEquals(0, options.size()); }
Example #26
Source File: AbstractScopeTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Before public void setUp() throws Exception { resource = new ResourceImpl(URI.createURI("uri")); annotationA = EcoreFactory.eINSTANCE.createEAnnotation(); annotationB = EcoreFactory.eINSTANCE.createEAnnotation(); resource.getContents().add(annotationA); resource.getContents().add(annotationB); descriptionA = EObjectDescription.create("a", annotationA); descriptionA_aliased = EObjectDescription.create("aliasedA", annotationA); descriptionB = EObjectDescription.create("b", annotationB); descriptionB_as_A = EObjectDescription.create("a", annotationB); }
Example #27
Source File: GenconfUtilsTests.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
@Test public void getOptionsGenconfURI() { final Generation generation = GenconfPackage.eINSTANCE.getGenconfFactory().createGeneration(); final Resource resource = new ResourceImpl(URI.createURI("test")); resource.getContents().add(generation); final Map<String, String> options = GenconfUtils.getOptions(generation); assertEquals(1, options.size()); assertEquals("test", options.get(GenconfUtils.GENCONF_URI_OPTION)); }
Example #28
Source File: NullJdtTypeProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public Resource createResource(URI uri) { doLogMessage("Creating empty resource instead of type resource:" + uri); return new ResourceImpl(uri) { @Override protected void doLoad(InputStream inputStream, Map<?, ?> options) throws IOException { // ignore } }; }
Example #29
Source File: GenconfUtilsTests.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
@Test public void getOptions() { final Generation generation = GenconfPackage.eINSTANCE.getGenconfFactory().createGeneration(); final Resource resource = new ResourceImpl(URI.createFileURI("/generation.xmi")); resource.getContents().add(generation); generation.setTemplateFileName("template.docx"); generation.setResultFileName("result.docx"); generation.setValidationFileName("validation.docx"); final Option option1 = GenconfPackage.eINSTANCE.getGenconfFactory().createOption(); option1.setName("option1"); option1.setValue("value1"); generation.getOptions().add(option1); final Option option2 = GenconfPackage.eINSTANCE.getGenconfFactory().createOption(); option2.setName("option2"); option2.setValue("value2"); generation.getOptions().add(option2); final Option option3 = GenconfPackage.eINSTANCE.getGenconfFactory().createOption(); option3.setName("option3"); option3.setValue("value3"); generation.getOptions().add(option3); final Map<String, String> options = GenconfUtils.getOptions(generation); assertEquals(7, options.size()); assertEquals("file:/generation.xmi", options.get(GenconfUtils.GENCONF_URI_OPTION)); assertEquals("file:/template.docx", options.get(M2DocUtils.TEMPLATE_URI_OPTION)); assertEquals("file:/result.docx", options.get(M2DocUtils.RESULT_URI_OPTION)); assertEquals("file:/validation.docx", options.get(M2DocUtils.VALIDATION_URI_OPTION)); assertEquals("value1", options.get("option1")); assertEquals("value2", options.get("option2")); assertEquals("value3", options.get("option3")); }
Example #30
Source File: GenconfUtilsTests.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
@Test public void getResolvedURINullResourceURI() { final Generation generation = GenconfPackage.eINSTANCE.getGenconfFactory().createGeneration(); final Resource resource = new ResourceImpl(); resource.getContents().add(generation); final URI uri = GenconfUtils.getResolvedURI(generation, URI.createURI("test")); assertEquals("test", uri.toString()); }