下面列出了javax.management.monitor.StringMonitor#setNotifyMatch ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Wait for granularity period (multiplied by 2 for sure)
//
Thread.sleep(granularityperiod * 2);
// Check if notification was received
//
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}
/**
* Update the string and check for notifications
*/
public int stringMonitorNotification() throws Exception {
StringMonitor stringMonitor = new StringMonitor();
try {
// Create a new StringMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new StringMonitor MBean");
ObjectName stringMonitorName = new ObjectName(
domain + ":type=" + StringMonitor.class.getName());
server.registerMBean(stringMonitor, stringMonitorName);
echo(">>> ADD a listener to the StringMonitor");
stringMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the StringMonitor:");
stringMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
stringMonitor.setObservedAttribute("StringAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute");
stringMonitor.setNotifyMatch(false);
echo("\tATTRIBUTE \"NotifyMatch\" = false");
stringMonitor.setNotifyDiffer(false);
echo("\tATTRIBUTE \"NotifyDiffer\" = false");
stringMonitor.setStringToCompare("dummy");
echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\"");
int granularityperiod = 500;
stringMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the StringMonitor");
stringMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: StringMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: StringMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (stringMonitor != null)
stringMonitor.stop();
}
return 0;
}