< prev index next >
application/uitests/org.openjdk.jmc.console.uitest/src/test/java/org/openjdk/jmc/console/uitest/mbeanhelpers/Testable.java
Print this page
*** 115,125 ****
private boolean stop = false;
// @jmx.mbean.description("Abstract Webservice deployer")
// @javax.management.ManagedAttribute
public Testable() {
! this("Hello there"); //$NON-NLS-1$
}
public Testable(String s) {
this(s, 5000);
}
--- 115,125 ----
private boolean stop = false;
// @jmx.mbean.description("Abstract Webservice deployer")
// @javax.management.ManagedAttribute
public Testable() {
! this("Hello there");
}
public Testable(String s) {
this(s, 5000);
}
*** 166,187 ****
primitiveLong = Long.MIN_VALUE;
_long = Long.valueOf(Long.MAX_VALUE);
nullLong = null;
! bigInteger = new BigInteger("123456789012345678901234567890"); //$NON-NLS-1$
nullBigInteger = null;
primitiveFloat = Float.MIN_VALUE;
_float = Float.valueOf(Float.MAX_VALUE);
nullFloat = null;
primitiveDouble = Math.E;
_double = Double.valueOf(Math.PI);
nullDouble = null;
! string = "Hello there"; //$NON-NLS-1$
nullString = null;
primitiveArray = new int[] {1, 2, 3};
nullPrimitiveArray = null;
primitivBooleanArray = new boolean[] {true, false};
--- 166,187 ----
primitiveLong = Long.MIN_VALUE;
_long = Long.valueOf(Long.MAX_VALUE);
nullLong = null;
! bigInteger = new BigInteger("123456789012345678901234567890");
nullBigInteger = null;
primitiveFloat = Float.MIN_VALUE;
_float = Float.valueOf(Float.MAX_VALUE);
nullFloat = null;
primitiveDouble = Math.E;
_double = Double.valueOf(Math.PI);
nullDouble = null;
! string = "Hello there";
nullString = null;
primitiveArray = new int[] {1, 2, 3};
nullPrimitiveArray = null;
primitivBooleanArray = new boolean[] {true, false};
*** 190,221 ****
for (int i = 0; i < stringArray.length; i += 1) {
stringArray[i] = Integer.toHexString(i);
}
nullStringArray = null;
! multiArray = new String[][] {{"1-1", "1-2", "1-3"}, {"2-2", "2-3"}, {null}, null}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
nullMultiArray = null;
! collection = Arrays.asList("one", "two", "three"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
map = new Hashtable<>();
! map.put("one", Integer.valueOf(1)); //$NON-NLS-1$
! map.put("two", Integer.valueOf(2)); //$NON-NLS-1$
! map.put("three", Integer.valueOf(3)); //$NON-NLS-1$
largeMap = new Hashtable<>();
for (int i = 0; i < 256; i += 1) {
! largeMap.put("nr_" + i, Integer.valueOf(i)); //$NON-NLS-1$
}
! editableObjectArray = new Object[] {1, Float.valueOf(1.5f), "two", null}; //$NON-NLS-1$
editableCollection = new ArrayList<>();
editableCollection.add(1);
editableCollection.add(Float.valueOf(1.5f));
! editableCollection.add("two"); //$NON-NLS-1$
editableMap = new Hashtable<>();
editableMap.put(0, 1);
editableMap.put(1, Float.valueOf(1.5f));
! editableMap.put(2, "two"); //$NON-NLS-1$
}
// Boolean
@Override
public boolean getPrimitiveBoolean() {
--- 190,221 ----
for (int i = 0; i < stringArray.length; i += 1) {
stringArray[i] = Integer.toHexString(i);
}
nullStringArray = null;
! multiArray = new String[][] {{"1-1", "1-2", "1-3"}, {"2-2", "2-3"}, {null}, null};
nullMultiArray = null;
! collection = Arrays.asList("one", "two", "three");
map = new Hashtable<>();
! map.put("one", Integer.valueOf(1));
! map.put("two", Integer.valueOf(2));
! map.put("three", Integer.valueOf(3));
largeMap = new Hashtable<>();
for (int i = 0; i < 256; i += 1) {
! largeMap.put("nr_" + i, Integer.valueOf(i));
}
! editableObjectArray = new Object[] {1, Float.valueOf(1.5f), "two", null};
editableCollection = new ArrayList<>();
editableCollection.add(1);
editableCollection.add(Float.valueOf(1.5f));
! editableCollection.add("two");
editableMap = new Hashtable<>();
editableMap.put(0, 1);
editableMap.put(1, Float.valueOf(1.5f));
! editableMap.put(2, "two");
}
// Boolean
@Override
public boolean getPrimitiveBoolean() {
*** 721,733 ****
}
@Override
public Collection<Object> getReadOnlyObjectCollection() {
Collection<Object> c = new ArrayList<>();
! c.add("one"); //$NON-NLS-1$
! c.add("two"); //$NON-NLS-1$
! c.add("three"); //$NON-NLS-1$
return c;
}
@Override
public Collection<Object> getReadOnlyNullCollection() {
--- 721,733 ----
}
@Override
public Collection<Object> getReadOnlyObjectCollection() {
Collection<Object> c = new ArrayList<>();
! c.add("one");
! c.add("two");
! c.add("three");
return c;
}
@Override
public Collection<Object> getReadOnlyNullCollection() {
*** 770,780 ****
* public Class<? extends TestMBean> getUneditableClass() { return getClass(); }
*/
@Override
public TestContainer getUneditableTestContainer() {
! return new TestContainer(new String[] {"this", "is", "an", "opaque", "object"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
@Override
public TestableMBean[] getUneditableArray() {
return new TestableMBean[] {this};
--- 770,780 ----
* public Class<? extends TestMBean> getUneditableClass() { return getClass(); }
*/
@Override
public TestContainer getUneditableTestContainer() {
! return new TestContainer(new String[] {"this", "is", "an", "opaque", "object"});
}
@Override
public TestableMBean[] getUneditableArray() {
return new TestableMBean[] {this};
*** 825,837 ****
while (!stop) {
synchronized (this) {
long oldLastTime = lastTime;
lastTime = System.currentTimeMillis();
// System.out.println("Current time: " + getAliveTime());
! sendNotification(new AttributeChangeNotification(this, sequenceNumber++, lastTime, "Update", //$NON-NLS-1$
! "AliveTime", "long", Long.valueOf(oldLastTime - startTime), //$NON-NLS-1$ //$NON-NLS-2$
! Long.valueOf(lastTime - startTime))); //$NON-NLS-1$ //$NON-NLS-2$
try {
wait(Math.max(1, updateTime));
} catch (InterruptedException e) {
}
}
--- 825,837 ----
while (!stop) {
synchronized (this) {
long oldLastTime = lastTime;
lastTime = System.currentTimeMillis();
// System.out.println("Current time: " + getAliveTime());
! sendNotification(new AttributeChangeNotification(this, sequenceNumber++, lastTime, "Update",
! "AliveTime", "long", Long.valueOf(oldLastTime - startTime),
! Long.valueOf(lastTime - startTime)));
try {
wait(Math.max(1, updateTime));
} catch (InterruptedException e) {
}
}
*** 865,875 ****
}
@Override
public boolean killExistingHelloMBean(String name) {
try {
! ObjectName mbeanName = new ObjectName("SimpleAgent:name=" + name); //$NON-NLS-1$
ManagementFactory.getPlatformMBeanServer().unregisterMBean(mbeanName);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
--- 865,875 ----
}
@Override
public boolean killExistingHelloMBean(String name) {
try {
! ObjectName mbeanName = new ObjectName("SimpleAgent:name=" + name);
ManagementFactory.getPlatformMBeanServer().unregisterMBean(mbeanName);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
*** 880,890 ****
public boolean startNewHelloMBeanWithType(String name, String type) {
Testable test = new Testable();
ObjectName mbeanName = null;
try {
! mbeanName = new ObjectName("SimpleAgent:name=" + name + ',' + type); //$NON-NLS-1$
ManagementFactory.getPlatformMBeanServer().registerMBean(test, mbeanName);
return true;
} catch (Exception e) {
e.printStackTrace();
test.stop = true;
--- 880,890 ----
public boolean startNewHelloMBeanWithType(String name, String type) {
Testable test = new Testable();
ObjectName mbeanName = null;
try {
! mbeanName = new ObjectName("SimpleAgent:name=" + name + ',' + type);
ManagementFactory.getPlatformMBeanServer().registerMBean(test, mbeanName);
return true;
} catch (Exception e) {
e.printStackTrace();
test.stop = true;
*** 892,902 ****
}
}
@Override
public boolean startNewHelloMBean(String name) {
! return startNewHelloMBeanWithType(name, "type=added"); //$NON-NLS-1$
}
@Override
public boolean startManyNewHelloMBean(String name, int number) {
for (int i = 0; i < number; i += 1) {
--- 892,902 ----
}
}
@Override
public boolean startNewHelloMBean(String name) {
! return startNewHelloMBeanWithType(name, "type=added");
}
@Override
public boolean startManyNewHelloMBean(String name, int number) {
for (int i = 0; i < number; i += 1) {
*** 914,923 ****
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
String[] types = new String[] {AttributeChangeNotification.ATTRIBUTE_CHANGE};
String name = AttributeChangeNotification.class.getName();
! String description = "An attribute of this MBean has changed"; //$NON-NLS-1$
MBeanNotificationInfo info = new MBeanNotificationInfo(types, name, description);
return new MBeanNotificationInfo[] {info};
}
}
--- 914,923 ----
@Override
public MBeanNotificationInfo[] getNotificationInfo() {
String[] types = new String[] {AttributeChangeNotification.ATTRIBUTE_CHANGE};
String name = AttributeChangeNotification.class.getName();
! String description = "An attribute of this MBean has changed";
MBeanNotificationInfo info = new MBeanNotificationInfo(types, name, description);
return new MBeanNotificationInfo[] {info};
}
}
< prev index next >