mirror of
https://github.com/torproject/metrics-lib.git
synced 2024-12-02 15:06:29 +00:00
The bool in hibernating lines is 0/1, not false/true.
This commit is contained in:
parent
a42848728f
commit
055e8fde32
@ -204,9 +204,9 @@ public class RelayServerDescriptorImpl extends DescriptorImpl
|
||||
if (partsNoOpt.length != 2) {
|
||||
throw new DescriptorParseException("Illegal line '" + line + "'.");
|
||||
}
|
||||
if (partsNoOpt[1].equals("true")) {
|
||||
if (partsNoOpt[1].equals("1")) {
|
||||
this.hibernating = true;
|
||||
} else if (partsNoOpt[1].equals("false")) {
|
||||
} else if (partsNoOpt[1].equals("0")) {
|
||||
this.hibernating = false;
|
||||
} else {
|
||||
throw new DescriptorParseException("Illegal line '" + line + "'.");
|
||||
|
@ -316,7 +316,7 @@ public class RelayServerDescriptorImplTest {
|
||||
@Test(expected = DescriptorParseException.class)
|
||||
public void testRouterLinePrecedingHibernatingLine()
|
||||
throws DescriptorParseException {
|
||||
DescriptorBuilder.createWithRouterLine("hibernating true\nrouter "
|
||||
DescriptorBuilder.createWithRouterLine("hibernating 1\nrouter "
|
||||
+ "saberrider2008 94.134.192.243 9001 0 0");
|
||||
}
|
||||
|
||||
@ -779,21 +779,21 @@ public class RelayServerDescriptorImplTest {
|
||||
@Test()
|
||||
public void testHibernatingOpt() throws DescriptorParseException {
|
||||
RelayServerDescriptor descriptor = DescriptorBuilder.
|
||||
createWithHibernatingLine("opt hibernating true");
|
||||
createWithHibernatingLine("opt hibernating 1");
|
||||
assertTrue(descriptor.isHibernating());
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void testHibernatingFalse() throws DescriptorParseException {
|
||||
RelayServerDescriptor descriptor = DescriptorBuilder.
|
||||
createWithHibernatingLine("hibernating false");
|
||||
createWithHibernatingLine("hibernating 0");
|
||||
assertFalse(descriptor.isHibernating());
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void testHibernatingTrue() throws DescriptorParseException {
|
||||
RelayServerDescriptor descriptor = DescriptorBuilder.
|
||||
createWithHibernatingLine("hibernating true");
|
||||
createWithHibernatingLine("hibernating 1");
|
||||
assertTrue(descriptor.isHibernating());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user