Skip to content

#73 - Filter successful and disabled tests #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class PreferenceModel extends HashStructureAdapter {
static final String KEY_SHOW_INFO_COUNTER = "showInfoCounter"
static final String KEY_SHOW_WARNING_INDICATOR = "showWarningIndicator"
static final String KEY_SHOW_INFO_INDICATOR = "showInfoIndicator"
static final String KEY_SHOW_SUCCESSFUL_TESTS = "showSuccessfulTests"
static final String KEY_SHOW_DISABLED_TESTS = "showDisabledTests"
static final String KEY_SHOW_TEST_DESCRIPTION = "showTestDescription"
static final String KEY_SYNC_DETAIL_TAB = "syncDetailTab"
static final String KEY_TEST_PACKAGE_PREFIX = "testPackagePrefix"
Expand Down Expand Up @@ -166,6 +168,22 @@ class PreferenceModel extends HashStructureAdapter {
def setShowInfoIndicator(boolean showInfoIndicator) {
getHashStructure.putBoolean(PreferenceModel.KEY_SHOW_INFO_INDICATOR, showInfoIndicator)
}

def isShowSuccessfulTests() {
return getHashStructure.getBoolean(PreferenceModel.KEY_SHOW_SUCCESSFUL_TESTS, true)
}

def setShowSuccessfulTests(boolean showSuccessfulTests) {
getHashStructure.putBoolean(PreferenceModel.KEY_SHOW_SUCCESSFUL_TESTS, showSuccessfulTests)
}

def isShowDisabledTests() {
return getHashStructure.getBoolean(PreferenceModel.KEY_SHOW_DISABLED_TESTS, true)
}

def setShowDisabledTests(boolean showDisabledTests) {
getHashStructure.putBoolean(PreferenceModel.KEY_SHOW_DISABLED_TESTS, showDisabledTests)
}

def isShowTestDescription() {
return getHashStructure.getBoolean(PreferenceModel.KEY_SHOW_TEST_DESCRIPTION, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class PreferencePanel extends DefaultTraversablePanel {
val JCheckBox showInfoCounterCheckBox = new JCheckBox
val JCheckBox showWarningIndicatorCheckBox = new JCheckBox
val JCheckBox showInfoIndicatorCheckBox = new JCheckBox
val JCheckBox showSuccessfulTestsCheckBox = new JCheckBox
val JCheckBox showDisabledTestsCheckBox = new JCheckBox
val JCheckBox showTestDescriptionCheckBox = new JCheckBox
val JCheckBox syncDetailTabCheckBox = new JCheckBox
val JPanel generateTestPanel = new JPanel();
Expand Down Expand Up @@ -134,6 +136,12 @@ class PreferencePanel extends DefaultTraversablePanel {
rrTab.add(
runTab.field.label.withText(UtplsqlResources.getString("PREF_SHOW_INFO_INDICATOR_LABEL")).component(
showInfoIndicatorCheckBox))
rrTab.add(
runTab.field.label.withText(UtplsqlResources.getString("PREF_SHOW_SUCCESSFUL_TESTS_LABEL")).component(
showSuccessfulTestsCheckBox))
rrTab.add(
runTab.field.label.withText(UtplsqlResources.getString("PREF_SHOW_DISABLED_TESTS_LABEL")).component(
showDisabledTestsCheckBox))
rrTab.add(
runTab.field.label.withText(UtplsqlResources.getString("PREF_SHOW_TEST_DESCRIPTION_LABEL")).component(
showTestDescriptionCheckBox))
Expand Down Expand Up @@ -348,6 +356,8 @@ class PreferencePanel extends DefaultTraversablePanel {
showInfoCounterCheckBox.selected = info.showInfoCounter
showWarningIndicatorCheckBox.selected = info.showWarningIndicator
showInfoIndicatorCheckBox.selected = info.showInfoIndicator
showSuccessfulTestsCheckBox.selected = info.showSuccessfulTests
showDisabledTestsCheckBox.selected = info.showDisabledTests
showTestDescriptionCheckBox.selected = info.showTestDescription
syncDetailTabCheckBox.selected = info.syncDetailTab
testPackagePrefixTextField.text = info.testPackagePrefix
Expand Down Expand Up @@ -383,6 +393,8 @@ class PreferencePanel extends DefaultTraversablePanel {
info.showInfoCounter = showInfoCounterCheckBox.selected
info.showWarningIndicator = showWarningIndicatorCheckBox.selected
info.showInfoIndicator = showInfoIndicatorCheckBox.selected
info.showSuccessfulTests = showSuccessfulTestsCheckBox.selected
info.showDisabledTests = showDisabledTestsCheckBox.selected
info.showTestDescription = showTestDescriptionCheckBox.selected
info.syncDetailTab = syncDetailTabCheckBox.selected
info.testPackagePrefix = testPackagePrefixTextField.text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import javax.swing.JSplitPane
import javax.swing.JTabbedPane
import javax.swing.JTable
import javax.swing.RepaintManager
import javax.swing.RowFilter
import javax.swing.SwingConstants
import javax.swing.Timer
import javax.swing.UIManager
Expand All @@ -55,6 +56,7 @@ import javax.swing.event.ListSelectionEvent
import javax.swing.event.ListSelectionListener
import javax.swing.plaf.basic.BasicProgressBarUI
import javax.swing.table.DefaultTableCellRenderer
import javax.swing.table.TableRowSorter
import oracle.dbtools.raptor.controls.grid.DefaultDrillLink
import oracle.dbtools.raptor.utils.Connections
import oracle.ide.config.Preferences
Expand Down Expand Up @@ -105,6 +107,8 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
JCheckBoxMenuItem showTestDescriptionCheckBoxMenuItem
JCheckBoxMenuItem showWarningIndicatorCheckBoxMenuItem
JCheckBoxMenuItem showInfoIndicatorCheckBoxMenuItem
JCheckBoxMenuItem showSuccessfulTestsCheckBoxMenuItem
JCheckBoxMenuItem showDisabledTestsCheckBoxMenuItem
JCheckBoxMenuItem syncDetailTabCheckBoxMenuItem
RunnerTextField testOwnerTextField
RunnerTextField testPackageTextField
Expand Down Expand Up @@ -220,6 +224,30 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
col.preferredWidth = 0
}
}

private def applyFilter(boolean showSuccessfulTests, boolean showDisabledTests) {
val sorter = testOverviewTable.rowSorter as TableRowSorter<TestOverviewTableModel>
val filter = new RowFilter<TestOverviewTableModel, Integer>() {
override include(Entry<? extends TestOverviewTableModel, ? extends Integer> entry) {
val test = entry.model.getTest(entry.identifier)
val counter = test.counter
if (counter !== null) {
if (counter.success > 0) {
if (!showSuccessfulTests) {
return false
}
}
if (counter.disabled > 0) {
if (!showDisabledTests) {
return false
}
}
}
return true
}
}
sorter.rowFilter = filter
}

private def openSelectedTest() {
val rowIndex = testOverviewTable.selectedRow
Expand Down Expand Up @@ -338,6 +366,9 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
fixCheckBoxMenuItem(showWarningIndicatorCheckBoxMenuItem)
showInfoIndicatorCheckBoxMenuItem.selected = preferences.showInfoIndicator
applyShowInfoIndicator(showInfoIndicatorCheckBoxMenuItem.selected)
showSuccessfulTestsCheckBoxMenuItem.selected = preferences.showSuccessfulTests
showDisabledTestsCheckBoxMenuItem.selected = preferences.showDisabledTests
applyFilter(showSuccessfulTestsCheckBoxMenuItem.selected, showDisabledTestsCheckBoxMenuItem.selected)
fixCheckBoxMenuItem(showInfoIndicatorCheckBoxMenuItem)
syncDetailTabCheckBoxMenuItem.selected = preferences.syncDetailTab
fixCheckBoxMenuItem(syncDetailTabCheckBoxMenuItem)
Expand Down Expand Up @@ -380,10 +411,13 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
testOverviewTableModel.fireTableDataChanged
} else {
if (testOverviewTableModel.rowCount > row) {
val positionOfCurrentTest = testOverviewTable.getCellRect(row, 0, true);
val positionOfCurrentTest = testOverviewTable.getCellRect(testOverviewTable.convertRowIndexToView(row), 0, true);
testOverviewTable.scrollRectToVisible = positionOfCurrentTest
testOverviewTableModel.fireTableRowsUpdated(row, row)
Thread.sleep(5) // reduce flickering
if (!showSuccessfulTestsCheckBoxMenuItem.selected || !showDisabledTestsCheckBoxMenuItem.selected) {
applyFilter(showSuccessfulTestsCheckBoxMenuItem.selected, showDisabledTestsCheckBoxMenuItem.selected)
}
testOverviewTable.scrollRectToVisible = positionOfCurrentTest
}
}
Expand Down Expand Up @@ -485,6 +519,12 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
} else if (e.source == showInfoCounterCheckBoxMenuItem) {
applyShowInfoCounter(showInfoCounterCheckBoxMenuItem.selected)
fixCheckBoxMenuItem(showInfoCounterCheckBoxMenuItem)
} else if (e.source == showSuccessfulTestsCheckBoxMenuItem) {
applyFilter(showSuccessfulTestsCheckBoxMenuItem.selected, showDisabledTestsCheckBoxMenuItem.selected)
fixCheckBoxMenuItem(showSuccessfulTestsCheckBoxMenuItem)
} else if (e.source == showDisabledTestsCheckBoxMenuItem) {
applyFilter(showSuccessfulTestsCheckBoxMenuItem.selected, showDisabledTestsCheckBoxMenuItem.selected)
fixCheckBoxMenuItem(showDisabledTestsCheckBoxMenuItem)
} else if (e.source == showTestDescriptionCheckBoxMenuItem) {
applyShowTestDescription(showTestDescriptionCheckBoxMenuItem.selected)
fixCheckBoxMenuItem(showTestDescriptionCheckBoxMenuItem)
Expand Down Expand Up @@ -943,6 +983,13 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
testOverviewRunWorksheetMenuItem.addActionListener(this)
testOverviewPopupMenu.add(testOverviewRunWorksheetMenuItem)
testOverviewPopupMenu.add(new JSeparator)
showSuccessfulTestsCheckBoxMenuItem = new JCheckBoxMenuItem(UtplsqlResources.getString("PREF_SHOW_SUCCESSFUL_TESTS_LABEL").replace("?",""), true)
showSuccessfulTestsCheckBoxMenuItem.addActionListener(this)
testOverviewPopupMenu.add(showSuccessfulTestsCheckBoxMenuItem)
showDisabledTestsCheckBoxMenuItem = new JCheckBoxMenuItem(UtplsqlResources.getString("PREF_SHOW_DISABLED_TESTS_LABEL").replace("?",""), true)
showDisabledTestsCheckBoxMenuItem.addActionListener(this)
testOverviewPopupMenu.add(showDisabledTestsCheckBoxMenuItem)
testOverviewPopupMenu.add(new JSeparator)
showTestDescriptionCheckBoxMenuItem = new JCheckBoxMenuItem(UtplsqlResources.getString("PREF_SHOW_TEST_DESCRIPTION_LABEL").replace("?",""), true)
showTestDescriptionCheckBoxMenuItem.addActionListener(this)
testOverviewPopupMenu.add(showTestDescriptionCheckBoxMenuItem)
Expand All @@ -956,6 +1003,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
syncDetailTabCheckBoxMenuItem.addActionListener(this)
testOverviewPopupMenu.add(syncDetailTabCheckBoxMenuItem)
testOverviewTable.componentPopupMenu = testOverviewPopupMenu
testOverviewTable.tableHeader.componentPopupMenu = testOverviewPopupMenu

// Test tabbed pane (Test Properties)
val testInfoPanel = new ScrollablePanel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ PREF_SHOW_WARNINGS_COUNTER_LABEL=Show warnings counter?
PREF_SHOW_INFO_COUNTER_LABEL=Show info counter?
PREF_SHOW_WARNING_INDICATOR_LABEL=Show warning indicator?
PREF_SHOW_INFO_INDICATOR_LABEL=Show info indicator?
PREF_SHOW_SUCCESSFUL_TESTS_LABEL=Show successful tests?
PREF_SHOW_DISABLED_TESTS_LABEL=Show disabled tests?
PREF_SHOW_TEST_DESCRIPTION_LABEL=Show description (if present)?
PREF_SYNC_DETAIL_TAB_LABEL=Synchronize detail tab based on test status?
PREF_TEST_PACKAGE_PREFIX_LABEL=Test package prefix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ PREF_SHOW_WARNINGS_COUNTER_LABEL=Warnungen-Z
PREF_SHOW_INFO_COUNTER_LABEL=Info-Z�hler anzeigen?
PREF_SHOW_WARNING_INDICATOR_LABEL=Warnung-Indikator anzeigen?
PREF_SHOW_INFO_INDICATOR_LABEL=Info-Indikator anzeigen?
PREF_SHOW_SUCCESSFUL_TESTS_LABEL=Erfolgreiche Tests anzeigen?
PREF_SHOW_DISABLED_TESTS_LABEL=Deaktivierte Tests anzeigen?
PREF_SHOW_TEST_DESCRIPTION_LABEL=Beschreibung anzeigen (falls vorhanden)?
PREF_SYNC_DETAIL_TAB_LABEL=Detailansicht basierend auf dem Teststatus synchronisieren?
PREF_TEST_PACKAGE_PREFIX_LABEL=Test Package Pr�fix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class PreferenceModelTest {
Assert.assertFalse(model.showInfoCounter)
Assert.assertFalse(model.showWarningIndicator)
Assert.assertFalse(model.showInfoIndicator)
Assert.assertTrue(model.showSuccessfulTests)
Assert.assertTrue(model.showDisabledTests)
Assert.assertFalse(model.isShowTestDescription)
Assert.assertTrue(model.syncDetailTab)
Assert.assertEquals("test_", model.testPackagePrefix)
Expand Down