use of org.junit.rules.TemporaryFolder in project iri by iotaledger.
the class BundleValidatorTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
TemporaryFolder dbFolder = new TemporaryFolder();
TemporaryFolder logFolder = new TemporaryFolder();
dbFolder.create();
logFolder.create();
tangle.addPersistenceProvider(new RocksDBPersistenceProvider(dbFolder.getRoot().getAbsolutePath(), logFolder.getRoot().getAbsolutePath(), 1000));
tangle.init();
}
use of org.junit.rules.TemporaryFolder in project iri by iotaledger.
the class NodeIntegrationTests method testGetsSolid.
// @Test
public void testGetsSolid() throws Exception {
int count = 1;
long spacing = 5000;
Iota[] iotaNodes = new Iota[count];
API[] api = new API[count];
IXI[] ixi = new IXI[count];
Thread cooThread, master;
TemporaryFolder[] folders = new TemporaryFolder[count * 2];
for (int i = 0; i < count; i++) {
folders[i * 2] = new TemporaryFolder();
folders[i * 2 + 1] = new TemporaryFolder();
iotaNodes[i] = newNode(i, folders[i * 2], folders[i * 2 + 1]);
ixi[i] = new IXI(iotaNodes[i]);
ixi[i].init(iotaNodes[i].configuration.string(Configuration.DefaultConfSettings.IXI_DIR));
api[i] = new API(iotaNodes[i], ixi[i]);
api[i].init();
}
Node.uri("udp://localhost:14701").ifPresent(uri -> iotaNodes[0].node.addNeighbor(iotaNodes[0].node.newNeighbor(uri, true)));
// Node.uri("udp://localhost:14700").ifPresent(uri -> iotaNodes[1].node.addNeighbor(iotaNodes[1].node.newNeighbor(uri, true)));
cooThread = new Thread(spawnCoordinator(api[0], spacing), "Coordinator");
master = new Thread(spawnMaster(), "master");
/*
TODO: Put some test stuff here
*/
cooThread.start();
master.start();
synchronized (waitObj) {
waitObj.wait();
}
for (int i = 0; i < count; i++) {
ixi[i].shutdown();
api[i].shutDown();
iotaNodes[i].shutdown();
}
for (TemporaryFolder folder : folders) {
folder.delete();
}
}
use of org.junit.rules.TemporaryFolder in project iri by iotaledger.
the class TangleTest method setUp.
@Before
public void setUp() throws Exception {
TemporaryFolder dbFolder = new TemporaryFolder(), logFolder = new TemporaryFolder();
dbFolder.create();
logFolder.create();
RocksDBPersistenceProvider rocksDBPersistenceProvider;
rocksDBPersistenceProvider = new RocksDBPersistenceProvider(dbFolder.getRoot().getAbsolutePath(), logFolder.getRoot().getAbsolutePath(), 1000);
tangle.addPersistenceProvider(rocksDBPersistenceProvider);
tangle.init();
}
use of org.junit.rules.TemporaryFolder in project flink by apache.
the class FlinkEmbeddedHiveRunner method classRules.
@Override
protected List<TestRule> classRules() {
// need to load hive runner config before the context is inited
loadAnnotatesHiveRunnerConfig(getTestClass().getJavaClass());
final TemporaryFolder temporaryFolder = new TemporaryFolder();
context = new FlinkEmbeddedHiveServerContext(temporaryFolder, config);
List<TestRule> rules = super.classRules();
ExternalResource hiveShell = new ExternalResource() {
@Override
protected void before() throws Throwable {
container = createHiveServerContainer(getTestClass().getJavaClass(), context);
}
@Override
protected void after() {
tearDown();
}
};
rules.add(hiveShell);
rules.add(temporaryFolder);
return rules;
}
use of org.junit.rules.TemporaryFolder in project flink by apache.
the class RestClusterClientTest method testJobSubmissionWithUserArtifact.
@Test(timeout = 120_000)
public void testJobSubmissionWithUserArtifact() throws Exception {
try (final TestRestServerEndpoint restServerEndpoint = createRestServerEndpoint(new TestJobSubmitHandler())) {
try (RestClusterClient<?> restClusterClient = createRestClusterClient(restServerEndpoint.getServerAddress().getPort())) {
TemporaryFolder temporaryFolder = new TemporaryFolder();
temporaryFolder.create();
File file = temporaryFolder.newFile();
Files.write(file.toPath(), "hello world".getBytes(ConfigConstants.DEFAULT_CHARSET));
// Add file path with scheme
jobGraph.addUserArtifact("file", new DistributedCache.DistributedCacheEntry(file.toURI().toString(), false));
// Add file path without scheme
jobGraph.addUserArtifact("file2", new DistributedCache.DistributedCacheEntry(file.toURI().getPath(), false));
restClusterClient.submitJob(jobGraph).get();
}
}
}
Aggregations