Search in sources :

Example 76 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project dkpro-tc by dkpro.

the class TestFoldUtil method createSequenceCas.

private void createSequenceCas() throws IOException, UIMAException {
    tmpFoldSeq = new TemporaryFolder();
    tmpFoldSeq.create();
    jcasSequence = JCasFactory.createJCas();
    jcasSequence.setDocumentText("One A Two B Three C Four D Five E Six F Seven G Eight H Nine I Ten J");
    setSeq(jcasSequence, 0, 5);
    setSeq(jcasSequence, 6, 11);
    setSeq(jcasSequence, 12, 19);
    setSeq(jcasSequence, 20, 26);
    setSeq(jcasSequence, 27, 33);
    setSeq(jcasSequence, 34, 39);
    setSeq(jcasSequence, 40, 47);
    setSeq(jcasSequence, 48, 55);
    setSeq(jcasSequence, 56, 62);
    setSeq(jcasSequence, 63, 68);
    DocumentMetaData dmd = new DocumentMetaData(jcasSequence);
    dmd.setDocumentId("id");
    dmd.addToIndexes();
    createJCasIdAnnotation(jcasSequence);
    AnalysisEngine xmiWriter = AnalysisEngineFactory.createEngine(BinaryCasWriter.class, BinaryCasWriter.PARAM_TARGET_LOCATION, tmpFoldSeq.getRoot(), BinaryCasWriter.PARAM_FORMAT, "6+");
    xmiWriter.process(jcasSequence);
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) DocumentMetaData(de.tudarmstadt.ukp.dkpro.core.api.metadata.type.DocumentMetaData) AnalysisEngine(org.apache.uima.analysis_engine.AnalysisEngine)

Example 77 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project spring-integration by spring-projects.

the class FileMessageHistoryTests method testMessageHistory.

@Test
public void testMessageHistory() throws Exception {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("file-message-history-context.xml", getClass());
    TemporaryFolder input = context.getBean(TemporaryFolder.class);
    File file = input.newFile("FileMessageHistoryTest.txt");
    BufferedWriter out = new BufferedWriter(new FileWriter(file));
    out.write("hello");
    out.close();
    PollableChannel outChannel = context.getBean("outChannel", PollableChannel.class);
    Message<?> message = outChannel.receive(10000);
    assertThat(message, is(notNullValue()));
    MessageHistory history = MessageHistory.read(message);
    assertThat(history, is(notNullValue()));
    Properties componentHistoryRecord = TestUtils.locateComponentInHistory(history, "fileAdapter", 0);
    assertNotNull(componentHistoryRecord);
    assertEquals("file:inbound-channel-adapter", componentHistoryRecord.get("type"));
    context.close();
}
Also used : MessageHistory(org.springframework.integration.history.MessageHistory) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) FileWriter(java.io.FileWriter) TemporaryFolder(org.junit.rules.TemporaryFolder) PollableChannel(org.springframework.messaging.PollableChannel) Properties(java.util.Properties) File(java.io.File) BufferedWriter(java.io.BufferedWriter) Test(org.junit.Test)

Example 78 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project xodus by JetBrains.

the class JMHEnvTokyoCabinetBenchmarkBase method setup.

public void setup() throws IOException {
    Log.invalidateSharedCache();
    TokyoCabinetBenchmark.shuffleKeys(randomKeys);
    temporaryFolder = new TemporaryFolder();
    temporaryFolder.create();
    final File testsDirectory = temporaryFolder.newFolder("data");
    env = Environments.newInstance(testsDirectory, new EnvironmentConfig().setLogFileSize(32768));
    store = env.computeInTransaction(new TransactionalComputable<Store>() {

        @Override
        public Store compute(@NotNull Transaction txn) {
            return env.openStore("TokyoCabinetBenchmarkStore", getConfig(), txn);
        }
    });
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Example 79 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project blueocean-plugin by jenkinsci.

the class GitRepositoryRule method before.

@Override
protected void before() throws Throwable {
    temporaryFolder = new TemporaryFolder();
    temporaryFolder.create();
    gitDirectory = temporaryFolder.newFolder();
    client = Git.init().setDirectory(gitDirectory).call();
    logger.info("Created git repository at " + gitDirectory.getAbsolutePath());
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder)

Example 80 with TemporaryFolder

use of org.junit.rules.TemporaryFolder in project pentaho-kettle by pentaho.

the class MessagesSourceCrawlerTest method setup.

@Before
public void setup() throws Exception {
    temporaryFolder = new TemporaryFolder();
    temporaryFolder.create();
}
Also used : TemporaryFolder(org.junit.rules.TemporaryFolder) Before(org.junit.Before)

Aggregations

TemporaryFolder (org.junit.rules.TemporaryFolder)106 File (java.io.File)40 Before (org.junit.Before)28 Test (org.junit.Test)28 BeforeClass (org.junit.BeforeClass)13 URL (java.net.URL)7 Path (java.nio.file.Path)7 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)3 UserState (alluxio.security.user.UserState)2 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)2 RocksDBPersistenceProvider (com.iota.iri.storage.rocksDB.RocksDBPersistenceProvider)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 URISyntaxException (java.net.URISyntaxException)2 BdpDataPlanePlugin (org.batfish.bdp.BdpDataPlanePlugin)2 Batfish (org.batfish.main.Batfish)2 NotNull (org.jetbrains.annotations.NotNull)2 DefaultSafeModeManager (alluxio.master.DefaultSafeModeManager)1 InMemoryReferenceSequenceFile (au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile)1 SynchronousReferenceLookupAdapter (au.edu.wehi.idsv.picard.SynchronousReferenceLookupAdapter)1