Skip to content

Commit

Permalink
JBIDE-27821: Created test for Environment variables in Quarkus Launch (
Browse files Browse the repository at this point in the history
…#145)

* JBIDE-27821: Created test for Environment variables in Quarkus Launch
Configuration

Signed-off-by: Oleksii Korniienko <[email protected]>

* JBIDE-27821: fixed Copyright year

Signed-off-by: Oleksii Korniienko <[email protected]>

* JBIDE-27821: reworked "addEnvironment" due to
eclipse-archived/reddeer#2120

Signed-off-by: Oleksii Korniienko <[email protected]>

* JBIDE-27821: renamed class

Signed-off-by: Oleksii Korniienko <[email protected]>
  • Loading branch information
olkornii authored Jun 22, 2021
1 parent b97b97b commit 3b7789a
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.jboss.tools.quarkus.integration.tests.common.PerspectiveTest;
import org.jboss.tools.quarkus.integration.tests.content.assistant.ApplicationPropertiesContentAssistTest;
import org.jboss.tools.quarkus.integration.tests.content.assistant.ApplicationPropertiesNewExtensionContentAssistTest;
import org.jboss.tools.quarkus.integration.tests.environment.EnvironmentVariablesTest;
import org.jboss.tools.quarkus.integration.tests.launch.configuration.CreateNewQuarkusConfigurationGradleTest;
import org.jboss.tools.quarkus.integration.tests.launch.configuration.CreateNewQuarkusConfigurationMavenTest;
import org.jboss.tools.quarkus.integration.tests.project.CreateNewProjectTest;
Expand All @@ -41,6 +42,7 @@
CreateNewProjectTest.class,
CreateNewQuarkusConfigurationMavenTest.class,
CreateNewQuarkusConfigurationGradleTest.class,
EnvironmentVariablesTest.class,
ApplicationPropertiesContentAssistTest.class,
InstallQuarkusExtensionTest.class,
ApplicationPropertiesNewExtensionContentAssistTest.class,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*******************************************************************************
* Copyright (c) 2021 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is 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.jboss.tools.quarkus.integration.tests.environment;

import org.eclipse.reddeer.common.wait.TimePeriod;
import org.eclipse.reddeer.common.wait.WaitUntil;
import org.eclipse.reddeer.eclipse.condition.ConsoleHasText;
import org.eclipse.reddeer.eclipse.debug.ui.launchConfigurations.EnvironmentTab;
import org.eclipse.reddeer.eclipse.debug.ui.launchConfigurations.RunConfigurationsDialog;
import org.eclipse.reddeer.eclipse.ui.console.ConsoleView;
import org.eclipse.reddeer.swt.impl.shell.DefaultShell;
import org.jboss.tools.quarkus.integration.tests.launch.configuration.AbstractLaunchConfigurationTest;
import org.jboss.tools.quarkus.reddeer.common.QuarkusLabels.Shell;
import org.jboss.tools.quarkus.reddeer.ui.launch.QuarkusLaunchConfigurationTabGroup;

/**
*
* @author [email protected] Oleksii Korniienko
*
*/
public abstract class AbstractEnvironmentVariablesTest extends AbstractLaunchConfigurationTest {

private static String ENVIRONMENT_NAME = "MVNW_VERBOSE";

public void testEnvironmentWorks(String projectName) {
RunConfigurationsDialog runDialog = new RunConfigurationsDialog();
QuarkusLaunchConfigurationTabGroup launchConfiguration = createNewQuarkusConfiguration(projectName, runDialog);
checkNewQuarkusConfiguration(projectName, runDialog, launchConfiguration);
addEnvironment(projectName, runDialog, launchConfiguration);
runNewQuarkusConfiguration(projectName, runDialog, launchConfiguration, "8080");
checkEnvironmentWorks(projectName, runDialog, launchConfiguration);
new ConsoleView().terminateConsole();
deleteNewQuarkusConfiguration(projectName, runDialog, launchConfiguration);
}

public void addEnvironment(String projectName, RunConfigurationsDialog runDialog,
QuarkusLaunchConfigurationTabGroup launchConfiguration) {
runDialog.open();
runDialog.select(launchConfiguration, projectName);
EnvironmentTab envTab = new EnvironmentTab();
envTab.activate();
envTab.add(ENVIRONMENT_NAME, "true");
new DefaultShell(Shell.RUN_CONFIGURATION).setFocus();
runDialog.close(true);
}

public void checkEnvironmentWorks(String projectName, RunConfigurationsDialog runDialog,
QuarkusLaunchConfigurationTabGroup launchConfiguration) {
ConsoleView consoleView = new ConsoleView();
new WaitUntil(new ConsoleHasText(consoleView, "Takari Maven Wrapper"), TimePeriod.DEFAULT);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright (c) 2021 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is 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.jboss.tools.quarkus.integration.tests.environment;

import org.eclipse.reddeer.junit.runner.RedDeerSuite;
import org.eclipse.reddeer.requirements.openperspective.OpenPerspectiveRequirement.OpenPerspective;
import org.jboss.tools.quarkus.reddeer.perspective.QuarkusPerspective;
import org.jboss.tools.quarkus.reddeer.common.QuarkusLabels.TextLabels;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
*
* @author [email protected] Oleksii Korniienko
*/
@OpenPerspective(QuarkusPerspective.class)
@RunWith(RedDeerSuite.class)
public class EnvironmentVariablesTest extends AbstractEnvironmentVariablesTest {

private static String PROJECT_NAME = "environment_test";

@BeforeClass
public static void createQuarkusProject() {
createNewQuarkusProject(PROJECT_NAME, TextLabels.MAVEN_TYPE);
}

@Test
public void testEnvironment() {
testEnvironmentWorks(PROJECT_NAME);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static class TextLabels {
//Project type labels
public static final String PROJECT_NAME = "Project name:";
public static final String NAME = "Name:";
public static final String VALUE = "Value:";
public static final String PROJECT_TYPE = "Project type:";
public static final String MAVEN_TYPE = "Maven";
public static final String GRADLE_TYPE = "Gradle";
Expand Down

0 comments on commit 3b7789a

Please sign in to comment.