[CVS nano] picogui corrected, bar one testcase

Paul Hammant <paul-yCVjj/[email protected]> Mon, 17 Nov 2003 17:31:15 -0600
Newsgroups gmane.comp.java.nanocontainer.cvs
Message-ID <[email protected]>
Commit in nano/picogui/src on MAIN

test/org/picoextras/gui/model/ContainerNodeTestCase.java +62 added 1.1

/ComponentRegistrarTestCase.java +2 -1 1.1 -> 1.2

/EditContainerPanelTestCase.java +1 -2 1.1 -> 1.2

java/org/picoextras/gui/model/ContainerNodeTestCase.java -60 1.1 removed

test/org/picocontainer/gui/model/ComponentRegistrarTestCase.java -45 1.1 removed

/ContainerNodeTestCase.java -60 1.4 removed

/EditContainerPanelTestCase.java -85 1.5 removed

/Foo.java -17 1.2 removed

/NeedsFoo.java -10 1.1 removed

test/org/picocontainer/gui/swing/BeanPropertyTableModelTestCase.java -63 1.4 removed

/PropertyTableCommanderTest.java -36 1.3 removed

/PropertyTableCommanderTestCase.java -37 1.4 removed

+65 -416

1 added + 9 removed + 2 modified, total 12 files

picogui corrected, bar one testcase

----------

nano /picogui /src /test /org /picoextras /gui /model

ContainerNodeTestCase.java added at 1.1

diff -N ContainerNodeTestCase.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ContainerNodeTestCase.java 17 Nov 2003 23:31:14 -0000 1.1
@@ -0,0 +1,62 @@

+package org.picoextras.gui.model;
+
+import junit.framework.TestCase;
+import org.picocontainer.PicoContainer;
+import org.picoextras.gui.model.*;
+import org.picoextras.gui.model.NeedsFoo;
+
+import java.util.ArrayList;
+import java.beans.IntrospectionException;
+
+/**
+ * @author Aslak Helles&oslash;y
+ * @version $Revision: 1.1 $
+ */
+public class ContainerNodeTestCase extends TestCase {
+
+ public void testEmptyContainerNodeCreatesEmptyContainer() {
+ ContainerNode containerNode = new ContainerNode();
+ PicoContainer container = containerNode.createPicoContainer();
+ assertEquals(0, container.getComponentKeys().size());
+ }
+
+ public void testContainerNodeWithChildrenCreatesContainerWithComponents() throws IntrospectionException {
+ ContainerNode containerNode = new ContainerNode();
+
+ ComponentNode stringNode = new ComponentNode(new BeanPropertyModel(String.class));
+ ComponentNode listNode = new ComponentNode(new BeanPropertyModel(ArrayList.class));
+
+ containerNode.add(stringNode);
+ containerNode.add(listNode);
+
+ PicoContainer container = containerNode.createPicoContainer();
+ assertEquals("", container.getComponentInstance(String.class));
+ assertEquals(new ArrayList(), container.getComponentInstance(ArrayList.class));
+ }
+
+ public void testChildContainerNodeCreatesHierarchicalContainer() throws IntrospectionException {
+ ContainerNode parentContainerNode = new ContainerNode();
+ ContainerNode childContainerNode = new ContainerNode();
+ parentContainerNode.add(childContainerNode);
+
+ ComponentNode fooNode = new ComponentNode(new BeanPropertyModel(org.picoextras.gui.model.Foo.class));
+ ComponentNode needsFooNode = new ComponentNode(new BeanPropertyModel(NeedsFoo.class));
+
+ parentContainerNode.add(fooNode);
+ childContainerNode.add(needsFooNode);
+
+ PicoContainer container = childContainerNode.createPicoContainer();
+ assertNotNull(container.getComponentInstance(NeedsFoo.class));
+ }
+
+ public void testPropertiesAreSetOnComponents() throws IntrospectionException {
+// ContainerNode containerNode = new ContainerNode();
+// ComponentNode fooNode = new ComponentNode(new BeanPropertyModel(Foo.class));
+// containerNode.add(fooNode);
+//
+// PicoContainer container = containerNode.createPicoContainer();
+// Foo foo = (Foo) container.getComponentInstance(Foo.class);
+// assertEquals("hello", foo.getBar());
+ }
+
+}

----------

nano /picogui /src /test /org /picoextras /gui /model

ComponentRegistrarTestCase.java 1.1 -> 1.2

