Search in sources :

Example 6 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project android_frameworks_base by DirtyUnicorns.

the class DiskStatsFileLoggerTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    temporaryFolder = new TemporaryFolder();
    temporaryFolder.create();
    mOutputFile = temporaryFolder.newFile();
    mMainResult = new FileCollector.MeasurementResult();
    mDownloadsResult = new FileCollector.MeasurementResult();
    mPackages = new ArrayList<>();
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) Before(org.junit.Before)

Example 7 with TemporaryFolder

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

the class DocGeneratorTest method testProcessorLoadsNarResources.

@Test
public void testProcessorLoadsNarResources() throws IOException, ClassNotFoundException {
    TemporaryFolder temporaryFolder = new TemporaryFolder();
    temporaryFolder.create();
    NiFiProperties properties = loadSpecifiedProperties("/conf/nifi.properties", NiFiProperties.COMPONENT_DOCS_DIRECTORY, temporaryFolder.getRoot().getAbsolutePath());
    final Bundle systemBundle = SystemBundle.create(properties);
    final ExtensionMapping mapping = NarUnpacker.unpackNars(properties, systemBundle);
    NarClassLoaders.getInstance().init(properties.getFrameworkWorkingDirectory(), properties.getExtensionsWorkingDirectory());
    ExtensionManager.discoverExtensions(systemBundle, NarClassLoaders.getInstance().getBundles());
    DocGenerator.generate(properties, mapping);
    final String extensionClassName = "org.apache.nifi.processors.WriteResourceToStream";
    final BundleCoordinate coordinate = mapping.getProcessorNames().get(extensionClassName).stream().findFirst().get();
    final String path = coordinate.getGroup() + "/" + coordinate.getId() + "/" + coordinate.getVersion() + "/" + extensionClassName;
    File processorDirectory = new File(temporaryFolder.getRoot(), path);
    File indexHtml = new File(processorDirectory, "index.html");
    Assert.assertTrue(indexHtml + " should have been generated", indexHtml.exists());
    String generatedHtml = FileUtils.readFileToString(indexHtml);
    Assert.assertNotNull(generatedHtml);
    Assert.assertTrue(generatedHtml.contains("This example processor loads a resource from the nar and writes it to the FlowFile content"));
    Assert.assertTrue(generatedHtml.contains("files that were successfully processed"));
    Assert.assertTrue(generatedHtml.contains("files that were not successfully processed"));
    Assert.assertTrue(generatedHtml.contains("resources"));
}
Also used : NiFiProperties(org.apache.nifi.util.NiFiProperties) ExtensionMapping(org.apache.nifi.nar.ExtensionMapping) Bundle(org.apache.nifi.bundle.Bundle) SystemBundle(org.apache.nifi.nar.SystemBundle) TemporaryFolder(org.junit.rules.TemporaryFolder) BundleCoordinate(org.apache.nifi.bundle.BundleCoordinate) File(java.io.File) Test(org.junit.Test)

Example 8 with TemporaryFolder

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

the class TestAdminDocsModule method beforeClass.

@BeforeClass
public static void beforeClass() throws IOException {
    tempFolder = new TemporaryFolder();
    tempFolder.create();
    mockDdfHome = tempFolder.newFolder("ddf");
    System.setProperty("karaf.home", mockDdfHome.getPath());
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) BeforeClass(org.junit.BeforeClass)

Example 9 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project android_frameworks_base by crdroidandroid.

the class FileCollectorTest method setUp.

@Before
public void setUp() throws Exception {
    temporaryFolder = new TemporaryFolder();
    temporaryFolder.create();
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) Before(org.junit.Before)

Example 10 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project GeoGig by boundlessgeo.

the class DefaultStepDefinitions method before.

@cucumber.annotation.Before
public void before() throws Exception {
    tempFolder = new TemporaryFolder();
    tempFolder.create();
    setupFeatures();
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder)

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