diff --git a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestProjectServiceClient.java b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestProjectServiceClient.java
index adaf409425..ada80fa696 100644
--- a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestProjectServiceClient.java
+++ b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestProjectServiceClient.java
@@ -293,6 +293,8 @@ public class TestProjectServiceClient {
return requestFactory
.fromUrl(workspaceAgentApiEndpointUrlProvider.get(workspaceId) + "project/" + projectName)
.useGetMethod()
+ .setAuthorizationHeader(
+ BEARER_TOKEN_PREFIX + machineServiceClient.getMachineApiToken(workspaceId))
.request()
.asDto(ProjectConfigDto.class);
}
diff --git a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/project/ProjectTemplates.java b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/project/ProjectTemplates.java
index eadba5a39e..95c927d12f 100644
--- a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/project/ProjectTemplates.java
+++ b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/project/ProjectTemplates.java
@@ -25,6 +25,7 @@ public class ProjectTemplates {
public static final String CONSOLE_JAVA_SIMPLE = "console_java_simple.json";
public static final String GO = "go.json";
public static final String DOT_NET = "dotNet.json";
+ public static final String PROJECT_OF_UNDEFINED_TYPE = "undefined.json";
private ProjectTemplates() {}
}
diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToMavenProjectTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToMavenProjectTest.java
new file mode 100644
index 0000000000..8a6716a5d2
--- /dev/null
+++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToMavenProjectTest.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2012-2018 Red Hat, Inc.
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ */
+package org.eclipse.che.selenium.miscellaneous;
+
+import static java.lang.String.format;
+import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.PROJECT;
+import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.UPDATE_PROJECT_CONFIGURATION;
+import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.CONVERT_TO_PROJECT;
+import static org.eclipse.che.selenium.core.project.ProjectTemplates.PROJECT_OF_UNDEFINED_TYPE;
+
+import com.google.inject.Inject;
+import java.net.URL;
+import java.nio.file.Paths;
+import org.eclipse.che.commons.lang.NameGenerator;
+import org.eclipse.che.selenium.core.SeleniumWebDriver;
+import org.eclipse.che.selenium.core.action.ActionsFactory;
+import org.eclipse.che.selenium.core.client.TestProjectServiceClient;
+import org.eclipse.che.selenium.core.workspace.TestWorkspace;
+import org.eclipse.che.selenium.pageobject.AskForValueDialog;
+import org.eclipse.che.selenium.pageobject.CodenvyEditor;
+import org.eclipse.che.selenium.pageobject.Ide;
+import org.eclipse.che.selenium.pageobject.InformationDialog;
+import org.eclipse.che.selenium.pageobject.Loader;
+import org.eclipse.che.selenium.pageobject.Menu;
+import org.eclipse.che.selenium.pageobject.ProjectExplorer;
+import org.eclipse.che.selenium.pageobject.Wizard;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/** @author Aleksandr Shmaraev, Musienko Maxim */
+public class ConvertToMavenProjectTest {
+ private static final String PROJECT_NAME = NameGenerator.generate("project", 4);
+ private static final String WEB_APP_MODULE = "my-webapp";
+ private static final String NONE_MAVEN_PROJECT = NameGenerator.generate("noneMavenProject", 4);
+ private static final String PARENT_ARTIFACT_SECTION =
+ "\n"
+ + "org.eclipse.che.examples\n"
+ + "qa-multimodule\n"
+ + " 1.0-SNAPSHOT\n"
+ + "\n";
+ private static final String CONVERT_PATH = format("%s/%s", PROJECT_NAME, WEB_APP_MODULE);
+ @Inject private TestWorkspace workspace;
+ @Inject private Ide ide;
+ @Inject private ProjectExplorer projectExplorer;
+ @Inject private CodenvyEditor editor;
+ @Inject private Menu menu;
+ @Inject private Loader loader;
+ @Inject private Wizard wizard;
+ @Inject private AskForValueDialog askForValueDialog;
+ @Inject private InformationDialog informationDialog;
+ @Inject private ActionsFactory actionsFactory;
+ @Inject private TestProjectServiceClient testProjectServiceClient;
+ @Inject private SeleniumWebDriver seleniumWebDriver;
+ private String workspaceId;
+
+ @BeforeClass
+ public void setUp() throws Exception {
+ workspaceId = workspace.getId();
+ URL mavenMultimodule = getClass().getResource("/projects/java-multimodule");
+ URL noneMavenProject = getClass().getResource("/projects/console-cpp-simple");
+ testProjectServiceClient.importProject(
+ workspaceId, Paths.get(mavenMultimodule.toURI()), PROJECT_NAME, PROJECT_OF_UNDEFINED_TYPE);
+ testProjectServiceClient.importProject(
+ workspaceId,
+ Paths.get(noneMavenProject.toURI()),
+ NONE_MAVEN_PROJECT,
+ PROJECT_OF_UNDEFINED_TYPE);
+
+ ide.open(workspace);
+ ide.waitOpenedWorkspaceIsReadyToUse();
+ projectExplorer.quickRevealToItemWithJavaScript(format("%s/%s", PROJECT_NAME, WEB_APP_MODULE));
+ }
+
+ @Test
+ public void shouldConvertToMavenMultimoduleProject() throws Exception {
+ convertPredefinedFolderToMavenProjectWithContextMenu(CONVERT_PATH);
+ testProjectServiceClient.checkProjectType(workspaceId, CONVERT_PATH, "maven");
+ addParentArticatSectionIntoPomFile();
+ menu.runCommand(PROJECT, UPDATE_PROJECT_CONFIGURATION);
+ convertToMavenByWizard("/", PROJECT_NAME);
+ testProjectServiceClient.checkProjectType(workspaceId, CONVERT_PATH, "maven");
+ }
+
+ @Test
+ public void shouldNotConvertToMavenProject() {
+ projectExplorer.waitAndSelectItem(NONE_MAVEN_PROJECT);
+ menu.runCommand(PROJECT, UPDATE_PROJECT_CONFIGURATION);
+ wizard.waitOpenProjectConfigForm();
+ wizard.waitTextParentDirectoryName("/");
+ wizard.waitTextProjectNameInput(NONE_MAVEN_PROJECT);
+ wizard.selectSample(Wizard.TypeProject.MAVEN);
+ informationDialog.acceptInformDialogWithText("pom.xml does not exist.");
+ wizard.closeWithIcon();
+ }
+
+ private void convertPredefinedFolderToMavenProjectWithContextMenu(String converPath) {
+ projectExplorer.waitAndSelectItem(converPath);
+ projectExplorer.openContextMenuByPathSelectedItem(converPath);
+ projectExplorer.clickOnItemInContextMenu(CONVERT_TO_PROJECT);
+ convertToMavenByWizard("/" + PROJECT_NAME, WEB_APP_MODULE);
+ }
+
+ private void convertToMavenByWizard(String pathToDirectory, String convertedFolder) {
+ wizard.waitOpenProjectConfigForm();
+ wizard.waitTextParentDirectoryName(pathToDirectory);
+ wizard.waitTextProjectNameInput(convertedFolder);
+ wizard.selectSample(Wizard.TypeProject.MAVEN);
+ loader.waitOnClosed();
+ wizard.clickSaveButton();
+ wizard.waitCloseProjectConfigForm();
+ }
+
+ private void addParentArticatSectionIntoPomFile() {
+ projectExplorer.openItemByPath(CONVERT_PATH + "/pom.xml");
+ editor.goToPosition(23, 3);
+ editor.typeTextIntoEditor(PARENT_ARTIFACT_SECTION);
+ projectExplorer.waitAndSelectItem(PROJECT_NAME);
+ }
+}
diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToProjectWithPomFileTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToProjectWithPomFileTest.java
deleted file mode 100644
index 944aec61a7..0000000000
--- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToProjectWithPomFileTest.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 2012-2018 Red Hat, Inc.
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- */
-package org.eclipse.che.selenium.miscellaneous;
-
-import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.CONVERT_TO_PROJECT;
-import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.NEW;
-import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.XML_FILE;
-import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING;
-import static org.eclipse.che.selenium.pageobject.ProjectExplorer.FolderTypes.SIMPLE_FOLDER;
-
-import com.google.inject.Inject;
-import java.net.URL;
-import java.nio.file.Paths;
-import org.eclipse.che.commons.lang.NameGenerator;
-import org.eclipse.che.selenium.core.SeleniumWebDriver;
-import org.eclipse.che.selenium.core.action.ActionsFactory;
-import org.eclipse.che.selenium.core.client.TestProjectServiceClient;
-import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants;
-import org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuItems;
-import org.eclipse.che.selenium.core.utils.WaitUtils;
-import org.eclipse.che.selenium.core.workspace.TestWorkspace;
-import org.eclipse.che.selenium.pageobject.AskForValueDialog;
-import org.eclipse.che.selenium.pageobject.CodenvyEditor;
-import org.eclipse.che.selenium.pageobject.Ide;
-import org.eclipse.che.selenium.pageobject.InformationDialog;
-import org.eclipse.che.selenium.pageobject.Loader;
-import org.eclipse.che.selenium.pageobject.Menu;
-import org.eclipse.che.selenium.pageobject.ProjectExplorer;
-import org.eclipse.che.selenium.pageobject.Wizard;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-/** @author Aleksandr Shmaraev */
-public class ConvertToProjectWithPomFileTest {
- private static final String PROJECT_NAME = NameGenerator.generate("project", 4);
- private static final String NEW_FOLDER_NAME = "new-folder";
- private static final String NEW_MODULE_NAME = "new-module";
- private static final String PATH_TO_POM_FILE = PROJECT_NAME + "/" + NEW_MODULE_NAME;
- private static final String EXPECTED_TEXT =
- "\n"
- + "\n"
- + "4.0.0\n"
- + "groupId\n"
- + "new-module\n"
- + "jar\n"
- + "1.0-SNAPSHOT\n"
- + "new-module\n"
- + "";
-
- @Inject private TestWorkspace workspace;
- @Inject private Ide ide;
- @Inject private ProjectExplorer projectExplorer;
- @Inject private CodenvyEditor editor;
- @Inject private Menu menu;
- @Inject private Loader loader;
- @Inject private Wizard wizard;
- @Inject private AskForValueDialog askForValueDialog;
- @Inject private InformationDialog informationDialog;
- @Inject private ActionsFactory actionsFactory;
- @Inject private TestProjectServiceClient testProjectServiceClient;
- @Inject private SeleniumWebDriver seleniumWebDriver;
-
- @BeforeClass
- public void setUp() throws Exception {
- URL resource = getClass().getResource("/projects/guess-project");
- testProjectServiceClient.importProject(
- workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING);
- ide.open(workspace);
-
- ide.waitOpenedWorkspaceIsReadyToUse();
- projectExplorer.waitAndSelectItem(PROJECT_NAME);
- }
-
- @BeforeMethod
- public void expandProject() {
- projectExplorer.quickCollapseJavaScript();
- projectExplorer.quickExpandWithJavaScript();
- }
-
- @Test
- public void checkConvertToProjectWithPomFile() throws Exception {
-
- // create a folder and check message if the path is wrong
- createNewFolder(PROJECT_NAME, NEW_FOLDER_NAME);
- projectExplorer.waitAndSelectItemByName(NEW_FOLDER_NAME);
- projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/" + NEW_FOLDER_NAME);
- projectExplorer.clickOnItemInContextMenu(CONVERT_TO_PROJECT);
- wizard.waitOpenProjectConfigForm();
- wizard.waitTextParentDirectoryName("/" + PROJECT_NAME);
- wizard.waitTextProjectNameInput(NEW_FOLDER_NAME);
- wizard.selectSample(Wizard.TypeProject.MAVEN);
- informationDialog.acceptInformDialogWithText("pom.xml does not exist.");
- wizard.selectSample(Wizard.TypeProject.BLANK);
- loader.waitOnClosed();
- wizard.clickSaveButton();
- wizard.waitCloseProjectConfigForm();
-
- // create a folder with pom file
- createNewFolder(PROJECT_NAME, NEW_MODULE_NAME);
- createNewFile("pom", PATH_TO_POM_FILE, XML_FILE);
- editor.waitActive();
- editor.waitTabIsPresent("pom.xml");
- editor.selectTabByName("pom.xml");
- editor.deleteAllContent();
- actionsFactory.createAction(seleniumWebDriver).sendKeys(EXPECTED_TEXT).perform();
- editor.waitTextIntoEditor(EXPECTED_TEXT);
-
- // this timeout is needed for waiting that the Editor tab name of 'pom.xml' file is changed
- WaitUtils.sleepQuietly(5);
- editor.waitTabIsPresent("pom.xml");
- projectExplorer.waitDefinedTypeOfFolder(PATH_TO_POM_FILE, SIMPLE_FOLDER);
-
- editor.closeAllTabs();
- seleniumWebDriver.navigate().refresh();
- projectExplorer.waitProjectExplorer();
- projectExplorer.waitDefinedTypeOfFolder(PATH_TO_POM_FILE, SIMPLE_FOLDER);
- }
-
- @Test
- public void checkEditorTabNameAfterChangingArtifactID() {
- projectExplorer.openItemByPath(PROJECT_NAME + "/pom.xml");
- editor.waitActive();
- editor.waitTabIsPresent("qa-spring-sample");
- editor.goToCursorPositionVisible(19, 17);
- editor.typeTextIntoEditor("new-");
-
- // this timeout is needed for waiting that the Editor tab name of 'pom.xml' file is changed
- WaitUtils.sleepQuietly(5);
- editor.waitTabIsPresent("new-qa-spring-sample");
-
- seleniumWebDriver.navigate().refresh();
- ide.waitOpenedWorkspaceIsReadyToUse();
- projectExplorer.waitItem(PROJECT_NAME + "/pom.xml");
- editor.waitTabIsPresent("new-qa-spring-sample");
-
- editor.closeAllTabsByContextMenu();
- }
-
- private void createNewFolder(String path, String folderName) {
- projectExplorer.waitAndSelectItem(path);
- menu.runCommand(
- TestMenuCommandsConstants.Project.PROJECT,
- TestMenuCommandsConstants.Project.New.NEW,
- TestMenuCommandsConstants.Project.New.FOLDER);
- askForValueDialog.waitFormToOpen();
- askForValueDialog.typeAndWaitText(folderName);
- askForValueDialog.clickOkBtn();
- askForValueDialog.waitFormToClose();
- projectExplorer.waitVisibilityByName(folderName);
- loader.waitOnClosed();
- }
-
- private void createNewFile(String name, String pathToFile, ContextMenuItems type) {
- projectExplorer.waitAndSelectItem(pathToFile);
- projectExplorer.openContextMenuByPathSelectedItem(pathToFile);
- projectExplorer.clickOnItemInContextMenu(NEW);
- projectExplorer.clickOnItemInContextMenu(type);
- askForValueDialog.waitFormToOpen();
- askForValueDialog.typeAndWaitText(name);
- askForValueDialog.clickOkBtn();
- }
-}
diff --git a/selenium/che-selenium-test/src/test/resources/projects/java-multimodule/my-webapp/pom.xml b/selenium/che-selenium-test/src/test/resources/projects/java-multimodule/my-webapp/pom.xml
index c678d696f3..6a0eaa6c65 100644
--- a/selenium/che-selenium-test/src/test/resources/projects/java-multimodule/my-webapp/pom.xml
+++ b/selenium/che-selenium-test/src/test/resources/projects/java-multimodule/my-webapp/pom.xml
@@ -16,7 +16,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
org.eclipse.che.examples
- qa-multimodule
+ qa-webapp
war
1.0-SNAPSHOT
qa-spring-sample
diff --git a/selenium/che-selenium-test/src/test/resources/projects/simple_Artik_project/test.c b/selenium/che-selenium-test/src/test/resources/projects/simple_Artik_project/test.c
deleted file mode 100644
index 893bbd5b8d..0000000000
--- a/selenium/che-selenium-test/src/test/resources/projects/simple_Artik_project/test.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Copyright (c) 2012-2018 Red Hat, Inc.
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- */
-#include
-
-int main() {
- int integer1; // Declare a variable named integer1 of the type integer
- int integer2; // Declare a variable named integer2 of the type integer
- int sum; // Declare a variable named sum of the type integer
- int multiplyVal;
-
- integer1 = 55; // Assign value to variable integer1
- integer2 = 66; // Assign value to variable integer1
- multiplyVal = 0;
- sum = integer1 + integer2; // Compute the sum
- multiplyVal = multiply(integer1, integer2);
- // Print the result
- printf("The sum of %d and %d is %d.\n", integer1, integer2, sum);
-
- return 0;
-}
-
-
-int multiply(int a, int b){
-return a*b;
-}
diff --git a/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml b/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml
index 69f9975271..6fc219c821 100644
--- a/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml
+++ b/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml
@@ -140,7 +140,7 @@
-
+
diff --git a/selenium/che-selenium-test/src/test/resources/templates/project/undefined.json b/selenium/che-selenium-test/src/test/resources/templates/project/undefined.json
new file mode 100644
index 0000000000..d1b99d6f86
--- /dev/null
+++ b/selenium/che-selenium-test/src/test/resources/templates/project/undefined.json
@@ -0,0 +1,8 @@
+{
+ "name":"replaced_name",
+ "contentRoot":null,
+
+ "visibility":"public",
+ "mixinTypes":[
+ ]
+}