本文整理汇总了Java中org.junit.rules.TemporaryFolder.create方法的典型用法代码示例。如果您正苦于以下问题:Java TemporaryFolder.create方法的具体用法?Java TemporaryFolder.create怎么用?Java TemporaryFolder.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.junit.rules.TemporaryFolder
的用法示例。
在下文中一共展示了TemporaryFolder.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test0
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
public void test0(){
if (System.getenv().get("SKIP_HEAVY")!=null){
return;
}
TemporaryFolder tempSwaggerApis=new TemporaryFolder();
TemporaryFolder tempRAMLApis=new TemporaryFolder();
try{
File fs=File.createTempFile("ddd", "tmp");
FileUtils.copyInputStreamToFile(RegistryManager.getInstance().getClass().getResourceAsStream("/azure-specs.zip"), fs);
tempSwaggerApis.create();
tempRAMLApis.create();
extractFolder(fs.getAbsolutePath(), tempSwaggerApis.getRoot().getAbsolutePath());
WriteApis.write(tempSwaggerApis.getRoot().getAbsolutePath(), tempRAMLApis.getRoot().getAbsolutePath());
tempSwaggerApis.delete();
tempRAMLApis.delete();
}catch (Exception e) {
throw new IllegalStateException();
}
}
示例2: FakeWikidataLuceneIndexFactory
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
public FakeWikidataLuceneIndexFactory() throws IOException {
TemporaryFolder temporaryFolder = new TemporaryFolder();
temporaryFolder.create();
File fakeDumpFile = temporaryFolder.newFile("wikidata-20160829-all.json.gz");
compressFileToGzip(new File(FakeWikidataLuceneIndexFactory.class.getResource("/wikidata-20160829-all.json").getPath()), fakeDumpFile);
MwLocalDumpFile fakeDump = new MwLocalDumpFile(fakeDumpFile.getPath());
File dbFile = temporaryFolder.newFile();
dbFile.delete();
try (WikidataTypeHierarchy typeHierarchy = new WikidataTypeHierarchy(dbFile.toPath())) {
index = new LuceneIndex(temporaryFolder.newFolder().toPath());
DumpProcessingController dumpProcessingController = new DumpProcessingController("wikidatawiki");
dumpProcessingController.setDownloadDirectory(temporaryFolder.newFolder().toString());
dumpProcessingController.registerEntityDocumentProcessor(typeHierarchy.getUpdateProcessor(), null, true);
dumpProcessingController.processDump(fakeDump);
dumpProcessingController.registerEntityDocumentProcessor(
new WikidataResourceProcessor(new LuceneLoader(index), dumpProcessingController.getSitesInformation(), typeHierarchy),
null,
true
);
dumpProcessingController.processDump(fakeDump);
index.refreshReaders();
}
}
示例3: parameters
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Parameterized.Parameters
public static Collection<AbstractStateBackend> parameters() throws IOException {
TemporaryFolder tempFolder = new TemporaryFolder();
tempFolder.create();
MemoryStateBackend syncMemBackend = new MemoryStateBackend(MAX_MEM_STATE_SIZE, false);
MemoryStateBackend asyncMemBackend = new MemoryStateBackend(MAX_MEM_STATE_SIZE, true);
FsStateBackend syncFsBackend = new FsStateBackend("file://" + tempFolder.newFolder().getAbsolutePath(), false);
FsStateBackend asyncFsBackend = new FsStateBackend("file://" + tempFolder.newFolder().getAbsolutePath(), true);
RocksDBStateBackend fullRocksDbBackend = new RocksDBStateBackend(new MemoryStateBackend(MAX_MEM_STATE_SIZE), false);
fullRocksDbBackend.setDbStoragePath(tempFolder.newFolder().getAbsolutePath());
RocksDBStateBackend incRocksDbBackend = new RocksDBStateBackend(new MemoryStateBackend(MAX_MEM_STATE_SIZE), true);
incRocksDbBackend.setDbStoragePath(tempFolder.newFolder().getAbsolutePath());
return Arrays.asList(
syncMemBackend,
asyncMemBackend,
syncFsBackend,
asyncFsBackend,
fullRocksDbBackend,
incRocksDbBackend);
}
示例4: setUp
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@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();
}
示例5: createEnvironment
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
private void createEnvironment() throws IOException, PersistitException {
closeDb();
temporaryFolder = new TemporaryFolder();
temporaryFolder.create();
persistit = new Persistit();
persistit.setPersistitLogger(new Slf4jAdapter(LoggerFactory.getLogger("PERSISTIT")));
Properties props = new Properties();
props.setProperty("datapath", temporaryFolder.getRoot().getAbsolutePath());
props.setProperty("logpath", "${datapath}/log");
props.setProperty("logfile", "${logpath}/persistit_${timestamp}.log");
props.setProperty("buffer.count.8192", "5000");
props.setProperty("journalpath", "${datapath}/journal");
props.setProperty("tmpvoldir", "${datapath}");
props.setProperty("volume.1", "${datapath}/persistit,create,pageSize:8192,initialPages:10,extensionPages:100,maximumPages:25000");
props.setProperty("jmx", "false");
persistit.setProperties(props);
persistit.initialize();
volume = persistit.createTemporaryVolume();
}
示例6: initOnce
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
public static final boolean initOnce() throws IOException {
if (once.compareAndSet(false, true)) {
final TemporaryFolder tmpFolder = new TemporaryFolder();
tmpFolder.create();
init(tmpFolder.newFolder());
// add shutdown hook because we want to initialized/cleanup once
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
try {
finish();
} finally {
tmpFolder.delete();
}
}
}));
return true;
}
return false;
}
示例7: start
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Override
public void start() {
super.start();
tmpFolder = new TemporaryFolder();
try {
tmpFolder.create();
} catch (IOException e) {
e.printStackTrace();
return;
}
JsonObject config = new JsonObject();
config.putString("address", TEST_PERSISTOR);
config.putString("datastore-path", tmpFolder.getRoot().getAbsolutePath());
container.deployModule(System.getProperty("vertx.modulename"), config, 1,
new AsyncResultHandler<String>() {
public void handle(AsyncResult<String> ar) {
if (ar.succeeded()) {
Neo4jPersistorTest.super.start();
} else {
ar.cause().printStackTrace();
}
}
});
}
示例8: setUp
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Before
public void setUp() throws InterruptedException, IOException {
TemporaryFolder tempDirectory = new TemporaryFolder();
tempDirectory.create();
projectFilesystem =
TestProjectFilesystems.createProjectFilesystem(tempDirectory.getRoot().toPath());
outputExecutor =
MostExecutors.newSingleThreadExecutor(new CommandThreadFactory(getClass().getName()));
info =
InvocationInfo.of(
new BuildId(),
false,
false,
"topspin",
ImmutableList.of(),
ImmutableList.of(),
tempDirectory.getRoot().toPath());
durationTracker = new BuildRuleDurationTracker();
}
示例9: setup
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Before
public void setup() throws Exception
{
tmpDir = new TemporaryFolder();
tmpDir.create();
dbFile = tmpDir.newFile( "spacereclaimer.db" );
//System.out.println(dbFile.getAbsolutePath());
rm = new RecordManager( dbFile.getAbsolutePath() );
rm.setPageReclaimerThreshold( 10 );
uidTree = ( PersistedBTree<Integer, String> ) rm.addBTree( TREE_NAME, IntSerializer.INSTANCE, StringSerializer.INSTANCE, false );
}
示例10: KafkaEmbedded
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
/**
* Creates and starts an embedded Kafka broker.
*
* @param config Broker configuration settings. Used to modify, for example, on which port the
* broker should listen to. Note that you cannot change the `log.dirs` setting
* currently.
*/
public KafkaEmbedded(final Properties config, final MockTime time) throws IOException {
tmpFolder = new TemporaryFolder();
tmpFolder.create();
logDir = tmpFolder.newFolder();
effectiveConfig = effectiveConfigFrom(config);
final boolean loggingEnabled = true;
final KafkaConfig kafkaConfig = new KafkaConfig(effectiveConfig, loggingEnabled);
log.debug("Starting embedded Kafka broker (with log.dirs={} and ZK ensemble at {}) ...",
logDir, zookeeperConnect());
kafka = TestUtils.createServer(kafkaConfig, time);
log.debug("Startup of embedded Kafka broker at {} completed (with ZK ensemble at {}) ...",
brokerList(), zookeeperConnect());
}
示例11: KafkaEmbedded
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
/**
* Creates and starts an embedded Kafka broker.
*
* @param config Broker configuration settings. Used to modify, for example, on which port the
* broker should listen to. Note that you cannot change some settings such as
* `log.dirs`, `port`.
*/
public KafkaEmbedded(Properties config) throws IOException {
tmpFolder = new TemporaryFolder();
tmpFolder.create();
logDir = tmpFolder.newFolder();
effectiveConfig = effectiveConfigFrom(config);
boolean loggingEnabled = true;
KafkaConfig kafkaConfig = new KafkaConfig(effectiveConfig, loggingEnabled);
log.debug("Starting embedded Kafka broker (with log.dirs={} and ZK ensemble at {}) ...",
logDir, zookeeperConnect());
kafka = TestUtils.createServer(kafkaConfig, Time.SYSTEM);
log.debug("Startup of embedded Kafka broker at {} completed (with ZK ensemble at {}) ...",
brokerList(), zookeeperConnect());
}
示例12: setupTest
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Before
public void setupTest() throws IOException {
TemporaryFolder f = new TemporaryFolder();
f.create();
_temp_folder = f.getRoot();
System.out.println("created temporary folder: " + _temp_folder.getAbsolutePath());
}
示例13: init
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@BeforeClass
public static void init() throws IOException {
TemporaryFolder f = new TemporaryFolder();
f.create();
File temp_folder = f.getRoot();
System.out.println("created temporary folder: " + temp_folder.getAbsolutePath());
UURI uuri = UURIFactory.getInstance("http://localtest/test");
curi = new CrawlURI(uuri);
l = new DecesiveValueLogger2();
l.setPath(new ConfigPath("test", temp_folder.getAbsolutePath()));
l.start();
}
示例14: getFileFromResource
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
public static File getFileFromResource(Object obj, String resourceName) throws IOException {
TemporaryFolder folder = new TemporaryFolder();
folder.create();
File file = folder.newFile(resourceName);
InputStream stream = obj.getClass().getClassLoader().getResourceAsStream(resourceName);
byte[] buffer = new byte[stream.available()];
stream.read(buffer);
OutputStream outStream = new FileOutputStream(file);
outStream.write(buffer);
return file;
}
示例15: setUp
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Before
public void setUp() throws IOException, FileNotFoundException, JAXBException {
this.delegate = new WorkflowInputDelegate();
this.jcommander = new JCommander(delegate);
WorkflowTrace trace = new WorkflowTrace();
tempFolder = new TemporaryFolder();
tempFolder.create();
tempFile = tempFolder.newFile();
WorkflowTraceSerializer.write(tempFile, trace);
}