/hg/gfx-test: Added command for deleting compiled class file for...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Tue Jul 12 05:55:52 PDT 2011
changeset 1c22439b7d07 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=1c22439b7d07
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Jul 12 14:55:44 2011 +0200
Added command for deleting compiled class file for selected test
suite.
diffstat:
src/org/gfxtest/harness/Configuration.java | 6 ++
src/org/gfxtest/harness/Dialogs.java | 25 +++++---
src/org/gfxtest/harness/MainWindow.java | 84 +++++++++++++++++++++++++++--
3 files changed, 97 insertions(+), 18 deletions(-)
diffs (233 lines):
diff -r 8e10b41701d6 -r 1c22439b7d07 src/org/gfxtest/harness/Configuration.java
--- a/src/org/gfxtest/harness/Configuration.java Tue Jul 12 11:25:38 2011 +0200
+++ b/src/org/gfxtest/harness/Configuration.java Tue Jul 12 14:55:44 2011 +0200
@@ -56,6 +56,7 @@
private static final String DEFAULT_TESTED_JAVA = "/usr/lib/jvm/java/bin/java";
private static final String DEFAULT_SAMPLES_DIRECTORY = "samples";
private static final String DEFAULT_OUTPUT_DIRECTORY = "output";
+ private static final String TEST_CLASSES_DIRECTORY = "test-build/org/gfxtest/testsuites";
private String referenceJava;
private String testedJava;
@@ -235,4 +236,9 @@
{
this.outputDirectory = outputDirectory;
}
+
+ public String getTestClassesDirectory()
+ {
+ return TEST_CLASSES_DIRECTORY;
+ }
}
diff -r 8e10b41701d6 -r 1c22439b7d07 src/org/gfxtest/harness/Dialogs.java
--- a/src/org/gfxtest/harness/Dialogs.java Tue Jul 12 11:25:38 2011 +0200
+++ b/src/org/gfxtest/harness/Dialogs.java Tue Jul 12 14:55:44 2011 +0200
@@ -61,45 +61,50 @@
this.window = window;
}
- private void infoMessage(String message)
+ public void showInfoMessage(String message)
{
JOptionPane.showMessageDialog(this.window, message, this.title, JOptionPane.INFORMATION_MESSAGE);
}
- private void errorMessage(String message)
+ public void showErrorMessage(String message)
{
JOptionPane.showMessageDialog(this.window, message, this.title, JOptionPane.ERROR_MESSAGE);
}
+ public void showWarningMessage(String message)
+ {
+ JOptionPane.showMessageDialog(this.window, message, this.title, JOptionPane.WARNING_MESSAGE);
+ }
+
public void showNoTestSelectedMessage()
{
- this.errorMessage("No test selected in left list box!");
+ this.showErrorMessage("No test selected in left list box!");
}
public void showDialogWhenCompilationFailed(Exception e)
{
- this.errorMessage("Error occured during compilation: " + e.getMessage());
+ this.showErrorMessage("Error occured during compilation: " + e.getMessage());
}
public void showDialogWhenRunTestFailed(Exception e)
{
- this.errorMessage("Error occured during test run: " + e.getMessage());
+ this.showErrorMessage("Error occured during test run: " + e.getMessage());
}
public void showAboutDialog()
{
- this.infoMessage(ABOUT_TEXT);
+ this.showInfoMessage(ABOUT_TEXT);
}
public void showDialogAfterLoadConfiguration(boolean result)
{
if (result)
{
- this.infoMessage("Configuration successfully loaded");
+ this.showInfoMessage("Configuration successfully loaded");
}
else
{
- this.errorMessage("Error occured during configuration loading!");
+ this.showErrorMessage("Error occured during configuration loading!");
}
}
@@ -107,11 +112,11 @@
{
if (result)
{
- this.infoMessage("Configuration successfully saved");
+ this.showInfoMessage("Configuration successfully saved");
}
else
{
- this.errorMessage("Error occured during configuration saving!");
+ this.showErrorMessage("Error occured during configuration saving!");
}
}
}
diff -r 8e10b41701d6 -r 1c22439b7d07 src/org/gfxtest/harness/MainWindow.java
--- a/src/org/gfxtest/harness/MainWindow.java Tue Jul 12 11:25:38 2011 +0200
+++ b/src/org/gfxtest/harness/MainWindow.java Tue Jul 12 14:55:44 2011 +0200
@@ -86,6 +86,8 @@
private JTextArea resultTextArea = new JTextArea(5, 40);
private JButton commandCompile = new JButton("Compile");
private JButton commandRun = new JButton("Run");
+ private JButton commandDeleteClass = new JButton("Delete test class");
+ private JButton commandRefresh = new JButton("Refresh test list");
protected JList jTestList = null;
protected JTable jResultsTable;
private JLabel topRightLabel = new JLabel("sample image");
@@ -310,13 +312,20 @@
}
});
- JButton commandRefresh = new JButton("Refresh test list");
- commandRefresh.addActionListener(new ActionListener()
+ this.commandDeleteClass.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ onCommandDeleteClassPressed();
+ }
+ });
+
+ this.commandRefresh.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
- refreshTestList();
+ onRefreshTestListPressed();
}
});
@@ -328,14 +337,15 @@
panel.add(new JLabel("Gfx. test"), constraints(0, 0, 1, 1, 0.4, 0.0, GridBagConstraints.HORIZONTAL));
panel.add(new JLabel("Commands"), constraints(1, 0, 1, 1, 0.3, 0.0, GridBagConstraints.HORIZONTAL));
panel.add(this.testResultsLabel, constraints(2, 0, 1, 1, 0.3, 0.0, GridBagConstraints.HORIZONTAL));
- panel.add(testListPane, constraints(0, 1, 1, 6, 0.4, 1.0, GridBagConstraints.BOTH));
- panel.add(resultsPane, constraints(2, 1, 1, 4, 0.3, 0.5, GridBagConstraints.BOTH));
- panel.add(resultTextPane, constraints(1, 5, 2, 1, 0.3, 0.5, GridBagConstraints.BOTH));
+ panel.add(testListPane, constraints(0, 1, 1, 7, 0.4, 1.0, GridBagConstraints.BOTH));
+ panel.add(resultsPane, constraints(2, 1, 1, 6, 0.3, 0.5, GridBagConstraints.BOTH));
+ panel.add(resultTextPane, constraints(1, 7, 2, 1, 0.3, 0.5, GridBagConstraints.BOTH));
panel.add(this.commandCompile, constraints(1, 1, 1, 1, 0.1, 0.0, GridBagConstraints.HORIZONTAL));
panel.add(this.commandRun, constraints(1, 2, 1, 1, 0.1, 0.0, GridBagConstraints.HORIZONTAL));
- panel.add(commandRefresh, constraints(1, 4, 1, 1, 0.1, 0.0, GridBagConstraints.HORIZONTAL));
- panel.add(new JPanel(), constraints(1, 3, 1, 1, 0.1, 1.0, GridBagConstraints.BOTH));
+ panel.add(this.commandDeleteClass, constraints(1, 4, 1, 1, 0.1, 0.0, GridBagConstraints.HORIZONTAL));
+ panel.add(this.commandRefresh, constraints(1, 6, 1, 1, 0.1, 0.0, GridBagConstraints.HORIZONTAL));
+ panel.add(new JPanel(), constraints(1, 5, 1, 1, 0.1, 1.0, GridBagConstraints.BOTH));
}
/**
@@ -418,6 +428,7 @@
this.testResultsLabel.setText("no test selected");
this.commandCompile.setEnabled(false);
this.commandRun.setEnabled(false);
+ this.commandDeleteClass.setEnabled(false);
}
private void setTestResultsLabel(String selectedTest)
@@ -425,6 +436,7 @@
this.testResultsLabel.setText(selectedTest + " results");
this.commandCompile.setEnabled(true);
this.commandRun.setEnabled(true);
+ this.commandDeleteClass.setEnabled(true);
}
protected void selectTestSuite(int selectedIndex)
@@ -708,6 +720,62 @@
refreshTestResults(this.selectedTestSuite);
}
+ protected void onCommandDeleteClassPressed() {
+ if (this.selectedTestSuite == null)
+ {
+ this.dialogs.showNoTestSelectedMessage();
+ }
+ String outputDirectory = this.configuration.getTestClassesDirectory();
+ if (outputDirectory == null)
+ {
+ this.dialogs.showErrorMessage("Output directory is not set");
+ }
+ File fileToDelete = new File(outputDirectory, this.selectedTestSuite + ".class");
+ if (!fileToDelete.exists())
+ {
+ try
+ {
+ this.dialogs.showWarningMessage("File " + fileToDelete.getCanonicalPath() + " does not exists");
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ if (fileToDelete.delete())
+ {
+ try
+ {
+ this.dialogs.showInfoMessage("File " + fileToDelete.getCanonicalPath() + " deleted");
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ try
+ {
+ this.dialogs.showErrorMessage("File " + fileToDelete.getCanonicalPath() + " can not be deleted");
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ protected void onCommandShowSourcePressed() {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected void onRefreshTestListPressed() {
+ refreshTestList();
+ }
+
private void runTestHarness()
{
this.configuration = new Configuration();
More information about the distro-pkg-dev
mailing list