Skip to content

Commit

Permalink
Maven itests fixes (#2079)
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Grossmann <lgrossma@redhat.com>
  • Loading branch information
lgrossma committed May 2, 2023
1 parent 7413098 commit 1904184
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 43 deletions.
9 changes: 7 additions & 2 deletions tests/org.jboss.tools.maven.ui.bot.test/META-INF/MANIFEST.MF
Expand Up @@ -11,8 +11,13 @@ Require-Bundle: org.junit,
org.eclipse.ui.workbench,
org.jboss.tools.central.reddeer,
org.jboss.tools.common.reddeer,
org.eclipse.egit.ui
org.eclipse.egit.ui,
org.jboss.tools.runtime.reddeer,
org.jboss.tools.community.project.examples,
org.eclipse.jpt.jpa.ui,
org.jboss.tools.cdi.ui,
org.eclipse.jst.ejb.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-Vendor: Red Hat
Export-Package: org.jboss.tools.maven.ui.bot.test.utils
7 changes: 6 additions & 1 deletion tests/org.jboss.tools.maven.ui.bot.test/pom.xml
Expand Up @@ -12,7 +12,7 @@

<packaging>eclipse-test-plugin</packaging>
<properties>
<wildflyVersion>26.1.2.Final</wildflyVersion>
<wildflyVersion>27.0.1.Final</wildflyVersion>
<requirementsDirectory>${project.build.directory}/requirements</requirementsDirectory>
<jbosstools.test.wildfly.home>${requirementsDirectory}/wildfly-${wildflyVersion}</jbosstools.test.wildfly.home>
<systemProperties>${integrationTestsSystemProperties} -Drd.config=${project.build.directory}/classes/servers/wildfly.json -Djbosstools.test.seam.2.1.0.home=${requirementsDirectory}/jboss-seam-2.1.2 -Djbosstools.test.seam.2.3.0.home=${requirementsDirectory}/jboss-seam-2.3.0.Final -Djbosstools.test.seam.2.2.0.home=${requirementsDirectory}/jboss-seam-2.2.0.GA -Dproject.build.directory=${project.build.directory} -Dmaven.settings.path=target/classes/usersettings/settings.xml -Dscope=${scope} -Djbosstools.test.wildfly.home=${jbosstools.test.wildfly.home}</systemProperties>
Expand Down Expand Up @@ -41,6 +41,11 @@
<suiteClass>org.jboss.tools.maven.ui.bot.test.${scope}</suiteClass>
<appArgLine>-testpluginname ${project.artifactId}</appArgLine>
<dependencies combine.children="append">
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.jboss.tools.maven.project.examples.feature.feature.group</artifactId>
<version>0.0.0</version>
</dependency>
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.jboss.tools.maven.feature.feature.group</artifactId>
Expand Down
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://java.sun.com/xml/ns/persistence" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/
http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd">
https://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/
https://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="primary" transaction-type="JTA">
</persistence-unit>
</persistence>
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.2"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://java.sun.com/xml/ns/persistence" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/
http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_2.xsd">
https://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/
https://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="primary" transaction-type="JTA">
</persistence-unit>
</persistence>
Expand Up @@ -13,9 +13,9 @@
</activation>
<repositories>
<repository>
<id>redhat-techpreview-all-repository</id>
<name>Red Hat Tech Preview repository (all)</name>
<url>http://maven.repository.redhat.com/techpreview/all/</url>
<id>redhat-earlyaccess-all-repository</id>
<name>Red Hat Early Access repository (all)</name>
<url>https://maven.repository.redhat.com/earlyaccess/all/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
Expand All @@ -29,9 +29,9 @@
</repositories>
<pluginRepositories>
<pluginRepository>
<id>redhat-techpreview-all-repository</id>
<name>Red Hat Tech Preview repository (all)</name>
<url>http://maven.repository.redhat.com/techpreview/all/</url>
<id>redhat-earlyaccess-all-repository</id>
<name>Red Hat Early Access repository (all)</name>
<url>https://maven.repository.redhat.com/earlyaccess/all/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
Expand Down
Expand Up @@ -2,7 +2,7 @@
"org.jboss.ide.eclipse.as.reddeer.server.requirement.ServerRequirement.JBossServer": [
{
"runtime": "${jbosstools.test.wildfly.home}",
"version": "24+",
"version": "27+",
"family": "WILDFLY"
}
]
Expand Down
Expand Up @@ -143,7 +143,13 @@ public void buildProject(String projectName, String mavenBuild, String goals, bo
WithTextMatchers m = new WithTextMatchers(rm1,rm2);
new ContextMenuItem(m.getMatchers()).select();
new WaitUntil(new ShellIsAvailable("Edit Configuration"),TimePeriod.DEFAULT);
new LabeledText("Goals:").setText(goals);
try {
new LabeledText("Goals:").setText(goals);
} catch (CoreLayerException ex) {
log.info("Lable Goals was not found. Trying again");
new LabeledText("Goals:").setText(goals);
}

new PushButton("Run").click();
ProjectIsBuilt pb = new ProjectIsBuilt();
new WaitUntil(pb,TimePeriod.VERY_LONG);
Expand Down
Expand Up @@ -42,27 +42,19 @@

PerspectiveTest.class,
MavenProfilesTest.class,
MaterializeLibraryTest.class,
MaterializeLibraryTest.class, //Missing entries in New Project Example dialog window |

EARProjectTest.class,

JPAConfiguratorTest.class,
JSFConfiguratorTest.class,
CDIConfiguratorTest.class,
JAXRSConfiguratorTest.class,
JPAConfiguratorTest.class, //JPA Facet is never checked
JSFConfiguratorTest.class, //Facets are not checked, jar isntead of war
CDIConfiguratorTest.class, // Facets are not checked, jar instead of war/ejb
JAXRSConfiguratorTest.class, //doesnt have facets, jar instead of war

MavenRepositories.class,

MavenConversionTest.class,
RemoteRepositoriesPreferenceTest.class,

SourceLookupTest.class,

SeamPluginsTest.class,

APTPropertiesPageTest.class,

SCMCheckoutProject.class
RemoteRepositoriesPreferenceTest.class

})
public class MavenAllBotTests {
Expand Down
Expand Up @@ -10,9 +10,9 @@
******************************************************************************/
package org.jboss.tools.maven.ui.bot.test.configurator;

import static org.jboss.tools.maven.ui.bot.test.utils.MavenProjectHelper.updateConf;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.jboss.tools.maven.ui.bot.test.utils.MavenProjectHelper.updateConf;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
Expand All @@ -27,6 +27,7 @@
import org.eclipse.reddeer.swt.impl.button.PushButton;
import org.eclipse.reddeer.swt.impl.ctab.DefaultCTabItem;
import org.eclipse.reddeer.swt.impl.menu.ContextMenuItem;
import org.eclipse.reddeer.swt.impl.shell.DefaultShell;
import org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText;
import org.eclipse.reddeer.swt.impl.text.LabeledText;
import org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem;
Expand Down Expand Up @@ -62,7 +63,8 @@ public void addPersistence(String projectName, String jpaVersion) throws FileNot
pe.open();
pe.getProject(projectName).select();
new ContextMenuItem("New","Other...").select();
new WaitUntil(new ShellIsAvailable("New"),TimePeriod.DEFAULT);
new WaitUntil(new ShellIsAvailable("Select a wizard"),TimePeriod.DEFAULT);
new DefaultShell("Select a wizard").setFocus();
new DefaultTreeItem("XML","XML File").select();
new PushButton("Next >").click();
new LabeledText("Enter or select the parent folder:").setText(projectName+"/src/META-INF");
Expand Down Expand Up @@ -106,10 +108,11 @@ public void addFacesConf(String projectName){
pe.open();
pe.getProject(projectName).select();
new ContextMenuItem("New","Other...").select();
new DefaultShell("Select a wizard").setFocus();
new DefaultTreeItem("JBoss Tools Web","JSF","Faces Config").select();
new PushButton("Next >").click();
new PushButton("Browse...").click();
new DefaultTreeItem(projectName,"WebContent","WEB-INF").select();
new DefaultTreeItem(projectName, "src", "main", "webapp","WEB-INF").select();
new PushButton("OK").click();
new PushButton("Finish").click();
updateConf(projectName);
Expand Down
Expand Up @@ -11,10 +11,12 @@
package org.jboss.tools.maven.ui.bot.test.conversion;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import org.eclipse.reddeer.common.wait.TimePeriod;
import org.eclipse.reddeer.common.wait.WaitUntil;
import org.eclipse.reddeer.common.wait.WaitWhile;
import org.eclipse.reddeer.core.exception.CoreLayerException;
import org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart;
import org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog;
import org.eclipse.reddeer.eclipse.ui.perspectives.JavaPerspective;
Expand All @@ -26,10 +28,10 @@
import org.eclipse.reddeer.swt.impl.button.CheckBox;
import org.eclipse.reddeer.swt.impl.button.PushButton;
import org.eclipse.reddeer.swt.impl.combo.LabeledCombo;
import org.eclipse.reddeer.swt.impl.ctab.DefaultCTabItem;
import org.eclipse.reddeer.swt.impl.menu.ContextMenuItem;
import org.eclipse.reddeer.swt.impl.menu.ShellMenuItem;
import org.eclipse.reddeer.swt.impl.shell.DefaultShell;
import org.eclipse.reddeer.swt.impl.tab.DefaultTabItem;
import org.eclipse.reddeer.swt.impl.tree.DefaultTree;
import org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem;
import org.eclipse.reddeer.workbench.core.condition.JobIsRunning;
Expand Down Expand Up @@ -64,10 +66,15 @@ public void setup(){
@Test
public void testMaterializeLibrary() throws Exception{
new ShellMenuItem("File","New","Example...").select();
new DefaultShell("New Example").setFocus();
new DefaultTreeItem("JBoss Tools","Project Examples").select();
new PushButton("Next >").click();
new DefaultShell("New Project Example");
new DefaultTreeItem("JBoss Maven Archetypes","Spring MVC Project").select();
try {
new DefaultTreeItem("JBoss Maven Archetypes","Spring MVC Project").select();
} catch (CoreLayerException ex) {
fail(ex.getMessage());
}
new PushButton("Next >").click();
new PushButton("Next >").click();
new LabeledCombo("Project name").setText(projectName);
Expand All @@ -80,6 +87,7 @@ public void testMaterializeLibrary() throws Exception{
new DefaultTreeItem(projectName,"Maven Dependencies").select();
new ContextMenuItem("Copy Classpath Libraries...").select();
new WaitUntil(new ShellIsAvailable("Copy Classpath Libraries"),TimePeriod.DEFAULT);
new DefaultShell("Copy Classpath Libraries").setFocus();
new PushButton("OK").click();
new PushButton("OK").click();
new WaitWhile(new ShellIsAvailable("Materialize Classpath Library"), TimePeriod.DEFAULT);
Expand All @@ -91,7 +99,7 @@ private void testExcludedResources(String project) throws Exception{
PropertyDialog pd = openPropertiesPackage(project);
new WaitUntil(new ShellIsAvailable("Properties for "+project),TimePeriod.DEFAULT);
new DefaultTreeItem("Java Build Path").select();
new DefaultTabItem("Source").activate();
new DefaultCTabItem("Source").activate();
for(TreeItem item: new DefaultTree(1).getAllItems()){
if(item.getText().startsWith("Included")){
assertTrue("(All) expected in Included patterns",item.getText().endsWith("(All)"));
Expand Down
Expand Up @@ -10,13 +10,14 @@
******************************************************************************/
package org.jboss.tools.maven.ui.bot.test.conversion;

import static org.jboss.tools.maven.ui.bot.test.utils.MavenProjectHelper.updateConf;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.jboss.tools.maven.ui.bot.test.utils.MavenProjectHelper.updateConf;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

import org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException;
Expand All @@ -35,6 +36,7 @@
import org.eclipse.reddeer.junit.runner.RedDeerSuite;
import org.eclipse.reddeer.requirements.openperspective.OpenPerspectiveRequirement.OpenPerspective;
import org.eclipse.reddeer.requirements.server.ServerRequirementState;
import org.eclipse.reddeer.swt.api.TreeItem;
import org.eclipse.reddeer.swt.condition.ControlIsEnabled;
import org.eclipse.reddeer.swt.condition.ShellIsAvailable;
import org.eclipse.reddeer.swt.exception.SWTLayerException;
Expand All @@ -49,6 +51,7 @@
import org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText;
import org.eclipse.reddeer.swt.impl.table.DefaultTable;
import org.eclipse.reddeer.swt.impl.text.LabeledText;
import org.eclipse.reddeer.swt.impl.tree.DefaultTree;
import org.eclipse.reddeer.workbench.core.condition.JobIsRunning;
import org.eclipse.reddeer.workbench.impl.editor.DefaultEditor;
import org.jboss.ide.eclipse.as.reddeer.server.requirement.ServerRequirement;
Expand Down Expand Up @@ -94,6 +97,7 @@ public void deleteDependenciesAfterConversion(){
finishConversionDialog();
checkProblemsAndResolve();
PropertyDialog pd = openPropertiesProject(WEB_PROJECT_NAME);
pd.getShell().setFocus();
List<String> libs = getJavaBuildPathLibraries(pd);
assertTrue("project contains more libraries than expected", libs.size() == 2);
for (String i : libs) {
Expand All @@ -112,6 +116,7 @@ public void keepDependenciesAfterConversion(){
finishConversionDialog();
checkProblemsAndResolve();
PropertyDialog pd = openPropertiesProject(WEB_PROJECT_NAME);
pd.getShell().setFocus();
List<String> libs = getJavaBuildPathLibraries(pd);
assertTrue("project contains more libraries than expected",libs.size()==3);
Collections.sort(libs);
Expand Down Expand Up @@ -254,10 +259,17 @@ private void finishConversionDialog(){

private List<String> getJavaBuildPathLibraries(PropertyDialog pd) {
pd.select(new BuildPathsPropertyPage(pd));
BuildPathsPropertyPage bppp = new BuildPathsPropertyPage(pd);
bppp.activateLibrariesTab();
List<String> libs = new ArrayList<String>();
libs.addAll(bppp.getLibraries());
new DefaultCTabItem("Libraries").activate();
LinkedList<String> libs = new LinkedList<String>();
for (TreeItem item : new DefaultTree(1).getItems()) {
if (item.getText().equals("Classpath") || item.getText().equals("Modulepath")) {
for (TreeItem tiPath : item.getItems()) {
libs.addLast(tiPath.getText());
}
} else {
libs.addLast(item.getText());
}
}
log.debug("Libraries found after conversion:");
for (String i : libs) {
log.debug(" " + i);
Expand Down
Expand Up @@ -10,8 +10,8 @@
******************************************************************************/
package org.jboss.tools.maven.ui.bot.test.project;

import static org.junit.Assert.assertTrue;
import static org.jboss.tools.maven.ui.bot.test.utils.MavenProjectHelper.convertToMavenProject;
import static org.junit.Assert.assertTrue;

import org.eclipse.reddeer.common.wait.TimePeriod;
import org.eclipse.reddeer.common.wait.WaitWhile;
Expand All @@ -25,6 +25,7 @@
import org.eclipse.reddeer.junit.runner.RedDeerSuite;
import org.eclipse.reddeer.requirements.openperspective.OpenPerspectiveRequirement.OpenPerspective;
import org.eclipse.reddeer.requirements.server.ServerRequirementState;
import org.eclipse.reddeer.swt.impl.button.PushButton;
import org.eclipse.reddeer.swt.impl.menu.ContextMenu;
import org.eclipse.reddeer.swt.impl.menu.ContextMenuItem;
import org.eclipse.reddeer.workbench.core.condition.JobIsRunning;
Expand All @@ -45,6 +46,7 @@ public class EARProjectTest extends AbstractMavenSWTBotTest{
public static final String WAR_PROJECT_NAME="earWeb";
public static final String EJB_PROJECT_NAME="earEJB";
public static final String EAR_PROJECT_NAME="ear";
public static final String EAR_VERSION="8.0";

@Test
public void testEARProject() throws InterruptedException{
Expand Down Expand Up @@ -93,6 +95,7 @@ public void createEARProject(){
EarProjectFirstPage ef = new EarProjectFirstPage(earw);
ef.setProjectName(EAR_PROJECT_NAME);
ef.setTargetRuntime("<None>");
ef.setEARVersion(EAR_VERSION);
earw.next();
EarProjectInstallPage es = new EarProjectInstallPage(earw);
DefaultJ2EEComponentCreationWizard p = es.newModule();
Expand Down
Expand Up @@ -42,6 +42,7 @@ public static void addDependency(String projectName, String groupId, String arti
pexplorer.getProject(projectName).select();
new ContextMenuItem("Maven", "Add Dependency").select();
new WaitUntil(new ShellIsAvailable("Add Dependency"), TimePeriod.DEFAULT);
new DefaultShell("Add Dependency").setFocus();
new LabeledText("Group Id:").setText(groupId);
new LabeledText("Artifact Id:").setText(artifactId);
new LabeledText("Version: ").setText(version);
Expand Down Expand Up @@ -86,6 +87,7 @@ public static void updateConf(String projectName, boolean forceDependencies) {
pexplorer.getProject(projectName).select();
new ContextMenuItem("Maven", "Update Project...").select();
new WaitUntil(new ShellIsAvailable("Update Maven Project"), TimePeriod.LONG);
new DefaultShell("Update Maven Project").setFocus();
new CheckBox("Force Update of Snapshots/Releases").toggle(forceDependencies);
new PushButton("OK").click();
new WaitWhile(new ShellIsAvailable("Update Maven Project"), TimePeriod.DEFAULT);
Expand Down

0 comments on commit 1904184

Please sign in to comment.