dont test creating of registry keys by default

This commit is contained in:
Doug MacEachern 2004-11-21 01:22:37 +00:00
parent 3461d15b4c
commit 2a148decc1
1 changed files with 16 additions and 4 deletions

View File

@ -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