diff -u -r1.1 -r1.2
--- ComponentRegistrarTestCase.java 17 Nov 2003 21:03:50 -0000 1.1
+++ ComponentRegistrarTestCase.java 17 Nov 2003 23:31:14 -0000 1.2
@@ -10,9 +10,10 @@

/**
* @author Aslak Helles&oslash;y

- * @version $Revision: 1.1 $

+ * @version $Revision: 1.2 $

*/
public class ComponentRegistrarTestCase extends TestCase {

+

public void testCreateComponentNode() throws IntrospectionException {
ContainerNode containerNode = new ContainerNode();
DefaultTreeModel treeModel = new DefaultTreeModel(containerNode);

----------

nano /picogui /src /test /org /picoextras /gui /model

EditContainerPanelTestCase.java 1.1 -> 1.2

diff -u -r1.1 -r1.2
--- EditContainerPanelTestCase.java 17 Nov 2003 21:03:50 -0000 1.1
+++ EditContainerPanelTestCase.java 17 Nov 2003 23:31:14 -0000 1.2
@@ -4,11 +4,10 @@

import org.picoextras.gui.swing.EditContainerPanel;

import javax.swing.*;

-import javax.swing.tree.TreePath;

/**
* @author Aslak Helles&oslash;y

- * @version $Revision: 1.1 $

+ * @version $Revision: 1.2 $

*/
public class EditContainerPanelTestCase extends TestCase {
private JTree tree;

----------

nano /picogui /src /java /org /picoextras /gui /model

ContainerNodeTestCase.java removed after 1.1

diff -N ContainerNodeTestCase.java
--- ContainerNodeTestCase.java 17 Nov 2003 21:03:00 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,60 +0,0 @@

-package org.picoextras.gui.model;
-
-import junit.framework.TestCase;
-import org.picocontainer.PicoContainer;
-
-import java.util.ArrayList;
-import java.beans.IntrospectionException;
-
-/**
- * @author Aslak Helles&oslash;y
- * @version $Revision: 1.1 $
- */
-public class ContainerNodeTestCase extends TestCase {
-
- public void testEmptyContainerNodeCreatesEmptyContainer() {
- ContainerNode containerNode = new ContainerNode();
- PicoContainer container = containerNode.createPicoContainer();
- assertEquals(0, container.getComponentKeys().size());
- }
-
- public void testContainerNodeWithChildrenCreatesContainerWithComponents() throws IntrospectionException {
- ContainerNode containerNode = new ContainerNode();
-
- ComponentNode stringNode = new ComponentNode(new BeanPropertyModel(String.class));
- ComponentNode listNode = new ComponentNode(new BeanPropertyModel(ArrayList.class));
-
- containerNode.add(stringNode);
- containerNode.add(listNode);
-
- PicoContainer container = containerNode.createPicoContainer();
- assertEquals("", container.getComponentInstance(String.class));
- assertEquals(new ArrayList(), container.getComponentInstance(ArrayList.class));
- }
-
- public void testChildContainerNodeCreatesHierarchicalContainer() throws IntrospectionException {
- ContainerNode parentContainerNode = new ContainerNode();
- ContainerNode childContainerNode = new ContainerNode();
- parentContainerNode.add(childContainerNode);
-
- ComponentNode fooNode = new ComponentNode(new BeanPropertyModel(Foo.class));
- ComponentNode needsFooNode = new ComponentNode(new BeanPropertyModel(NeedsFoo.class));
-
- parentContainerNode.add(fooNode);
- childContainerNode.add(needsFooNode);
-
- PicoContainer container = childContainerNode.createPicoContainer();
- assertNotNull(container.getComponentInstance(NeedsFoo.class));
- }
-
- public void testPropertiesAreSetOnComponents() throws IntrospectionException {
-// ContainerNode containerNode = new ContainerNode();
-// ComponentNode fooNode = new ComponentNode(new BeanPropertyModel(Foo.class));
-// containerNode.add(fooNode);
-//
-// PicoContainer container = containerNode.createPicoContainer();
-// Foo foo = (Foo) container.getComponentInstance(Foo.class);
-// assertEquals("hello", foo.getBar());
- }
-
-}

----------

nano /picogui /src /test /org /picocontainer /gui /model

ComponentRegistrarTestCase.java removed after 1.1

diff -N ComponentRegistrarTestCase.java
--- ComponentRegistrarTestCase.java 11 Sep 2003 19:17:16 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,45 +0,0 @@

-package org.picocontainer.gui.model;
-
-import junit.framework.TestCase;
-
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.*;
-import java.beans.IntrospectionException;
-
-import org.picocontainer.gui.swing.ComponentRegistrar;
-
-/**
- * @author Aslak Helles&oslash;y
- * @version $Revision: 1.1 $
- */
-public class ComponentRegistrarTestCase extends TestCase {
- public void testCreateComponentNode() throws IntrospectionException {
- ContainerNode containerNode = new ContainerNode();
- DefaultTreeModel treeModel = new DefaultTreeModel(containerNode);
- ComponentRegistrar componentRegistrar = new ComponentRegistrar(treeModel, null);
-
- componentRegistrar.createComponentNodeInTree(containerNode, "somekey", String.class);
- ComponentNode componentNode = (ComponentNode) containerNode.getChildAt(0);
- BeanPropertyModel beanPropertyModel = (BeanPropertyModel) componentNode.getUserObject();
- assertEquals(String.class, beanPropertyModel.getBeanClass());
- }
-
- public void testDisplayComponentNode() throws IntrospectionException {
- ContainerNode containerNode = new ContainerNode();
- DefaultTreeModel treeModel = new DefaultTreeModel(containerNode);
-
- JTable table = new JTable();
-
- ComponentRegistrar componentRegistrar = new ComponentRegistrar(treeModel, table);
-
- componentRegistrar.createComponentNodeInTree(containerNode, "somekey", String.class);
- ComponentNode componentNode = (ComponentNode) containerNode.getChildAt(0);
- BeanPropertyModel beanPropertyModel = (BeanPropertyModel) componentNode.getUserObject();
-
- componentRegistrar.displayInPropertyTable(beanPropertyModel);
- BeanPropertyTableModel beanPropertyTableModel = (BeanPropertyTableModel) table.getModel();
-
- assertSame(beanPropertyModel, beanPropertyTableModel.getBeanPropertyModel());
- }
-
-}

----------

nano /picogui /src /test /org /picocontainer /gui /model

ContainerNodeTestCase.java removed after 1.4

diff -N ContainerNodeTestCase.java
--- ContainerNodeTestCase.java 16 Sep 2003 08:45:50 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,60 +0,0 @@

-package org.picocontainer.gui.model;
-
-import junit.framework.TestCase;
-import org.picocontainer.PicoContainer;
-
-import java.util.ArrayList;
-import java.beans.IntrospectionException;
-
-/**
- * @author Aslak Helles&oslash;y
- * @version $Revision: 1.4 $
- */
-public class ContainerNodeTestCase extends TestCase {
-
- public void testEmptyContainerNodeCreatesEmptyContainer() {
- ContainerNode containerNode = new ContainerNode();
- PicoContainer container = containerNode.createPicoContainer();
- assertEquals(0, container.getComponentKeys().size());
- }
-
- public void testContainerNodeWithChildrenCreatesContainerWithComponents() throws IntrospectionException {
- ContainerNode containerNode = new ContainerNode();
-
- ComponentNode stringNode = new ComponentNode(new BeanPropertyModel(String.class));
- ComponentNode listNode = new ComponentNode(new BeanPropertyModel(ArrayList.class));
-
- containerNode.add(stringNode);
- containerNode.add(listNode);
-
- PicoContainer container = containerNode.createPicoContainer();
- assertEquals("", container.getComponentInstance(String.class));
- assertEquals(new ArrayList(), container.getComponentInstance(ArrayList.class));
- }
-
- public void testChildContainerNodeCreatesHierarchicalContainer() throws IntrospectionException {
- ContainerNode parentContainerNode = new ContainerNode();
- ContainerNode childContainerNode = new ContainerNode();
- parentContainerNode.add(childContainerNode);
-
- ComponentNode fooNode = new ComponentNode(new BeanPropertyModel(Foo.class));
- ComponentNode needsFooNode = new ComponentNode(new BeanPropertyModel(NeedsFoo.class));
-
- parentContainerNode.add(fooNode);
- childContainerNode.add(needsFooNode);
-
- PicoContainer container = childContainerNode.createPicoContainer();
- assertNotNull(container.getComponentInstance(NeedsFoo.class));
- }
-
- public void testPropertiesAreSetOnComponents() throws IntrospectionException {
-// ContainerNode containerNode = new ContainerNode();
-// ComponentNode fooNode = new ComponentNode(new BeanPropertyModel(Foo.class));
-// containerNode.add(fooNode);
-//
-// PicoContainer container = containerNode.createPicoContainer();
-// Foo foo = (Foo) container.getComponentInstance(Foo.class);
-// assertEquals("hello", foo.getBar());
- }
-
-}

----------

nano /picogui /src /test /org /picocontainer /gui /model

EditContainerPanelTestCase.java removed after 1.5

diff -N EditContainerPanelTestCase.java
--- EditContainerPanelTestCase.java 16 Sep 2003 08:45:50 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,85 +0,0 @@

-package org.picocontainer.gui.model;
-
-import junit.framework.TestCase;
-import org.picocontainer.gui.swing.EditContainerPanel;
-
-import javax.swing.*;
-import javax.swing.tree.TreePath;
-
-/**
- * @author Aslak Helles&oslash;y
- * @version $Revision: 1.5 $
- */
-public class EditContainerPanelTestCase extends TestCase {
- private JTree tree;
- private EditContainerPanel panel;
- private ContainerNode root;
-
-// protected void setUp() {
-// root = new ContainerNode();
-// tree = new JTree(root);
-// panel = new EditContainerPanel(tree);
-// }
-//
-// public void testRegisterComponent() {
-// tree.setSelectionPath(new TreePath(root.getPath()));
-//
-// JTextField componentField = panel.getComponentField();
-// componentField.setText(Foo.class.getName());
-//
-// panel.addPicoComponent();
-//
-// assertEquals(1, root.getChildCount());
-// }
-//
-// public void testUnregisterComponent() {
-// testRegisterComponent();
-// ComponentNode fooNode = (ComponentNode) root.getChildAt(0);
-// tree.setSelectionPath(new TreePath(fooNode.getPath()));
-//
-// panel.removeSelected();
-//
-// assertEquals(0, root.getChildCount());
-// }
-//
-// public void testAddContainer() {
-// tree.setSelectionPath(new TreePath(root.getPath()));
-// panel.addPicoContainer();
-// assertEquals(1, root.getChildCount());
-// }
-//
-// public void testRemoveContainer() {
-// testAddContainer();
-// ContainerNode fooNode = (ContainerNode) root.getChildAt(0);
-// tree.setSelectionPath(new TreePath(fooNode.getPath()));
-//
-// panel.removeSelected();
-//
-// assertEquals(0, root.getChildCount());
-// }
-//
-//
-// public void testExecuteContainer() {
-// tree.setSelectionPath(new TreePath(root.getPath()));
-// JTextField componentField = panel.getComponentField();
-//
-// // Make a Foo in the root
-////// componentField.setText(ContainerNodeTestCase.Foo.class.getName());
-// panel.addPicoComponent();
-//
-// // Make a Bar in a child
-// panel.addPicoContainer();
-////// componentField.setText(ContainerNodeTestCase.Bar.class.getName());
-// panel.addPicoComponent();
-//
-// ContainerNode childRegNode = (ContainerNode) root.getChildAt(1);
-// tree.setSelectionPath(new TreePath(childRegNode.getPath()));
-//
-// panel.executeSelected();
-// }
-//
- public void testIt() {
-
- }
-
-}

----------

nano /picogui /src /test /org /picocontainer /gui /model

Foo.java removed after 1.2

diff -N Foo.java
--- Foo.java 11 Sep 2003 14:05:24 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@

-package org.picocontainer.gui.model;
-
-/**
- * @author Aslak Helles&oslash;y
- * @version $Revision: 1.2 $
- */
-public class Foo {
- private String bar;
-
- public String getBar() {
- return bar;
- }
-
- public void setBar(String bar) {
- this.bar = bar;
- }
-}

----------

nano /picogui /src /test /org /picocontainer /gui /model

NeedsFoo.java removed after 1.1

diff -N NeedsFoo.java
--- NeedsFoo.java 10 Sep 2003 22:05:47 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@

-package org.picocontainer.gui.model;
-
-/**
- * @author Aslak Helles&oslash;y
- * @version $Revision: 1.1 $
- */
-public class NeedsFoo {
- public NeedsFoo(Foo foo) {
- }
-}

----------

nano /picogui /src /test /org /picocontainer /gui /swing

BeanPropertyTableModelTestCase.java removed after 1.4

diff -N BeanPropertyTableModelTestCase.java
--- BeanPropertyTableModelTestCase.java 16 Sep 2003 08:45:50 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,63 +0,0 @@

-package org.picocontainer.gui.swing;
-
-import junit.framework.TestCase;
-import java.beans.IntrospectionException;
-import org.picocontainer.gui.model.BeanPropertyTableModel;
-import org.picocontainer.extras.BeanPropertyComponentAdapterFactory;
-import org.picocontainer.defaults.DefaultComponentAdapterFactory;
-import org.picocontainer.PicoIntrospectionException;
-
-/**
- * @author Aslak Helles&oslash;y
- * @version $Revision: 1.4 $
- */
-public class BeanPropertyTableModelTestCase extends TestCase {
- private BeanPropertyTableModel model;
-
- public static class Man {
- public String birth;
- public String haircolour;
- public String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getBirth() {
- return birth;
- }
-
- public void setBirth(String birth) {
- this.birth = birth;
- }
-
- public String getHaircolour() {
- return haircolour;
- }
-
- public void setHaircolour(String haircolour) {
- this.haircolour = haircolour;
- }
- }
-
- protected void setUp() throws PicoIntrospectionException {
- BeanPropertyComponentAdapterFactory factory = new BeanPropertyComponentAdapterFactory(
- new DefaultComponentAdapterFactory()
- );
-// BeanPropertyComponentAdapterFactory.Adapter adapter =
-// (BeanPropertyComponentAdapterFactory.Adapter) factory.createComponentAdapter("whatever", Man.class, null);
-// model = new BeanPropertyTableModel(adapter);
- }
-
- public void testRows() throws IntrospectionException {
-// assertEquals(4, model.getRowCount());
-//
-// // they are automatically alphabetically sorted, and there is class too
-// assertEquals("name", model.getValueAt(3,0));
- }
-
-}

----------

nano /picogui /src /test /org /picocontainer /gui /swing

PropertyTableCommanderTest.java removed after 1.3

diff -N PropertyTableCommanderTest.java
--- PropertyTableCommanderTest.java 11 Sep 2003 19:17:16 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@

-package org.picocontainer.gui.swing;
-
-import junit.framework.TestCase;
-
-import javax.swing.*;
-import javax.swing.table.TableModel;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreePath;
-import javax.swing.tree.DefaultTreeModel;
-
-import org.picocontainer.gui.model.ComponentNode;
-import org.picocontainer.gui.model.BeanPropertyTableModel;
-
-/**
- * @author Aslak Helles&oslash;y
- * @version $Revision: 1.3 $
- */
-public class PropertyTableCommanderTest extends TestCase {
-
- public void testTreeSelectionUpdatesTable() {
-// JTree tree = new JTree();
-// TableModel defaultModel = new DefaultTableModel();
-// JTable table = new JTable(defaultModel);
-//
-// PropertyTableCommander propertyTableCommander = new PropertyTableCommander(tree, table);
-//
-// DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel();
-// treeModel.setRoot(new ComponentNode(BeanPropertyTableModelTestCase.Man.class));
-//
-// tree.setSelectionPath(new TreePath(treeModel.getRoot()));
-// BeanPropertyTableModel model = (BeanPropertyTableModel) table.getModel();
-//
-// assertEquals("birth", model.getValueAt(0,0));
- }
-}

----------

nano /picogui /src /test /org /picocontainer /gui /swing

PropertyTableCommanderTestCase.java removed after 1.4

diff -N PropertyTableCommanderTestCase.java
--- PropertyTableCommanderTestCase.java 16 Sep 2003 08:45:50 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,37 +0,0 @@

-package org.picocontainer.gui.swing;
-
-import junit.framework.TestCase;
-
-import javax.swing.*;
-import javax.swing.table.TableModel;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreePath;
-import javax.swing.tree.DefaultTreeModel;
-
-import org.picocontainer.gui.model.ComponentNode;
-import org.picocontainer.gui.model.BeanPropertyTableModel;
-import org.picocontainer.defaults.DefaultComponentAdapter;
-
-/**
- * @author Aslak Helles&oslash;y
- * @version $Revision: 1.4 $
- */
-public class PropertyTableCommanderTestCase extends TestCase {
-
- public void testTreeSelectionUpdatesTable() {
-// JTree tree = new JTree();
-// TableModel defaultModel = new DefaultTableModel();
-// JTable table = new JTable(defaultModel);
-//
-// PropertyTableCommander propertyTableCommander = new PropertyTableCommander(tree, null);
-//
-// DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel();
-//// treeModel.setRoot(new ComponentNode(new DefaultComponentAdapter("abc", BeanPropertyTableModelTestCase.Man.class)));
-//
-// tree.setSelectionPath(new TreePath(treeModel.getRoot()));
-// BeanPropertyTableModel model = (BeanPropertyTableModel) table.getModel();
-//
-// assertEquals("birth", model.getValueAt(0,0));
- }
-}