use of io.atomix.primitive.partition.TestPrimaryElection in project atomix by atomix.
the class PrimaryBackupTest method clearTests.
@Before
@After
public void clearTests() throws Exception {
Futures.allOf(servers.stream().map(s -> s.stop().exceptionally(v -> null)).collect(Collectors.toList())).get(30, TimeUnit.SECONDS);
Futures.allOf(clients.stream().map(c -> c.close().exceptionally(v -> null)).collect(Collectors.toList())).get(30, TimeUnit.SECONDS);
nodes = new ArrayList<>();
memberId = 0;
sessionId = 0;
clients = new ArrayList<>();
servers = new ArrayList<>();
protocolFactory = new TestPrimaryBackupProtocolFactory();
election = new TestPrimaryElection(PartitionId.from("test", 1));
}
use of io.atomix.primitive.partition.TestPrimaryElection in project atomix by atomix.
the class DistributedLogTest method clearTests.
@Before
@After
public void clearTests() throws Exception {
Futures.allOf(servers.stream().map(s -> s.stop().exceptionally(v -> null)).collect(Collectors.toList())).get(30, TimeUnit.SECONDS);
Futures.allOf(clients.stream().map(c -> c.close().exceptionally(v -> null)).collect(Collectors.toList())).get(30, TimeUnit.SECONDS);
Path directory = Paths.get("target/test-logs/");
if (Files.exists(directory)) {
Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
}
nodes = new ArrayList<>();
memberId = 0;
sessionId = 0;
clients = new ArrayList<>();
servers = new ArrayList<>();
protocolFactory = new TestLogProtocolFactory();
election = new TestPrimaryElection(PartitionId.from("test", 1));
}
Aggregations