use of org.junit.rules.TemporaryFolder in project android_frameworks_base by ResurrectionRemix.
the class DiskStatsLoggingServiceTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
MockitoAnnotations.initMocks(this);
mTemporaryFolder = new TemporaryFolder();
mTemporaryFolder.create();
mInputFile = mTemporaryFolder.newFile();
mDownloads = new TemporaryFolder();
mDownloads.create();
mRootDirectory = new TemporaryFolder();
mRootDirectory.create();
}
use of org.junit.rules.TemporaryFolder in project galley by Commonjava.
the class GalleyMavenFixture method initGalley.
public void initGalley() throws IOException {
if (temp == null) {
temp = new TemporaryFolder();
}
temp.create();
if (cacheDir == null) {
cacheDir = temp.newFolder("cache");
}
mavenBuilder = new GalleyMavenBuilder();
mavenBuilder.withCacheProviderFactory(new FileCacheProviderFactory(cacheDir));
}
use of org.junit.rules.TemporaryFolder in project ddf by codice.
the class SystemPropertiesAdminTest method setUp.
@Before
public void setUp() throws IOException {
System.setProperty(SystemBaseUrl.PORT, "1234");
System.setProperty(SystemBaseUrl.HOST, "host");
expectedSystemPropertiesCount++;
System.setProperty(SystemBaseUrl.HTTP_PORT, "4567");
expectedSystemPropertiesCount++;
System.setProperty(SystemBaseUrl.HTTPS_PORT, "8901");
expectedSystemPropertiesCount++;
System.setProperty(SystemInfo.ORGANIZATION, "org");
expectedSystemPropertiesCount++;
System.setProperty(SystemInfo.SITE_CONTACT, "contact");
expectedSystemPropertiesCount++;
System.setProperty(SystemInfo.SITE_NAME, "site");
expectedSystemPropertiesCount++;
System.setProperty(SystemInfo.VERSION, "version");
expectedSystemPropertiesCount++;
TemporaryFolder temporaryFolder = new TemporaryFolder();
temporaryFolder.create();
etcFolder = temporaryFolder.newFolder("etc");
System.setProperty("karaf.etc", etcFolder.getAbsolutePath());
systemPropsFile = new File(etcFolder, "system.properties");
userPropsFile = new File(etcFolder, "users.properties");
userAttrsFile = new File(etcFolder, "users.attributes");
}
use of org.junit.rules.TemporaryFolder in project ddf by codice.
the class TestOwaspDiffRunner method before.
@Before
public void before() throws Exception {
fakeRepo = new TemporaryFolder();
fakeRepo.create();
File fakeChangedPom = fakeRepo.newFile("pom.xml");
System.setProperty("maven.repo.local", fakeChangedPom.getParent());
//Set command line returns
when(mavenVersionCommandProcess.getInputStream()).thenReturn(new ByteArrayInputStream(("Maven home: " + fakeRepo.getRoot().getPath()).getBytes(StandardCharsets.UTF_8)));
when(mavenSettingCommandProcess.getInputStream()).thenReturn(new ByteArrayInputStream(("<localRepository>" + fakeRepo.getRoot().getPath() + "</localRepository>").getBytes(StandardCharsets.UTF_8)));
when(gitShortBranchNameCommandProcess.getInputStream()).thenReturn(new ByteArrayInputStream("test-branch".getBytes(StandardCharsets.UTF_8)));
when(gitDiffNameCommandProcess.getInputStream()).thenReturn(new ByteArrayInputStream(fakeChangedPom.getPath().getBytes(StandardCharsets.UTF_8)));
//Set runtime when executing commands
when(runtime.exec(MAVEN_VERSION_COMMAND)).thenReturn(mavenVersionCommandProcess);
when(runtime.exec(MAVEN_SETTINGS_COMMAND)).thenReturn(mavenSettingCommandProcess);
when(runtime.exec(GIT_SHORT_BRANCH_NAME_COMMAND)).thenReturn(gitShortBranchNameCommandProcess);
when(runtime.exec(matches(GIT_DIFF_NAME_COMMAND + ".*"))).thenReturn(gitDiffNameCommandProcess);
//Set maven executor
when(mavenBuildResult.getExitCode()).thenReturn(0);
when(invoker.execute(any())).thenReturn(mavenBuildResult);
owaspDiffRunner = new OwaspDiffRunner(runtime, invoker);
}
use of org.junit.rules.TemporaryFolder in project sling by apache.
the class BundleListContentProviderTest method setupTemporaryFiles.
@Before
public void setupTemporaryFiles() throws IOException {
TemporaryFolder configRoot = new TemporaryFolder(tempFolder.getRoot());
configRoot.create();
for (String filename : CONFIG_FILES) {
final File f = getConfigFile(configRoot, filename);
f.createNewFile();
assertTrue("Expecting temporary config file to have been created: " + f.getAbsolutePath(), f.exists());
}
configDirectory = configRoot.getRoot();
resourceProviderRoot = new File(tempFolder.getRoot(), "RESOURCE_PROVIDER_ROOT");
resourceProviderRoot.mkdirs();
resourceProviderFile = new File(resourceProviderRoot, "RP_FILE_" + System.currentTimeMillis());
resourceProviderFile.createNewFile();
fakeBundlePath = getFakeBundlePath();
}
Aggregations