Search in sources :

Example 21 with TemporaryFolder

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();
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) RocksDBPersistenceProvider(com.iota.iri.storage.rocksDB.RocksDBPersistenceProvider) BeforeClass(org.junit.BeforeClass)

Example 22 with TemporaryFolder

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();
    }
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) API(com.iota.iri.service.API)

Example 23 with TemporaryFolder

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();
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) RocksDBPersistenceProvider(com.iota.iri.storage.rocksDB.RocksDBPersistenceProvider) Before(org.junit.Before)

Example 24 with TemporaryFolder

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;
}
Also used : TestRule(org.junit.rules.TestRule) TemporaryFolder(org.junit.rules.TemporaryFolder) ExternalResource(org.junit.rules.ExternalResource)

Example 25 with TemporaryFolder

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();
        }
    }
}
Also used : DistributedCache(org.apache.flink.api.common.cache.DistributedCache) TestRestServerEndpoint(org.apache.flink.runtime.rest.util.TestRestServerEndpoint) TemporaryFolder(org.junit.rules.TemporaryFolder) File(java.io.File) Test(org.junit.Test)

Aggregations

TemporaryFolder (org.junit.rules.TemporaryFolder)88 File (java.io.File)33 Test (org.junit.Test)25 Before (org.junit.Before)24 BeforeClass (org.junit.BeforeClass)13 Path (java.nio.file.Path)7 URL (java.net.URL)6 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 UserState (alluxio.security.user.UserState)2 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)2 RocksDBPersistenceProvider (com.iota.iri.storage.rocksDB.RocksDBPersistenceProvider)2 DocumentMetaData (de.tudarmstadt.ukp.dkpro.core.api.metadata.type.DocumentMetaData)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 URISyntaxException (java.net.URISyntaxException)2 BdpDataPlanePlugin (org.batfish.bdp.BdpDataPlanePlugin)2 Batfish (org.batfish.main.Batfish)2 DefaultSafeModeManager (alluxio.master.DefaultSafeModeManager)1 InMemoryReferenceSequenceFile (au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile)1 SynchronousReferenceLookupAdapter (au.edu.wehi.idsv.picard.SynchronousReferenceLookupAdapter)1