aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/test/java.beans
diff options
context:
space:
mode:
authorMark Wielaard <mark@gcc.gnu.org>2006-05-18 17:29:21 +0000
committerMark Wielaard <mark@gcc.gnu.org>2006-05-18 17:29:21 +0000
commit4f9533c7722fa07511a94d005227961f4a4dec23 (patch)
tree9f9c470de62ee62fba1331a396450d728d2b1fad /libjava/classpath/test/java.beans
parenteaec4980e139903ae9b274d1abcf3a13946603a8 (diff)
downloadgcc-4f9533c7722fa07511a94d005227961f4a4dec23.zip
gcc-4f9533c7722fa07511a94d005227961f4a4dec23.tar.gz
gcc-4f9533c7722fa07511a94d005227961f4a4dec23.tar.bz2
Imported GNU Classpath 0.90
Imported GNU Classpath 0.90 * scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. From-SVN: r113887
Diffstat (limited to 'libjava/classpath/test/java.beans')
-rw-r--r--libjava/classpath/test/java.beans/DescriptorTest.java48
-rw-r--r--libjava/classpath/test/java.beans/IntrospectorTest.java97
-rw-r--r--libjava/classpath/test/java.beans/PropertyChangeSupportTest.java200
3 files changed, 0 insertions, 345 deletions
diff --git a/libjava/classpath/test/java.beans/DescriptorTest.java b/libjava/classpath/test/java.beans/DescriptorTest.java
deleted file mode 100644
index 31d2bd0..0000000
--- a/libjava/classpath/test/java.beans/DescriptorTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-import java.beans.*;
-
-public class DescriptorTest implements Runnable {
- public static void main(String[] args) {
- new DescriptorTest().run();
- }
-
- interface TestClass {
- public String[] getTest();
- public void setTest(String[] test);
- public String getTest(int i);
- public void setTest(int i, String name);
- }
-
- public void run() {
- try {
- new PropertyDescriptor("class",java.lang.Object.class);
- System.out.println("PASSED: Property Object.class");
- } catch(IntrospectionException e) {
- System.out.println("FAILED: Property Object.class");
- e.printStackTrace();
- }
-
- try {
- new IndexedPropertyDescriptor("test",TestClass.class);
- System.out.println("PASSED: Indexed Property Component.location");
- } catch(IntrospectionException e) {
- System.out.println("FAILED: Indexed Property Component.location");
- e.printStackTrace();
- }
-
- try {
- new EventSetDescriptor(java.awt.Button.class,"action",java.awt.event.ActionListener.class,"actionPerformed");
- System.out.println("PASSED: Event Set Button.action");
- } catch(IntrospectionException e) {
- System.out.println("FAILED: Event Set Button.action");
- e.printStackTrace();
- }
-
- try {
- new MethodDescriptor(java.awt.Component.class.getMethod("getLocation",new Class[0]));
- System.out.println("PASSED: Method Component.getLocation");
- } catch(NoSuchMethodException e) {
- System.out.println("FAILED: No such method: Component.getLocation()");
- e.printStackTrace();
- }
- }
-} \ No newline at end of file
diff --git a/libjava/classpath/test/java.beans/IntrospectorTest.java b/libjava/classpath/test/java.beans/IntrospectorTest.java
deleted file mode 100644
index d786382..0000000
--- a/libjava/classpath/test/java.beans/IntrospectorTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-import java.beans.*;
-
-public class IntrospectorTest {
- public static void main(String[] args) {
- try {
- BeanInfo b = Introspector.getBeanInfo(java.awt.Component.class);
- if(b.getPropertyDescriptors().length == 6
- && b.getEventSetDescriptors().length == 5
- && b.getMethodDescriptors().length == 128) {
- System.out.println("PASSED: Introspector.getBeanInfo(java.awt.Component.class)");
- } else {
- System.out.println("FAILED: Introspector.getBeanInfo(java.awt.Component.class)");
- }
- b = Introspector.getBeanInfo(java.util.BitSet.class);
- if(b.getPropertyDescriptors().length == 2
- && b.getEventSetDescriptors().length == 0
- && b.getMethodDescriptors().length == 17) {
- System.out.println("PASSED: Introspector.getBeanInfo(java.util.BitSet.class)");
- } else {
- System.out.println("FAILED: Introspector.getBeanInfo(java.util.BitSet.class)");
- }
- b = Introspector.getBeanInfo(java.lang.Object.class);
- if(b.getPropertyDescriptors().length == 1
- && b.getEventSetDescriptors().length == 0
- && b.getMethodDescriptors().length == 9) {
- System.out.println("PASSED: Introspector.getBeanInfo(java.lang.Object.class)");
- } else {
- System.out.println("FAILED: Introspector.getBeanInfo(java.lang.Object.class)");
- }
- b = Introspector.getBeanInfo(java.applet.Applet.class);
- if(b.getPropertyDescriptors().length == 24
- && b.getEventSetDescriptors().length == 6
- && b.getMethodDescriptors().length == 168) {
- System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class)");
- } else {
- System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class)");
- }
- b = Introspector.getBeanInfo(java.awt.Button.class);
- if(b.getPropertyDescriptors().length == 8
- && b.getEventSetDescriptors().length == 6
- && b.getMethodDescriptors().length == 134) {
- System.out.println("PASSED: Introspector.getBeanInfo(java.awt.Button.class)");
- } else {
- System.out.println("FAILED: Introspector.getBeanInfo(java.awt.Button.class)");
- }
- b = Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Panel.class);
- if(b.getPropertyDescriptors().length == 8
- && b.getEventSetDescriptors().length == 0
- && b.getMethodDescriptors().length == 22) {
- System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Panel.class)");
- } else {
- System.out.println(b.getPropertyDescriptors().length + " " + b.getEventSetDescriptors().length + " " + b.getMethodDescriptors().length);
- System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Panel.class)");
- }
- b = Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Component.class);
- if(b.getPropertyDescriptors().length == 18
- && b.getEventSetDescriptors().length == 1
- && b.getMethodDescriptors().length == 65) {
- System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Component.class)");
- } else {
- System.out.println(b.getPropertyDescriptors().length + " " + b.getEventSetDescriptors().length + " " + b.getMethodDescriptors().length);
- System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class,java.awt.Component.class)");
- }
- b = Introspector.getBeanInfo(java.applet.Applet.class,java.lang.Object.class);
- if(b.getPropertyDescriptors().length == 24
- && b.getEventSetDescriptors().length == 6
- && b.getMethodDescriptors().length == 160) {
- System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class,java.lang.Object.class)");
- } else {
- System.out.println(b.getPropertyDescriptors().length + " " + b.getEventSetDescriptors().length + " " + b.getMethodDescriptors().length);
- System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class,java.lang.Object.class)");
- }
-
- b = Introspector.getBeanInfo(java.applet.Applet.class,null);
- if(b.getPropertyDescriptors().length == 24
- && b.getEventSetDescriptors().length == 6
- && b.getMethodDescriptors().length == 168) {
- System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class,java.lang.Object.class)");
- } else {
- System.out.println(b.getPropertyDescriptors().length + " " + b.getEventSetDescriptors().length + " " + b.getMethodDescriptors().length);
- System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class,null)");
- }
-
- b = Introspector.getBeanInfo(java.applet.Applet.class);
- if(b.getPropertyDescriptors().length == 24
- && b.getEventSetDescriptors().length == 6
- && b.getMethodDescriptors().length == 168) {
- System.out.println("PASSED: Introspector.getBeanInfo(java.applet.Applet.class) 2nd time");
- } else {
- System.out.println("FAILED: Introspector.getBeanInfo(java.applet.Applet.class) 2nd time");
- }
- } catch(IntrospectionException e) {
- System.out.println("FAILED: IntrospectionException");
- e.printStackTrace();
- }
- }
-}
diff --git a/libjava/classpath/test/java.beans/PropertyChangeSupportTest.java b/libjava/classpath/test/java.beans/PropertyChangeSupportTest.java
deleted file mode 100644
index 8db2af0..0000000
--- a/libjava/classpath/test/java.beans/PropertyChangeSupportTest.java
+++ /dev/null
@@ -1,200 +0,0 @@
-import java.beans.PropertyChangeSupport;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeEvent;
-import java.util.Hashtable;
-
-public class PropertyChangeSupportTest implements Runnable {
- class Source {
- PropertyChangeSupport support = new PropertyChangeSupport(this);
- public void addPropertyChangeListener(PropertyChangeListener l) {
- support.addPropertyChangeListener(l);
- }
- public void addPropertyChangeListener(String s, PropertyChangeListener l) {
- support.addPropertyChangeListener(s,l);
- }
- public void removePropertyChangeListener(PropertyChangeListener l) {
- support.removePropertyChangeListener(l);
- }
- public void removePropertyChangeListener(String s, PropertyChangeListener l) {
- support.removePropertyChangeListener(s,l);
- }
-
- void changeProperty(String name) {
- support.firePropertyChange(name,"old","new");
-
- }
- }
-
- class Listener implements PropertyChangeListener {
- Hashtable numEventsReceived = new Hashtable();
- int getNumEvents(String propertyName) {
- Integer i = (Integer)numEventsReceived.get(propertyName);
- try {
- return i.intValue();
- } catch(NullPointerException e) {
- return 0;
- }
- }
-
- public void propertyChange(PropertyChangeEvent e) {
- Integer i = (Integer)numEventsReceived.get(e.getPropertyName());
- try {
- int newI = i.intValue() + 1;
- numEventsReceived.put(e.getPropertyName(), new Integer(newI));
- } catch(NullPointerException exc) {
- numEventsReceived.put(e.getPropertyName(), new Integer(1));
- }
- }
-
- public void reset() {
- numEventsReceived = new Hashtable();
- }
- }
-
- public void setProperties(Source s) {
- s.changeProperty("foo");
- s.changeProperty("foo");
- s.changeProperty("foo");
- s.changeProperty("bar");
- s.changeProperty("bar");
- s.changeProperty("foobar");
- }
-
- public void shouldEqual(Listener l, int foo, int bar, int foobar, String testName) {
- String whatsWrong = "";
- if(l.getNumEvents("foo") != foo) {
- whatsWrong += ("foo(" + l.getNumEvents("foo") + ") != " + foo);
- }
- if(l.getNumEvents("bar") != bar) {
- whatsWrong += (" bar(" + l.getNumEvents("bar") + ") != " + bar);
- }
- if(l.getNumEvents("foobar") != foobar) {
- whatsWrong += (" foobar(" + l.getNumEvents("foobar") + ") != " + foobar);
- }
-
- if(!whatsWrong.equals("")) {
- System.out.println("FAILURE: " + testName + ": " + whatsWrong);
- } else {
- System.out.println("Success: " + testName);
- }
- }
-
- public void run() {
- Source s = new Source();
-
- /* Test: single multi-property adds */
- Listener l = new Listener();
- s.addPropertyChangeListener(l);
- setProperties(s);
- shouldEqual(l, 3, 2, 1, "single multi-property adds");
-
- /* Test: multiple listeners */
- Listener l2 = new Listener();
- s.addPropertyChangeListener(l2);
- setProperties(s);
- shouldEqual(l, 6, 4, 2, "multiple listeners-l");
- shouldEqual(l2, 3, 2, 1, "multiple listeners-l2");
-
- /* Test: multiple multi-property adds */
- s.addPropertyChangeListener(l);
- setProperties(s);
- shouldEqual(l, 12, 8, 4, "multiple multi-property adds-l");
- shouldEqual(l2, 6, 4, 2, "multiple multi-property adds-l2");
-
- /* Test: remove multi-property add */
- s.removePropertyChangeListener(l);
- setProperties(s);
- shouldEqual(l, 15, 10, 5, "remove multi-property add-l");
- shouldEqual(l2, 9, 6, 3, "remove multi-property add-l2");
-
-
- s.removePropertyChangeListener(l);
- s.removePropertyChangeListener(l2);
- l.reset();
- l2.reset();
-
- /* ENABLE THIS IF YOU THINK RESET ISN'T HAPPENING
- shouldEqual(l, 0, 0, 0, "RESET-l");
- shouldEqual(l2, 0, 0, 0, "RESET-l2");
- setProperties(s);
- shouldEqual(l, 0, 0, 0, "RESET_AGAIN-l");
- shouldEqual(l2, 0, 0, 0, "RESET_AGAIN-l2");
- */
-
-
- /* Test: single property listener */
- s.addPropertyChangeListener("foo", l);
- setProperties(s);
- shouldEqual(l, 3, 0, 0, "single property listener");
-
- /* Test: multiple different properties */
- s.addPropertyChangeListener("bar", l);
- setProperties(s);
- shouldEqual(l, 6, 2, 0, "multiple different properties");
-
- /* Test: multiple of same property */
- s.addPropertyChangeListener("foo", l);
- setProperties(s);
- shouldEqual(l, 12, 4, 0, "multiple of same property");
-
- /* Test: multiple single-property listeners */
- s.addPropertyChangeListener("foo", l2);
- setProperties(s);
- shouldEqual(l, 18, 6, 0, "multiple single-property listeners-l");
- shouldEqual(l2, 3, 0, 0, "multiple single-property listeners-l2");
-
- /* Test: remove single-property add */
- s.removePropertyChangeListener("foo", l);
- setProperties(s);
- shouldEqual(l, 21, 8, 0, "remove single-property add-l");
- shouldEqual(l2, 6, 0, 0, "remove single-property add-l2");
-
-
- s.removePropertyChangeListener("foo", l);
- s.removePropertyChangeListener("bar", l);
- s.removePropertyChangeListener("foo", l2);
- l.reset();
- l2.reset();
-
- /* ENABLE THIS IF YOU THINK RESET ISN'T HAPPENING
- shouldEqual(l, 0, 0, 0, "RESET-l");
- shouldEqual(l2, 0, 0, 0, "RESET-l2");
- setProperties(s);
- shouldEqual(l, 0, 0, 0, "RESET_AGAIN-l");
- shouldEqual(l2, 0, 0, 0, "RESET_AGAIN-l2");
- */
-
- /* Test: multiple- and single-property interaction */
- s.addPropertyChangeListener(l);
- s.addPropertyChangeListener("foo", l);
- setProperties(s);
- shouldEqual(l, 6, 2, 1, "multiple- and single-property interaction");
-
- /* Test: multiple- and single-property interaction: multiple-listener removal */
- s.removePropertyChangeListener(l);
- setProperties(s);
- shouldEqual(l, 9, 2, 1, "multiple- and single-property interaction: multiple-listener removal");
-
- /* Test: hasListeners() with multiple cases */
- if(s.support.hasListeners("foo")) {
- System.out.println("Success: hasListeners() returning true");
- } else {
- System.out.println("FAILURE: hasListeners() returning true");
- }
- if(s.support.hasListeners("bar")) {
- System.out.println("FAILURE: hasListeners() returning false");
- } else {
- System.out.println("Success: hasListeners() returning false");
- }
- s.addPropertyChangeListener(l);
- if(s.support.hasListeners("bar")) {
- System.out.println("Success: hasListeners() with all-event listeners");
- } else {
- System.out.println("FAILURE: hasListeners() with all-event listeners");
- }
- }
-
- public static void main(String[] args) {
- new PropertyChangeSupportTest().run();
- }
-} \ No newline at end of file