/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6333528
* @summary Check that the initial threshold is properly used by the observed
* objects added before the counter monitor is started as well as by
* the observed objects which are added once the monitor is started.
* @author Luis-Miguel Alventosa
* @run clean CounterMonitorInitThresholdTest
* @run build CounterMonitorInitThresholdTest
* @run main CounterMonitorInitThresholdTest
*/
public class CounterMonitorInitThresholdTest {
public interface TestMBean {
public int getCounter();
}
public int getCounter() {
return count;
}
}
}
if (n instanceof MonitorNotification) {
mn.getTimeStamp());
mn.getObservedObject());
mn.getDerivedGauge());
mn.getTrigger());
}
}
}
// Retrieve the platform MBean server
//
// Create and register TestMBeans
//
new ObjectName(domain +
",name=1");
new ObjectName(domain +
",name=2");
// Create and register CounterMonitorMBean
//
new ObjectName(domain +
CounterMonitor m = new CounterMonitor();
// Add observed object name1
//
"\" registered before starting the monitor");
// Start the monitor
//
// Play with counter for name1
//
for (int i = 0; i < 4; i++) {
mbean1.setCounter(i);
thresholdValue + " Expected value = 3");
throw new IllegalArgumentException("wrong threshold");
}
}
// Add observed object name2
//
"\" registered after starting the monitor");
// Play with counter for name2
//
for (int i = 0; i < 4; i++) {
mbean2.setCounter(i);
thresholdValue + " Expected value = 3");
throw new IllegalArgumentException("wrong threshold");
}
}
// Stop the monitor
//
}
runTest();
}
}