Search in sources :

Example 11 with ByteArraySource

use of org.apache.stanbol.enhancer.servicesapi.impl.ByteArraySource in project stanbol by apache.

the class ContentSourceTest method checkFileName.

@Test
public void checkFileName() throws IOException {
    ContentSource source = new StreamSource(new ByteArrayInputStream(DATA), null, null, null);
    assertNull(source.getFileName());
    source = new StreamSource(new ByteArrayInputStream(DATA), null, FILE_NAME, null);
    assertEquals(FILE_NAME, source.getFileName());
    source = new ByteArraySource(DATA, null, FILE_NAME);
    assertEquals(FILE_NAME, source.getFileName());
    source = new ByteArraySource(DATA, null, FILE_NAME, null);
    assertEquals(FILE_NAME, source.getFileName());
}
Also used : ContentSource(org.apache.stanbol.enhancer.servicesapi.ContentSource) ByteArrayInputStream(java.io.ByteArrayInputStream) StreamSource(org.apache.stanbol.enhancer.servicesapi.impl.StreamSource) ByteArraySource(org.apache.stanbol.enhancer.servicesapi.impl.ByteArraySource) Test(org.junit.Test)

Aggregations

ByteArraySource (org.apache.stanbol.enhancer.servicesapi.impl.ByteArraySource)11 Test (org.junit.Test)9 ContentSource (org.apache.stanbol.enhancer.servicesapi.ContentSource)7 ByteArrayInputStream (java.io.ByteArrayInputStream)4 StreamSource (org.apache.stanbol.enhancer.servicesapi.impl.StreamSource)4 Graph (org.apache.clerezza.commons.rdf.Graph)3 IRI (org.apache.clerezza.commons.rdf.IRI)3 RDFTerm (org.apache.clerezza.commons.rdf.RDFTerm)3 InputStream (java.io.InputStream)2 Triple (org.apache.clerezza.commons.rdf.Triple)2 SimpleGraph (org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph)2 ParsingProvider (org.apache.clerezza.rdf.core.serializedform.ParsingProvider)2 JenaParserProvider (org.apache.clerezza.rdf.jena.parser.JenaParserProvider)2 IndexedGraph (org.apache.stanbol.commons.indexedgraph.IndexedGraph)2 Blob (org.apache.stanbol.enhancer.servicesapi.Blob)2 BeforeClass (org.junit.BeforeClass)2 BufferedInputStream (java.io.BufferedInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 FilterInputStream (java.io.FilterInputStream)1 Charset (java.nio.charset.Charset)1