Skip to content

Commit

Permalink
Adapt New Java project wizard pages for 2021-06
Browse files Browse the repository at this point in the history
   - Fix tests failures for 20201-06 M3

Signed-off-by: Ondrej Dockal <odockal@redhat.com>
  • Loading branch information
odockal committed May 26, 2021
1 parent f0b2b69 commit 3eb1801
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* Represents first page of New Java Project Wizard.
*
* @author rhopp
* @author rhopp, odockal
*
*/

Expand Down Expand Up @@ -98,5 +98,18 @@ public NewJavaProjectWizardPageOne useExecutionEnvironmentJRE(String env) {
new DefaultCombo(referencedComposite, 0).setSelection(env);
return this;
}

/**
* Sets whether to create module-info.java file
* @param check
* Indicates whether to create module-info.java file
* @return
*/
public NewJavaProjectWizardPageOne createModuleInfoFile(boolean check) {
CheckBox box = new CheckBox(this, "Create module-info.java file");
log.debug("Setting 'Create module-info.java file' to " + check);
box.toggle(check);
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ public NewJavaProjectWizardPageTwo(ReferencedComposite referencedComposite) {
}

/**
* Sets whether to create module-info.java file
* Sets whether to create module-info.java file. Section was moved to
* the first page of Java Project creation wizard.
* @param check
* Indicates whether to create module-info.java file
* @return
*/
@Deprecated
public NewJavaProjectWizardPageTwo createModuleInfoFile(boolean check) {
CheckBox box = new CheckBox(this, "Create module-info.java file");
log.debug("Setting 'Create module-info.java file' to " + check);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,10 @@ public void testJavaProjectWizardCreateInfoModule() {

NewJavaProjectWizardPageOne pageOne = new NewJavaProjectWizardPageOne(dialog);
pageOne.setProjectName(JAVA_PROJECT);
pageOne.useExecutionEnvironmentJRE("JavaSE-9");

dialog.next();

NewJavaProjectWizardPageTwo pageTwo = new NewJavaProjectWizardPageTwo(dialog);
pageOne.useExecutionEnvironmentJRE("JavaSE-11");
new WaitUntil(new JobIsRunning(), TimePeriod.MEDIUM, false);
new WaitWhile(new JobIsRunning(), TimePeriod.MEDIUM, false);
pageTwo.createModuleInfoFile(true);
pageOne.createModuleInfoFile(true);

dialog.finish(true, JAVA_MODULE_NAME);

Expand All @@ -132,12 +128,8 @@ public void testJavaProjectWizardCreateInfoModuleDefaultName() {

NewJavaProjectWizardPageOne pageOne = new NewJavaProjectWizardPageOne(dialog);
pageOne.setProjectName(JAVA_PROJECT);
pageOne.useExecutionEnvironmentJRE("JavaSE-10");

dialog.next();

NewJavaProjectWizardPageTwo pageTwo = new NewJavaProjectWizardPageTwo(dialog);
pageTwo.createModuleInfoFile(true);
pageOne.useExecutionEnvironmentJRE("JavaSE-11");
pageOne.createModuleInfoFile(true);

dialog.finish();

Expand All @@ -156,12 +148,8 @@ public void testJavaProjectWizardDisabledModuleInfoCheckbox() {
NewJavaProjectWizardPageOne pageOne = new NewJavaProjectWizardPageOne(dialog);
pageOne.setProjectName(JAVA_PROJECT);
pageOne.useExecutionEnvironmentJRE("JavaSE-1.8");

dialog.next();

NewJavaProjectWizardPageTwo pageTwo = new NewJavaProjectWizardPageTwo(dialog);
try {
pageTwo.createModuleInfoFile(true);
pageOne.createModuleInfoFile(true);
} catch (WaitTimeoutExpiredException exc) {
// exception expected
}
Expand Down

0 comments on commit 3eb1801

Please sign in to comment.