Examples of MockComponentContext


Examples of org.apache.sling.commons.testing.osgi.MockComponentContext

    }

    @Test
    public void test_with_nostatic_class() throws Exception {
        MockBundle bundle = new MockBundle(-1);
        MockComponentContext ctx = new MockComponentContext(bundle);
        ctx.setProperty("prefixes", new String[] { "/etc/clientlib" });
        ctx.setProperty("host.pattern", "static.host.com");

        StaticReferenceRewriteTransformerFactory factory = new StaticReferenceRewriteTransformerFactory();
        factory.activate(ctx);

        Transformer transformer = factory.createTransformer();
View Full Code Here

Examples of org.apache.sling.commons.testing.osgi.MockComponentContext


    @Test
    public void test_with_non_matching_prefix_and_single_host() throws Exception {
        MockBundle bundle = new MockBundle(-1);
        MockComponentContext ctx = new MockComponentContext(bundle);
        ctx.setProperty("prefixes", new String[] { "/etc/clientlib" });
        ctx.setProperty("host.pattern", "static.host.com");

        StaticReferenceRewriteTransformerFactory factory = new StaticReferenceRewriteTransformerFactory();
        factory.activate(ctx);

        Transformer transformer = factory.createTransformer();
View Full Code Here

Examples of org.apache.sling.commons.testing.osgi.MockComponentContext

    }

    @Test
    public void test_with_prefix_and_multiple_hosts() throws Exception {
        MockBundle bundle = new MockBundle(-1);
        MockComponentContext ctx = new MockComponentContext(bundle);
        ctx.setProperty("prefixes", new String[] { "/etc/clientlib" });
        ctx.setProperty("host.pattern", "static{}.host.com");
        ctx.setProperty("host.count", 2);

        StaticReferenceRewriteTransformerFactory factory = new StaticReferenceRewriteTransformerFactory();
        factory.activate(ctx);

        Transformer transformer = factory.createTransformer();
View Full Code Here

Examples of org.apache.sling.commons.testing.osgi.MockComponentContext

    }

    @Test
    public void test_with_nonrewritten_attribute() throws Exception {
        MockBundle bundle = new MockBundle(-1);
        MockComponentContext ctx = new MockComponentContext(bundle);
        ctx.setProperty("prefixes", new String[] { "/etc/clientlib" });
        ctx.setProperty("host.pattern", "static{}.host.com");
        ctx.setProperty("host.count", 2);

        StaticReferenceRewriteTransformerFactory factory = new StaticReferenceRewriteTransformerFactory();
        factory.activate(ctx);

        Transformer transformer = factory.createTransformer();
View Full Code Here

Examples of org.apache.sling.commons.testing.osgi.MockComponentContext

    }

    @Test
    public void test_with_nonrewritten_element() throws Exception {
        MockBundle bundle = new MockBundle(-1);
        MockComponentContext ctx = new MockComponentContext(bundle);
        ctx.setProperty("prefixes", new String[] { "/etc/clientlib" });
        ctx.setProperty("host.pattern", "static{}.host.com");
        ctx.setProperty("host.count", 2);

        StaticReferenceRewriteTransformerFactory factory = new StaticReferenceRewriteTransformerFactory();
        factory.activate(ctx);

        Transformer transformer = factory.createTransformer();
View Full Code Here

Examples of org.apache.sling.commons.testing.osgi.MockComponentContext

    protected void setUp() throws Exception {
        super.setUp();
        servlet = new MockSlingRequestHandlerServlet();
        servletResolver = new SlingServletResolver();
        MockBundle bundle = new MockBundle(1L);
        MockComponentContext mockComponentContext = new MockComponentContext(
            bundle, SlingServletResolverTest.this.servlet);
        MockServiceReference serviceReference = new MockServiceReference(bundle);
        serviceReference.setProperty(Constants.SERVICE_ID, 1L);
        serviceReference.setProperty(EngineConstants.SLING_SERLVET_NAME,
            SERVLET_NAME);
        serviceReference.setProperty(
            ServletResolverConstants.SLING_SERVLET_PATHS, SERVLET_PATH);
        serviceReference.setProperty(
            ServletResolverConstants.SLING_SERVLET_EXTENSIONS,
            SERVLET_EXTENSION);
        mockComponentContext.locateService(SERVLET_NAME, serviceReference);

        servletResolver.bindServlet(serviceReference);
        servletResolver.activate(mockComponentContext);
        mockResourceResolver = new MockResourceResolver();
        mockResourceResolver.setSearchPath("/");
View Full Code Here

Examples of org.apache.sling.commons.testing.osgi.MockComponentContext

        servlet = new MockSlingRequestHandlerServlet();
        servletResolver = new SlingServletResolver();
        servletResolver.bindResourceResolverFactory(factory);

        MockBundle bundle = new MockBundle(1L);
        MockComponentContext mockComponentContext = new MockComponentContext(
            bundle, SlingServletResolverTest.this.servlet);
        MockServiceReference serviceReference = new MockServiceReference(bundle);
        serviceReference.setProperty(Constants.SERVICE_ID, 1L);
        serviceReference.setProperty(EngineConstants.SLING_SERLVET_NAME,
            SERVLET_NAME);
        serviceReference.setProperty(
            ServletResolverConstants.SLING_SERVLET_PATHS, SERVLET_PATH);
        serviceReference.setProperty(
            ServletResolverConstants.SLING_SERVLET_EXTENSIONS,
            SERVLET_EXTENSION);
        mockComponentContext.locateService(SERVLET_NAME, serviceReference);

        servletResolver.bindServlet(serviceReference);
        servletResolver.activate(mockComponentContext);

        String path = "/"
View Full Code Here

Examples of org.apache.stanbol.enhancer.engines.celi.testutils.MockComponentContext

    properties.put(EnhancementEngine.PROPERTY_NAME, "celiNer");
        properties.put(CeliConstants.CELI_TEST_ACCOUNT, "true");
      properties.put(CeliNamedEntityExtractionEnhancementEngine.SERVICE_URL, "http://linguagrid.org/LSGrid/ws/com.celi-france.linguagrid.namedentityrecognition.v0u0.demo");
      properties.put(CeliNamedEntityExtractionEnhancementEngine.SUPPORTED_LANGUAGES, "fr;it");
        properties.put(CeliConstants.CELI_CONNECTION_TIMEOUT, "5");
      MockComponentContext context = new MockComponentContext(properties);
    nerEngine.activate(context);
  }
View Full Code Here

Examples of org.apache.stanbol.enhancer.engines.celi.testutils.MockComponentContext

    properties.put(EnhancementEngine.PROPERTY_NAME, "celiSentimentAnalysis");
    properties.put(CeliConstants.CELI_TEST_ACCOUNT, "true");
    properties.put(CeliSentimentAnalysisEngine.SERVICE_URL, CELI_SENTIMENT_ANALYSIS_SERVICE_URL);
    properties.put(CeliSentimentAnalysisEngine.SUPPORTED_LANGUAGES, "fr;it");
        properties.put(CeliConstants.CELI_CONNECTION_TIMEOUT, "5");
    MockComponentContext context = new MockComponentContext(properties);
    sentimentAnalysisEngine.activate(context);
  }
View Full Code Here

Examples of org.apache.stanbol.enhancer.engines.celi.testutils.MockComponentContext

    properties.put(EnhancementEngine.PROPERTY_NAME, "celiClassification");
    properties.put(CeliConstants.CELI_TEST_ACCOUNT, "true");
    properties.put(CeliConstants.CELI_CONNECTION_TIMEOUT, "5");
      properties.put(CeliClassificationEnhancementEngine.SERVICE_URL, "http://linguagrid.org/LSGrid/ws/dbpedia-classification");
    
    MockComponentContext context = new MockComponentContext(properties);
    classificationEngine.activate(context);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.