Search in sources :

Example 31 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project indy by Commonjava.

the class TestProvider method setup.

@PostConstruct
public void setup() {
    storeDataManager = new MemoryStoreDataManager(true);
    nfc = new MemoryNotFoundCache();
    objectMapper = new IndyObjectMapper(false);
    fileEventManager = new NoOpFileEventManager();
    transferDecorator = new NoOpTransferDecorator();
    transportManagerConfig = new TransportManagerConfig();
    weftConfig = new DefaultWeftConfig();
    globalHttpConfiguration = new GlobalHttpConfiguration();
    userLifecycleManager = new AlternativeUserLifecycleManager();
    temp = new TemporaryFolder();
    try {
        temp.create();
        cacheProvider = new FileCacheProvider(temp.newFolder("storage"), indyPathGenerator, fileEventManager, new TransferDecoratorManager(transferDecorator));
    } catch (IOException e) {
        fail("Cannot initialize temporary directory structure");
        temp.delete();
    }
}
Also used : FileCacheProvider(org.commonjava.maven.galley.cache.FileCacheProvider) NoOpTransferDecorator(org.commonjava.maven.galley.io.NoOpTransferDecorator) DefaultWeftConfig(org.commonjava.cdi.util.weft.config.DefaultWeftConfig) TransportManagerConfig(org.commonjava.maven.galley.config.TransportManagerConfig) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) IOException(java.io.IOException) NoOpFileEventManager(org.commonjava.maven.galley.event.NoOpFileEventManager) AlternativeUserLifecycleManager(org.commonjava.indy.action.fixture.AlternativeUserLifecycleManager) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) TransferDecoratorManager(org.commonjava.maven.galley.io.TransferDecoratorManager) GlobalHttpConfiguration(org.commonjava.maven.galley.transport.htcli.conf.GlobalHttpConfiguration) TemporaryFolder(org.junit.rules.TemporaryFolder) PostConstruct(javax.annotation.PostConstruct)

Example 32 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 33 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 34 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 35 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project ddf by codice.

the class SystemPropertiesAdminTest method setUp.

@Before
public void setUp() throws IOException {
    TemporaryFolder temporaryFolder = new TemporaryFolder();
    temporaryFolder.create();
    etcFolder = temporaryFolder.newFolder("etc");
    System.setProperty("karaf.etc", etcFolder.getAbsolutePath());
    systemPropsFile = new File(etcFolder, "custom.system.properties");
    userPropsFile = new File(etcFolder, "users.properties");
    userAttrsFile = new File(etcFolder, "users.attributes");
    try (InputStream is = SystemPropertiesAdminTest.class.getResourceAsStream("/custom.system.properties")) {
        FileUtils.copyToFile(is, systemPropsFile);
    }
}
Also used : InputStream(java.io.InputStream) TemporaryFolder(org.junit.rules.TemporaryFolder) File(java.io.File) Before(org.junit.Before)

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