use of org.eclipse.che.api.project.server.FolderEntry in project che by eclipse.
the class WorkspaceTest method testAddingNewModule.
@Test
public void testAddingNewModule() throws Exception {
String pom = "<groupId>test</groupId>" + "<artifactId>testArtifact</artifactId>" + "<version>42</version>" + "<modules>" + " <module>module1</module>" + "</modules>";
FolderEntry parentFolder = createTestProject("parent", pom);
String pomModule1 = "<groupId>test</groupId>" + "<artifactId>testModule1</artifactId>" + "<version>1</version>" + "<dependencies>" + " <dependency>" + " <groupId>junit</groupId>" + " <artifactId>junit</artifactId>" + " <version>4.12</version>" + " </dependency>" + "</dependencies>";
createTestProject("parent/module1", pomModule1);
IProject parent = ResourcesPlugin.getWorkspace().getRoot().getProject("parent");
mavenWorkspace.update(Collections.singletonList(parent));
mavenWorkspace.waitForUpdate();
assertThat(projectRegistry.getProjects()).hasSize(2).onProperty("path").containsOnly("/parent", "/parent/module1");
VirtualFile parentPom = parentFolder.getChild("pom.xml").getVirtualFile();
Model model = Model.readFrom(parentPom);
List<String> modules = new ArrayList<>(model.getModules());
modules.add("module2");
model.setModules(modules);
model.writeTo(parentPom);
String pomModule2 = "<groupId>module2</groupId>" + "<artifactId>testModule2</artifactId>" + "<version>2</version>" + "<dependencies>" + " <dependency>" + " <groupId>junit</groupId>" + " <artifactId>junit</artifactId>" + " <version>4.12</version>" + " </dependency>" + "</dependencies>";
createTestProject("parent/module2", pomModule2);
mavenWorkspace.update(Collections.singletonList(parent));
mavenWorkspace.waitForUpdate();
assertThat(projectRegistry.getProjects()).hasSize(3).onProperty("path").containsOnly("/parent", "/parent/module1", "/parent/module2");
}
use of org.eclipse.che.api.project.server.FolderEntry in project che by eclipse.
the class CreateNetCoreProjectHandler method onCreateProject.
@Override
public void onCreateProject(Path projectPath, Map<String, AttributeValue> attributes, Map<String, String> options) throws ForbiddenException, ConflictException, ServerException {
VirtualFileSystem vfs = virtualFileSystemProvider.getVirtualFileSystem();
FolderEntry baseFolder = new FolderEntry(vfs.getRoot().createFolder(projectPath.toString()));
baseFolder.createFile(PROJECT_FILE_NAME, getProjectContent());
}
use of org.eclipse.che.api.project.server.FolderEntry in project che by eclipse.
the class CProjectGenerator method onCreateProject.
@Override
public void onCreateProject(Path projectPath, Map<String, AttributeValue> attributes, Map<String, String> options) throws ForbiddenException, ConflictException, ServerException {
VirtualFileSystem vfs = virtualFileSystemProvider.getVirtualFileSystem();
FolderEntry baseFolder = new FolderEntry(vfs.getRoot().createFolder(projectPath.toString()));
baseFolder.createFile(FILE_NAME, getClass().getClassLoader().getResourceAsStream("files/default_c_content"));
}
use of org.eclipse.che.api.project.server.FolderEntry in project che by eclipse.
the class CppProjectGenerator method onCreateProject.
@Override
public void onCreateProject(Path projectPath, Map<String, AttributeValue> attributes, Map<String, String> options) throws ForbiddenException, ConflictException, ServerException {
VirtualFileSystem vfs = virtualFileSystemProvider.getVirtualFileSystem();
FolderEntry baseFolder = new FolderEntry(vfs.getRoot().createFolder(projectPath.toString()));
baseFolder.createFile(FILE_NAME, getClass().getClassLoader().getResourceAsStream("files/default_cpp_content"));
}
use of org.eclipse.che.api.project.server.FolderEntry in project che by eclipse.
the class SubversionProjectImporterTest method testValidImportSources.
/**
* Test for {@link SubversionProjectImporter#importSources(org.eclipse.che.api.project.server.FolderEntry, org.eclipse.che.api.core.model.project.SourceStorage, org.eclipse.che.api.core.util.LineConsumerFactory)}
* with a valid url.
*
* @throws Exception if anything goes wrong
*/
@Test
public void testValidImportSources() throws Exception {
final String projectName = NameGenerator.generate("project-", 3);
final VirtualFile virtualFile = root.createFolder(projectName);
FolderEntry projectFolder = new FolderEntry(virtualFile);
String repoUrl = Paths.get(repoRoot.getAbsolutePath()).toUri().toString();
when(sourceStorage.getLocation()).thenReturn(repoUrl);
projectImporter.importSources(projectFolder, sourceStorage, new TestUtils.SystemOutLineConsumerFactory());
assertTrue(projectFolder.getChild(".svn").isFolder());
assertTrue(projectFolder.getChild("trunk").isFolder());
assertTrue(projectFolder.getChildFolder("trunk").getChild("A").isFolder());
assertTrue(projectFolder.getChildFolder("trunk").getChildFolder("A").getChild("mu").isFile());
}
Aggregations