5299N/A/*
5846N/A * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
5299N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5299N/A *
5299N/A * This code is free software; you can redistribute it and/or modify it
5299N/A * under the terms of the GNU General Public License version 2 only, as
5299N/A * published by the Free Software Foundation.
5299N/A *
5299N/A * This code is distributed in the hope that it will be useful, but WITHOUT
5299N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5299N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5299N/A * version 2 for more details (a copy is included in the LICENSE file that
5299N/A * accompanied this code).
5299N/A *
5299N/A * You should have received a copy of the GNU General Public License version
5299N/A * 2 along with this work; if not, write to the Free Software Foundation,
5299N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5299N/A *
5299N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5299N/A * or visit www.oracle.com if you need additional information or have any
5299N/A * questions.
5299N/A */
5299N/A
5299N/A/*
5299N/A * @test
5846N/A * @bug 7192955 8000183
5299N/A * @summary Tests that all properties are bound
5299N/A * @author Sergey Malenkov
5299N/A */
5299N/A
5846N/Aimport java.beans.IntrospectionException;
5846N/Aimport java.beans.Introspector;
5299N/Aimport java.beans.PropertyChangeListener;
5846N/Aimport java.beans.PropertyDescriptor;
5299N/Aimport java.util.List;
5299N/A
5299N/Apublic class Test7192955 {
5299N/A
5846N/A public static void main(String[] args) throws IntrospectionException {
5299N/A if (!BeanUtils.findPropertyDescriptor(MyBean.class, "test").isBound()) {
5299N/A throw new Error("a simple property is not bound");
5299N/A }
5299N/A if (!BeanUtils.findPropertyDescriptor(MyBean.class, "list").isBound()) {
5299N/A throw new Error("a generic property is not bound");
5299N/A }
5299N/A if (!BeanUtils.findPropertyDescriptor(MyBean.class, "readOnly").isBound()) {
5299N/A throw new Error("a read-only property is not bound");
5299N/A }
5846N/A PropertyDescriptor[] pds = Introspector.getBeanInfo(MyBean.class, BaseBean.class).getPropertyDescriptors();
5846N/A for (PropertyDescriptor pd : pds) {
5846N/A if (pd.getName().equals("test") && pd.isBound()) {
5846N/A throw new Error("a simple property is bound without superclass");
5846N/A }
5846N/A }
5299N/A }
5299N/A
5299N/A public static class BaseBean {
5299N/A
5299N/A private List<String> list;
5299N/A
5299N/A public List<String> getList() {
5299N/A return this.list;
5299N/A }
5299N/A
5299N/A public void setList(List<String> list) {
5299N/A this.list = list;
5299N/A }
5299N/A
5299N/A public void addPropertyChangeListener(PropertyChangeListener listener) {
5299N/A }
5299N/A
5299N/A public void removePropertyChangeListener(PropertyChangeListener listener) {
5299N/A }
5299N/A
5299N/A public List<String> getReadOnly() {
5299N/A return this.list;
5299N/A }
5299N/A }
5299N/A
5299N/A public static class MyBean extends BaseBean {
5299N/A
5299N/A private String test;
5299N/A
5299N/A public String getTest() {
5299N/A return this.test;
5299N/A }
5299N/A
5299N/A public void setTest(String test) {
5299N/A this.test = test;
5299N/A }
5299N/A }
5299N/A}