use of org.eclipse.emf.common.util.URI in project xtext-core by eclipse.
the class UriUtilTest method testPrefixRequiresSameScheme.
@Test
public void testPrefixRequiresSameScheme() {
final URI prefix = URI.createURI("platform:/foo/");
final URI uri = URI.createURI("file:/foo/bar");
Assert.assertFalse(UriUtil.isPrefixOf(prefix, uri));
}
use of org.eclipse.emf.common.util.URI in project xtext-core by eclipse.
the class UriUtilTest method testPrefix.
@Test
public void testPrefix() {
final URI prefix = URI.createURI("file:/foo/");
final URI uri = URI.createURI("file:/foo/bar");
Assert.assertTrue(UriUtil.isPrefixOf(prefix, uri));
}
use of org.eclipse.emf.common.util.URI in project xtext-core by eclipse.
the class UriUtilTest method testPrefixRequiresSegmentsToMatch.
@Test
public void testPrefixRequiresSegmentsToMatch() {
final URI prefix = URI.createURI("file:/foo");
final URI uri = URI.createURI("file:/buzz/bar");
Assert.assertFalse(UriUtil.isPrefixOf(prefix, uri));
}
use of org.eclipse.emf.common.util.URI in project xtext-core by eclipse.
the class UriUtilTest method testFolderUriHasTrailingSeparator.
@Test
public void testFolderUriHasTrailingSeparator() {
final File folder = new File(".");
final URI uri = UriUtil.createFolderURI(folder);
Assert.assertTrue(uri.hasTrailingPathSeparator());
int _segmentCount = uri.segmentCount();
int _minus = (_segmentCount - 2);
Assert.assertEquals(".", uri.segment(_minus));
}
use of org.eclipse.emf.common.util.URI in project xtext-core by eclipse.
the class ImportedNamespaceAwareLocalScopeProviderTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
with(new IndexTestLanguageStandaloneSetup());
globalScopeProvider = new ResourceSetGlobalScopeProvider();
nameProvider = new DefaultDeclarativeQualifiedNameProvider();
nameConverter = new IQualifiedNameConverter.DefaultImpl();
final DefaultResourceDescriptionStrategy strategy = new DefaultResourceDescriptionStrategy();
strategy.setQualifiedNameProvider(nameProvider);
final DefaultResourceDescriptionManager resourceDescMnr = new DefaultResourceDescriptionManager() {
@Override
public IResourceDescription getResourceDescription(Resource resource) {
DefaultResourceDescription resourceDescription = new DefaultResourceDescription(resource, strategy);
return resourceDescription;
}
};
final DefaultResourceServiceProvider provider = new DefaultResourceServiceProvider() {
@Override
public Manager getResourceDescriptionManager() {
return resourceDescMnr;
}
};
globalScopeProvider.setGlobalResourceDecriptionProvider(new GlobalResourceDescriptionProvider(new ResourceServiceProviderRegistryImpl() {
@Override
public IResourceServiceProvider getResourceServiceProvider(URI uri, String contentType) {
return provider;
}
}));
CaseInsensitivityHelper caseInsensitivityHelper = new CaseInsensitivityHelper();
globalScopeProvider.setCaseInsensitivityHelper(caseInsensitivityHelper);
scopeProvider = new ImportedNamespaceAwareLocalScopeProvider(globalScopeProvider, nameProvider, nameConverter, caseInsensitivityHelper);
}
Aggregations