diff --git a/bindings/java/src/net/hyperic/sigar/win32/test/TestRegistryKey.java b/bindings/java/src/net/hyperic/sigar/win32/test/TestRegistryKey.java index b651c1df..73272d0b 100644 --- a/bindings/java/src/net/hyperic/sigar/win32/test/TestRegistryKey.java +++ b/bindings/java/src/net/hyperic/sigar/win32/test/TestRegistryKey.java @@ -5,15 +5,27 @@ import net.hyperic.sigar.win32.RegistryKey; public class TestRegistryKey extends TestCase { + private static final boolean TEST_WRITE = false; + public TestRegistryKey(String name) { super(name); } - public void testRegistryKey() throws Exception { + public void testRegistryRead() throws Exception { + RegistryKey software = + RegistryKey.LocalMachine.openSubKey("SOFTWARE"); + String[] keys = software.getSubKeyNames(); + assertTrue(keys.length > 0); + } + //dont want to be writing to the registry + public void testRegistryWrite() throws Exception { + if (!TEST_WRITE) { + return; + } RegistryKey key = RegistryKey.LocalMachine. - createSubKey("SOFTWARE\\Covalent\\Test", "Covalent Test"); - + createSubKey("SOFTWARE\\Hyperic\\Test", "Hyperic Test"); + key.setStringValue("TestString", "Hello World"); key.setIntValue("Test Int", 100); @@ -24,7 +36,7 @@ public class TestRegistryKey extends TestCase { int iValue = key.getIntValue(astrNames[1]); //assertTrue(iValue == 100); - key = RegistryKey.LocalMachine.openSubKey("SOFTWARE\\Covalent"); + key = RegistryKey.LocalMachine.openSubKey("SOFTWARE\\Hyperic"); astrNames = key.getSubKeyNames(); // Clean up