Search in sources :

Example 1 with ProjectSet

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);
}
Also used : BuildOrderInfo(org.eclipse.n4js.xtext.workspace.BuildOrderInfo) N4JSWorkspaceConfigSnapshot(org.eclipse.n4js.workspace.N4JSWorkspaceConfigSnapshot) N4JSProjectConfigSnapshot(org.eclipse.n4js.workspace.N4JSProjectConfigSnapshot) URI(org.eclipse.emf.common.util.URI) FileURI(org.eclipse.n4js.workspace.locations.FileURI) ProjectSet(org.eclipse.n4js.xtext.workspace.ProjectSet)

Example 2 with ProjectSet

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);
}
Also used : N4JSProjectConfigSnapshot(org.eclipse.n4js.workspace.N4JSProjectConfigSnapshot) ProjectConfigSnapshot(org.eclipse.n4js.xtext.workspace.ProjectConfigSnapshot) N4JSProjectConfigSnapshot(org.eclipse.n4js.workspace.N4JSProjectConfigSnapshot) URI(org.eclipse.emf.common.util.URI) ProjectSet(org.eclipse.n4js.xtext.workspace.ProjectSet) Test(org.junit.Test)

Aggregations

URI (org.eclipse.emf.common.util.URI)2 N4JSProjectConfigSnapshot (org.eclipse.n4js.workspace.N4JSProjectConfigSnapshot)2 ProjectSet (org.eclipse.n4js.xtext.workspace.ProjectSet)2 N4JSWorkspaceConfigSnapshot (org.eclipse.n4js.workspace.N4JSWorkspaceConfigSnapshot)1 FileURI (org.eclipse.n4js.workspace.locations.FileURI)1 BuildOrderInfo (org.eclipse.n4js.xtext.workspace.BuildOrderInfo)1 ProjectConfigSnapshot (org.eclipse.n4js.xtext.workspace.ProjectConfigSnapshot)1 Test (org.junit.Test)1