You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2006/03/20 17:31:33 UTC
svn commit: r387239 [14/21] - in
/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math: ./
Harmony/ doc/ doc/images/ make/ src/ src/common/ src/common/javasrc/
src/common/javasrc/java/ src/common/javasrc/java/applet/
src/common/javasrc/ja...
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/ExpressionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/ExpressionTest.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/ExpressionTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/ExpressionTest.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+package java.beans;
+
+import java.beans.Expression;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import java.beans.auxiliary.SampleBean;
+
+/**
+ * The test checks the class java.beans.Expression
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+
+public class ExpressionTest extends TestCase {
+
+ private static int testId = -1;
+
+ /**
+ *
+ */
+ public ExpressionTest() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public ExpressionTest(String name) {
+ super(name);
+ }
+
+ /**
+ * The test checks the correct constructor is initialized
+ */
+ public void testConstructor() {
+ Expression expr = new Expression(SampleBean.class, "new",
+ new Object[] { "hello" });
+ try {
+ Object result = expr.getValue();
+ if(result != null && result instanceof SampleBean) {
+ SampleBean bean = (SampleBean) result;
+ assertEquals("hello", bean.getText());
+ } else {
+ fail("Cannot instantialte an instance of Bean class.");
+ }
+ } catch (Exception e) {
+ System.out.println(e.getClass() + ": " + e.getMessage());
+ fail("Exception is thrown while trying to invoke new Bean(String)");
+ }
+ }
+
+ /**
+ * The test checks the correct static method is initialized
+ */
+ public void testStatic() {
+ SampleBean theBean = new SampleBean();
+ Expression expr = new Expression(SampleBean.class, "create",
+ new Object[] { "hello", theBean });
+ try {
+ Object result = expr.getValue();
+ if(result != null && result instanceof SampleBean) {
+ SampleBean bean = (SampleBean) result;
+ assertEquals("hello", bean.getText());
+ assertEquals(theBean, bean.getObject());
+ } else {
+ fail("Cannot instantialte an instance of Bean class by "
+ + "static method.");
+ }
+ } catch (Exception e) {
+ System.out.println(e.getClass() + ": " + e.getMessage());
+ fail("Exception is thrown while trying to invoke "
+ + "SampleBean.create(String, SampleBean)");
+ }
+ }
+
+ /**
+ * The test checks the correct getter is initialized
+ */
+ public void testGetter() {
+ Expression expr = new Expression(new SampleBean("hello"), "getText",
+ new Object[] {});
+ try {
+ Object result = expr.getValue();
+ if(result != null && result instanceof String) {
+ assertEquals("hello", result);
+ } else {
+ fail("Result of SampleBean.getText() call is not "
+ + "of String type.");
+ }
+ } catch (Exception e) {
+ System.out.println(e.getClass() + ": " + e.getMessage());
+ fail("Exception is thrown while trying to invoke "
+ + "SampleBean.getText()");
+ }
+ }
+
+ /**
+ * The test checks the correct array getter is initialized
+ */
+ public void testArrayGetter() {
+ int[] a = {1, 2, 3};
+ Expression expr = new Expression(a, "get",
+ new Object[] { new Integer(1) });
+ try {
+ Object result = expr.getValue();
+ if(result != null && result instanceof Integer) {
+ assertEquals(new Integer(2), result);
+ } else {
+ fail("Result of array getter is not of Integer type.");
+ }
+ } catch (Exception e) {
+ System.out.println(e.getClass() + ": " + e.getMessage());
+ fail("Exception is thrown while trying to invoke get element "
+ + "from array");
+ }
+ }
+
+ /**
+ *
+ */
+ public static Test suite() {
+ return new TestSuite(ExpressionTest.class);
+ }
+
+ /**
+ *
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/IntrospectorTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/IntrospectorTest.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/IntrospectorTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/IntrospectorTest.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,285 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.14.6.3 $
+ */
+package java.beans;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import java.beans.Introspector;
+import java.beans.auxiliary.ChildBean;
+import java.beans.auxiliary.GrannyBean;
+import java.beans.auxiliary.MisprintBean;
+import java.beans.auxiliary.OtherBean;
+import java.beans.auxiliary.SampleBean;
+import java.beans.auxiliary.StandardBean2;
+import java.lang.reflect.Method;
+import java.util.TooManyListenersException;
+
+/**
+ * The test checks the class java.beans.Introspector
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.14.6.3 $
+ */
+
+public class IntrospectorTest extends TestCase {
+
+ /**
+ *
+ */
+ public IntrospectorTest() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public IntrospectorTest(String name) {
+ super(name);
+ }
+
+ /**
+ * The test checks the constructor is private
+ */
+ public void testIntrospectorConstructor() {
+ try {
+ Class.forName("java.beans.Introspector").newInstance();
+ fail("No exception is thrown on new Introspector() call");
+ } catch (Exception e) {}
+ }
+
+ /**
+ * The test checks the getBeanDescriptor method
+ */
+ public void testBeanDescriptor() {
+ String[] oldBeanInfoSearchPath = Introspector.getBeanInfoSearchPath();
+ try {
+ Introspector.setBeanInfoSearchPath(
+ new String[] { "java.beans.infos" } );
+ BeanInfo info = Introspector.getBeanInfo(SampleBean.class);
+ assertNotNull(info);
+ BeanDescriptor descriptor = info.getBeanDescriptor();
+ assertNotNull(descriptor);
+ assertEquals(SampleBean.class, descriptor.getBeanClass());
+ } catch (Exception e) {
+ fail("Cannot extract bean info from SampleBean class");
+ } finally {
+ Introspector.setBeanInfoSearchPath(oldBeanInfoSearchPath);
+ }
+ }
+
+ /**
+ * The test checks the getMethodDescriptor method
+ */
+ public void testNonUniqueByNameMethodDescriptors() {
+ try {
+ BeanInfo info = Introspector.getBeanInfo(ChildBean.class);
+ assertNotNull(info);
+ MethodDescriptor[] mds = info.getMethodDescriptors();
+ assertNotNull(mds);
+ assertEquals(11, mds.length);
+ assertEquals("wait", mds[8].getName());
+ assertEquals("wait", mds[9].getName());
+ assertEquals("wait", mds[10].getName());
+ } catch (Exception e) {
+ fail("Cannot extract bean info from ChildBean class: "
+ + e.getClass());
+ }
+ }
+
+ /**
+ * The test checks the getEventSetDescriptors method
+ */
+ public void testUnicastEventSetDescriptor() {
+ try {
+ BeanInfo info = Introspector.getBeanInfo(SampleBean.class);
+ assertNotNull(info);
+ EventSetDescriptor[] descriptors = info.getEventSetDescriptors();
+ assertNotNull(descriptors);
+ for(int i = 0; i < descriptors.length; ++i) {
+ Method m = descriptors[i].getAddListenerMethod();
+ if(m != null) {
+ Class[] exceptionTypes = m.getExceptionTypes();
+ boolean found = false;
+
+ for(int j = 0; j < exceptionTypes.length; ++j) {
+ if(exceptionTypes[j].equals(
+ TooManyListenersException.class)) {
+ assertTrue(descriptors[i].isUnicast());
+ found = true;
+ break;
+ }
+ }
+
+ if(!found) {
+ assertEquals(descriptors[i].isUnicast(), false);
+ }
+
+ }
+ }
+ } catch (Exception e) {
+ fail("Cannot extract bean info from SampleBean class: "
+ + e.getClass());
+ }
+ }
+
+ /**
+ * The test checks the getEventSetDescriptors method
+ */
+ public void testEventSetDescriptorWithoutAddListenerMethod() {
+ try {
+ BeanInfo info = Introspector.getBeanInfo(OtherBean.class);
+ assertNotNull(info);
+ EventSetDescriptor[] descriptors = info.getEventSetDescriptors();
+ assertNotNull(descriptors);
+ assertEquals(0, descriptors.length);
+ } catch (Exception e) {
+ System.out.println(e.getClass() + ": " + e.getMessage());
+ fail("Cannot extract bean info from SampleBean class");
+ }
+ }
+
+ /**
+ * The test checks the getEventSetDescriptors method
+ */
+ public void testIllegalEventSetDescriptor() {
+ try {
+ BeanInfo info = Introspector.getBeanInfo(MisprintBean.class);
+ assertNotNull(info);
+ EventSetDescriptor[] descriptors = info.getEventSetDescriptors();
+ assertNotNull(descriptors);
+ assertEquals(0, descriptors.length);
+ } catch (Exception e) {
+ System.out.println(e.getClass() + ": " + e.getMessage());
+ fail("Cannot extract bean info from MisprintBean class");
+ }
+ }
+
+ /**
+ * The test checks the getPropertyDescriptors method
+ */
+ public void testPropertyDescriptorWithSetMethod() {
+ try {
+ BeanInfo info = Introspector.getBeanInfo(OtherBean.class);
+ assertNotNull(info);
+ PropertyDescriptor[] descriptors = info.getPropertyDescriptors();
+ assertNotNull(descriptors);
+ assertEquals(2, descriptors.length);
+ assertEquals("class", descriptors[0].getName());
+ assertEquals("number", descriptors[1].getName());
+ } catch (Exception e) {
+ System.out.println(e.getClass() + ": " + e.getMessage());
+ fail("Cannot extract bean info from SampleBean class");
+ }
+ }
+
+ /**
+ * The test checks the getPropertyDescriptors method
+ */
+ public void testUseAllBeanInfo() {
+ try {
+ BeanInfo info = Introspector.getBeanInfo(ChildBean.class,
+ Introspector.USE_ALL_BEANINFO);
+ PropertyDescriptor[] pds = info.getPropertyDescriptors();
+ assertEquals(1, pds.length);
+ assertEquals("childText", pds[0].getName());
+ } catch(IntrospectionException ie) {
+ fail(ie.getClass() + ": " + ie.getMessage());
+ }
+ }
+
+ /**
+ * The test checks the getPropertyDescriptors method for
+ * IGNORE_IMMEDIATE_BEANINFO flag
+ */
+ public void testIgnoreImmediateBeanInfo() {
+ try {
+ BeanInfo info = Introspector.getBeanInfo(ChildBean.class,
+ Introspector.IGNORE_IMMEDIATE_BEANINFO);
+ PropertyDescriptor[] pds = info.getPropertyDescriptors();
+ assertEquals(1, pds.length);
+ assertEquals("parentText", pds[0].getName());
+ } catch(IntrospectionException ie) {
+ fail(ie.getClass() + ": " + ie.getMessage());
+ }
+ }
+
+ /**
+ * The test checks the getPropertyDescriptors method for
+ * IGNORE_ALL_BEANINFO flag
+ */
+ public void testIgnoreAllBeanInfo() {
+ try {
+ BeanInfo info = Introspector.getBeanInfo(ChildBean.class,
+ Introspector.IGNORE_ALL_BEANINFO);
+ PropertyDescriptor[] pds = info.getPropertyDescriptors();
+ assertEquals(2, pds.length);
+ assertEquals("class", pds[0].getName());
+ assertEquals("text", pds[1].getName());
+ } catch(IntrospectionException ie) {
+ fail(ie.getClass() + ": " + ie.getMessage());
+ }
+ }
+
+ /**
+ * The test checks the getPropertyDescriptors method
+ */
+ public void testAdditionalBeanInfo() {
+ try {
+ BeanInfo info = Introspector.getBeanInfo(StandardBean2.class);
+ PropertyDescriptor[] pds = info.getPropertyDescriptors();
+ assertEquals(1, pds.length);
+ assertEquals("grannyText", pds[0].getName());
+ } catch(IntrospectionException ie) {
+ fail(ie.getClass() + ": " + ie.getMessage());
+ }
+ }
+
+ /**
+ * The test checks the getPropertyDescriptors for stop class prune
+ */
+ public void testStopClass() {
+ try {
+ BeanInfo info = Introspector.getBeanInfo(ChildBean.class,
+ GrannyBean.class);
+ PropertyDescriptor[] pds = info.getPropertyDescriptors();
+ assertEquals(1, pds.length);
+ assertEquals("childText", pds[0].getName());
+ } catch(IntrospectionException ie) {
+ fail(ie.getClass() + ": " + ie.getMessage());
+ }
+ }
+
+ /**
+ *
+ */
+ public static Test suite() {
+ return new TestSuite(IntrospectorTest.class);
+ }
+
+ /**
+ *
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/PropertyChangeSupportTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/PropertyChangeSupportTest.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/PropertyChangeSupportTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/PropertyChangeSupportTest.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+package java.beans;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import java.beans.auxiliary.SerializablePropertyChangeListener;
+import java.beans.auxiliary.NonSerializablePropertyChangeListener;
+
+/**
+ * The test checks the class java.beans.PropertyChangeSupport
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+
+public class PropertyChangeSupportTest extends TestCase {
+
+ /**
+ *
+ */
+ public PropertyChangeSupportTest() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public PropertyChangeSupportTest(String name) {
+ super(name);
+ }
+
+ /**
+ * The test checks the serialization for listeners supporting serialization
+ */
+ public void testSerializableListener() {
+ writePropertyChangeListeners(new PropertyChangeListener[] {
+ new SerializablePropertyChangeListener()
+ });
+ PropertyChangeListener[] pcls = readPropertyChangeListeners();
+ }
+
+ /**
+ * The test checks the serialization for listeners not supporting
+ * serialization
+ */
+ public void testNonSerializableListener() {
+ writePropertyChangeListeners(new PropertyChangeListener[] {
+ new NonSerializablePropertyChangeListener()
+ });
+ PropertyChangeListener[] pcls = readPropertyChangeListeners();
+ }
+
+ /**
+ *
+ */
+ public static Test suite() {
+ return new TestSuite(PropertyChangeSupportTest.class);
+ }
+
+ /**
+ *
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+
+ private void writePropertyChangeListeners(PropertyChangeListener[] array) {
+ ObjectOutputStream oos = null;
+ try {
+ oos = new ObjectOutputStream(new FileOutputStream("x.ser"));
+ PropertyChangeSupport pcs = new PropertyChangeSupport("bean");
+ if(array != null && array.length > 0) {
+ for(int i = 0; i < array.length; ++i) {
+ pcs.addPropertyChangeListener(array[i]);
+ }
+ }
+ oos.writeObject(pcs);
+ oos.flush();
+ } catch (Exception e) {
+ System.out.println(e.getClass() + ": " + e.getMessage());
+ fail("Exception is thrown in testNonSerializableListener");
+ } finally {
+ if(oos != null) {
+ try {
+ oos.close();
+ } catch (IOException ioe) {
+ fail("Exception while closing ObjectOutputStream");
+ }
+ }
+ }
+ }
+
+ private PropertyChangeListener[] readPropertyChangeListeners() {
+ ObjectInputStream ois = null;
+ PropertyChangeSupport pcs = null;
+ try {
+ ois = new ObjectInputStream(new FileInputStream("x.ser"));
+ pcs = (PropertyChangeSupport) ois.readObject();
+ } catch (Exception e) {
+ System.out.println(e.getClass() + ": " + e.getMessage());
+ fail("Exception is thrown in testNonSerializableListener while "
+ + "reading");
+ } finally {
+ if(ois != null) {
+ try {
+ ois.close();
+ } catch (IOException ioe) {
+ fail("Exception while closing ObjectInputStream");
+ }
+ }
+ }
+
+ return pcs.getPropertyChangeListeners();
+
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/PropertyEditorManagerTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/PropertyEditorManagerTest.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/PropertyEditorManagerTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/PropertyEditorManagerTest.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.4.6.3 $
+ */
+package java.beans;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import java.beans.PropertyEditorManager;
+import java.beans.auxiliary.AnotherSampleProperty;
+import java.beans.auxiliary.OtherEditor;
+import java.beans.auxiliary.SampleProperty;
+import java.beans.auxiliary.SamplePropertyEditor;
+import java.beans.editors.AnotherSamplePropertyEditor;
+
+/**
+ * The test checks the class java.beans.PropertyEditorManager
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.4.6.3 $
+ */
+
+public class PropertyEditorManagerTest extends TestCase {
+
+ /**
+ *
+ */
+ public PropertyEditorManagerTest() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public PropertyEditorManagerTest(String name) {
+ super(name);
+ }
+
+ /**
+ * The test checks the method findEditor() for registered editors
+ */
+ public void testFindRegisteredEditor() {
+ PropertyEditorManager.registerEditor(SampleProperty.class,
+ OtherEditor.class);
+ PropertyEditor pe = PropertyEditorManager.findEditor(
+ SampleProperty.class);
+ if(pe == null) {
+ fail("No property editor found");
+ } else {
+ assertTrue(pe instanceof OtherEditor);
+ }
+ PropertyEditorManager.registerEditor(SampleProperty.class, null);
+ }
+
+ /**
+ * The test checks the method findEditor() for editors found by name
+ */
+ public void testFindEditorByNameAddOn() {
+ PropertyEditor pe = PropertyEditorManager.findEditor(
+ SampleProperty.class);
+ if(pe == null) {
+ fail("No property editor found");
+ } else {
+ assertTrue(pe instanceof SamplePropertyEditor);
+ }
+ }
+
+ /**
+ * The test checks the method findEditor() for editors on search path
+ */
+ public void testFindEditorByDefaultLocation() {
+ PropertyEditorManager.setEditorSearchPath(
+ new String[] {"java.beans.editors"});
+ PropertyEditor pe = PropertyEditorManager.findEditor(
+ AnotherSampleProperty.class);
+ if(pe == null) {
+ fail("No property editor found");
+ } else {
+ assertTrue(pe instanceof AnotherSamplePropertyEditor);
+ }
+ }
+
+ /**
+ *
+ */
+ public static Test suite() {
+ return new TestSuite(PropertyEditorManagerTest.class);
+ }
+
+ /**
+ *
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/SimpleBeanInfoTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/SimpleBeanInfoTest.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/SimpleBeanInfoTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/SimpleBeanInfoTest.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+package java.beans;
+
+import java.awt.Image;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * The test checks the class java.beans.SimpleBeanInfo
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+
+public class SimpleBeanInfoTest extends TestCase {
+
+ /**
+ *
+ */
+ public SimpleBeanInfoTest() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public SimpleBeanInfoTest(String name) {
+ super(name);
+ }
+
+ /**
+ * The test checks the method loadImage()
+ */
+ public void testLoadImage() {
+ SimpleBeanInfo sbi = new SimpleBeanInfo();
+ Image image = sbi.loadImage("/java/beans/gif/test.gif");
+ assertNotNull(image);
+ }
+
+ /**
+ *
+ */
+ public static Test suite() {
+ return new TestSuite(SimpleBeanInfoTest.class);
+ }
+
+ /**
+ *
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/StatementTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/StatementTest.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/StatementTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/StatementTest.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,262 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.4.6.3 $
+ */
+package java.beans;
+
+import java.beans.Statement;
+import java.beans.auxiliary.SampleException;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * The test checks the class java.beans.Statement
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.4.6.3 $
+ */
+
+public class StatementTest extends TestCase {
+
+ private static int testId = -1;
+
+ /**
+ *
+ */
+ public StatementTest() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public StatementTest(String name) {
+ super(name);
+ }
+
+ /**
+ * The test checks the method execute() for setter
+ */
+ public void testSetter() {
+ Bean bean = new Bean();
+ Statement s = new Statement(bean, "setText", new Object[] { "hello" });
+ try {
+ s.execute();
+ assertEquals("hello", bean.getText());
+ } catch (Exception e) {
+ System.out.println(e.getClass() + ": " + e.getMessage());
+ fail("Exception is thrown while trying to invoke Bean.getText()");
+ }
+ }
+
+ /**
+ * The test checks the method execute() for indexed setter
+ */
+ public void testIndexedSetter() {
+ Bean bean = new Bean("hello");
+ Statement s = new Statement(bean, "setChar",
+ new Object[] { new Integer(1), new Character('a') });
+ try {
+ s.execute();
+ assertEquals("hallo", bean.getText());
+ } catch (Exception e) {
+ System.out.println(e.getClass() + ": " + e.getMessage());
+ fail("Exception is thrown while trying to invoke Bean.getText()");
+ }
+ }
+
+ /**
+ * The test checks the method execute() for array setter
+ */
+ public void testArraySetter() {
+ int[] a = {1, 2, 3};
+ Statement s = new Statement(a, "set",
+ new Object[] { new Integer(1), new Integer(7) });
+ try {
+ s.execute();
+ assertEquals(7, a[1]);
+ } catch (Exception e) {
+ System.out.println(e.getClass() + ": " + e.getMessage());
+ fail("Exception is thrown while trying to invoke array[i] =");
+ }
+ }
+
+ /**
+ * The test checks the method execute() for static method
+ */
+ public void testStatic() {
+ int currentId = getTestId();
+ Statement s = new Statement(StatementTest.class, "nextTestId",
+ new Object[] { });
+ try {
+ s.execute();
+ assertEquals(++currentId, getTestId());
+ } catch (Exception e) {
+ System.out.println(e.getClass() + ": " + e.getMessage());
+ fail("Exception is thrown while trying to invoke "
+ + "StatementTest.nextTestId()");
+ }
+ }
+
+ /**
+ * The test checks the method execute() if exception is thrown on method call
+ */
+ public void testExceptionThrownOnMethodCall() {
+ Bean bean = new Bean("hello");
+ Statement s = new Statement(bean, "setChar",
+ new Object[] { new Integer(5), new Character('a') });
+ try {
+ s.execute();
+ assertFalse("Exception must be thrown while Bean.setChar(5, 'a') "
+ + "invocation.", true);
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+
+ /**
+ * The test checks the method execute() if exception is thrown on
+ * static method call
+ */
+ public void testExceptionThrownOnStaticMethodCall() {
+ Statement s = new Statement(StatementTest.class, "methodWithException",
+ new Object[] {} );
+ try {
+ s.execute();
+ assertFalse(
+ "Exception must be thrown with methodWithException call",
+ true);
+ } catch (SampleException se) {
+ assertTrue("SampleException is thrown as expected", true);
+ } catch (Exception e) {
+ assertTrue("Non expected exception: " + e.getClass(), false);
+ }
+ }
+
+ /**
+ * The test checks the method execute() with array as parameter
+ */
+ public void testMethodWithArrayParam() {
+ Statement s = new Statement(StatementTest.class, "methodWithIntArray",
+ new Object[] { new int[] { 3 } } );
+ try {
+ s.execute();
+ assertTrue("No exception is thrown for methodWithIntArray call",
+ true);
+ } catch (Exception e) {
+ assertTrue("Non expected exception: " + e.getClass(), false);
+ }
+ }
+
+ /**
+ *
+ */
+ public static int getTestId() {
+ return testId;
+ }
+
+ /**
+ *
+ */
+ public static void nextTestId() {
+ ++testId;
+ }
+
+ /**
+ *
+ */
+ public static void methodWithException() throws Exception {
+ throw new SampleException("sample");
+ }
+
+ /**
+ *
+ */
+ public static void methodWithIntArray(int[] array) {
+ }
+
+ /**
+ *
+ */
+ public static Test suite() {
+ return new TestSuite(StatementTest.class);
+ }
+
+ /**
+ *
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+
+ public class Bean {
+
+ private String text;
+
+ public Bean() {
+ text = null;
+ }
+
+ public Bean(String text) {
+ this.text = text;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public char getChar(int idx) throws IllegalAccessException {
+ if(text == null) {
+ throw new IllegalAccessException("Text property is null.");
+ } else {
+ return text.charAt(idx);
+ }
+ }
+
+ public void setChar(int idx, char value) throws IllegalAccessException {
+ if(text == null) {
+ throw new IllegalAccessException("Text property is null.");
+ } else {
+ // IndexOutOfBounds exception is thrown, if indexed bounds are violated
+ char oldValue = text.charAt(idx);
+
+ String newText = "";
+
+ if(idx > 0) {
+ newText += text.substring(0, idx);
+ }
+
+ newText += value;
+
+ if(idx < (text.length() - 1)) {
+ newText += text.substring(idx + 1);
+ }
+
+ text = newText;
+
+ }
+ }
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/VetoableChangeSupportTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/VetoableChangeSupportTest.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/VetoableChangeSupportTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/VetoableChangeSupportTest.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+package java.beans;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import java.beans.VetoableChangeSupport;
+
+/**
+ * The test checks the class java.beans.VetoableChangeSupport
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+
+public class VetoableChangeSupportTest extends TestCase {
+
+ /**
+ *
+ */
+ public VetoableChangeSupportTest() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public VetoableChangeSupportTest(String name) {
+ super(name);
+ }
+
+ /**
+ * The test checks the method add() with no property specified
+ */
+ public void testAddVetoableChangeListener() {
+ VetoableChangeSupport vcs = new VetoableChangeSupport("bean1");
+ VetoableChangeListener vcl = new VetoableChangeListener() {
+ public void vetoableChange(PropertyChangeEvent pce) {
+ }
+ };
+ vcs.addVetoableChangeListener(vcl);
+ VetoableChangeListener[] vcls = vcs.getVetoableChangeListeners();
+ if(vcls == null) {
+ fail("Returned listeners is null.");
+ } else if(vcls.length != 1) {
+ fail("Number of listeners is not equal to 1.");
+ } else {
+ assertEquals(vcl, vcls[0]);
+ }
+ }
+
+ /**
+ * The test checks the method add() for property specified
+ */
+ public void testAddVetoableChangeListenerByPropertyName() {
+ VetoableChangeSupport vcs = new VetoableChangeSupport("bean1");
+ VetoableChangeListener vcl = new VetoableChangeListener() {
+ public void vetoableChange(PropertyChangeEvent pce) {
+ }
+ };
+ vcs.addVetoableChangeListener("property1", vcl);
+ VetoableChangeListener[] vcls = vcs.getVetoableChangeListeners(
+ "property1");
+ if(vcls == null) {
+ fail("Returned listeners is null.");
+ } else if(vcls.length != 1) {
+ fail("Number of listeners is not equal to 1.");
+ } else {
+ assertEquals(vcl, vcls[0]);
+ }
+ }
+
+ /**
+ * The test checks the method add() for VetoableChangeListenerProxy
+ */
+ public void testAddVetoableChangeListenerProxy() {
+ VetoableChangeSupport vcs = new VetoableChangeSupport("bean1");
+ VetoableChangeListener vcl = new VetoableChangeListener() {
+ public void vetoableChange(PropertyChangeEvent pce) {
+ }
+ };
+ vcs.addVetoableChangeListener("property1", vcl);
+ VetoableChangeListener[] vcls = vcs.getVetoableChangeListeners();
+ if(vcls == null) {
+ fail("Returned listeners is null.");
+ } else if(vcls.length != 1) {
+ fail("Number of listeners is not equal to 1.");
+ } else if(!(vcls[0] instanceof VetoableChangeListenerProxy)) {
+ fail("Listener is not of VetoableChangeListenerProxy type");
+ } else {
+ assertEquals(vcl,
+ ((VetoableChangeListenerProxy) vcls[0]).getListener());
+ assertEquals("property1",
+ ((VetoableChangeListenerProxy) vcls[0]).getPropertyName());
+ }
+ }
+
+ /**
+ *
+ */
+ public static Test suite() {
+ return new TestSuite(VetoableChangeSupportTest.class);
+ }
+
+ /**
+ *
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/XMLDecoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/XMLDecoderTest.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/XMLDecoderTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/XMLDecoderTest.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.3.6.3 $
+ */
+package java.beans;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import java.beans.Introspector;
+import java.beans.XMLDecoder;
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+
+/**
+ * The test checks the class java.beans.XMLDecoder
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.3.6.3 $
+ */
+
+public class XMLDecoderTest extends TestCase {
+
+ /**
+ *
+ */
+ public XMLDecoderTest() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public XMLDecoderTest(String name) {
+ super(name);
+ }
+
+ /**
+ * The test checks the code generation for XML from Test1.xml
+ */
+ public void testDecodeLinkedList() {
+ decode("/java/beans/xml/Test1.xml");
+ }
+
+ /**
+ * The test checks the code generation for XML from Test2.xml
+ */
+ public void testDecodePrimitiveArrayByLength() {
+ decode("/java/beans/xml/Test2.xml");
+ }
+
+ /**
+ * The test checks the code generation for XML from Test3.xml
+ */
+ public void testDecodePrimitiveArrayByElements() {
+ decode("/java/beans/xml/Test3.xml");
+ }
+
+ /**
+ * The test checks the code generation for XML from Test4.xml
+ */
+ public void testDecodeObjectArrayByLength() {
+ decode("/java/beans/xml/Test4.xml");
+ }
+
+ /**
+ * The test checks the code generation for XML from Test5.xml
+ */
+ public void testDecodeObjectArrayByElements() {
+ decode("/java/beans/xml/Test5.xml");
+ }
+
+ /**
+ * The test checks the code generation for XML from Test6.xml
+ */
+ public void testDecodeReference() {
+ decode("/java/beans/xml/Test6.xml");
+ }
+
+ /**
+ * The test checks the code generation for XML from Test7.xml
+ */
+ public void testDecodeStringArray() {
+ decode("/java/beans/xml/Test7.xml");
+ }
+
+ /*
+ * The test checks the code generation for XML from MainTest.xml
+ *
+ public void testMain() {
+ decode("/java/beans/xml/MainTest.xml");
+ }
+ */
+
+ /**
+ *
+ */
+ public static Test suite() {
+ return new TestSuite(XMLDecoderTest.class);
+ }
+
+ /**
+ *
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+
+ /**
+ *
+ */
+ private void decode(String resourceName) {
+ XMLDecoder d = null;
+ try {
+ Introspector.setBeanInfoSearchPath(new String[] {});
+ d = new XMLDecoder(new BufferedInputStream(
+ FileInputStream.class.getResourceAsStream(resourceName)));
+ while(true) {
+ Object obj = d.readObject();
+ }
+ } catch (ArrayIndexOutOfBoundsException aibe) {
+ assertTrue(true);
+ } catch (Exception e) {
+ System.out.println(e.getClass() + " :" + e.getMessage());
+ fail("Exception " + e.getClass() + " is thrown");
+ } finally {
+ if(d != null) {
+ d.close();
+ }
+ }
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/XMLEncoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/XMLEncoderTest.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/XMLEncoderTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/XMLEncoderTest.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,407 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.5.6.3 $
+ */
+package java.beans;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import java.beans.XMLEncoder;
+
+import java.beans.auxiliary.AType;
+import java.beans.auxiliary.StandardBean;
+
+/**
+ * The test checks the class java.beans.XMLEncoder
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.5.6.3 $
+ */
+
+public class XMLEncoderTest extends TestCase {
+
+ /**
+ *
+ */
+ public XMLEncoderTest() {
+ super();
+ }
+
+ /**
+ *
+ */
+ public XMLEncoderTest(String name) {
+ super(name);
+ }
+
+ /**
+ * The test checks that java.lang.Boolean exemplar store is correct
+ */
+ public void testEncodeBoolean() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ try {
+ e.writeObject(new Boolean(true));
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ * The test checks that java.lang.Byte exemplar store is correct
+ */
+ public void testEncodeByte() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ try {
+ e.writeObject(new Byte((byte) 123));
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ * The test checks that java.lang.Character exemplar store is correct
+ */
+ public void testEncodeCharacter() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ try {
+ e.writeObject(new Character('a'));
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ * The test checks that java.lang.Class exemplar store is correct
+ */
+ public void testEncodeClass() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ try {
+ e.writeObject(Object.class);
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ * The test checks that java.lang.Double exemplar store is correct
+ */
+ public void testEncodeDouble() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ try {
+ e.writeObject(new Double((double) 0.01));
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ * The test checks that java.lang.Float exemplar store is correct
+ */
+ public void testEncodeFloat() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ try {
+ e.writeObject(new Float((float) 0.01));
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ * The test checks that java.lang.Integer exemplar store is correct
+ */
+ public void testEncodeInteger() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ try {
+ e.writeObject(new Integer(1));
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ * The test checks that java.lang.Long exemplar store is correct
+ */
+ public void testEncodeLong() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ try {
+ e.writeObject(new Long(1));
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ * The test checks that java.lang.Short exemplar store is correct
+ */
+ public void testEncodeShort() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ try {
+ e.writeObject(new Short((short) 1));
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ * The test checks that java.lang.String exemplar store is correct
+ */
+ public void testEncodeString() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ try {
+ e.writeObject(new String("hello"));
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ * The test checks that array exemplar store is correct
+ */
+ public void testEncodeArray() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ try {
+ e.writeObject(new int[] {1, 2, 3});
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ * The test checks that null exemplar store is correct
+ */
+ public void testEncodeNull() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ try {
+ e.writeObject(null);
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ * The test checks that complex scenario store is correct
+ */
+ public void testEncodingScenario() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ StandardBean bean1 = new StandardBean("bean1");
+
+ StandardBean bean2 = new StandardBean();
+ bean2.setText(null);
+
+ bean1.setPeer(bean2);
+ bean2.setPeer(bean1);
+
+ try {
+ e.writeObject(bean1);
+ e.writeObject(bean2);
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ * The test checks that encoder can handle writeExpression in initialize
+ */
+ public void testEncodeExpressionAsStatement() {
+ XMLEncoder e = new XMLEncoder(System.out);
+ e.setExceptionListener(new ExceptionListener() {
+ public void exceptionThrown(Exception e) {
+ fail("Exception " + e.getClass() +" is thrown: "
+ + e.getMessage());
+ }
+ });
+
+ try {
+ final Object object = new Object();
+ e.setPersistenceDelegate(AType.class,
+ new DefaultPersistenceDelegate() {
+ protected void initialize(
+ Class type,
+ Object oldInstance,
+ Object newInstance,
+ Encoder out) {
+ out.writeExpression(new Expression(
+ object, oldInstance, "go", new Object[] {}
+ ));
+ }
+ });
+ AType a = new AType();
+
+ //e.writeObject(object);
+ e.writeObject(a);
+ e.writeObject(object);
+ } catch (Exception excp) {
+ fail("Exception " + excp.getClass() +" is thrown: "
+ + excp.getMessage());
+ } finally {
+ e.close();
+ }
+ }
+
+ /**
+ *
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ //suite.addTest(new XMLEncoderTest("testEncodeArray"));
+ //suite.addTest(new XMLEncoderTest("testEncodeExpressionAsStatement"));
+ //suite.addTest(new XMLEncoderTest("testEncodingScenario"));
+ //return suite;
+ return new TestSuite(XMLEncoderTest.class);
+ }
+
+ /**
+ *
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/AType.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/AType.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/AType.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/AType.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.1.6.3 $
+ */
+package java.beans.auxiliary;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.1.6.3 $
+ */
+
+public class AType {
+
+ public Object go() {
+ return new Object();
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/AnotherSampleProperty.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/AnotherSampleProperty.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/AnotherSampleProperty.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/AnotherSampleProperty.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.2 $
+ */
+package java.beans.auxiliary;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.2 $
+ */
+
+public class AnotherSampleProperty {
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ChildBean.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ChildBean.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ChildBean.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ChildBean.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.2 $
+ */
+package java.beans.auxiliary;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.2 $
+ */
+
+public class ChildBean extends ParentBean {
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ChildBeanBeanInfo.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ChildBeanBeanInfo.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ChildBeanBeanInfo.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ChildBeanBeanInfo.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+package java.beans.auxiliary;
+
+import java.beans.IntrospectionException;
+import java.beans.PropertyDescriptor;
+import java.beans.SimpleBeanInfo;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+
+public class ChildBeanBeanInfo extends SimpleBeanInfo {
+
+ public ChildBeanBeanInfo() {
+ super();
+ }
+
+ public PropertyDescriptor[] getPropertyDescriptors() {
+ try {
+ return new PropertyDescriptor[] {
+ new PropertyDescriptor("childText", ChildBean.class,
+ "getText", "setText")
+ };
+ } catch (IntrospectionException ie) {
+ System.out.println("in ChildBeanBeanInfo.getPropertyDescriptors: "
+ + ie.getMessage());
+ return null;
+ }
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/GrannyBean.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/GrannyBean.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/GrannyBean.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/GrannyBean.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+package java.beans.auxiliary;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+
+public class GrannyBean {
+
+ private String text = "GrannyBean";
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/GrannyBeanBeanInfo.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/GrannyBeanBeanInfo.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/GrannyBeanBeanInfo.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/GrannyBeanBeanInfo.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+package java.beans.auxiliary;
+
+import java.beans.IntrospectionException;
+import java.beans.PropertyDescriptor;
+import java.beans.SimpleBeanInfo;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+
+public class GrannyBeanBeanInfo extends SimpleBeanInfo {
+
+ public GrannyBeanBeanInfo() {
+ super();
+ }
+
+ public PropertyDescriptor[] getPropertyDescriptors() {
+ try {
+ return new PropertyDescriptor[] {
+ new PropertyDescriptor("grannyText", GrannyBean.class,
+ "getText", "setText")
+ };
+ } catch (IntrospectionException ie) {
+ System.out.println("in GrannyBeanBeanInfo.getPropertyDescriptors: "
+ + ie.getMessage());
+ return null;
+ }
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/InvocationObject.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/InvocationObject.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/InvocationObject.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/InvocationObject.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.3.6.3 $
+ */
+package java.beans.auxiliary;
+
+import java.beans.EventHandlerTest;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.3.6.3 $
+ */
+
+public class InvocationObject {
+
+ private EventHandlerTest logger;
+ private Object object;
+ private String text;
+ private int intValue = -1;
+
+ public InvocationObject(EventHandlerTest logger) {
+ this.logger = logger;
+ }
+
+ public void doSomething() {
+ if(logger != null) {
+ logger.logMethodCall(this, "doSomething", new Object[] {} );
+ }
+ }
+
+ public void doSomething(int intValue) {
+ this.intValue = intValue;
+
+ if(logger != null) {
+ logger.logMethodCall(this, "doSomething",
+ new Object[] { new Integer(intValue) } );
+ }
+ }
+
+ public void setSomeObject(Object object) {
+ this.object = object;
+
+ if(logger != null) {
+ logger.logMethodCall(this, "setSomeObject",
+ new Object[] { object } );
+ }
+ }
+
+ public void setSomeText(String text) {
+ this.text = text;
+
+ if(logger != null) {
+ logger.logMethodCall(this, "setSomeText", new Object[] { text } );
+ }
+ }
+
+ public String getSomeText() {
+ return text;
+ }
+
+ public int getIntValue() {
+ return intValue;
+ }
+
+ public void setIntValue(int intValue) {
+ this.intValue = intValue;
+
+ if(logger != null) {
+ logger.logMethodCall(this, "setIntValue",
+ new Object[] { new Integer(intValue) } );
+ }
+ }
+
+ public void setSomeValue(int i) {
+ if(logger != null) {
+ logger.logMethodCall(this, "setSomeValue",
+ new Object[] { new Integer(intValue) } );
+ }
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/MisprintBean.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/MisprintBean.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/MisprintBean.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/MisprintBean.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+package java.beans.auxiliary;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+
+public class MisprintBean {
+
+ //public void addMiisprintListener(MisprintListenerr ml) {}
+ public void removeMisprintListener(MisprintListenerr ml) {}
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/MisprintEvent.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/MisprintEvent.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/MisprintEvent.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/MisprintEvent.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+package java.beans.auxiliary;
+
+import java.util.EventObject;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+
+public class MisprintEvent extends EventObject {
+
+ public MisprintEvent(Object object) {
+ super(object);
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/MisprintListenerr.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/MisprintListenerr.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/MisprintListenerr.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/MisprintListenerr.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+package java.beans.auxiliary;
+
+import java.util.EventListener;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+
+public interface MisprintListenerr extends EventListener {
+
+ public void fireMisprintEvent(MisprintEvent me);
+ // public void fireMisprint2Event(MisprintEvent me);
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/NonSerializablePropertyChangeListener.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/NonSerializablePropertyChangeListener.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/NonSerializablePropertyChangeListener.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/NonSerializablePropertyChangeListener.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+package java.beans.auxiliary;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+
+public class NonSerializablePropertyChangeListener
+ implements PropertyChangeListener {
+
+ public void propertyChange(PropertyChangeEvent event) {
+ }
+}
\ No newline at end of file
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/OtherBean.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/OtherBean.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/OtherBean.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/OtherBean.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+package java.beans.auxiliary;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+
+public class OtherBean {
+
+ public void addSaampleListener(SampleListener listener) {
+ }
+
+ public void removeSampleListener(SampleListener listener) {
+ }
+
+ public void setNumber(int a) {
+ }
+
+ public void set(int a) {
+ }
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/OtherEditor.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/OtherEditor.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/OtherEditor.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/OtherEditor.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.2 $
+ */
+package java.beans.auxiliary;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.2 $
+ */
+
+public class OtherEditor extends PropertyEditorSupport {
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ParentBean.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ParentBean.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ParentBean.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ParentBean.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.2 $
+ */
+package java.beans.auxiliary;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.2 $
+ */
+
+public class ParentBean extends GrannyBean {
+}
Added: incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ParentBeanBeanInfo.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ParentBeanBeanInfo.java?rev=387239&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ParentBeanBeanInfo.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex-beans-math/test/common/unit/java/beans/auxiliary/ParentBeanBeanInfo.java Mon Mar 20 08:31:09 2006
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+package java.beans.auxiliary;
+
+import java.beans.IntrospectionException;
+import java.beans.PropertyDescriptor;
+import java.beans.SimpleBeanInfo;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.2.6.3 $
+ */
+
+public class ParentBeanBeanInfo extends SimpleBeanInfo {
+
+ public ParentBeanBeanInfo() {
+ super();
+ }
+
+ public PropertyDescriptor[] getPropertyDescriptors() {
+ try {
+ return new PropertyDescriptor[] {
+ new PropertyDescriptor("parentText", ParentBean.class,
+ "getText", "setText")
+ };
+ } catch (IntrospectionException ie) {
+ System.out.println("in ParentBeanBeanInfo.getPropertyDescriptors: "
+ + ie.getMessage());
+ return null;
+ }
+
+ }
+}