Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Commit [0259ef] Maximize Restore History

Relocated uitests profile to root so that it can be used by the plugin projects as well. Moved the surefire-plugin configuration out of the plugin parent pom so that the common configuration in the root can be inherited. Relocated the derby plugin preferences UI test to the derby project.

Robert Manning Robert Manning 2011-03-19

removed sql12/test/jfctests/net/sourceforge/squirrel_sql/plugins/derby
changed sql12/app/pom.xml
changed sql12/plugins/derby/pom.xml
changed sql12/plugins/squirrelsql-plugins-parent-pom/pom.xml
changed sql12/pom.xml
copied sql12/test/jfctests/net/sourceforge/squirrel_sql/client/plugin/gui/AbstractPluginPreferencesUITest.java -> sql12/plugins/derby/src/test/java/net/sourceforge/squirrel_sql/plugins/derby/prefs/DerbyPluginPreferencesPanelUITest.java
sql12/app/pom.xml Diff Switch to side-by-side view
Loading...
sql12/plugins/derby/pom.xml Diff Switch to side-by-side view
Loading...
sql12/plugins/squirrelsql-plugins-parent-pom/pom.xml Diff Switch to side-by-side view
Loading...
sql12/pom.xml Diff Switch to side-by-side view
Loading...
sql12/test/jfctests/net/sourceforge/squirrel_sql/client/plugin/gui/AbstractPluginPreferencesUITest.java to sql12/plugins/derby/src/test/java/net/sourceforge/squirrel_sql/plugins/derby/prefs/DerbyPluginPreferencesPanelUITest.java
--- a/sql12/test/jfctests/net/sourceforge/squirrel_sql/client/plugin/gui/AbstractPluginPreferencesUITest.java
+++ b/sql12/plugins/derby/src/test/java/net/sourceforge/squirrel_sql/plugins/derby/prefs/DerbyPluginPreferencesPanelUITest.java
@@ -16,124 +16,42 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-package net.sourceforge.squirrel_sql.client.plugin.gui;
+package net.sourceforge.squirrel_sql.plugins.derby.prefs;
 
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
 
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-
-import net.sourceforge.squirrel_sql.BaseSQuirreLJUnit4TestCase;
 import net.sourceforge.squirrel_sql.client.plugin.PluginException;
-import net.sourceforge.squirrel_sql.client.plugin.PluginQueryTokenizerPreferencesManager;
-import net.sourceforge.squirrel_sql.fw.preferences.IQueryTokenizerPreferenceBean;
+import net.sourceforge.squirrel_sql.client.plugin.gui.AbstractPluginPreferencesUITest;
+import net.sourceforge.squirrel_sql.client.plugin.gui.PluginQueryTokenizerPreferencesPanel;
+import net.sourceforge.squirrel_sql.fw.preferences.BaseQueryTokenizerPreferenceBean;
 
 import org.fest.swing.annotation.GUITest;
-import org.fest.swing.fixture.FrameFixture;
-import org.fest.swing.fixture.JCheckBoxFixture;
-import org.fest.swing.fixture.JTextComponentFixture;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
 
-/**
- * Test base class for UI tests on database-specific plugin preferences panels. 
- */
 @GUITest
-public abstract class AbstractPluginPreferencesUITest extends BaseSQuirreLJUnit4TestCase
+public class DerbyPluginPreferencesPanelUITest extends AbstractPluginPreferencesUITest
 {
 
-	protected JFrame frame = null;
-	protected FrameFixture fixture = null;
-	protected PluginQueryTokenizerPreferencesPanel classUnderTest = null;
-	protected PluginQueryTokenizerPreferencesManager prefsManager =
-		new PluginQueryTokenizerPreferencesManager();
-	protected JCheckBoxFixture useCustomQTCheckBox = null;
-
-	@Before
-   public void setUp() throws Exception
+	/**
+    * The main method is not used at all in the test - it is just here to allow for user interaction testing
+    * with the graphical component, which doesn't require launching SQuirreL.
+    * 
+    * @param args
+    */
+   public static void main(String[] args) throws Exception
    {
-   	if (frame == null) {
-   		frame = constructTestFrame();
-   	}
-   	fixture = new FrameFixture(frame);
-   	fixture.show();
-   	useCustomQTCheckBox = fixture.checkBox("useCustomQTCheckBox");
+   	new DerbyPluginPreferencesPanelUITest().constructTestFrame().setVisible(true);
+   }	
+	
+	@Override
+   protected PluginQueryTokenizerPreferencesPanel getPrefsPanelToTest() throws PluginException
+   {
+   	return new DerbyPluginPreferencesPanel(prefsManager);
    }
 
-	@After
-   public void tearDown()
+	@Override
+   protected BaseQueryTokenizerPreferenceBean getPreferenceBean()
    {
-		if (fixture != null) {
-			fixture.cleanUp();
-		}
+	   return new DerbyPreferenceBean();
    }
 
-	@Test
-	public void testCustomQTCheckbox() {
-		JTextComponentFixture lineCommentTextField = fixture.textBox("lineCommentTextField");
-		JTextComponentFixture statementSeparatorTextField = fixture.textBox("statementSeparatorTextField");
-		
-		useCustomQTCheckBox.uncheck();
-		useCustomQTCheckBox.check();
-		useCustomQTCheckBox.uncheck();
-		
-		lineCommentTextField.requireDisabled();
-		statementSeparatorTextField.requireDisabled();
-		
-		useCustomQTCheckBox.check();
-		lineCommentTextField.requireEnabled();
-		statementSeparatorTextField.requireEnabled();		
-	}	
 
-	/**
-    * Builds the frame that will be used to display the panel.
-    * 
-    * @return
-    * @throws Exception
-    */
-   protected JFrame constructTestFrame() throws Exception
-   {
-   	JFrame f = new JFrame();
-   	f.getContentPane().setLayout(new BorderLayout());
-   	File prefsFile = new File("prefs.xml");
-   	prefsFile.delete();
-   	prefsManager.initialize(new DummyPlugin(), getPreferenceBean());
-   	classUnderTest = getPrefsPanelToTest();
-   	JScrollPane sp = new JScrollPane(classUnderTest);
-   	f.getContentPane().add(sp, BorderLayout.CENTER);
-   	JButton button = new JButton("Save");
-   	button.setName("saveButton");
-   	button.addActionListener(new ActionListener()
-   	{
-   		public void actionPerformed(ActionEvent e)
-   		{
-   			classUnderTest.applyChanges();
-   			prefsManager.unload();
-   		}
-   	});
-   	JButton exitButton = new JButton("Exit");
-   	exitButton.addActionListener(new ActionListener()
-   	{
-   		public void actionPerformed(ActionEvent e)
-   		{
-   			System.exit(0);
-   		}
-   	});
-   	JPanel buttonPanel = new JPanel();
-   	buttonPanel.add(button);
-   	buttonPanel.add(exitButton);
-   	f.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
-   	f.setBounds(200, 50, 700, 700);
-   	return f;
-   }
-   
-   protected abstract PluginQueryTokenizerPreferencesPanel getPrefsPanelToTest() throws PluginException;
-   
-   protected abstract IQueryTokenizerPreferenceBean getPreferenceBean();
-}+}