2362N/A * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * support attributes of arbitrary data types. 0N/A * @author Luis-Miguel Alventosa 0N/A * @run clean AttributeArbitraryDataTypeTest 0N/A * @run build AttributeArbitraryDataTypeTest 0N/A * @run main AttributeArbitraryDataTypeTest 0N/A // Flag to notify that a message has been received 0N/A // MatchBeanInfo class 0N/A // ComplexAttribute class 0N/A // Simple type buried in complex getter 0N/A // Simple type buried in CompositeData 0N/A "Composite Data Attribute",
0N/A "StringAttribute" };
0N/A "String Attribute" };
0N/A // Notification handler 0N/A echo(
"\tInside handleNotification...");
0N/A " has reached or exceeded the threshold");
0N/A " has reached or exceeded the high threshold");
0N/A " matches the string-to-compare value");
0N/A echo(
"\tError in handleNotification!");
0N/A * Update the counter and check for notifications 0N/A // Create a new CounterMonitor MBean and add it to the MBeanServer. 0N/A echo(
">>> CREATE a new CounterMonitor MBean");
0N/A echo(
">>> ADD a listener to the CounterMonitor");
0N/A // MANAGEMENT OF A STANDARD MBEAN 0N/A echo(
">>> CREATE a new ObservedObject MBean");
0N/A echo(
">>> SET the attributes of the CounterMonitor:");
0N/A "CompositeDataAttribute.IntegerAttribute");
0N/A echo(
"\tATTRIBUTE \"ObservedAttribute\" = " +
0N/A "CompositeDataAttribute.IntegerAttribute");
0N/A "ComplexAttribute.integerAttribute");
0N/A echo(
"\tATTRIBUTE \"ObservedAttribute\" = " +
0N/A "ComplexAttribute.integerAttribute");
0N/A "ComplexAttribute.arrayAttribute.length");
0N/A echo(
"\tATTRIBUTE \"ObservedAttribute\" = " +
0N/A "ComplexAttribute.arrayAttribute.length");
0N/A echo(
"\tATTRIBUTE \"NotifyFlag\" = true");
0N/A echo(
">>> START the CounterMonitor");
0N/A // Wait for granularity period (multiplied by 2 for sure) 0N/A // Wait for granularity period (multiplied by 2 for sure) 0N/A // Wait for granularity period (multiplied by 2 for sure) 0N/A // Check if notification was received 0N/A echo(
"\tOK: CounterMonitor notification received");
0N/A echo(
"\tKO: CounterMonitor notification missed or not emitted");
0N/A * Update the gauge and check for notifications 0N/A // Create a new GaugeMonitor MBean and add it to the MBeanServer. 0N/A echo(
">>> CREATE a new GaugeMonitor MBean");
0N/A echo(
">>> ADD a listener to the GaugeMonitor");
0N/A // MANAGEMENT OF A STANDARD MBEAN 0N/A echo(
">>> CREATE a new ObservedObject MBean");
0N/A echo(
">>> SET the attributes of the GaugeMonitor:");
0N/A "CompositeDataAttribute.DoubleAttribute");
0N/A echo(
"\tATTRIBUTE \"ObservedAttribute\" = " +
0N/A "CompositeDataAttribute.DoubleAttribute");
0N/A "ComplexAttribute.doubleAttribute");
0N/A echo(
"\tATTRIBUTE \"ObservedAttribute\" = " +
0N/A "ComplexAttribute.doubleAttribute");
0N/A "ComplexAttribute.arrayAttribute.length");
0N/A echo(
"\tATTRIBUTE \"ObservedAttribute\" = " +
0N/A "ComplexAttribute.arrayAttribute.length");
0N/A echo(
"\tATTRIBUTE \"Notify Low Flag\" = false");
0N/A echo(
"\tATTRIBUTE \"Notify High Flag\" = true");
0N/A echo(
">>> START the GaugeMonitor");
0N/A // Wait for granularity period (multiplied by 2 for sure) 0N/A // Wait for granularity period (multiplied by 2 for sure) 0N/A // Wait for granularity period (multiplied by 2 for sure) 0N/A // Check if notification was received 0N/A echo(
"\tOK: GaugeMonitor notification received");
0N/A echo(
"\tKO: GaugeMonitor notification missed or not emitted");
0N/A * Update the string and check for notifications 0N/A // Create a new StringMonitor MBean and add it to the MBeanServer. 0N/A echo(
">>> CREATE a new StringMonitor MBean");
0N/A echo(
">>> ADD a listener to the StringMonitor");
0N/A // MANAGEMENT OF A STANDARD MBEAN 0N/A echo(
">>> CREATE a new ObservedObject MBean");
0N/A echo(
">>> SET the attributes of the StringMonitor:");
0N/A "CompositeDataAttribute.StringAttribute");
0N/A echo(
"\tATTRIBUTE \"ObservedAttribute\" = " +
0N/A "CompositeDataAttribute.StringAttribute");
0N/A "ComplexAttribute.stringAttribute");
0N/A echo(
"\tATTRIBUTE \"ObservedAttribute\" = " +
0N/A "ComplexAttribute.stringAttribute");
0N/A "ComplexAttribute.enumAttribute.name");
0N/A echo(
"\tATTRIBUTE \"ObservedAttribute\" = " +
0N/A "ComplexAttribute.enumAttribute.name");
0N/A echo(
"\tATTRIBUTE \"NotifyMatch\" = true");
0N/A echo(
"\tATTRIBUTE \"NotifyDiffer\" = false");
0N/A echo(
"\tATTRIBUTE \"StringToCompare\" = \"do_match_now\"");
0N/A echo(
">>> START the StringMonitor");
0N/A // Wait for granularity period (multiplied by 2 for sure) 0N/A // Wait for granularity period (multiplied by 2 for sure) 0N/A // Wait for granularity period (multiplied by 2 for sure) 0N/A // Check if notification was received 0N/A echo(
"\tOK: StringMonitor notification received");
0N/A echo(
"\tKO: StringMonitor notification missed or not emitted");
0N/A * Test the monitor notifications. 0N/A echo(
">>> ----------------------------------------");
0N/A echo(
">>> ----------------------------------------");
0N/A echo(
">>> ----------------------------------------");
0N/A echo(
">>> ----------------------------------------");
0N/A echo(
">>> ----------------------------------------");
0N/A echo(
">>> ----------------------------------------");
0N/A echo(
">>> ----------------------------------------");
0N/A echo(
">>> ----------------------------------------");
0N/A echo(
">>> ----------------------------------------");
0N/A echo(
">>> ----------------------------------------");
1790N/A // Java Beans introspection 1790N/A "Could not find the getter method for the property " +
0N/A * Standalone entry point. 0N/A * Run the test and report to stdout. 0N/A "the notifications that were " +
0N/A "expected by the test!");