Skip to content

Commit 422008e

Browse files
committed
fix unit test error
1 parent 9f64f6b commit 422008e

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

src/test/java/org/tron/gossip/GossipTest.java

+24-23
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,38 @@
1515

1616
package org.tron.gossip;
1717

18-
import java.util.concurrent.Semaphore;
19-
import java.util.concurrent.TimeUnit;
2018
import org.junit.Assert;
2119
import org.junit.BeforeClass;
2220
import org.junit.Test;
23-
import org.tron.gossip.example.StandNode;
21+
import org.tron.gossip.example.LocalNode;
2422
import org.tron.overlay.message.Message;
2523
import org.tron.overlay.message.Type;
2624

25+
import java.util.concurrent.Semaphore;
26+
import java.util.concurrent.TimeUnit;
27+
2728
public class GossipTest {
28-
private final static String CLUSTER = "mycluster";
29-
private static StandNode standNode = null;
30-
private Semaphore lock = new Semaphore(0);
31-
private Object sharedData = null;
29+
private final static String CLUSTER = "mycluster";
30+
private static LocalNode standNode = null;
31+
private Semaphore lock = new Semaphore(0);
32+
private Object sharedData = null;
3233

33-
@BeforeClass
34-
public static void init() {
35-
standNode = new StandNode(CLUSTER, "udp://localhost:10000", "0");
36-
}
34+
@BeforeClass
35+
public static void init() {
36+
standNode = new LocalNode(CLUSTER, "udp://localhost:10000", "0");
37+
}
3738

38-
@Test
39-
public void testGossipBroadcast() throws InterruptedException {
40-
standNode.getGossipManager().registerSharedDataSubscriber((key, oldValue, newValue) -> {
41-
if (key.equals("block")) {
42-
sharedData = newValue;
43-
}
44-
});
39+
@Test
40+
public void testGossipBroadcast() throws InterruptedException {
41+
standNode.getGossipManager().registerSharedDataSubscriber((key, oldValue, newValue) -> {
42+
if (key.equals("block")) {
43+
sharedData = newValue;
44+
}
45+
});
4546

46-
Message message = new Message("test", Type.BLOCK);
47-
standNode.broadcast(message);
48-
lock.tryAcquire(10, TimeUnit.SECONDS);
49-
Assert.assertEquals("test", sharedData);
50-
}
47+
Message message = new Message("test", Type.BLOCK);
48+
standNode.broadcast(message);
49+
lock.tryAcquire(10, TimeUnit.SECONDS);
50+
Assert.assertEquals("test", sharedData);
51+
}
5152
}

0 commit comments

Comments
 (0)