Search in sources :

Example 1 with RuntimeDelegateImpl

use of org.glassfish.jersey.internal.RuntimeDelegateImpl in project stanbol by apache.

the class ContentItemReaderWriterTest method createTestContentItem.

/**
 * @return
 */
@BeforeClass
public static void createTestContentItem() throws IOException {
    contentItem = ciFactory.createContentItem(new IRI("urn:test"), new StringSource("<html>\n" + "  <body>\n" + "    This is a <b>ContentItem</b> to <i>Mime Multipart</i> test!\n" + "  </body>\n" + "</html>", "text/html"));
    RuntimeDelegate.setInstance(new RuntimeDelegateImpl());
    contentItem.addPart(new IRI("run:text:text"), ciFactory.createBlob(new StringSource("This is a ContentItem to Mime Multipart test!")));
    contentItem.getMetadata().add(new TripleImpl(new IRI("urn:test"), RDF.type, new IRI("urn:types:Document")));
    // mark the main content as parsed and also that all
    // contents and contentparts should be included
    Map<String, Object> properties = initRequestPropertiesContentPart(contentItem);
    properties.put(PARSED_CONTENT_URIS, Collections.singleton(contentItem.getPartUri(0).getUnicodeString()));
    properties.put(OUTPUT_CONTENT, Collections.singleton("*/*"));
    properties.put(OUTPUT_CONTENT_PART, Collections.singleton("*"));
    properties.put(RDF_FORMAT, "application/rdf+xml");
    Graph em = initExecutionMetadataContentPart(contentItem);
    BlankNodeOrIRI ep = createExecutionPlan(em, "testChain", null);
    writeExecutionNode(em, ep, "testEngine", true, null, null);
    initExecutionMetadata(em, em, contentItem.getUri(), "testChain", false);
    ciWriter = new ContentItemWriter(Serializer.getInstance());
    ciReader = new ContentItemReader() {

        @Override
        protected Parser getParser() {
            return Parser.getInstance();
        }

        @Override
        protected ContentItemFactory getContentItemFactory() {
            return ciFactory;
        }
    };
}
Also used : IRI(org.apache.clerezza.commons.rdf.IRI) BlankNodeOrIRI(org.apache.clerezza.commons.rdf.BlankNodeOrIRI) ContentItemFactory(org.apache.stanbol.enhancer.servicesapi.ContentItemFactory) InMemoryContentItemFactory(org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory) RuntimeDelegateImpl(org.glassfish.jersey.internal.RuntimeDelegateImpl) BlankNodeOrIRI(org.apache.clerezza.commons.rdf.BlankNodeOrIRI) Parser(org.apache.clerezza.rdf.core.serializedform.Parser) ContentItemReader(org.apache.stanbol.enhancer.jersey.reader.ContentItemReader) SimpleGraph(org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph) Graph(org.apache.clerezza.commons.rdf.Graph) StringSource(org.apache.stanbol.enhancer.servicesapi.impl.StringSource) TripleImpl(org.apache.clerezza.commons.rdf.impl.utils.TripleImpl) ContentItemWriter(org.apache.stanbol.enhancer.jersey.writers.ContentItemWriter) BeforeClass(org.junit.BeforeClass)

Aggregations

BlankNodeOrIRI (org.apache.clerezza.commons.rdf.BlankNodeOrIRI)1 Graph (org.apache.clerezza.commons.rdf.Graph)1 IRI (org.apache.clerezza.commons.rdf.IRI)1 TripleImpl (org.apache.clerezza.commons.rdf.impl.utils.TripleImpl)1 SimpleGraph (org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph)1 Parser (org.apache.clerezza.rdf.core.serializedform.Parser)1 InMemoryContentItemFactory (org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory)1 ContentItemReader (org.apache.stanbol.enhancer.jersey.reader.ContentItemReader)1 ContentItemWriter (org.apache.stanbol.enhancer.jersey.writers.ContentItemWriter)1 ContentItemFactory (org.apache.stanbol.enhancer.servicesapi.ContentItemFactory)1 StringSource (org.apache.stanbol.enhancer.servicesapi.impl.StringSource)1 RuntimeDelegateImpl (org.glassfish.jersey.internal.RuntimeDelegateImpl)1 BeforeClass (org.junit.BeforeClass)1