use of org.junit.rules.TemporaryFolder in project cdap by caskdata.
the class DatasetFrameworkTestUtil method before.
@Override
protected void before() throws Throwable {
this.tmpFolder = new TemporaryFolder();
tmpFolder.create();
File localDataDir = tmpFolder.newFolder();
cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, localDataDir.getAbsolutePath());
injector = Guice.createInjector(new ConfigModule(cConf), new NonCustomLocationUnitTestModule().getModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new TransactionModules().getInMemoryModules(), new TransactionExecutorModule(), new PrivateModule() {
@Override
protected void configure() {
install(new FactoryModuleBuilder().implement(DatasetDefinitionRegistry.class, DefaultDatasetDefinitionRegistry.class).build(DatasetDefinitionRegistryFactory.class));
bind(DatasetFramework.class).to(InMemoryDatasetFramework.class);
expose(DatasetFramework.class);
}
});
txManager = injector.getInstance(TransactionManager.class);
txManager.startAndWait();
framework = injector.getInstance(DatasetFramework.class);
}
use of org.junit.rules.TemporaryFolder in project cdap by caskdata.
the class MetricsSuiteTestBase method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
if (!runBefore) {
return;
}
tmpFolder = new TemporaryFolder();
conf = CConfiguration.create();
conf.set(Constants.Metrics.ADDRESS, hostname);
conf.set(Constants.AppFabric.OUTPUT_DIR, System.getProperty("java.io.tmpdir"));
conf.set(Constants.AppFabric.TEMP_DIR, System.getProperty("java.io.tmpdir"));
conf.setBoolean(Constants.Dangerous.UNRECOVERABLE_RESET, true);
conf.setBoolean(Constants.Metrics.CONFIG_AUTHENTICATION_REQUIRED, true);
conf.set(Constants.Metrics.CLUSTER_NAME, CLUSTER);
Injector injector = startMetricsService(conf);
store = injector.getInstance(Store.class);
locationFactory = injector.getInstance(LocationFactory.class);
metricStore = injector.getInstance(MetricStore.class);
tmpFolder.create();
}
use of org.junit.rules.TemporaryFolder in project activemq-artemis by apache.
the class EmbeddedBrokerTestSupport method setUp.
@Override
protected void setUp() throws Exception {
BrokerService.disableWrapper = disableWrapper;
File tmpRoot = new File("./target/tmp");
tmpRoot.mkdirs();
temporaryFolder = new TemporaryFolder(tmpRoot);
temporaryFolder.create();
if (artemisBroker == null) {
artemisBroker = createArtemisBroker();
}
startBroker();
connectionFactory = createConnectionFactory();
destination = createDestination();
template = createJmsTemplate();
template.setDefaultDestination(destination);
template.setPubSubDomain(useTopic);
template.afterPropertiesSet();
}
use of org.junit.rules.TemporaryFolder in project activemq-artemis by apache.
the class BrokerService method start.
@Override
public void start() throws Exception {
File targetTmp = new File("./target/tmp");
targetTmp.mkdirs();
tmpfolder = new TemporaryFolder(targetTmp);
tmpfolder.create();
Exception e = new Exception();
startBroker(startAsync);
map.put(broker, e);
}
use of org.junit.rules.TemporaryFolder in project accumulo by apache.
the class SortedLogRecoveryTest method recover.
private static List<Mutation> recover(Map<String, KeyValue[]> logs, Set<String> files, KeyExtent extent) throws IOException {
TemporaryFolder root = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
root.create();
final String workdir = root.getRoot().getAbsolutePath() + "/workdir";
VolumeManager fs = VolumeManagerImpl.getLocal(workdir);
final Path workdirPath = new Path("file://" + workdir);
fs.deleteRecursively(workdirPath);
ArrayList<Path> dirs = new ArrayList<>();
try {
for (Entry<String, KeyValue[]> entry : logs.entrySet()) {
String path = workdir + "/" + entry.getKey();
FileSystem ns = fs.getVolumeByPath(new Path(path)).getFileSystem();
@SuppressWarnings("deprecation") Writer map = new MapFile.Writer(ns.getConf(), ns, path + "/log1", LogFileKey.class, LogFileValue.class);
for (KeyValue lfe : entry.getValue()) {
map.append(lfe.key, lfe.value);
}
map.close();
ns.create(SortedLogState.getFinishedMarkerPath(path)).close();
dirs.add(new Path(path));
}
// Recover
SortedLogRecovery recovery = new SortedLogRecovery(fs);
CaptureMutations capture = new CaptureMutations();
recovery.recover(extent, dirs, files, capture);
return capture.result;
} finally {
root.delete();
}
}
Aggregations