/** * Register the specified management object. * * @param name the name of the object. * @param obj the management object. */ public static void register(String name, Object obj) { if (mbeanServer == null) return; runOrEnqueueCommand(new ManagementRegisterCommand(name, obj)); }
/** * Unregister the management object with the specified name. * * @param name the name of the object. */ public static void unregister(String name) { if (mbeanServer == null) return; runOrEnqueueCommand(new ManagementUnregisterCommand(name)); }
public void testEquals() throws Exception { Uid uid1 = UidGenerator.generateUid(); Uid uid2 = UidGenerator.generateUid(); Uid uid3 = null; assertFalse(uid1.equals(uid2)); assertFalse(uid2.equals(uid3)); assertTrue(uid2.equals(uid2)); }
public void testHexaStringEncoder() throws Exception { byte[] result = Encoder.intToBytes(0x80); String hexString = new Uid(result).toString(); assertEquals("00000080", hexString); result = Encoder.longToBytes(0x81); hexString = new Uid(result).toString(); assertEquals("0000000000000081", hexString); result = Encoder.shortToBytes((short) 0xff); hexString = new Uid(result).toString(); assertEquals("00FF", hexString); }
public void testSetClonedProperties() throws Exception { Destination destination = new Destination(); PropertyUtils.setProperty(destination, "clonedProps.key", "value"); assertEquals("value", destination.getClonedProps().getProperty("key")); }
public void testSetMultipleProperties() throws Exception { Destination destination = new Destination(); PropertyUtils.setProperty(destination, "props.key1", "value1"); PropertyUtils.setProperty(destination, "props.key2", "value2"); assertEquals("value1", destination.getProps().getProperty("key1")); assertEquals("value2", destination.getProps().getProperty("key2")); }
public void testCrypt() throws Exception { String textToCrypt = "java"; String cypherText = CryptoEngine.crypt("DES", textToCrypt); String decryptedText = CryptoEngine.decrypt("DES", cypherText); assertEquals(textToCrypt, decryptedText); }
public void testSetPropertiesObjectLongKey() throws Exception { PrivateDestination destination = new PrivateDestination(); PropertyUtils.setProperty(destination, "props.key", "value1"); PropertyUtils.setProperty(destination, "props.a.dotted.key", "value2"); assertEquals("value1", destination.getProps().get("key")); assertEquals("value2", destination.getProps().get("a.dotted.key")); }
public void testHexaStringEncoder() throws Exception { byte[] result = Encoder.intToBytes(0x80); String hexString = new Uid(result).toString(); assertEquals("00000080", hexString); result = Encoder.longToBytes(0x81); hexString = new Uid(result).toString(); assertEquals("0000000000000081", hexString); result = Encoder.shortToBytes((short) 0xff); hexString = new Uid(result).toString(); assertEquals("00FF", hexString); }
public void testSetClonedProperties() throws Exception { Destination destination = new Destination(); PropertyUtils.setProperty(destination, "clonedProps.key", "value"); assertEquals("value", destination.getClonedProps().getProperty("key")); }
public void testEquals() throws Exception { Uid uid1 = UidGenerator.generateUid(); Uid uid2 = UidGenerator.generateUid(); Uid uid3 = null; assertFalse(uid1.equals(uid2)); assertFalse(uid2.equals(uid3)); assertTrue(uid2.equals(uid2)); }
public void testSetMultipleProperties() throws Exception { Destination destination = new Destination(); PropertyUtils.setProperty(destination, "props.key1", "value1"); PropertyUtils.setProperty(destination, "props.key2", "value2"); assertEquals("value1", destination.getProps().getProperty("key1")); assertEquals("value2", destination.getProps().getProperty("key2")); }
public void testCrypt() throws Exception { String textToCrypt = "java"; String cypherText = CryptoEngine.crypt("DES", textToCrypt); String decryptedText = CryptoEngine.decrypt("DES", cypherText); assertEquals(textToCrypt, decryptedText); }
/** * Register the specified management object. * * @param name the name of the object. * @param obj the management object. */ public static void register(String name, Object obj) { if (mbeanServer == null) return; runOrEnqueueCommand(new ManagementRegisterCommand(name, obj)); }
/** * Unregister the management object with the specified name. * * @param name the name of the object. */ public static void unregister(String name) { if (mbeanServer == null) return; runOrEnqueueCommand(new ManagementUnregisterCommand(name)); }
public void testSetMultipleClonedProperties() throws Exception { Destination destination = new Destination(); PropertyUtils.setProperty(destination, "clonedProps.key1", "value1"); PropertyUtils.setProperty(destination, "clonedProps.key2", "value2"); assertEquals("value1", destination.getClonedProps().getProperty("key1")); assertEquals("value2", destination.getClonedProps().getProperty("key2")); }
public void testSetPropertiesDirectly() throws Exception { Destination destination = new Destination(); Properties p = new Properties(); p.setProperty("key", "value"); PropertyUtils.setProperty(destination, "props", p); assertEquals("value", destination.getProps().getProperty("key")); }
public void testSetMultipleClonedProperties() throws Exception { Destination destination = new Destination(); PropertyUtils.setProperty(destination, "clonedProps.key1", "value1"); PropertyUtils.setProperty(destination, "clonedProps.key2", "value2"); assertEquals("value1", destination.getClonedProps().getProperty("key1")); assertEquals("value2", destination.getClonedProps().getProperty("key2")); }
public void testSetClonedPropertiesDirectly() throws Exception { Destination destination = new Destination(); Properties p = new Properties(); p.setProperty("key", "value"); PropertyUtils.setProperty(destination, "clonedProps", p); assertEquals("value", destination.getClonedProps().getProperty("key")); }
public void testSetClonedPropertiesDirectly() throws Exception { Destination destination = new Destination(); Properties p = new Properties(); p.setProperty("key", "value"); PropertyUtils.setProperty(destination, "clonedProps", p); assertEquals("value", destination.getClonedProps().getProperty("key")); }