Search in sources :

Example 56 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project druid by druid-io.

the class ProcCgroupDiscovererTest method testFallBack.

@Test
public void testFallBack() throws Exception {
    TemporaryFolder temporaryFolder = new TemporaryFolder();
    temporaryFolder.create();
    File cgroupDir = temporaryFolder.newFolder();
    File procDir = temporaryFolder.newFolder();
    TestUtils.setUpCgroups(procDir, cgroupDir);
    // Swap out the cgroup path with a default path
    FileUtils.deleteDirectory(new File(cgroupDir, "cpu,cpuacct/"));
    Assert.assertTrue(new File(cgroupDir, "cpu,cpuacct/").mkdir());
    Assert.assertEquals(new File(cgroupDir, "cpu,cpuacct").toPath(), new ProcCgroupDiscoverer(procDir.toPath()).discover("cpu"));
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) File(java.io.File) Test(org.junit.Test)

Example 57 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project batfish by batfish.

the class NodJobChunkingTest method setupDataPlane.

private void setupDataPlane() throws IOException {
    TemporaryFolder tmp = new TemporaryFolder();
    tmp.create();
    Batfish batfish = BatfishTestUtils.getBatfish(_configs, tmp);
    BdpDataPlanePlugin bdpDataPlanePlugin = new BdpDataPlanePlugin();
    bdpDataPlanePlugin.initialize(batfish);
    batfish.registerDataPlanePlugin(bdpDataPlanePlugin, "bdp");
    batfish.computeDataPlane(false);
    _dataPlane = batfish.loadDataPlane();
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) BdpDataPlanePlugin(org.batfish.bdp.BdpDataPlanePlugin) Batfish(org.batfish.main.Batfish)

Example 58 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project batfish by batfish.

the class BatfishCompressionTest method compressNetwork.

private SortedMap<String, Configuration> compressNetwork(Map<String, Configuration> configs, HeaderSpace headerSpace) throws IOException {
    TemporaryFolder tmp = new TemporaryFolder();
    tmp.create();
    IBatfish batfish = BatfishTestUtils.getBatfish(new TreeMap<>(configs), tmp);
    return new TreeMap<>(new BatfishCompressor(batfish, configs).compress(headerSpace));
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) TreeMap(java.util.TreeMap) IBatfish(org.batfish.common.plugin.IBatfish)

Example 59 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project junit4 by junit-team.

the class TempFolderRuleTest method recursiveDeleteFolderWithZeroElements.

@Test
public void recursiveDeleteFolderWithZeroElements() throws IOException {
    TemporaryFolder folder = new TemporaryFolder();
    folder.create();
    folder.delete();
    assertFalse(folder.getRoot().exists());
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) Test(org.junit.Test)

Example 60 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project buck by facebook.

the class RuleKeyLoggerListenerTest method setUp.

@Before
public void setUp() throws IOException {
    tempDirectory = new TemporaryFolder();
    tempDirectory.create();
    projectFilesystem = new ProjectFilesystem(tempDirectory.getRoot().toPath());
    outputExecutor = MostExecutors.newSingleThreadExecutor(new CommandThreadFactory(getClass().getName()));
    info = InvocationInfo.of(new BuildId(), false, false, "topspin", tempDirectory.getRoot().toPath());
    durationTracker = new BuildRuleDurationTracker();
}
Also used : BuildId(com.facebook.buck.model.BuildId) TemporaryFolder(org.junit.rules.TemporaryFolder) CommandThreadFactory(com.facebook.buck.log.CommandThreadFactory) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) BuildRuleDurationTracker(com.facebook.buck.rules.BuildRuleDurationTracker) Before(org.junit.Before)

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