use of org.junit.rules.TemporaryFolder in project gridss by PapenfussLab.
the class IntervalBedTest method should_round_trip.
@Test
public void should_round_trip() throws IOException {
IntervalBed bed = new IntervalBed(getContext().getDictionary(), getContext().getLinear());
bed.addInterval(1, 3, 5);
TemporaryFolder folder = new TemporaryFolder();
folder.create();
File f = folder.newFile("IntervalBedTest.bed");
f.delete();
bed.write(f, "IntervalBedTest");
IntervalBed bed2 = new IntervalBed(getContext().getDictionary(), getContext().getLinear(), f);
assertFalse(bed2.overlaps(1, 2, 2));
assertTrue(bed2.overlaps(1, 3, 3));
assertTrue(bed2.overlaps(1, 4, 4));
assertTrue(bed2.overlaps(1, 5, 5));
assertFalse(bed2.overlaps(1, 6, 6));
f.delete();
folder.delete();
}
use of org.junit.rules.TemporaryFolder in project contribution by checkstyle.
the class TemplateProcessorTest method setup.
@BeforeClass
public static void setup() throws IOException {
tmpDir = new TemporaryFolder();
tmpDir.create();
}
use of org.junit.rules.TemporaryFolder in project flink by apache.
the class FileUtilsTest method testReadAllBytes.
// ------------------------------------------------------------------------
// Tests
// ------------------------------------------------------------------------
@Test
public void testReadAllBytes() throws Exception {
TemporaryFolder tmpFolder = null;
try {
tmpFolder = new TemporaryFolder(new File(this.getClass().getResource("/").getPath()));
tmpFolder.create();
final int fileSize = 1024;
final String testFilePath = tmpFolder.getRoot().getAbsolutePath() + File.separator + this.getClass().getSimpleName() + "_" + fileSize + ".txt";
{
String expectedMD5 = generateTestFile(testFilePath, 1024);
final byte[] data = FileUtils.readAllBytes((new File(testFilePath)).toPath());
assertEquals(expectedMD5, md5Hex(data));
}
{
String expectedMD5 = generateTestFile(testFilePath, 4096);
final byte[] data = FileUtils.readAllBytes((new File(testFilePath)).toPath());
assertEquals(expectedMD5, md5Hex(data));
}
{
String expectedMD5 = generateTestFile(testFilePath, 5120);
final byte[] data = FileUtils.readAllBytes((new File(testFilePath)).toPath());
assertEquals(expectedMD5, md5Hex(data));
}
} finally {
if (tmpFolder != null) {
tmpFolder.delete();
}
}
}
use of org.junit.rules.TemporaryFolder in project alluxio by Alluxio.
the class PersistenceTest method before.
@Before
public void before() throws Exception {
UserState s = UserState.Factory.create(ServerConfiguration.global());
AuthenticatedClientUser.set(s.getUser().getName());
TemporaryFolder tmpFolder = new TemporaryFolder();
tmpFolder.create();
File ufsRoot = tmpFolder.newFolder();
ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.UFS);
ServerConfiguration.set(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS, ufsRoot.getAbsolutePath());
ServerConfiguration.set(PropertyKey.MASTER_PERSISTENCE_INITIAL_INTERVAL_MS, 0);
ServerConfiguration.set(PropertyKey.MASTER_PERSISTENCE_MAX_INTERVAL_MS, 1000);
ServerConfiguration.set(PropertyKey.MASTER_PERSISTENCE_MAX_TOTAL_WAIT_TIME_MS, 1000);
mJournalFolder = tmpFolder.newFolder();
mSafeModeManager = new DefaultSafeModeManager();
mStartTimeMs = System.currentTimeMillis();
mPort = ServerConfiguration.getInt(PropertyKey.MASTER_RPC_PORT);
startServices();
}
use of org.junit.rules.TemporaryFolder in project alluxio by Alluxio.
the class FileSystemMasterSyncMetadataTest method before.
@Before
public void before() throws Exception {
UserState s = UserState.Factory.create(ServerConfiguration.global());
AuthenticatedClientUser.set(s.getUser().getName());
TemporaryFolder tmpFolder = new TemporaryFolder();
tmpFolder.create();
File ufsRoot = tmpFolder.newFolder();
ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.UFS);
ServerConfiguration.set(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS, ufsRoot.getAbsolutePath());
ServerConfiguration.set(PropertyKey.MASTER_PERSISTENCE_INITIAL_INTERVAL_MS, 0);
ServerConfiguration.set(PropertyKey.MASTER_PERSISTENCE_MAX_INTERVAL_MS, 1000);
ServerConfiguration.set(PropertyKey.MASTER_PERSISTENCE_MAX_TOTAL_WAIT_TIME_MS, 1000);
mJournalFolder = tmpFolder.newFolder();
startServices();
}
Aggregations