use of org.eclipse.che.api.workspace.server.model.impl.devfile.ProjectImpl in project devspaces-images by redhat-developer.
the class ProjectConverterTest method testClonePathCannotEscapeProjectsRoot.
@Test(expectedExceptions = DevfileException.class)
public void testClonePathCannotEscapeProjectsRoot() throws Exception {
ProjectImpl devfileProject = new ProjectImpl("myProject", new SourceImpl("git", "https://github.com/eclipse/che.git", "master", null, null, null, null), "cant/hack/../../../usr/bin");
projectConverter.toWorkspaceProject(devfileProject);
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.ProjectImpl in project devspaces-images by redhat-developer.
the class ProjectConverterTest method testOnlyOneOfStartPointAttributesAllowed.
@Test(expectedExceptions = DevfileException.class, expectedExceptionsMessageRegExp = "Only one of '" + START_POINT_PARAMETER_NAME + "', '" + TAG_PARAMETER_NAME + "', '" + COMMIT_ID_PARAMETER_NAME + "' can be specified\\.", dataProvider = "invalidStartPointOrTagOrCommitIdCombinations")
public void testOnlyOneOfStartPointAttributesAllowed(String startPoint, String tag, String commitId) throws Exception {
ProjectImpl devfileProject = new ProjectImpl("myProject", new SourceImpl("git", "https://github.com/eclipse/che.git", null, startPoint, tag, commitId, null), null);
projectConverter.toWorkspaceProject(devfileProject);
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.ProjectImpl in project devspaces-images by redhat-developer.
the class ProjectConverterTest method testUndefinedCloneParametersNotTransferredToWorkspaceConfig.
@Test
public void testUndefinedCloneParametersNotTransferredToWorkspaceConfig() throws Exception {
ProjectImpl devfileProject = new ProjectImpl("myProject", new SourceImpl("git", "https://github.com/eclipse/che.git", null, null, null, null, null), null);
ProjectConfigImpl wsProject = projectConverter.toWorkspaceProject(devfileProject);
SourceStorageImpl wsSource = wsProject.getSource();
assertFalse(wsSource.getParameters().containsKey(BRANCH_PARAMETER_NAME));
assertFalse(wsSource.getParameters().containsKey(START_POINT_PARAMETER_NAME));
assertFalse(wsSource.getParameters().containsKey(TAG_PARAMETER_NAME));
assertFalse(wsSource.getParameters().containsKey(COMMIT_ID_PARAMETER_NAME));
assertFalse(wsSource.getParameters().containsKey(SPARSE_CHECKOUT_DIR_PARAMETER_NAME));
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.ProjectImpl in project devspaces-images by redhat-developer.
the class ProjectConverterTest method testConvertingDevfileProjectToProjectConfig.
@Test
public void testConvertingDevfileProjectToProjectConfig() throws Exception {
ProjectImpl devfileProject = new ProjectImpl("myProject", new SourceImpl("git", "https://github.com/eclipse/che.git", "master", "3434d", null, null, "core"), null);
ProjectConfigImpl workspaceProject = projectConverter.toWorkspaceProject(devfileProject);
assertEquals(workspaceProject.getName(), "myProject");
assertEquals(workspaceProject.getPath(), "/myProject");
SourceStorageImpl source = workspaceProject.getSource();
assertEquals(source.getType(), "git");
assertEquals(source.getLocation(), "https://github.com/eclipse/che.git");
assertEquals(source.getParameters().get(BRANCH_PARAMETER_NAME), "master");
assertEquals(source.getParameters().get(START_POINT_PARAMETER_NAME), "3434d");
assertEquals(source.getParameters().get("keepDir"), "core");
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.ProjectImpl in project devspaces-images by redhat-developer.
the class ProjectConverterTest method testUpDirOkInClonePathAsLongAsItDoesntEscapeProjectsRoot.
@Test
public void testUpDirOkInClonePathAsLongAsItDoesntEscapeProjectsRoot() throws Exception {
ProjectImpl devfileProject = new ProjectImpl("myProject", new SourceImpl("git", "https://github.com/eclipse/che.git", "master", null, null, null, null), "cant/hack/../../usr/bin");
ProjectConfigImpl workspaceProject = projectConverter.toWorkspaceProject(devfileProject);
// this is OK, because the absolute-looking path is applied to the projects root
assertEquals(workspaceProject.getPath(), "/usr/bin");
}
Aggregations