dont test creating of registry keys by default
This commit is contained in:
parent
3461d15b4c
commit
2a148decc1
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue