use of org.eclipse.xtext.parser.partialParsingTestUtil.CrossResourceContainerOneChild in project xtext-core by eclipse.
the class CrossContainmentTest method testCrossContainment_02.
@Test
public void testCrossContainment_02() {
XtextResourceSet resourceSet = get(XtextResourceSet.class);
resourceSet.setClasspathURIContext(getClass());
Resource resource = resourceSet.createResource(URI.createFileURI("container.xmi"));
Resource childResource = resourceSet.createResource(URI.createFileURI("child.xmi"));
CrossResourceContainerOneChild container = PartialParsingTestUtilFactory.eINSTANCE.createCrossResourceContainerOneChild();
resource.getContents().add(container);
Grammar grammar = XtextFactory.eINSTANCE.createGrammar();
childResource.getContents().add(grammar);
assertNull(grammar.eContainer());
container.setChild(grammar);
assertSame(container, grammar.eContainer());
assertSame(childResource, grammar.eResource());
assertSame(resource, container.eResource());
}
use of org.eclipse.xtext.parser.partialParsingTestUtil.CrossResourceContainerOneChild in project xtext-core by eclipse.
the class PartialParserCrossContainmentSingleTest method setCrossResourceContainer.
@Override
protected void setCrossResourceContainer(XtextResource resource) {
ResourceSet resourceSet = resource.getResourceSet();
Resource containerResource = resourceSet.createResource(URI.createFileURI("sample.xmi"));
CrossResourceContainerOneChild container = PartialParsingTestUtilFactory.eINSTANCE.createCrossResourceContainerOneChild();
containerResource.getContents().add(container);
assertEquals(1, resource.getContents().size());
container.setChild(resource.getContents().get(0));
}
Aggregations