use of org.eclipse.n4js.xtext.workspace.ProjectSet in project n4js by eclipse.
the class MockWorkspaceSupplier method createWorkspaceConfig.
/**
* Creates the configuration of the mocked test workspace.
* <p>
* The returned workspace configuration is expected to contain at least one project with at least one source folder
* that isn't a {@link N4JSSourceFolderSnapshotForPackageJson}. The corresponding folders and files are not expected
* to exist on disk.
* <p>
* Only invoked on demand and never more than once.
*/
protected N4JSWorkspaceConfigSnapshot createWorkspaceConfig() {
N4JSProjectConfigSnapshot projectConfig = createProjectConfig();
URI workspacePath = URIUtils.trimTrailingPathSeparator(projectConfig.getPath()).trimSegments(1);
ProjectSet projects = new ProjectSet(Collections.singleton(projectConfig));
BuildOrderInfo buildOrderInfo = new BuildOrderInfo(Collections.emptyList(), Collections.emptySet());
return new N4JSWorkspaceConfigSnapshot(workspacePath, projects, buildOrderInfo);
}
use of org.eclipse.n4js.xtext.workspace.ProjectSet in project n4js by eclipse.
the class ProjectSetTest method testRemoveAndRecreate.
/**
* Tests the special cases described in {@link ProjectSet#update(Iterable, Iterable)}.
*/
@Test
public void testRemoveAndRecreate() {
String projectName = "TestProject";
URI rootA = URI.createFileURI("///some/folder");
URI rootB = URI.createFileURI("///another/folder");
N4JSProjectConfigSnapshot projectBelowRootA = createProjectConfig(rootA.appendSegment(projectName));
N4JSProjectConfigSnapshot projectBelowRootB = createProjectConfig(rootB.appendSegment(projectName));
ProjectSet set1 = new ProjectSet(Collections.singleton(projectBelowRootA));
ProjectSet set2 = set1.update(Collections.singleton(projectBelowRootB), Collections.singleton(projectName));
assertEquals(1, set2.size());
ProjectConfigSnapshot projectInSet2 = IterableExtensions.head(set2.getProjects());
assertEquals(rootB.appendSegment(projectName), projectInSet2.getPath());
assertEquals(projectBelowRootB, projectInSet2);
}
Aggregations