private void enablePMD() { final PMDProjectPropertyDialogBot dialog = JavaProjectClient.openPMDProjectPropertyDialog(PROJECT_NAME_1); assertFalse("PMD should be disabled by default", dialog.enablePMD().isChecked()); assertFalse( "The button to add a new configuration should be disabled as long as PMD is disabled", dialog.addConfiguration().isEnabled()); dialog.enablePMD().select(); dialog.ok().click(); dialog.bot().waitUntil(Conditions.shellCloses(dialog)); }
public void addFileSystemConfigurationInFirstProject() { final PMDProjectPropertyDialogBot dialog = JavaProjectClient.openPMDProjectPropertyDialog(PROJECT_NAME_1); assertTrue("PMD should be enabled", dialog.enablePMD().isChecked()); assertTrue( "The button to add a new configuration should be enabled when PMD is enabled", dialog.addConfiguration().isEnabled()); dialog.addConfiguration().click(); final AddRuleSetConfigurationWizardBot wizard = AddRuleSetConfigurationWizardBot.getActive(); assertFalse( "The finish button should be disabled as long as the name is missing", wizard.finish().isEnabled()); wizard.filesystem().click(); wizard.next().click(); assertFalse( "The finish button should be disabled as long as the name is missing", wizard.finish().isEnabled()); wizard.name().setText(FILE_SYSTEM_CONFIGURATION_NAME); assertFalse( "The finish button should be disabled as long as the location is missing", wizard.finish().isEnabled()); wizard.location().setText(rules.getAbsolutePath()); wizard.bot().waitUntil(Conditions.tableHasRows(wizard.rules(), 2)); final String[] expectedNames = new String[] {"ExtendsObject", "BooleanInstantiation"}; final String[] actualNames = wizard.ruleNames(); assertArrayEquals("Rules of the PMD configuration", expectedNames, actualNames); assertTrue( "The finish button should be enabled if bot a name and a location with a valid configuration is available", wizard.finish().isEnabled()); wizard.finish().click(); wizard.bot().waitUntil(Conditions.shellCloses(wizard)); dialog.bot().waitUntil(Conditions.tableHasRows(dialog.configurations(), 1)); assertTrue( "The added configuration should be activated", dialog.configurations().getTableItem(0).isChecked()); assertEquals( "Name of the configuration", FILE_SYSTEM_CONFIGURATION_NAME, dialog.configurations().cell(0, "Name")); assertEquals( "Type of the configuration", "File System", dialog.configurations().cell(0, "Type")); assertEquals( "Location of the configuration", rules.getAbsolutePath(), dialog.configurations().cell(0, "Location")); dialog.ok().click(); dialog.bot().waitUntil(Conditions.shellCloses(dialog)); }
private void addWorkspaceConfigurationInFirstProject() { final PMDProjectPropertyDialogBot dialog = JavaProjectClient.openPMDProjectPropertyDialog(PROJECT_NAME_1); assertTrue("PMD should be enabled", dialog.enablePMD().isChecked()); assertTrue( "The button to add a new configuration should be enabled when PMD is enabled", dialog.addConfiguration().isEnabled()); dialog.enablePMD().select(); dialog.addConfiguration().click(); final AddRuleSetConfigurationWizardBot wizard = AddRuleSetConfigurationWizardBot.getActive(); assertFalse( "The finish button should be disabled as long as the name is missing", wizard.finish().isEnabled()); wizard.workspace().click(); wizard.next().click(); assertFalse( "The finish button should be disabled as long as the name is missing", wizard.finish().isEnabled()); wizard.name().setText(WORKSPACE_CONFIGURATION_NAME); assertFalse( "The finish button should be disabled as long as the location is missing", wizard.finish().isEnabled()); final String workspaceRelativePath = Paths.get(PROJECT_NAME_1).resolve(PMD_XML).toString(); wizard.location().setText(workspaceRelativePath); wizard.bot().waitUntil(Conditions.tableHasRows(wizard.rules(), 2)); final String[] expectedNames = new String[] {"ExtendsObject", "BooleanInstantiation"}; final String[] actualNames = wizard.ruleNames(); assertArrayEquals("Rules of the PMD configuration", expectedNames, actualNames); assertTrue( "The finish button should be enabled if bot a name and a location with a valid configuration is available", wizard.finish().isEnabled()); wizard.finish().click(); wizard.bot().waitUntil(Conditions.shellCloses(wizard)); dialog.bot().waitUntil(Conditions.tableHasRows(dialog.configurations(), 2)); assertTrue( "The added configuration should be activated", dialog.configurations().getTableItem(1).isChecked()); assertEquals( "Name of the configuration", WORKSPACE_CONFIGURATION_NAME, dialog.configurations().cell(1, "Name")); assertEquals("Type of the configuration", "Workspace", dialog.configurations().cell(1, "Type")); assertEquals( "Location of the configuration", workspaceRelativePath, dialog.configurations().cell(1, "Location")); dialog.ok().click(); dialog.bot().waitUntil(Conditions.shellCloses(dialog)); }
private void activateTheSameConfigurationInSecondProject() { PMDProjectPropertyDialogBot dialog = JavaProjectClient.openPMDProjectPropertyDialog(PROJECT_NAME_2); assertFalse("PMD should be disabled by default", dialog.enablePMD().isChecked()); dialog.enablePMD().select(); assertEquals( "The previously added configuration should als be available in the second project", 1, dialog.configurations().rowCount()); assertFalse( "The available configuration should not be activated", dialog.configurations().getTableItem(0).isChecked()); assertEquals( "Name of the configuration", FILE_SYSTEM_CONFIGURATION_NAME, dialog.configurations().cell(0, "Name")); assertEquals( "Type of the configuration", "File System", dialog.configurations().cell(0, "Type")); assertEquals( "Location of the configuration", rules.getAbsolutePath(), dialog.configurations().cell(0, "Location")); dialog.configurations().getTableItem(0).check(); dialog.ok().click(); dialog.bot().waitUntil(Conditions.shellCloses(dialog)); dialog = JavaProjectClient.openPMDProjectPropertyDialog(PROJECT_NAME_2); assertTrue("PMD should be enabled", dialog.enablePMD().isChecked()); assertTrue( "The configuration should be activated", dialog.configurations().getTableItem(0).isChecked()); dialog.ok().click(); dialog.bot().waitUntil(Conditions.shellCloses(dialog)); }