2788N/A/*
2788N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2788N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2788N/A *
2788N/A * This code is free software; you can redistribute it and/or modify it
2788N/A * under the terms of the GNU General Public License version 2 only, as
2788N/A * published by the Free Software Foundation.
2788N/A *
2788N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2788N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2788N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2788N/A * version 2 for more details (a copy is included in the LICENSE file that
2788N/A * accompanied this code).
2788N/A *
2788N/A * You should have received a copy of the GNU General Public License version
2788N/A * 2 along with this work; if not, write to the Free Software Foundation,
2788N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2788N/A *
2788N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2788N/A * or visit www.oracle.com if you need additional information or have any
2788N/A * questions.
2788N/A */
2788N/A
2788N/A/*
2788N/A * @test
2788N/A * @bug 6976577
2788N/A * @summary Tests public methods in non-public beans
2788N/A * @author Sergey Malenkov
2788N/A */
2788N/A
2788N/Aimport test.Accessor;
2788N/A
2788N/Aimport java.beans.EventSetDescriptor;
2788N/Aimport java.beans.IndexedPropertyDescriptor;
2788N/Aimport java.beans.PropertyDescriptor;
2788N/Aimport java.lang.reflect.Method;
2788N/A
2788N/Apublic class Test6976577 {
2788N/A
2788N/A public static void main(String[] args) throws Exception {
2788N/A Class<?> bt = Accessor.getBeanType();
2788N/A Class<?> lt = Accessor.getListenerType();
2788N/A
2788N/A // test PropertyDescriptor
2788N/A PropertyDescriptor pd = new PropertyDescriptor("boolean", bt);
2788N/A test(pd.getReadMethod());
2788N/A test(pd.getWriteMethod());
2788N/A
2788N/A // test IndexedPropertyDescriptor
2788N/A IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("indexed", bt);
2788N/A test(ipd.getReadMethod());
2788N/A test(ipd.getWriteMethod());
2788N/A test(ipd.getIndexedReadMethod());
2788N/A test(ipd.getIndexedWriteMethod());
2788N/A
2788N/A // test EventSetDescriptor
2788N/A EventSetDescriptor esd = new EventSetDescriptor(bt, "test", lt, "process");
2788N/A test(esd.getAddListenerMethod());
2788N/A test(esd.getRemoveListenerMethod());
2788N/A test(esd.getGetListenerMethod());
2788N/A test(esd.getListenerMethods());
2788N/A }
2788N/A
2788N/A private static void test(Method... methods) {
2788N/A for (Method method : methods) {
2788N/A if (method == null) {
2788N/A throw new Error("public method is not found");
2788N/A }
2788N/A }
2788N/A }
2788N/A}