Search in sources :

Example 46 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project app-maven-plugin by GoogleCloudPlatform.

the class AbstractDevServerTest method setUpAppEngineWebXml.

protected void setUpAppEngineWebXml() throws IOException {
    TemporaryFolder tempFolder = new TemporaryFolder();
    tempFolder.create();
    File webInf = tempFolder.newFolder("build", "artifact", "WEB-INF");
    new File(webInf, "appengine-web.xml").createNewFile();
    when(mavenProjectMock.getBuild()).thenReturn(mock(Build.class));
    when(mavenProjectMock.getBuild().getDirectory()).thenReturn(webInf.getParentFile().getParentFile().getAbsolutePath());
    when(mavenProjectMock.getBuild().getFinalName()).thenReturn("artifact");
}
Also used : Build(org.apache.maven.model.Build) TemporaryFolder(org.junit.rules.TemporaryFolder) File(java.io.File)

Example 47 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project xodus by JetBrains.

the class JMH_MVStoreTokyoCabinetBenchmarkBase method createEnvironment.

private void createEnvironment() throws IOException {
    closeStore();
    temporaryFolder = new TemporaryFolder();
    temporaryFolder.create();
    store = new MVStore.Builder().fileName(temporaryFolder.newFile("data").getAbsolutePath()).autoCommitDisabled().open();
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder)

Example 48 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 49 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)

Example 50 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project flink by apache.

the class LolCacheFactory method create.

@Override
public DownloadCache create() throws IOException {
    final TemporaryFolder folder = new TemporaryFolder();
    folder.create();
    return new LolCache(folder);
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder)

Aggregations

TemporaryFolder (org.junit.rules.TemporaryFolder)106 File (java.io.File)40 Before (org.junit.Before)28 Test (org.junit.Test)28 BeforeClass (org.junit.BeforeClass)13 URL (java.net.URL)7 Path (java.nio.file.Path)7 IOException (java.io.IOException)5 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 ByteArrayInputStream (java.io.ByteArrayInputStream)2 URISyntaxException (java.net.URISyntaxException)2 BdpDataPlanePlugin (org.batfish.bdp.BdpDataPlanePlugin)2 Batfish (org.batfish.main.Batfish)2 NotNull (org.jetbrains.annotations.NotNull)2 DefaultSafeModeManager (alluxio.master.DefaultSafeModeManager)1 InMemoryReferenceSequenceFile (au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile)1 SynchronousReferenceLookupAdapter (au.edu.wehi.idsv.picard.SynchronousReferenceLookupAdapter)1