Merge branch 'che-multiuser' into spi
commit
44aa9d89fe
|
|
@ -62,6 +62,7 @@ Thumbs.db
|
|||
#############
|
||||
.che
|
||||
dockerfiles/che/eclipse-che.tar.gz
|
||||
dockerfiles/che/eclipse-che/
|
||||
.unison*
|
||||
docs/_site
|
||||
docs/.sass-cache
|
||||
|
|
@ -69,7 +70,6 @@ docs/.jekyll-metadata
|
|||
docs/assets/imgs
|
||||
!assembly/assembly-main/src/assembly/bin/
|
||||
|
||||
|
||||
# NodeJs modules #
|
||||
##################
|
||||
plugins/plugin-terminal-ui/node_modules/
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import org.eclipse.che.api.user.server.spi.PreferenceDao;
|
|||
import org.eclipse.che.api.user.server.spi.UserDao;
|
||||
import org.eclipse.che.api.workspace.server.hc.ServerCheckerFactoryImpl;
|
||||
import org.eclipse.che.inject.DynaModule;
|
||||
import org.eclipse.che.multiuser.api.permission.server.AdminPermissionInitializer;
|
||||
import org.eclipse.che.multiuser.api.permission.server.PermissionChecker;
|
||||
import org.eclipse.che.multiuser.api.permission.server.PermissionCheckerImpl;
|
||||
import org.eclipse.che.multiuser.keycloak.server.deploy.KeycloakModule;
|
||||
|
|
@ -55,6 +56,7 @@ public class MultiUserCheWsMasterModule extends AbstractModule {
|
|||
bind(org.eclipse.che.multiuser.permission.user.UserServicePermissionsFilter.class);
|
||||
bind(org.eclipse.che.multiuser.permission.factory.FactoryPermissionsFilter.class);
|
||||
bind(org.eclipse.che.plugin.activity.ActivityPermissionsFilter.class);
|
||||
bind(AdminPermissionInitializer.class).asEagerSingleton();
|
||||
bind(
|
||||
org.eclipse.che.multiuser.permission.resource.filters.ResourceUsageServicePermissionsFilter
|
||||
.class);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ set -e
|
|||
set -u
|
||||
|
||||
IMAGE_ALIASES=${IMAGE_ALIASES:-}
|
||||
ERROR=${ERROR:-}
|
||||
|
||||
skip_tests() {
|
||||
if [ $SKIP_TESTS = "true" ]; then
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ build_directory() {
|
|||
shift
|
||||
# Calling build.sh
|
||||
if [ -e ${directory}/build.sh ] ; then
|
||||
${directory}build.sh ${OPTIONS} ${ARGS}
|
||||
bash ${directory}build.sh ${OPTIONS} ${ARGS}
|
||||
else
|
||||
printf "${RED}No build.sh in directory ${directory}${NC}\n"
|
||||
exit 2
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
base
|
||||
bats
|
||||
che
|
||||
init
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.google.inject.Provider;
|
|||
import com.google.inject.Singleton;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import elemental.events.Event;
|
||||
import elemental.events.EventRemover;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -99,6 +100,8 @@ public class AppContextImpl implements AppContext, SelectionChangedHandler, Reso
|
|||
private ResourceManager resourceManager;
|
||||
private Map<String, String> properties;
|
||||
|
||||
private EventRemover appStateEventRemover;
|
||||
|
||||
@Inject
|
||||
public AppContextImpl(
|
||||
EventBus eventBus,
|
||||
|
|
@ -121,11 +124,6 @@ public class AppContextImpl implements AppContext, SelectionChangedHandler, Reso
|
|||
eventBus.addHandler(ResourceChangedEvent.getType(), this);
|
||||
eventBus.addHandler(WorkspaceStoppedEvent.TYPE, workspaceStateHandler);
|
||||
eventBus.addHandler(WorkspaceStoppingEvent.TYPE, workspaceStateHandler);
|
||||
|
||||
// in some cases IDE doesn't save preferences on window close
|
||||
// so try to save if window lost focus
|
||||
Elements.getWindow()
|
||||
.addEventListener(Event.BLUR, evt -> appStateManager.get().persistWorkspaceState());
|
||||
}
|
||||
|
||||
private static native String getMasterApiPathFromIDEConfig() /*-{
|
||||
|
|
@ -144,6 +142,16 @@ public class AppContextImpl implements AppContext, SelectionChangedHandler, Reso
|
|||
/** Sets the current workspace. */
|
||||
public void setWorkspace(WorkspaceImpl workspace) {
|
||||
this.workspace = new WorkspaceImpl(workspace);
|
||||
|
||||
if (appStateEventRemover != null) {
|
||||
appStateEventRemover.remove();
|
||||
}
|
||||
|
||||
// in some cases IDE doesn't save preferences on window close
|
||||
// so try to save if window lost focus
|
||||
appStateEventRemover =
|
||||
Elements.getWindow()
|
||||
.addEventListener(Event.BLUR, evt -> appStateManager.get().persistWorkspaceState());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@ class FindResultViewImpl extends BaseView<FindResultView.ActionDelegate> impleme
|
|||
NodeLoader loader = new NodeLoader(Collections.<NodeInterceptor>emptySet());
|
||||
tree = new Tree(nodeStorage, loader);
|
||||
|
||||
//do not remove debug id; it's needed for selenium tests
|
||||
tree.ensureDebugId("result-search-tree");
|
||||
ensureDebugId("find-info-panel");
|
||||
|
||||
tree.getSelectionModel()
|
||||
.addSelectionChangedHandler(
|
||||
new SelectionChangedEvent.SelectionChangedHandler() {
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ public class FoundOccurrenceNode extends AbstractTreeNode implements HasPresenta
|
|||
//TODO
|
||||
public void updatePresentation(@NotNull NodePresentation presentation) {
|
||||
SpanElement spanElement = createSpanElement(styles.styles().presentableTextContainer());
|
||||
spanElement.setAttribute("debugFilePath", itemPath);
|
||||
SpanElement lineNumberElement = createSpanElement();
|
||||
lineNumberElement.setInnerHTML(
|
||||
String.valueOf(searchOccurrence.getLineNumber() + 1) + ": ");
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class AppStateManager {
|
|||
new WindowActionHandler() {
|
||||
@Override
|
||||
public void onWindowClosing(WindowActionEvent event) {
|
||||
final Workspace workspace = appContext.getWorkspace();
|
||||
Workspace workspace = appContext.getWorkspace();
|
||||
if (workspace != null) {
|
||||
persistWorkspaceState();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ public class PermissionsModule extends AbstractModule {
|
|||
bind(SetPermissionsFilter.class);
|
||||
bind(RemovePermissionsFilter.class);
|
||||
bind(GetPermissionsFilter.class);
|
||||
bind(AdminPermissionInitializer.class).asEagerSingleton();
|
||||
|
||||
// Creates empty multibinder to avoid error during container starting
|
||||
Multibinder.newSetBinder(
|
||||
|
|
|
|||
|
|
@ -101,15 +101,6 @@ public interface TestMenuCommandsConstants {
|
|||
String DEBUG_CONFIGURATION = "gwt-debug-topmenu/Run/Debug Configurations";
|
||||
String END_DEBUG_SESSION = "gwt-debug-topmenu/Run/disconnectDebug";
|
||||
String TEST = "gwt-debug-topmenu/Run/TestingMainGroup";
|
||||
|
||||
interface Test {
|
||||
String TEST_NG_TEST = "topmenu/Run/Test/Run Test";
|
||||
String TEST_NG_CLASS = "gwt-debug-topmenu/Run/Test/TestNGActionRunClass";
|
||||
String TEST_NG_PROJECT = "gwt-debug-topmenu/Run/Test/TestNGActionRunAllContext";
|
||||
String TEST_NG_XML_SUITE = "gwt-debug-topmenu/Run/Test/TestNGActionRunXMLContext";
|
||||
String JUNIT_TEST = "gwt-debug-topmenu/Run/Test/RunTest";
|
||||
String JUNIT_PROJECT = "gwt-debug-topmenu/Run/Test/TestJUnitActionRunAllContext";
|
||||
}
|
||||
}
|
||||
|
||||
interface Profile {
|
||||
|
|
@ -198,4 +189,10 @@ public interface TestMenuCommandsConstants {
|
|||
String ITEM_PREFFIX_ID = "gwt-debug-CommandsGroup/";
|
||||
String COMMAND_LIST_XPATH = "//div[@id='gwt-debug-dropDownHeader'][2]";
|
||||
}
|
||||
|
||||
public static final String TEST_NG_TEST_DROP_DAWN_ITEM = "topmenu/Run/Test/Run Test";
|
||||
public static final String JUNIT_TEST_DROP_DAWN_ITEM =
|
||||
"gwt-debug-topmenu/Run/Test/TestJUnitActionRun";
|
||||
|
||||
public static final String TEST_DROP_DAWN_ITEM = "gwt-debug-topmenu/Run/Test/RunTest";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.google.inject.Singleton;
|
|||
import org.eclipse.che.selenium.core.SeleniumWebDriver;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
|
|
@ -68,6 +69,7 @@ public class Consoles {
|
|||
|
||||
protected final SeleniumWebDriver seleniumWebDriver;
|
||||
private final Loader loader;
|
||||
private static final String CONSOLE_PANEL_DRUGGER_CSS = "div.gwt-SplitLayoutPanel-VDragger";
|
||||
|
||||
@Inject
|
||||
public Consoles(SeleniumWebDriver seleniumWebDriver, Loader loader) {
|
||||
|
|
@ -79,6 +81,9 @@ public class Consoles {
|
|||
PageFactory.initElements(seleniumWebDriver, this);
|
||||
}
|
||||
|
||||
@FindBy(css = CONSOLE_PANEL_DRUGGER_CSS)
|
||||
WebElement consolesPanelDrag;
|
||||
|
||||
@FindBy(id = PROCESSES_TAB)
|
||||
WebElement processesTab;
|
||||
|
||||
|
|
@ -342,4 +347,11 @@ public class Consoles {
|
|||
public void clickOnMaximizePanelIcon() {
|
||||
redrawDriverWait.until(elementToBeClickable(By.xpath(MAXIMIZE_PANEL_ICON))).click();
|
||||
}
|
||||
|
||||
public void dragConsolesInDefinePosition(int verticalShiftInPixels) {
|
||||
WebElement drag = redrawDriverWait.until(ExpectedConditions.visibilityOf(consolesPanelDrag));
|
||||
new Actions(seleniumWebDriver)
|
||||
.dragAndDropBy(drag, verticalShiftInPixels, verticalShiftInPixels)
|
||||
.perform();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRA
|
|||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import java.util.List;
|
||||
import org.eclipse.che.selenium.core.SeleniumWebDriver;
|
||||
import org.eclipse.che.selenium.core.action.ActionsFactory;
|
||||
import org.openqa.selenium.By;
|
||||
|
|
@ -64,6 +65,7 @@ public class FindText {
|
|||
String HIDE_FIND_PANEL = "//div[@id='gwt-debug-infoPanel']//div[@id='gwt-debug-hideButton']";
|
||||
String ITEM_FIND_PANEL =
|
||||
"//div[@id='gwt-debug-infoPanel']//div[@id='gwt-debug-partStackContent']//div[text()='%s']";
|
||||
String OCCURRENCE = "//span[@debugfilepath = '%s']";
|
||||
}
|
||||
|
||||
@FindBy(id = Locators.WHOLE_WORD_CHECKLBOX_INP)
|
||||
|
|
@ -75,7 +77,7 @@ public class FindText {
|
|||
@FindBy(xpath = Locators.FILE_MASK_CHECKBOX_INP)
|
||||
WebElement fileMaskCheckBox;
|
||||
|
||||
@FindBy(xpath = Locators.FIND_INFO_PANEL)
|
||||
@FindBy(id = Locators.FIND_INFO_PANEL)
|
||||
WebElement findInfoPanel;
|
||||
|
||||
@FindBy(id = Locators.FIND_TAB)
|
||||
|
|
@ -351,7 +353,7 @@ public class FindText {
|
|||
/** wait the 'Find' info panel is open */
|
||||
public void waitFindInfoPanelIsOpen() {
|
||||
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
|
||||
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Locators.FIND_INFO_PANEL)));
|
||||
.until(ExpectedConditions.visibilityOfElementLocated(By.id(Locators.FIND_INFO_PANEL)));
|
||||
}
|
||||
|
||||
/** press on the 'Hide' button on the 'Find' info panel */
|
||||
|
|
@ -406,17 +408,32 @@ public class FindText {
|
|||
return findInfoPanel.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* perform 'click' on the item in the 'Find' info panel
|
||||
*
|
||||
* @param item is the name of the item
|
||||
*/
|
||||
public void selectItemInFindInfoPanel(String item) {
|
||||
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
|
||||
.until(
|
||||
ExpectedConditions.visibilityOfElementLocated(
|
||||
By.xpath(String.format(Locators.ITEM_FIND_PANEL, item))))
|
||||
.click();
|
||||
public void selectItemInFindInfoPanel(String fileName, String textToFind) {
|
||||
List<WebElement> webElementList =
|
||||
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
|
||||
.until(
|
||||
ExpectedConditions.visibilityOfAllElementsLocatedBy(
|
||||
By.xpath(String.format(Locators.OCCURRENCE, fileName))));
|
||||
for (WebElement webElement : webElementList) {
|
||||
if (webElement.getText().equals(textToFind)) {
|
||||
webElement.click();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void selectItemInFindInfoPanelByDoubleClick(String fileName, String textToFind) {
|
||||
List<WebElement> webElementList =
|
||||
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
|
||||
.until(
|
||||
ExpectedConditions.visibilityOfAllElementsLocatedBy(
|
||||
By.xpath(String.format(Locators.OCCURRENCE, fileName))));
|
||||
for (WebElement webElement : webElementList) {
|
||||
if (webElement.getText().equals(textToFind)) {
|
||||
actionsFactory.createAction(seleniumWebDriver).doubleClick(webElement).perform();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -429,17 +446,4 @@ public class FindText {
|
|||
actionsFactory.createAction(seleniumWebDriver).sendKeys(command).perform();
|
||||
loader.waitOnClosed();
|
||||
}
|
||||
|
||||
/**
|
||||
* perform 'double click' on item in the 'Find' info panel
|
||||
*
|
||||
* @param item is the name of item into 'Find' info panel
|
||||
*/
|
||||
public void selectItemInFindInfoPanelByDoubleClick(String item) {
|
||||
WebElement element =
|
||||
seleniumWebDriver.findElement(By.xpath(String.format(Locators.ITEM_FIND_PANEL, item)));
|
||||
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
|
||||
.until(ExpectedConditions.visibilityOf(element));
|
||||
actionsFactory.createAction(seleniumWebDriver).doubleClick(element).perform();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,6 +242,7 @@ public class Refactor {
|
|||
|
||||
/** wait the 'Move item' form is open */
|
||||
public void waitMoveItemFormIsOpen() {
|
||||
loader.waitOnClosed();
|
||||
new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
|
||||
.until(ExpectedConditions.visibilityOf(moveItemForm));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRA
|
|||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import org.eclipse.che.selenium.core.SeleniumWebDriver;
|
||||
import org.eclipse.che.selenium.pageobject.Consoles;
|
||||
|
|
@ -43,6 +44,8 @@ public class JavaTestRunnerPluginConsole extends Consoles {
|
|||
private static final String METHODS_MARKED_AS_IGNORED =
|
||||
"//div[contains(@id,'gwt-uid')]//div[@style='text-decoration: line-through; color: yellow;']";
|
||||
|
||||
private static final String TEST_RESULT_NAVIGATION_TREE = "gwt-debug-test-tree-navigation-panel";
|
||||
|
||||
@FindAll({@FindBy(xpath = TEST_OUTPUT_XPATH)})
|
||||
private List<WebElement> testOutput;
|
||||
|
||||
|
|
@ -64,6 +67,9 @@ public class JavaTestRunnerPluginConsole extends Consoles {
|
|||
@FindAll({@FindBy(xpath = METHODS_MARKED_AS_IGNORED)})
|
||||
private List<WebElement> ignoredMethods;
|
||||
|
||||
@FindBy(id = TEST_RESULT_NAVIGATION_TREE)
|
||||
private WebElement resultTreeMainForm;
|
||||
|
||||
@Inject
|
||||
public JavaTestRunnerPluginConsole(SeleniumWebDriver seleniumWebDriver, Loader loader) {
|
||||
super(seleniumWebDriver, loader);
|
||||
|
|
@ -86,7 +92,7 @@ public class JavaTestRunnerPluginConsole extends Consoles {
|
|||
}
|
||||
|
||||
/**
|
||||
* wait single method in the result tree marked as failed (red color)
|
||||
* Wait single method in the result tree marked as failed (red color).
|
||||
*
|
||||
* @param nameOfFailedMethods name of that should fail
|
||||
*/
|
||||
|
|
@ -96,7 +102,7 @@ public class JavaTestRunnerPluginConsole extends Consoles {
|
|||
}
|
||||
|
||||
/**
|
||||
* wait single method in the result tree marked as failed (red color)
|
||||
* Wait single method in the result tree marked as failed (red color).
|
||||
*
|
||||
* @param nameOfFailedMethods name of that should fail
|
||||
*/
|
||||
|
|
@ -106,7 +112,7 @@ public class JavaTestRunnerPluginConsole extends Consoles {
|
|||
}
|
||||
|
||||
/**
|
||||
* wait single method in the result tree marked as passed (green color)
|
||||
* Wait single method in the result tree marked as passed (green color).
|
||||
*
|
||||
* @param nameOfFailedMethods name of expected method
|
||||
*/
|
||||
|
|
@ -116,25 +122,25 @@ public class JavaTestRunnerPluginConsole extends Consoles {
|
|||
}
|
||||
|
||||
/**
|
||||
* wait the FQN of the test class in result tree class that has been launched
|
||||
* Wait the FQN of the test class in result tree class that has been launched.
|
||||
*
|
||||
* @param fqn
|
||||
*/
|
||||
public void waitFqnOfTesClassInResultTree(String fqn) {
|
||||
new WebDriverWait(seleniumWebDriver, MINIMUM_SEC)
|
||||
.until(
|
||||
ExpectedConditions.visibilityOfAllElementsLocatedBy(
|
||||
ExpectedConditions.visibilityOfElementLocated(
|
||||
By.xpath(String.format(TEST_RESULT_TREE_XPATH_TEMPLATE, fqn))));
|
||||
}
|
||||
|
||||
/**
|
||||
* get all name of the test methods form the test result tree marked with defined status (may be
|
||||
* passed, failed or ignored)
|
||||
* Get all name of the test methods form the test result tree marked with defined status (may be
|
||||
* passed, failed or ignored).
|
||||
*
|
||||
* @param methodState the enumeration with defined status
|
||||
* @return the list with names of methods with defined status
|
||||
*/
|
||||
public List<String> getAllMethodsMarkedDefinedStatus(JunitMethodsState methodState) {
|
||||
public List<String> getAllNamesOfMethodsMarkedDefinedStatus(JunitMethodsState methodState) {
|
||||
List<String> definedMethods = null;
|
||||
switch (methodState) {
|
||||
case PASSED:
|
||||
|
|
@ -150,6 +156,28 @@ public class JavaTestRunnerPluginConsole extends Consoles {
|
|||
return definedMethods;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all defined methods from result tree and return as list WebElements.
|
||||
*
|
||||
* @param methodState the enumeration with defined status
|
||||
* @return List WebElements with defined status
|
||||
*/
|
||||
public List<WebElement> getAllMethodsMarkedDefinedStatus(JunitMethodsState methodState) {
|
||||
List<WebElement> definedMethods = null;
|
||||
switch (methodState) {
|
||||
case PASSED:
|
||||
definedMethods = passedMethods;
|
||||
break;
|
||||
case FAILED:
|
||||
definedMethods = failedMethods;
|
||||
break;
|
||||
case IGNORED:
|
||||
definedMethods = ignoredMethods;
|
||||
break;
|
||||
}
|
||||
return definedMethods;
|
||||
}
|
||||
|
||||
private List<String> getAllMetodsWithDefinedStatus(List<WebElement> definedMethod) {
|
||||
return new WebDriverWait(seleniumWebDriver, MINIMUM_SEC)
|
||||
.until(ExpectedConditions.visibilityOfAllElements(definedMethod))
|
||||
|
|
@ -157,4 +185,44 @@ public class JavaTestRunnerPluginConsole extends Consoles {
|
|||
.map(WebElement::getText)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text from the test result tree. Mote! This method represent only text from test result tree
|
||||
* without styles and formatting
|
||||
*
|
||||
* @return text representation of results of the test result tree widget
|
||||
*/
|
||||
public String getTextFromResultTree() {
|
||||
return new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
|
||||
.until(ExpectedConditions.visibilityOf(resultTreeMainForm))
|
||||
.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Click on the item in the result tree. If will be some items with the same name - will select
|
||||
* first.
|
||||
*
|
||||
* @param item name of the item (method or fqn of test class) in the test result tree
|
||||
*/
|
||||
public void selectItemInResultTree(String item) {
|
||||
new WebDriverWait(seleniumWebDriver, MINIMUM_SEC)
|
||||
.until(ExpectedConditions.visibilityOf(resultTreeMainForm))
|
||||
.findElement(By.xpath(String.format("//div[text()='%s']", item)))
|
||||
.click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Click on faled, passed or ignored method on the result tree.
|
||||
*
|
||||
* @param nameOfMethod
|
||||
* @param state
|
||||
*/
|
||||
public void selectMethodWithDefinedStatus(JunitMethodsState state, String nameOfMethod) {
|
||||
getAllMethodsMarkedDefinedStatus(state)
|
||||
.stream()
|
||||
.filter(webElement -> Objects.equals(webElement.getText(), nameOfMethod))
|
||||
.findFirst()
|
||||
.get()
|
||||
.click();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,14 +10,27 @@
|
|||
*/
|
||||
package org.eclipse.che.selenium.dashboard;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.eclipse.che.commons.lang.NameGenerator;
|
||||
import org.eclipse.che.selenium.core.SeleniumWebDriver;
|
||||
import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient;
|
||||
import org.eclipse.che.selenium.core.user.DefaultTestUser;
|
||||
import org.eclipse.che.selenium.core.utils.WaitUtils;
|
||||
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
|
||||
import org.eclipse.che.selenium.pageobject.dashboard.Dashboard;
|
||||
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace;
|
||||
import org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace.StateWorkspace;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.NoSuchElementException;
|
||||
import org.openqa.selenium.OutputType;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
|
@ -46,7 +59,7 @@ public class RenameWorkspaceTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void renameNameWorkspaceTest() {
|
||||
public void renameNameWorkspaceTest() throws IOException {
|
||||
dashboard.selectWorkspacesItemOnDashboard();
|
||||
dashboardWorkspace.waitToolbarTitleName("Workspaces");
|
||||
dashboardWorkspace.selectWorkspaceItemName(workspaceName);
|
||||
|
|
@ -55,10 +68,44 @@ public class RenameWorkspaceTest {
|
|||
dashboardWorkspace.enterNameWorkspace(CHANGE_WORKSPACE_NAME);
|
||||
dashboardWorkspace.clickOnSaveBtn();
|
||||
dashboardWorkspace.checkStateOfWorkspace(StateWorkspace.STOPPING);
|
||||
dashboardWorkspace.checkStateOfWorkspace(StateWorkspace.STARTING);
|
||||
|
||||
//This temporary solution for detect problem with this test
|
||||
//we will make screenshot every 5 ms for understanding problem
|
||||
screenshot(StateWorkspace.STOPPING.getStatus());
|
||||
|
||||
int i = 1;
|
||||
while (!checkStateOfWorkspace(StateWorkspace.STARTING) && i < 120) {
|
||||
screenshot(StateWorkspace.STARTING.getStatus() + i);
|
||||
WaitUtils.sleepQuietly(500, TimeUnit.MILLISECONDS);
|
||||
i++;
|
||||
}
|
||||
|
||||
dashboardWorkspace.checkStateOfWorkspace(StateWorkspace.RUNNING);
|
||||
dashboard.waitNotificationMessage("Workspace updated");
|
||||
dashboard.waitNotificationIsClosed();
|
||||
dashboardWorkspace.checkNameWorkspace(CHANGE_WORKSPACE_NAME);
|
||||
}
|
||||
|
||||
private void screenshot(String m) throws IOException {
|
||||
byte[] data = ((SeleniumWebDriver) dashboard.driver()).getScreenshotAs(OutputType.BYTES);
|
||||
Path screenshot =
|
||||
Paths.get(Paths.get("target/screenshots").toString(), "RenameWorkspaceTest_" + m + ".png");
|
||||
Files.createDirectories(screenshot.getParent());
|
||||
Files.copy(new ByteArrayInputStream(data), screenshot);
|
||||
}
|
||||
|
||||
public boolean checkStateOfWorkspace(StateWorkspace stateWorkspace) {
|
||||
try {
|
||||
dashboard
|
||||
.driver()
|
||||
.findElement(
|
||||
By.xpath(
|
||||
format(
|
||||
"//div[contains(@class, 'workspace-status')]/span[text()='%s']",
|
||||
stateWorkspace.getStatus())));
|
||||
return true;
|
||||
} catch (NoSuchElementException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
*/
|
||||
package org.eclipse.che.selenium.miscellaneous;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
|
|
@ -17,11 +19,13 @@ import org.eclipse.che.commons.lang.NameGenerator;
|
|||
import org.eclipse.che.selenium.core.client.TestProjectServiceClient;
|
||||
import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient;
|
||||
import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants;
|
||||
import org.eclipse.che.selenium.core.constant.TestTimeoutsConstants;
|
||||
import org.eclipse.che.selenium.core.project.ProjectTemplates;
|
||||
import org.eclipse.che.selenium.core.utils.WaitUtils;
|
||||
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
|
||||
import org.eclipse.che.selenium.pageobject.CodenvyEditor;
|
||||
import org.eclipse.che.selenium.pageobject.ConfigureClasspath;
|
||||
import org.eclipse.che.selenium.pageobject.Consoles;
|
||||
import org.eclipse.che.selenium.pageobject.FindText;
|
||||
import org.eclipse.che.selenium.pageobject.Ide;
|
||||
import org.eclipse.che.selenium.pageobject.Loader;
|
||||
|
|
@ -29,6 +33,7 @@ import org.eclipse.che.selenium.pageobject.Menu;
|
|||
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
|
||||
import org.eclipse.che.selenium.pageobject.machineperspective.MachineTerminal;
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
@ -37,71 +42,134 @@ public class FindTextFeatureTest {
|
|||
|
||||
private static final String PROJECT_NAME = NameGenerator.generate("FindTextFeature", 4);
|
||||
|
||||
private static final String FIND_NOTHING = "(0 occurrence)";
|
||||
private static final String FIND_NOTHING = "Found occurrences of 'dddhhh' (0 occurrence)";
|
||||
|
||||
private static final String PR_1_EXPECTED_TEXT_1 =
|
||||
"(4 occurrences)\n"
|
||||
+ "AppController.java\n"
|
||||
+ "(/"
|
||||
+ PROJECT_NAME
|
||||
+ "/my-webapp/src/main/java/org/eclipse/qa/examples/AppController.java)\n"
|
||||
+ "SayHello.java\n"
|
||||
+ "(/"
|
||||
+ PROJECT_NAME
|
||||
+ "/my-lib/src/main/java/hello/SayHello.java)\n"
|
||||
+ "SayHelloTest.java\n"
|
||||
+ "(/"
|
||||
+ PROJECT_NAME
|
||||
+ "/my-lib/src/test/java/hello/SayHelloTest.java)\n"
|
||||
+ "guess_num.jsp\n"
|
||||
+ "(/"
|
||||
+ PROJECT_NAME
|
||||
+ "/my-webapp/src/main/webapp/WEB-INF/jsp/guess_num.jsp)";
|
||||
format(
|
||||
"Found occurrences of 'Filesystem' (1 occurrence)\n"
|
||||
+ "/%s/readme.con\n"
|
||||
+ "(1 occurrence of 'Filesystem' found)\n"
|
||||
+ "1: Filesystem 1K-blocks Used Available Use%% Mounted on",
|
||||
PROJECT_NAME);
|
||||
private static final String PR_1_EXPECTED_TEXT_2 =
|
||||
format(
|
||||
"Found occurrences of 'Feature' (1 occurrence)\n"
|
||||
+ "/%s/readme.api\n"
|
||||
+ "(1 occurrence of 'Feature' found)\n"
|
||||
+ "1: FindTextFeatureTest",
|
||||
PROJECT_NAME);
|
||||
|
||||
private static final String PR_2_EXPECTED_TEXT_1 = "(4 occurrences)";
|
||||
private static final String PR_2_EXPECTED_TEXT_1 =
|
||||
format(
|
||||
"Found occurrences of 'String' (9 occurrences)\n"
|
||||
+ "/%1$s/my-webapp/src/main/java/org/eclipse/qa/examples/AppController.java\n"
|
||||
+ "(4 occurrences of 'String' found)\n"
|
||||
+ "22: private static final String secretNum = Integer.toString(new Random().nextInt(10));\n"
|
||||
+ "22: private static final String secretNum = Integer.toString(new Random().nextInt(10));\n"
|
||||
+ "26: String numGuessByUser = request.getParameter(\"numGuess\");\n"
|
||||
+ "27: String result = \"\";\n"
|
||||
+ "/%1$s/my-lib/src/main/java/hello/SayHello.java\n"
|
||||
+ "(2 occurrences of 'String' found)\n"
|
||||
+ "20: public String sayHello(String name)\n"
|
||||
+ "20: public String sayHello(String name)\n"
|
||||
+ "/%1$s/my-lib/src/test/java/hello/SayHelloTest.java\n"
|
||||
+ "(1 occurrence of 'String' found)\n"
|
||||
+ "27: public SayHelloTest(String testName)\n"
|
||||
+ "/%1$s/my-webapp/src/main/webapp/WEB-INF/jsp/guess_num.jsp\n"
|
||||
+ "(2 occurrences of 'String' found)\n"
|
||||
+ "25: java.lang.String attempt = (java.lang.String)request.getAttribute(\"num\");\n"
|
||||
+ "25: java.lang.String attempt = (java.lang.String)request.getAttribute(\"num\");",
|
||||
PROJECT_NAME);
|
||||
|
||||
private static final String PR_3_PATH_1 =
|
||||
PROJECT_NAME + "/my-webapp/src/main/java/org/eclipse/qa/examples";
|
||||
private static final String PR_3_EXPECTED_TEXT_1 =
|
||||
"(1 occurrence)\n"
|
||||
+ "AppController.java\n"
|
||||
+ "(/"
|
||||
+ PROJECT_NAME
|
||||
+ "/my-webapp/src/main/java/org/eclipse/qa/examples/AppController.java)";
|
||||
|
||||
private static final String PR_3_PATH_2 = "/" + PROJECT_NAME + "/my-lib";
|
||||
private static final String PR_3_EXPECTED_TEXT_2 =
|
||||
"(2 occurrences)\n"
|
||||
+ "SayHello.java\n"
|
||||
+ "(/"
|
||||
+ PROJECT_NAME
|
||||
+ "/my-lib/src/main/java/hello/SayHello.java)\n"
|
||||
+ "SayHelloTest.java\n"
|
||||
+ "(/"
|
||||
+ PROJECT_NAME
|
||||
+ "/my-lib/src/test/java/hello/SayHelloTest.java)";
|
||||
format(
|
||||
"Found occurrences of 'uess' (10 occurrences)\n"
|
||||
+ "/%1$s/my-webapp/src/main/java/org/eclipse/qa/examples/AppController.java\n"
|
||||
+ "(6 occurrences of 'uess' found)\n"
|
||||
+ "26: String numGuessByUser = request.getParameter(\"numGuess\");\n"
|
||||
+ "26: String numGuessByUser = request.getParameter(\"numGuess\");\n"
|
||||
+ "29: if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n"
|
||||
+ "29: if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n"
|
||||
+ "33: else if (numGuessByUser != null) {\n"
|
||||
+ "37: ModelAndView view = new ModelAndView(\"guess_num\");\n"
|
||||
+ "/%1$s/my-webapp/src/main/webapp/WEB-INF/jsp/guess_num.jsp\n"
|
||||
+ "(2 occurrences of 'uess' found)\n"
|
||||
+ "17: <form method=\"post\" action=\"guess\">\n"
|
||||
+ "18: <input type=text size=\"5\" name=\"numGuess\" >\n"
|
||||
+ "/%1$s/my-webapp/src/main/webapp/index.jsp\n"
|
||||
+ "(1 occurrence of 'uess' found)\n"
|
||||
+ "14: response.sendRedirect(\"spring/guess\");\n"
|
||||
+ "/%1$s/my-webapp/src/main/webapp/WEB-INF/spring-servlet.xml\n"
|
||||
+ "(1 occurrence of 'uess' found)\n"
|
||||
+ "15: <bean name=\"/guess\" class=\"projects.debugStepInto.src.main.java.java.org.eclipse.qa.examples.AppController\"></bean>",
|
||||
PROJECT_NAME);
|
||||
|
||||
private static final String PR_4_PATH_1 =
|
||||
PROJECT_NAME + "/my-webapp/src/main/java/org/eclipse/qa/examples";
|
||||
private static final String PR_4_EXPECTED_TEXT_1 =
|
||||
"(3 occurrences)\n"
|
||||
+ "AppController.java\n"
|
||||
+ "(/"
|
||||
+ PROJECT_NAME
|
||||
+ "/my-webapp/src/main/java/org/eclipse/qa/examples/AppController.java)\n"
|
||||
+ "SayHello.java\n"
|
||||
+ "(/"
|
||||
+ PROJECT_NAME
|
||||
+ "/my-lib/src/main/java/hello/SayHello.java)\n"
|
||||
+ "SayHelloTest.java\n"
|
||||
+ "(/"
|
||||
+ PROJECT_NAME
|
||||
+ "/my-lib/src/test/java/hello/SayHelloTest.java)";
|
||||
format(
|
||||
"Found occurrences of 'uess' (6 occurrences)\n"
|
||||
+ "/%1$s/my-webapp/src/main/java/org/eclipse/qa/examples/AppController.java\n"
|
||||
+ "(6 occurrences of 'uess' found)\n"
|
||||
+ "26: String numGuessByUser = request.getParameter(\"numGuess\");\n"
|
||||
+ "26: String numGuessByUser = request.getParameter(\"numGuess\");\n"
|
||||
+ "29: if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n"
|
||||
+ "29: if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n"
|
||||
+ "33: else if (numGuessByUser != null) {\n"
|
||||
+ "37: ModelAndView view = new ModelAndView(\"guess_num\");",
|
||||
PROJECT_NAME);
|
||||
|
||||
private static final String PR_4_PATH_2 = format("/%s/my-lib", PROJECT_NAME);
|
||||
private static final String PR_4_EXPECTED_TEXT_2 =
|
||||
"(1 occurrence)\n"
|
||||
+ "guess_num.jsp\n"
|
||||
+ "(/"
|
||||
+ PROJECT_NAME
|
||||
+ "/my-webapp/src/main/webapp/WEB-INF/jsp/guess_num.jsp)";
|
||||
format(
|
||||
"Found occurrences of 'hello' (15 occurrences)\n"
|
||||
+ "/%1$s/my-lib/src/main/java/hello/SayHello.java\n"
|
||||
+ "(5 occurrences of 'hello' found)\n"
|
||||
+ "11: package hello;\n"
|
||||
+ "14: * Hello world!\n"
|
||||
+ "18: public class SayHello\n"
|
||||
+ "20: public String sayHello(String name)\n"
|
||||
+ "22: return \"Hello, \" + name;\n"
|
||||
+ "/%1$s/my-lib/src/test/java/hello/SayHelloTest.java\n"
|
||||
+ "(10 occurrences of 'hello' found)\n"
|
||||
+ "11: package hello;\n"
|
||||
+ "20: public class SayHelloTest extends TestCase\n"
|
||||
+ "27: public SayHelloTest(String testName)\n"
|
||||
+ "37: return new TestSuite(SayHelloTest.class);\n"
|
||||
+ "43: public void testSayHello()\n"
|
||||
+ "45: SayHello sayHello = new SayHello();\n"
|
||||
+ "45: SayHello sayHello = new SayHello();\n"
|
||||
+ "45: SayHello sayHello = new SayHello();\n"
|
||||
+ "46: assertTrue(\"Hello, codenvy\".equals(sayHello.sayHello(\"codenvy\")));\n"
|
||||
+ "46: assertTrue(\"Hello, codenvy\".equals(sayHello.sayHello(\"codenvy\")));",
|
||||
PROJECT_NAME);
|
||||
|
||||
private static final String PR_5_EXPECTED_TEXT_1 =
|
||||
format(
|
||||
"Found occurrences of 'String' (7 occurrences)\n"
|
||||
+ "/%1$s/my-webapp/src/main/java/org/eclipse/qa/examples/AppController.java\n"
|
||||
+ "(4 occurrences of 'String' found)\n"
|
||||
+ "22: private static final String secretNum = Integer.toString(new Random().nextInt(10));\n"
|
||||
+ "22: private static final String secretNum = Integer.toString(new Random().nextInt(10));\n"
|
||||
+ "26: String numGuessByUser = request.getParameter(\"numGuess\");\n"
|
||||
+ "27: String result = \"\";\n"
|
||||
+ "/%1$s/my-lib/src/main/java/hello/SayHello.java\n"
|
||||
+ "(2 occurrences of 'String' found)\n"
|
||||
+ "20: public String sayHello(String name)\n"
|
||||
+ "20: public String sayHello(String name)\n"
|
||||
+ "/%1$s/my-lib/src/test/java/hello/SayHelloTest.java\n"
|
||||
+ "(1 occurrence of 'String' found)\n"
|
||||
+ "27: public SayHelloTest(String testName)",
|
||||
PROJECT_NAME);
|
||||
|
||||
private static final String PR_5_EXPECTED_TEXT_2 =
|
||||
format(
|
||||
"Found occurrences of 'String' (2 occurrences)\n"
|
||||
+ "/%s/my-webapp/src/main/webapp/WEB-INF/jsp/guess_num.jsp\n"
|
||||
+ "(2 occurrences of 'String' found)\n"
|
||||
+ "25: java.lang.String attempt = (java.lang.String)request.getAttribute(\"num\");\n"
|
||||
+ "25: java.lang.String attempt = (java.lang.String)request.getAttribute(\"num\");",
|
||||
PROJECT_NAME);
|
||||
|
||||
@Inject private TestWorkspace workspace;
|
||||
@Inject private Ide ide;
|
||||
|
|
@ -114,6 +182,7 @@ public class FindTextFeatureTest {
|
|||
@Inject private FindText findText;
|
||||
@Inject private TestWorkspaceServiceClient workspaceServiceClient;
|
||||
@Inject private TestProjectServiceClient testProjectServiceClient;
|
||||
@Inject private Consoles consoles;
|
||||
|
||||
@BeforeClass
|
||||
public void setUp() throws Exception {
|
||||
|
|
@ -129,10 +198,6 @@ public class FindTextFeatureTest {
|
|||
@Test
|
||||
public void checkFindTextForm() {
|
||||
projectExplorer.waitProjectExplorer();
|
||||
terminal.waitTerminalTab();
|
||||
loader.waitOnClosed();
|
||||
|
||||
// open main form from menu
|
||||
projectExplorer.selectItem(PROJECT_NAME);
|
||||
menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.FIND);
|
||||
findText.waitFindTextMainFormIsOpen();
|
||||
|
|
@ -146,7 +211,7 @@ public class FindTextFeatureTest {
|
|||
findText.closeFindTextFormByEscape();
|
||||
}
|
||||
|
||||
@Test(priority = 1)
|
||||
@Test
|
||||
public void checkRecentlyCreatedFiles() throws Exception {
|
||||
String content = "FindTextFeatureTest";
|
||||
String fileNameCreatedFromAPI = "readme.api";
|
||||
|
|
@ -154,22 +219,28 @@ public class FindTextFeatureTest {
|
|||
|
||||
projectExplorer.waitProjectExplorer();
|
||||
projectExplorer.selectItem(PROJECT_NAME);
|
||||
if (!consoles.processesMainAreaIsOpen()) {
|
||||
consoles.clickOnProcessesTab();
|
||||
}
|
||||
terminal.waitTerminalTab();
|
||||
terminal.selectTerminalTab();
|
||||
createFileInTerminal(fileNameCreatedFromTerminal);
|
||||
WaitUtils.sleepQuietly(15);
|
||||
WaitUtils.sleepQuietly(TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC);
|
||||
menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.FIND);
|
||||
findText.waitFindTextMainFormIsOpen();
|
||||
findText.typeTextIntoFindField("pom.xml");
|
||||
findText.waitTextIntoFindField("pom.xml");
|
||||
findText.typeTextIntoFindField("Filesystem");
|
||||
findText.waitTextIntoFindField("Filesystem");
|
||||
findText.setAndWaitWholeWordCheckbox(false);
|
||||
findText.waitPathIntoRootField("/" + PROJECT_NAME);
|
||||
findText.clickOnSearchButtonMainForm();
|
||||
findText.waitFindInfoPanelIsOpen();
|
||||
findText.waitExpectedTextInFindInfoPanel(fileNameCreatedFromTerminal);
|
||||
findText.selectItemInFindInfoPanel(fileNameCreatedFromTerminal);
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_1_EXPECTED_TEXT_1);
|
||||
findText.selectItemInFindInfoPanel(
|
||||
format("/%s/readme.con", PROJECT_NAME),
|
||||
"1: Filesystem 1K-blocks Used Available Use% Mounted on");
|
||||
findText.sendCommandByKeyboardInFindInfoPanel(Keys.ENTER.toString());
|
||||
editor.waitActiveTabFileName(fileNameCreatedFromTerminal);
|
||||
Assert.assertEquals(editor.getPositionOfLine(), 1);
|
||||
|
||||
projectExplorer.selectItem(PROJECT_NAME);
|
||||
createFileFromAPI(PROJECT_NAME, fileNameCreatedFromAPI, content);
|
||||
|
|
@ -182,14 +253,23 @@ public class FindTextFeatureTest {
|
|||
findText.waitPathIntoRootField("/" + PROJECT_NAME);
|
||||
findText.clickOnSearchButtonMainForm();
|
||||
findText.waitFindInfoPanelIsOpen();
|
||||
findText.waitExpectedTextInFindInfoPanel(fileNameCreatedFromAPI);
|
||||
findText.selectItemInFindInfoPanel(fileNameCreatedFromAPI);
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_1_EXPECTED_TEXT_2);
|
||||
findText.selectItemInFindInfoPanel(
|
||||
format("/%s/readme.api", PROJECT_NAME), "1: FindTextFeatureTest");
|
||||
findText.sendCommandByKeyboardInFindInfoPanel(Keys.ENTER.toString());
|
||||
editor.waitActiveTabFileName(fileNameCreatedFromAPI);
|
||||
Assert.assertEquals(editor.getPositionOfLine(), 1);
|
||||
}
|
||||
|
||||
@Test(priority = 2)
|
||||
@Test
|
||||
public void checkFindTextBasic() {
|
||||
String pathToQuessNumFile =
|
||||
format("/%s/my-webapp/src/main/webapp/WEB-INF/jsp/guess_num.jsp", PROJECT_NAME);
|
||||
String pathToSayHelloFile =
|
||||
format("/%s/my-lib/src/main/java/hello/SayHello.java", PROJECT_NAME);
|
||||
String pathToAppControllerFile =
|
||||
format(
|
||||
"/%s/my-webapp/src/main/java/org/eclipse/qa/examples/AppController.java", PROJECT_NAME);
|
||||
projectExplorer.waitProjectExplorer();
|
||||
projectExplorer.selectItem(PROJECT_NAME);
|
||||
menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.FIND);
|
||||
|
|
@ -212,24 +292,32 @@ public class FindTextFeatureTest {
|
|||
findText.waitPathIntoRootField("/" + PROJECT_NAME);
|
||||
findText.clickOnSearchButtonMainForm();
|
||||
findText.waitFindInfoPanelIsOpen();
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_1_EXPECTED_TEXT_1);
|
||||
findText.selectItemInFindInfoPanel("guess_num.jsp");
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_2_EXPECTED_TEXT_1);
|
||||
findText.selectItemInFindInfoPanel(
|
||||
pathToQuessNumFile,
|
||||
"25: java.lang.String attempt = (java.lang.String)request.getAttribute(\"num\");");
|
||||
findText.sendCommandByKeyboardInFindInfoPanel(Keys.ENTER.toString());
|
||||
editor.waitActiveEditor();
|
||||
editor.waitActiveTabFileName("guess_num.jsp");
|
||||
editor.waitTextIntoEditor("String");
|
||||
findText.selectItemInFindInfoPanelByDoubleClick("SayHello.java");
|
||||
Assert.assertEquals(editor.getPositionOfLine(), 25);
|
||||
findText.selectItemInFindInfoPanelByDoubleClick(
|
||||
pathToSayHelloFile, "20: public String sayHello(String name)");
|
||||
editor.waitActiveEditor();
|
||||
editor.waitActiveTabFileName("SayHello");
|
||||
editor.waitTextIntoEditor("String");
|
||||
findText.selectItemInFindInfoPanel("guess_num.jsp");
|
||||
Assert.assertEquals(editor.getPositionOfLine(), 20);
|
||||
findText.selectItemInFindInfoPanel(
|
||||
pathToAppControllerFile,
|
||||
"26: String numGuessByUser = request.getParameter(\"numGuess\");");
|
||||
findText.sendCommandByKeyboardInFindInfoPanel(Keys.ARROW_UP.toString());
|
||||
findText.sendCommandByKeyboardInFindInfoPanel(Keys.ENTER.toString());
|
||||
editor.waitActiveTabFileName("SayHelloTest");
|
||||
editor.closeAllTabs();
|
||||
editor.waitActiveTabFileName("AppController");
|
||||
Assert.assertEquals(editor.getPositionOfLine(), 22);
|
||||
editor.closeAllTabsByContextMenu();
|
||||
}
|
||||
|
||||
@Test(priority = 3)
|
||||
@Test
|
||||
public void checkFindWholeWordOnly() {
|
||||
projectExplorer.waitProjectExplorer();
|
||||
projectExplorer.selectItem(PROJECT_NAME);
|
||||
|
|
@ -241,7 +329,7 @@ public class FindTextFeatureTest {
|
|||
findText.waitPathIntoRootField("/" + PROJECT_NAME);
|
||||
findText.clickOnSearchButtonMainForm();
|
||||
findText.waitFindInfoPanelIsOpen();
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_2_EXPECTED_TEXT_1);
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_3_EXPECTED_TEXT_1);
|
||||
projectExplorer.selectItem(PROJECT_NAME);
|
||||
menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.FIND);
|
||||
findText.waitFindTextMainFormIsOpen();
|
||||
|
|
@ -251,23 +339,23 @@ public class FindTextFeatureTest {
|
|||
findText.waitPathIntoRootField("/" + PROJECT_NAME);
|
||||
findText.clickOnSearchButtonMainForm();
|
||||
findText.waitFindInfoPanelIsOpen();
|
||||
findText.waitExpectedTextInFindInfoPanel(FIND_NOTHING);
|
||||
findText.waitExpectedTextInFindInfoPanel("Found occurrences of 'uess' (0 occurrence)");
|
||||
}
|
||||
|
||||
@Test(priority = 4)
|
||||
@Test
|
||||
public void checkFindIntoSelectedPath() {
|
||||
projectExplorer.waitProjectExplorer();
|
||||
projectExplorer.selectItem(PROJECT_NAME);
|
||||
projectExplorer.quickExpandWithJavaScript();
|
||||
projectExplorer.selectItem(PR_3_PATH_1);
|
||||
projectExplorer.selectItem(PR_4_PATH_1);
|
||||
menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.FIND);
|
||||
findText.waitFindTextMainFormIsOpen();
|
||||
findText.typeTextIntoFindField("uess");
|
||||
findText.waitTextIntoFindField("uess");
|
||||
findText.setAndWaitStateSearchRootCheckbox(false);
|
||||
findText.waitPathIntoRootField("/" + PR_3_PATH_1);
|
||||
findText.waitPathIntoRootField("/" + PR_4_PATH_1);
|
||||
findText.clickOnSearchButtonMainForm();
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_3_EXPECTED_TEXT_1);
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_4_EXPECTED_TEXT_1);
|
||||
|
||||
projectExplorer.selectItem(PROJECT_NAME);
|
||||
findText.launchFindFormByKeyboard();
|
||||
|
|
@ -282,13 +370,13 @@ public class FindTextFeatureTest {
|
|||
configureClasspath.waitItemInSelectPathForm("my-webapp");
|
||||
configureClasspath.selectItemInSelectPathForm("my-lib");
|
||||
configureClasspath.clickOkBtnSelectPathForm();
|
||||
findText.waitPathIntoRootField(PR_3_PATH_2);
|
||||
findText.waitPathIntoRootField(PR_4_PATH_2);
|
||||
findText.clickOnSearchButtonMainForm();
|
||||
findText.waitFindInfoPanelIsOpen();
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_3_EXPECTED_TEXT_2);
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_4_EXPECTED_TEXT_2);
|
||||
}
|
||||
|
||||
@Test(priority = 5)
|
||||
@Test
|
||||
public void checkFindByFileMask() {
|
||||
projectExplorer.waitProjectExplorer();
|
||||
projectExplorer.selectItem(PROJECT_NAME);
|
||||
|
|
@ -301,8 +389,8 @@ public class FindTextFeatureTest {
|
|||
findText.waitTextIntoFileNameFilter("*.java");
|
||||
findText.clickOnSearchButtonMainForm();
|
||||
findText.waitFindInfoPanelIsOpen();
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_4_EXPECTED_TEXT_1);
|
||||
findText.waitExpectedTextIsNotPresentInFindInfoPanel(PR_4_EXPECTED_TEXT_2);
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_5_EXPECTED_TEXT_1);
|
||||
findText.waitExpectedTextIsNotPresentInFindInfoPanel(PR_5_EXPECTED_TEXT_2);
|
||||
|
||||
projectExplorer.selectItem(PROJECT_NAME);
|
||||
findText.launchFindFormByKeyboard();
|
||||
|
|
@ -314,8 +402,8 @@ public class FindTextFeatureTest {
|
|||
findText.waitTextIntoFileNameFilter("*.jsp");
|
||||
findText.clickOnSearchButtonMainForm();
|
||||
findText.waitFindInfoPanelIsOpen();
|
||||
findText.waitExpectedTextIsNotPresentInFindInfoPanel(PR_4_EXPECTED_TEXT_1);
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_4_EXPECTED_TEXT_2);
|
||||
findText.waitExpectedTextIsNotPresentInFindInfoPanel(PR_5_EXPECTED_TEXT_1);
|
||||
findText.waitExpectedTextInFindInfoPanel(PR_5_EXPECTED_TEXT_2);
|
||||
}
|
||||
|
||||
private void createFileFromAPI(String path, String fileName, String content) throws Exception {
|
||||
|
|
@ -324,7 +412,7 @@ public class FindTextFeatureTest {
|
|||
|
||||
private void createFileInTerminal(String fileName) {
|
||||
terminal.typeIntoTerminal("cd " + PROJECT_NAME + Keys.ENTER);
|
||||
terminal.typeIntoTerminal("ls -als > " + fileName + Keys.ENTER);
|
||||
terminal.typeIntoTerminal("df > " + fileName + Keys.ENTER);
|
||||
terminal.typeIntoTerminal("cat " + fileName + Keys.ENTER);
|
||||
terminal.typeIntoTerminal("ls" + Keys.ENTER);
|
||||
terminal.waitExpectedTextIntoTerminal(fileName);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ package org.eclipse.che.selenium.plainjava;
|
|||
|
||||
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.PROJECT;
|
||||
import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.BUILD_PATH;
|
||||
import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuBuildPath.CONFIGURE_CLASSPATH;
|
||||
import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuBuildPath.UNMARK_AS_SOURCE_FOLDER;
|
||||
import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuBuildPath.USE_AS_SOURCE_FOLDER;
|
||||
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkersType.ERROR_MARKER;
|
||||
|
|
@ -25,6 +24,7 @@ import java.util.List;
|
|||
import org.eclipse.che.commons.lang.NameGenerator;
|
||||
import org.eclipse.che.selenium.core.client.TestProjectServiceClient;
|
||||
import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants;
|
||||
import org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants;
|
||||
import org.eclipse.che.selenium.core.project.ProjectTemplates;
|
||||
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
|
||||
import org.eclipse.che.selenium.pageobject.CodenvyEditor;
|
||||
|
|
@ -142,7 +142,8 @@ public class PlainJavaProjectConfigureClasspathTest {
|
|||
projectExplorer.selectItem(PROJECT_NAME);
|
||||
projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME);
|
||||
projectExplorer.clickOnItemInContextMenu(BUILD_PATH);
|
||||
projectExplorer.clickOnItemInContextMenu(CONFIGURE_CLASSPATH);
|
||||
projectExplorer.clickOnItemInContextMenu(
|
||||
TestProjectExplorerContextMenuConstants.SubMenuBuildPath.CONFIGURE_CLASSPATH);
|
||||
configureClasspath.waitConfigureClasspathFormIsOpen();
|
||||
configureClasspath.selectSourceCategory();
|
||||
configureClasspath.deleteJarOrFolderFromBuildPath("/" + PROJECT_NAME + "/test");
|
||||
|
|
@ -154,7 +155,7 @@ public class PlainJavaProjectConfigureClasspathTest {
|
|||
|
||||
// check the library container
|
||||
projectExplorer.selectItem(PROJECT_NAME);
|
||||
menu.runCommand(PROJECT, CONFIGURE_CLASSPATH);
|
||||
menu.runCommand(PROJECT, TestMenuCommandsConstants.Project.CONFIGURE_CLASSPATH);
|
||||
configureClasspath.waitConfigureClasspathFormIsOpen();
|
||||
configureClasspath.clickLibraryContainer("org.eclipse.jdt.launching.JRE_CONTAINER");
|
||||
for (String jarName : listJar) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2017 Red Hat, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Red Hat, Inc. - initial API and implementation
|
||||
*/
|
||||
package org.eclipse.che.selenium.testrunner;
|
||||
|
||||
import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.FAILED;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.nio.file.Paths;
|
||||
import org.eclipse.che.api.workspace.server.DtoConverter;
|
||||
import org.eclipse.che.selenium.core.client.TestCommandServiceClient;
|
||||
import org.eclipse.che.selenium.core.client.TestProjectServiceClient;
|
||||
import org.eclipse.che.selenium.core.constant.TestBuildConstants;
|
||||
import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants;
|
||||
import org.eclipse.che.selenium.core.project.ProjectTemplates;
|
||||
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
|
||||
import org.eclipse.che.selenium.pageobject.CodenvyEditor;
|
||||
import org.eclipse.che.selenium.pageobject.Consoles;
|
||||
import org.eclipse.che.selenium.pageobject.Ide;
|
||||
import org.eclipse.che.selenium.pageobject.Loader;
|
||||
import org.eclipse.che.selenium.pageobject.Menu;
|
||||
import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel;
|
||||
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
|
||||
import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette;
|
||||
import org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/** @author Musienko Maxim */
|
||||
public class JavaTestPluginJunit4CheckRunSuitesAndScopesTest {
|
||||
private static final String JUNIT4_PROJECT = "junit4-tests-with-separeted-suites";
|
||||
|
||||
private static final String PATH_TO_JUNIT4_TEST_CLASSES =
|
||||
JUNIT4_PROJECT + "/src/test/java/org/eclipse/che/tests/AppOneTest.java";
|
||||
|
||||
private static final int VALUE_OF_SHIFTING_CONSOLES_ALONG_X_AXIS = -100;
|
||||
|
||||
@Inject private JavaTestRunnerPluginConsole pluginConsole;
|
||||
@Inject private ProjectExplorer projectExplorer;
|
||||
@Inject private Loader loader;
|
||||
@Inject private NotificationsPopupPanel notifications;
|
||||
@Inject private Menu menu;
|
||||
|
||||
@Inject private TestWorkspace ws;
|
||||
|
||||
@Inject private Ide ide;
|
||||
@Inject private Consoles consoles;
|
||||
@Inject private CodenvyEditor editor;
|
||||
@Inject private TestCommandServiceClient testCommandServiceClient;
|
||||
@Inject private CommandsPalette commandsPalette;
|
||||
@Inject private TestProjectServiceClient projectServiceClient;
|
||||
|
||||
@BeforeClass
|
||||
public void prepareTestProject() throws Exception {
|
||||
CompileCommand compileCommand = new CompileCommand();
|
||||
testCommandServiceClient.createCommand(DtoConverter.asDto(compileCommand), ws.getId());
|
||||
projectServiceClient.importProject(
|
||||
ws.getId(),
|
||||
Paths.get(
|
||||
getClass()
|
||||
.getResource("/projects/plugins/JavaTestRunnerPlugin/" + JUNIT4_PROJECT)
|
||||
.toURI()),
|
||||
JUNIT4_PROJECT,
|
||||
ProjectTemplates.CONSOLE_JAVA_SIMPLE);
|
||||
ide.open(ws);
|
||||
loader.waitOnClosed();
|
||||
projectExplorer.waitItem(JUNIT4_PROJECT);
|
||||
runCompileCommandByPallete(compileCommand);
|
||||
notifications.waitProgressPopupPanelClose();
|
||||
consoles.dragConsolesInDefinePosition(VALUE_OF_SHIFTING_CONSOLES_ALONG_X_AXIS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldExecuteJUnit4TestClassWithDifferentStatuses() throws InterruptedException {
|
||||
// given
|
||||
String expectedResultAfterFirstLaunch =
|
||||
"Default Suite\n"
|
||||
+ "org.eclipse.che.tests.AppOneTest\n"
|
||||
+ "shouldBeIgnoredOfAppOne\n"
|
||||
+ "shouldSuccessOfAppOne\n"
|
||||
+ "shouldFailOfAppOne\n"
|
||||
+ "org.eclipse.che.suite.Junit4TestSuite\n"
|
||||
+ "org.eclipse.che.tests.AppAnotherTest\n"
|
||||
+ "shouldFailOfAppAnother\n"
|
||||
+ "shouldSuccessOfAppAnother\n"
|
||||
+ "org.eclipse.che.tests.AppAnotherTest\n"
|
||||
+ "shouldFailOfAppAnother\n"
|
||||
+ "shouldSuccessOfAppAnother\n"
|
||||
+ "org.eclipse.che.tests.AppAnotherTest\n"
|
||||
+ "shouldFailOfAppAnother\n"
|
||||
+ "shouldSuccessOfAppAnother";
|
||||
|
||||
String expectedExceptionForFailedTest =
|
||||
"java.lang.AssertionError\n"
|
||||
+ " at org.junit.Assert.fail(Assert.java:86)\n"
|
||||
+ " at org.junit.Assert.assertTrue(Assert.java:41)";
|
||||
|
||||
projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_JUNIT4_TEST_CLASSES);
|
||||
projectExplorer.selectItem(JUNIT4_PROJECT);
|
||||
// when
|
||||
menu.runCommand(
|
||||
TestMenuCommandsConstants.Run.RUN_MENU,
|
||||
TestMenuCommandsConstants.Run.TEST,
|
||||
TestMenuCommandsConstants.JUNIT_TEST_DROP_DAWN_ITEM);
|
||||
|
||||
// then
|
||||
notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully.");
|
||||
pluginConsole.waitFqnOfTesClassInResultTree("org.eclipse.che.tests.AppAnotherTest");
|
||||
assertTrue(pluginConsole.getTextFromResultTree().equals(expectedResultAfterFirstLaunch));
|
||||
pluginConsole.waitFqnOfTesClassInResultTree("org.eclipse.che.tests.AppOneTest");
|
||||
pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppOne");
|
||||
pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppOne");
|
||||
pluginConsole.waitMethodMarkedAsIgnored("shouldBeIgnoredOfAppOne");
|
||||
pluginConsole.selectMethodWithDefinedStatus(FAILED, "shouldFailOfAppAnother");
|
||||
assertTrue(pluginConsole.getTestErrorMessage().startsWith(expectedExceptionForFailedTest));
|
||||
}
|
||||
|
||||
private void runCompileCommandByPallete(CompileCommand compileCommand) {
|
||||
commandsPalette.openCommandPalette();
|
||||
commandsPalette.startCommandByDoubleClick(compileCommand.getName());
|
||||
consoles.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
|
@ -12,23 +12,20 @@ package org.eclipse.che.selenium.testrunner;
|
|||
|
||||
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.RUN_MENU;
|
||||
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.TEST;
|
||||
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.Test.JUNIT_TEST;
|
||||
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.TEST_DROP_DAWN_ITEM;
|
||||
import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.FAILED;
|
||||
import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.IGNORED;
|
||||
import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.PASSED;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
import org.eclipse.che.api.workspace.server.DtoConverter;
|
||||
import org.eclipse.che.selenium.core.client.TestCommandServiceClient;
|
||||
import org.eclipse.che.selenium.core.client.TestProjectServiceClient;
|
||||
import org.eclipse.che.selenium.core.constant.TestBuildConstants;
|
||||
import org.eclipse.che.selenium.core.project.ProjectTemplates;
|
||||
import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace;
|
||||
import org.eclipse.che.selenium.core.workspace.TestWorkspace;
|
||||
import org.eclipse.che.selenium.core.workspace.WorkspaceTemplate;
|
||||
import org.eclipse.che.selenium.pageobject.CodenvyEditor;
|
||||
import org.eclipse.che.selenium.pageobject.Consoles;
|
||||
import org.eclipse.che.selenium.pageobject.Ide;
|
||||
|
|
@ -48,9 +45,7 @@ public class JavaTestPluginJunit4Test {
|
|||
private static final String PATH_TO_JUNIT4_TEST_CLASS =
|
||||
JUNIT4_PROJECT + "/src/test/java/org/eclipse/che/examples/AppOneTest.java";
|
||||
private static final String PATH_TO_JUNIT4_ANOTHER_TEST =
|
||||
JUNIT4_PROJECT + "/src/test/java/org/eclipse/che/examples/AppAppAnotherTest.java";
|
||||
private static final String PATH_TO_JUNIT4_TEST_SUITE =
|
||||
JUNIT4_PROJECT + "/src/test/java/org/eclipse/che/examples/Junit4TestSuite.java";
|
||||
JUNIT4_PROJECT + "/src/test/java/org/eclipse/che/examples/AppAnotherTest.java";
|
||||
|
||||
public static final String APP_TEST_ONE_FAIL_OUTPUT_TEMPLATE =
|
||||
"java.lang.AssertionError\n"
|
||||
|
|
@ -66,38 +61,40 @@ public class JavaTestPluginJunit4Test {
|
|||
+ " at org.junit.Assert.assertTrue(Assert.java:41)\n"
|
||||
+ " at org.junit.Assert.assertFalse(Assert.java:64)\n"
|
||||
+ " at org.junit.Assert.assertFalse(Assert.java:74)\n"
|
||||
+ " at org.eclipse.che.examples.AppAnotherTest.shouldFailOfAppAnother(AppAnotherTest.java:33)";
|
||||
+ " at org.eclipse.che.examples.AppAnotherTest.shouldFailOfAppAnother(AppAnotherTest.java:34)";
|
||||
|
||||
@Inject private JavaTestRunnerPluginConsole pluginConsole;
|
||||
@Inject private ProjectExplorer projectExplorer;
|
||||
@Inject private Loader loader;
|
||||
@Inject private NotificationsPopupPanel notifications;
|
||||
@Inject private Menu menu;
|
||||
|
||||
@InjectTestWorkspace(template = WorkspaceTemplate.CODENVY_UBUNTU_JDK8)
|
||||
private TestWorkspace ws;
|
||||
@Inject private TestWorkspace ws;
|
||||
|
||||
@Inject private Ide ide;
|
||||
@Inject private Consoles consoles;
|
||||
@Inject private CodenvyEditor editor;
|
||||
@Inject private TestProjectServiceClient testProjectServiceClient;
|
||||
@Inject private TestCommandServiceClient testCommandServiceClient;
|
||||
@Inject private CommandsPalette commandsPalette;
|
||||
@Inject private TestProjectServiceClient projectServiceClient;
|
||||
|
||||
@BeforeClass
|
||||
public void prepareTestProject() throws Exception {
|
||||
CompileCommand compileCommand = new CompileCommand();
|
||||
testCommandServiceClient.createCommand(DtoConverter.asDto(compileCommand), ws.getId());
|
||||
|
||||
URL resource = getClass().getResource("/projects/plugins/JavaTestRunnerPlugin/junit4-tests");
|
||||
testProjectServiceClient.importProject(
|
||||
projectServiceClient.importProject(
|
||||
ws.getId(),
|
||||
Paths.get(resource.toURI()),
|
||||
Paths.get(
|
||||
getClass()
|
||||
.getResource("/projects/plugins/JavaTestRunnerPlugin/" + JUNIT4_PROJECT)
|
||||
.toURI()),
|
||||
JUNIT4_PROJECT,
|
||||
ProjectTemplates.CONSOLE_JAVA_SIMPLE);
|
||||
|
||||
ide.open(ws);
|
||||
loader.waitOnClosed();
|
||||
projectExplorer.waitItem(JUNIT4_PROJECT);
|
||||
projectExplorer.quickExpandWithJavaScript();
|
||||
runCompileCommandByPallete(compileCommand);
|
||||
notifications.waitProgressPopupPanelClose();
|
||||
}
|
||||
|
|
@ -111,11 +108,10 @@ public class JavaTestPluginJunit4Test {
|
|||
@Test
|
||||
public void shouldExecuteJUnit4TestClassWithDifferentStatuses() throws InterruptedException {
|
||||
// given
|
||||
projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_JUNIT4_TEST_CLASS);
|
||||
projectExplorer.openItemByPath(PATH_TO_JUNIT4_TEST_CLASS);
|
||||
|
||||
// when
|
||||
menu.runCommand(RUN_MENU, TEST, JUNIT_TEST);
|
||||
menu.runCommand(RUN_MENU, TEST, TEST_DROP_DAWN_ITEM);
|
||||
|
||||
// then
|
||||
notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully.");
|
||||
|
|
@ -124,9 +120,9 @@ public class JavaTestPluginJunit4Test {
|
|||
pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppOne");
|
||||
pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppOne");
|
||||
pluginConsole.waitMethodMarkedAsIgnored("shouldBeIgnoredOfAppOne");
|
||||
assertTrue(pluginConsole.getAllMethodsMarkedDefinedStatus(PASSED).size() == 1);
|
||||
assertTrue(pluginConsole.getAllMethodsMarkedDefinedStatus(FAILED).size() == 1);
|
||||
assertTrue(pluginConsole.getAllMethodsMarkedDefinedStatus(IGNORED).size() == 1);
|
||||
assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1);
|
||||
assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1);
|
||||
assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(IGNORED).size() == 1);
|
||||
String testErrorMessage = pluginConsole.getTestErrorMessage();
|
||||
assertTrue(
|
||||
testErrorMessage.startsWith(APP_TEST_ONE_FAIL_OUTPUT_TEMPLATE),
|
||||
|
|
@ -136,37 +132,35 @@ public class JavaTestPluginJunit4Test {
|
|||
@Test(priority = 1)
|
||||
public void shouldExecuteJUnit4MethodWithDifferentStatuses() throws InterruptedException {
|
||||
// given
|
||||
projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_JUNIT4_ANOTHER_TEST);
|
||||
projectExplorer.openItemByPath(PATH_TO_JUNIT4_ANOTHER_TEST);
|
||||
editor.waitActiveEditor();
|
||||
editor.setCursorToDefinedLineAndChar(28, 17);
|
||||
|
||||
editor.setCursorToDefinedLineAndChar(27, 5);
|
||||
|
||||
// when
|
||||
menu.runCommand(RUN_MENU, TEST, JUNIT_TEST);
|
||||
menu.runCommand(RUN_MENU, TEST, TEST_DROP_DAWN_ITEM);
|
||||
notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully.");
|
||||
|
||||
// then
|
||||
pluginConsole.waitFqnOfTesClassInResultTree("org.eclipse.che.examples.AppAnotherTest");
|
||||
pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppAnother");
|
||||
assertTrue(pluginConsole.getAllMethodsMarkedDefinedStatus(PASSED).size() == 1);
|
||||
assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1);
|
||||
// then
|
||||
editor.setCursorToDefinedLineAndChar(33, 17);
|
||||
menu.runCommand(RUN_MENU, TEST, JUNIT_TEST);
|
||||
|
||||
editor.setCursorToDefinedLineAndChar(32, 5);
|
||||
menu.runCommand(RUN_MENU, TEST, TEST_DROP_DAWN_ITEM);
|
||||
notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully.");
|
||||
pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppAnother");
|
||||
assertTrue(pluginConsole.getAllMethodsMarkedDefinedStatus(FAILED).size() == 1);
|
||||
assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1);
|
||||
String testErrorMessage = pluginConsole.getTestErrorMessage();
|
||||
assertTrue(
|
||||
testErrorMessage.startsWith(APP_TEST_ANOTHER_FAIL_OUTPUT_TEMPLATE),
|
||||
"Actual message was: " + testErrorMessage);
|
||||
|
||||
editor.setCursorToDefinedLineAndChar(39, 17);
|
||||
menu.runCommand(RUN_MENU, TEST, JUNIT_TEST);
|
||||
editor.setCursorToDefinedLineAndChar(38, 5);
|
||||
menu.runCommand(RUN_MENU, TEST, TEST_DROP_DAWN_ITEM);
|
||||
notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully.");
|
||||
pluginConsole.waitMethodMarkedAsIgnored("shouldBeIgnoredOfAppAnother");
|
||||
assertTrue(pluginConsole.getAllMethodsMarkedDefinedStatus(IGNORED).size() == 1);
|
||||
assertTrue(
|
||||
testErrorMessage.startsWith(APP_TEST_ANOTHER_FAIL_OUTPUT_TEMPLATE),
|
||||
"Actual message was: " + testErrorMessage);
|
||||
assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(IGNORED).size() == 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ package org.eclipse.che.selenium.testrunner;
|
|||
|
||||
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.RUN_MENU;
|
||||
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.TEST;
|
||||
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.Test.TEST_NG_TEST;
|
||||
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.TEST_NG_TEST_DROP_DAWN_ITEM;
|
||||
import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.FAILED;
|
||||
import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.PASSED;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
|
@ -50,10 +50,6 @@ public class JavaTestPluginTestNgTest {
|
|||
PROJECT + "/src/test/java/org/eclipse/che/examples/AppOneTest.java";
|
||||
private static final String PATH_TO_ANOTHER_TEST_CLASS =
|
||||
PROJECT + "/src/test/java/org/eclipse/che/examples/AppAnotherTest.java";
|
||||
private static final String PATH_TO_MAIN_CLASS =
|
||||
PROJECT + "/src/main/java/org/eclipse/che/examples/HelloWorld.java";
|
||||
private static final String PATH_TO_TEST_PACKAGE =
|
||||
PROJECT + "/src/test/java/org/eclipse/che/examples";
|
||||
|
||||
public static final String APP_TEST_ONE_FAIL_OUTPUT_TEMPLATE =
|
||||
"[TestNG] Running: /home/user/che/ws-agent/temp/che-testng-suite.xmlexpected [false] but found [true]\n"
|
||||
|
|
@ -70,18 +66,16 @@ public class JavaTestPluginTestNgTest {
|
|||
+ " at org.testng.Assert.fail(Assert.java:94)\n"
|
||||
+ " at org.testng.Assert.failNotEquals(Assert.java:494)\n"
|
||||
+ " at org.testng.Assert.assertFalse(Assert.java:63)\n"
|
||||
+ " at org.testng.Assert.assertFalse(Assert.java:73)\n"
|
||||
+ " at org.eclipse.che.examples.AppAnotherTest.shouldFailOfAppAnother(AppAnotherTest.java:31)";
|
||||
+ " at org.testng.Assert.assertFalse(Assert.java:73)";
|
||||
|
||||
public static final String END_OF_FAILED_TEST =
|
||||
"at org.testng.CheTestNGLauncher.main(CheTestNGLauncher.java:43)===============================================Default SuiteTotal tests run: 1, Failures: 1, Skips: 0===============================================";
|
||||
"===============================================Default SuiteTotal tests run: 1, Failures: 1, Skips: 0===============================================";
|
||||
|
||||
@InjectTestWorkspace(template = WorkspaceTemplate.CODENVY_UBUNTU_JDK8)
|
||||
private TestWorkspace ws;
|
||||
|
||||
@Inject private Ide ide;
|
||||
@Inject private DefaultTestUser user;
|
||||
|
||||
@Inject private JavaTestRunnerPluginConsole pluginConsole;
|
||||
@Inject private ProjectExplorer projectExplorer;
|
||||
@Inject private Loader loader;
|
||||
|
|
@ -117,14 +111,14 @@ public class JavaTestPluginTestNgTest {
|
|||
// when
|
||||
|
||||
editor.waitActiveEditor();
|
||||
menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST);
|
||||
menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM);
|
||||
|
||||
// then
|
||||
notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully.");
|
||||
pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppOne");
|
||||
pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppOne");
|
||||
assertTrue(pluginConsole.getAllMethodsMarkedDefinedStatus(PASSED).size() == 1);
|
||||
assertTrue(pluginConsole.getAllMethodsMarkedDefinedStatus(FAILED).size() == 1);
|
||||
assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1);
|
||||
assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1);
|
||||
String testErrorMessage = pluginConsole.getTestErrorMessage();
|
||||
assertTrue(
|
||||
testErrorMessage.startsWith(APP_TEST_ONE_FAIL_OUTPUT_TEMPLATE),
|
||||
|
|
@ -139,14 +133,38 @@ public class JavaTestPluginTestNgTest {
|
|||
// then
|
||||
editor.waitActiveEditor();
|
||||
editor.setCursorToDefinedLineAndChar(25, 17);
|
||||
menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST);
|
||||
menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM);
|
||||
notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully.");
|
||||
pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppAnother");
|
||||
assertTrue(pluginConsole.getAllMethodsMarkedDefinedStatus(PASSED).size() == 1);
|
||||
assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1);
|
||||
editor.setCursorToDefinedLineAndChar(30, 17);
|
||||
menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST);
|
||||
menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM);
|
||||
pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppAnother");
|
||||
assertTrue(pluginConsole.getAllMethodsMarkedDefinedStatus(FAILED).size() == 1);
|
||||
assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1);
|
||||
String testErrorMessage = pluginConsole.getTestErrorMessage();
|
||||
assertTrue(
|
||||
testErrorMessage.startsWith(APP_TEST_ANOTHER_FAIL_OUTPUT_TEMPLATE),
|
||||
"Actual message was: " + testErrorMessage);
|
||||
assertTrue(
|
||||
testErrorMessage.endsWith(END_OF_FAILED_TEST), "Actual message was: " + testErrorMessage);
|
||||
}
|
||||
|
||||
@Test(priority = 2)
|
||||
public void shouldExecuteAlltets() throws InterruptedException {
|
||||
// given
|
||||
projectExplorer.openItemByPath(PATH_TO_ANOTHER_TEST_CLASS);
|
||||
|
||||
// then
|
||||
editor.waitActiveEditor();
|
||||
editor.setCursorToDefinedLineAndChar(25, 17);
|
||||
menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM);
|
||||
notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully.");
|
||||
pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppAnother");
|
||||
assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1);
|
||||
editor.setCursorToDefinedLineAndChar(30, 17);
|
||||
menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM);
|
||||
pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppAnother");
|
||||
assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1);
|
||||
String testErrorMessage = pluginConsole.getTestErrorMessage();
|
||||
assertTrue(
|
||||
testErrorMessage.startsWith(APP_TEST_ANOTHER_FAIL_OUTPUT_TEMPLATE),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
<!--
|
||||
|
||||
Copyright (c) 2012-2017 Red Hat, Inc.
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are made available under the terms of the Eclipse Public License v1.0
|
||||
which accompanies this distribution, and is available at
|
||||
http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
Contributors:
|
||||
Red Hat, Inc. - initial API and implementation
|
||||
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.eclipse.che.examples</groupId>
|
||||
<artifactId>console-java-simple</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>hello-app</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>lib/</classpathPrefix>
|
||||
<mainClass>org.eclipse.che.examples.HelloWorld</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2017 Red Hat, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Red Hat, Inc. - initial API and implementation
|
||||
*/
|
||||
package org.eclipse.che.example;
|
||||
|
||||
public class Hello {
|
||||
|
||||
|
||||
public boolean returnTrue() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String returnHello () {
|
||||
String message = "Hello IDE";
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2017 Red Hat, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Red Hat, Inc. - initial API and implementation
|
||||
*/
|
||||
package org.eclipse.che.example;
|
||||
public class HelloWorld {
|
||||
|
||||
public static void main(String[] argvs) {
|
||||
String a = "Che";
|
||||
System.out.println("Hello World " + a + "!");
|
||||
}
|
||||
|
||||
public boolean returnTrue() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2017 Red Hat, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Red Hat, Inc. - initial API and implementation
|
||||
*/
|
||||
package org.eclipse.che.suite;
|
||||
|
||||
import org.eclipse.che.tests.AppAnotherTest;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
/**
|
||||
* JUnit 4x Test Suite
|
||||
*/
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({AppAnotherTest.class,
|
||||
AppAnotherTest.class})
|
||||
public class Junit4TestSuite {
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2017 Red Hat, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Red Hat, Inc. - initial API and implementation
|
||||
*/
|
||||
package org.eclipse.che.tests;
|
||||
|
||||
import org.eclipse.che.example.Hello;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppAnotherTest {
|
||||
|
||||
@Test
|
||||
public void shouldSuccessOfAppAnother() {
|
||||
assertTrue(new Hello().returnHello().startsWith("Hello"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldFailOfAppAnother() {
|
||||
assertTrue(new Hello().returnHello().endsWith("Hello"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2017 Red Hat, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Red Hat, Inc. - initial API and implementation
|
||||
*/
|
||||
package org.eclipse.che.tests;
|
||||
|
||||
import org.eclipse.che.example.HelloWorld;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppOneTest {
|
||||
|
||||
@Test
|
||||
public void shouldSuccessOfAppOne() {
|
||||
assertTrue(new HelloWorld().returnTrue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldFailOfAppOne() {
|
||||
assertFalse(new HelloWorld().returnTrue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void shouldBeIgnoredOfAppOne(){ Assert.fail();}
|
||||
}
|
||||
|
|
@ -543,6 +543,7 @@
|
|||
</class>
|
||||
<class name="org.eclipse.che.selenium.testrunner.JavaTestPluginJunit4Test"/>
|
||||
<class name="org.eclipse.che.selenium.testrunner.JavaTestPluginTestNgTest"/>
|
||||
<class name="org.eclipse.che.selenium.testrunner.JavaTestPluginJunit4CheckRunSuitesAndScopesTest"/>
|
||||
<class name="org.eclipse.che.selenium.preferences.CheckErrorsWarningsTabTest">
|
||||
<methods>
|
||||
<!-- unstable -->
|
||||
|
|
|
|||
|
|
@ -18,7 +18,11 @@ is_current_user_sudoer() {
|
|||
}
|
||||
|
||||
set_sudo_command() {
|
||||
if is_current_user_sudoer && ! is_current_user_root; then SUDO="sudo -E"; else unset SUDO; fi
|
||||
if is_current_user_sudoer && ! is_current_user_root; then
|
||||
SUDO="sudo -E"
|
||||
else
|
||||
unset SUDO;
|
||||
fi
|
||||
}
|
||||
|
||||
set_sudo_command
|
||||
|
|
@ -54,10 +58,12 @@ fi
|
|||
MACHINE_TYPE=$(uname -m)
|
||||
|
||||
mkdir -p ${CHE_DIR}
|
||||
${SUDO} mkdir -p /projects
|
||||
${SUDO} sh -c "chown -R $(id -u -n) /projects"
|
||||
${SUDO} chmod 755 /projects
|
||||
|
||||
if is_current_user_sudoer; then
|
||||
${SUDO} mkdir -p /projects
|
||||
${SUDO} sh -c "chown -R $(id -u -n) /projects"
|
||||
find /projects -type d -exec ${SUDO} chmod 755 {} \;
|
||||
fi
|
||||
|
||||
INSTALL_JDK=false
|
||||
command -v ${JAVA_HOME}/bin/java >/dev/null 2>&1 || {
|
||||
|
|
|
|||
Loading…
Reference in New Issue