当前位置: 首页>>代码示例>>Java>>正文


Java TemporaryFolder.create方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:20,代码来源:Swagger2RamlTest.java

示例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();
    }
}
 
开发者ID:askplatypus,项目名称:platypus-kb-lucene,代码行数:27,代码来源:FakeWikidataLuceneIndexFactory.java

示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:PartitionedStateCheckpointingITCase.java

示例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();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:23,代码来源:EmbeddedBrokerTestSupport.java

示例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();

}
 
开发者ID:JetBrains,项目名称:xodus,代码行数:21,代码来源:JMHPersistItTokyoCabinetBenchmarkBase.java

示例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;
}
 
开发者ID:chtyim,项目名称:incubator-twill,代码行数:22,代码来源:YarnTestUtils.java

示例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();
			}
		}
	});
}
 
开发者ID:web-education,项目名称:mod-neo4j-persistor,代码行数:25,代码来源:Neo4jPersistorTest.java

示例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();
}
 
开发者ID:facebook,项目名称:buck,代码行数:20,代码来源:RuleKeyLoggerListenerTest.java

示例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 );
}
 
开发者ID:apache,项目名称:directory-mavibot,代码行数:15,代码来源:PageReclaimerTest.java

示例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());
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:21,代码来源:KafkaEmbedded.java

示例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());
}
 
开发者ID:kaiwaehner,项目名称:kafka-streams-machine-learning-examples,代码行数:22,代码来源:KafkaEmbedded.java

示例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());
}
 
开发者ID:tudarmstadt-lt,项目名称:topicrawler,代码行数:8,代码来源:LanguageModelTest.java

示例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();
}
 
开发者ID:tudarmstadt-lt,项目名称:topicrawler,代码行数:15,代码来源:DecesiveLoggerTest.java

示例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;
}
 
开发者ID:blablacar,项目名称:android-validator,代码行数:16,代码来源:Utils.java

示例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);
}
 
开发者ID:RUB-NDS,项目名称:TLS-Attacker,代码行数:11,代码来源:WorkflowInputDelegateTest.java


注:本文中的org.junit.rules.TemporaryFolder.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。