protected Object createObject() throws SAXException { return new ObjectInstance(objectName, className); } }
/** * Utility method to convert this <code>ObjectInstance</code> to a * <code>javax.management.ObjectInstance</code> instance. * * @return A JMX <code>ObjectInstance</code> based upon this instance. * @throws MalformedObjectNameException an exception */ public javax.management.ObjectInstance toObjectInstance() throws MalformedObjectNameException { return new javax.management.ObjectInstance(objectName.toObjectName(), className); } }
/** * Utility method to convert this <code>ObjectInstance</code> to a * <code>javax.management.ObjectInstance</code> instance. * * @return A JMX <code>ObjectInstance</code> based upon this instance. */ public javax.management.ObjectInstance toObjectInstance() throws MalformedObjectNameException { return new javax.management.ObjectInstance(objectName.toObjectName(), className); } }
@Override public boolean onResource(ObjectName resourceName) { if (name == null || name.apply(resourceName)) { set.add(new ObjectInstance(resourceName, CLASS_NAME)); } return true; }
ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException { if (resolvePathAddress(name) == null) { throw createInstanceNotFoundException(name); } return new ObjectInstance(name, CLASS_NAME); }
/** * We replace ourself with an ObjectInstance in the stream. * This loses the agentId which isn't part of the spec. * * @return an ObjectInstance version of ourself * @exception ObjectStreamException for a serialization error */ private Object writeReplace() throws ObjectStreamException { return new ObjectInstance(getObjectName(), getClassName()); }
@Override public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException { DynamicMBean mbean = getMBean(name); return new ObjectInstance(name, mbean.getMBeanInfo().getClassName()); }
ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException { final PathAddress address = resolvePathAddress(name); if (address == null) { throw MESSAGES.mbeanNotFound(name); } accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(name, address, false); return new ObjectInstance(name, CLASS_NAME); }
@Override public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException { DynamicMBean mbean = getMBean(name); return new ObjectInstance(name, mbean.getMBeanInfo().getClassName()); }
@Test public void testQEntryGetDeployed() throws Throwable { long result = new Q2.QEntry(0L, new ObjectInstance( new ObjectName("testQEntryParam1", "testQEntryParam2", "testQEntryParam3"), "testQEntryParam2")).getDeployed(); assertEquals("result", 0L, result); }
@Test public void testQEntryGetDeployed1() throws Throwable { long result = new Q2.QEntry(100L, new ObjectInstance(new ObjectName("testQEntryParam1", "testQEntryParam2", "testQEntryParam3"), "testQEntryParam2")).getDeployed(); assertEquals("result", 100L, result); }
@Test public void testQEntryIsQPersist1() throws Throwable { boolean result = new Q2.QEntry(100L, new ObjectInstance(new ObjectName("testQEntryParam1", "testQEntryParam2", "testQEntryParam3"), "testQEntryParam2")).isQPersist(); assertFalse("result", result); }
@Test public void testQEntryIsQBean() throws Throwable { boolean result = new Q2.QEntry(100L, new ObjectInstance(new ObjectName("testQEntryParam1", "testQEntryParam2", "testQEntryParam3"), "testQEntryParam2")).isQBean(); assertFalse("result", result); }
@Test public void testQEntrySetObject() throws Throwable { Q2.QEntry qEntry = new Q2.QEntry(100L, new ObjectInstance(new ObjectName("testQEntryParam1", "testQEntryParam2", "testQEntryParam3"), "testQEntryParam2")); qEntry.setObject(""); assertEquals("qEntry.obj", "", qEntry.obj); }
@Test public void testQEntryGetObject1() throws Throwable { Q2.QEntry qEntry = new Q2.QEntry(100L, new ObjectInstance(new ObjectName("testQEntryParam1", "testQEntryParam2", "testQEntryParam3"), "testQEntryParam2")); Object obj = new Object(); qEntry.setObject(obj); Object result = qEntry.getObject(); assertSame("result", obj, result); }
@Test public void testQEntryGetObjectName1() throws Throwable { ObjectName objectName = new ObjectName("testQEntryParam1", "testQEntryParam2", "testQEntryParam3"); ObjectName result = new Q2.QEntry(100L, new ObjectInstance(objectName, "testQEntryParam2")).getObjectName(); assertSame("result", objectName, result); }
@Test public void testQEntryIsQBean1() throws Throwable { Q2.QEntry qEntry = new Q2.QEntry(100L, new ObjectInstance(new ObjectName("testQEntryParam1", "testQEntryParam2", "testQEntryParam3"), "testQEntryParam2")); qEntry.setObject(new SystemMonitor()); boolean result = qEntry.isQBean(); assertTrue("result", result); }
@Test public void testQEntryConstructor() throws Throwable { ObjectInstance instance = new ObjectInstance(new ObjectName("testQEntryParam1", "testQEntryParam2", "testQEntryParam3"), "testQEntryParam2"); Q2.QEntry qEntry = new Q2.QEntry(100L, instance); assertEquals("qEntry.deployed", 100L, qEntry.deployed); assertSame("qEntry.instance", instance, qEntry.instance); }
@Test public void testQEntryGetInstance() throws Throwable { ObjectInstance instance = new ObjectInstance(new ObjectName("testQEntryParam1", "testQEntryParam2", "testQEntryParam3"), "testQEntryParam2"); ObjectInstance result = new Q2.QEntry(100L, instance).getInstance(); assertSame("result", instance, result); }
@Test public void testQEntrySetInstance() throws Throwable { ObjectInstance instance = new ObjectInstance(new ObjectName("testQEntryParam1", "testQEntryParam2", "testQEntryParam3"), "testQEntryParam2"); Q2.QEntry qEntry = new Q2.QEntry(100L, instance); qEntry.setInstance(instance); assertSame("qEntry.instance", instance, qEntry.instance); }