Examples of MockBundle


Examples of org.apache.sling.adapter.mock.MockBundle

        // no cache and no factories yet
        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
        assertTrue("AdapterFactoryDescriptors must be empty", am.getFactories().isEmpty());
        assertNull("AdapterFactory cache must be null", am.getFactoryCache());

        Bundle bundle = new MockBundle(1L);
        MockServiceReference ref = new MockServiceReference(bundle);
        ref.setProperty(Constants.SERVICE_ID, 1L);
        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
        am.bindAdapterFactory(ref);
View Full Code Here

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

        // set resource resolver factory
        final Field resolverField = resolverClass.getDeclaredField("resourceResolverFactory");
        resolverField.setAccessible(true);
        resolverField.set(servletResolver, factory);

        MockBundle bundle = new MockBundle(1L);
        MockBundleContext bundleContext = new MockBundleContext(bundle) {
            @Override
            public ServiceRegistration registerService(String s, Object o, Dictionary dictionary) {
                return null;
            }
View Full Code Here

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

    @Captor
    private ArgumentCaptor<Attributes> attributesCaptor;

    @Test
    public void test_without_config_is_noop() throws Exception {
        MockBundle bundle = new MockBundle(-1);
        MockComponentContext ctx = new MockComponentContext(bundle);

        StaticReferenceRewriteTransformerFactory factory = new StaticReferenceRewriteTransformerFactory();
        factory.activate(ctx);
View Full Code Here

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

        assertEquals("/etc/clientlib/test.css", out.getValue(0));
    }

    @Test
    public void test_with_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();
View Full Code Here

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

        assertEquals("//static.host.com/etc/clientlib/test.css", out.getValue(0));
    }

    @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();
View Full Code Here

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

    }


    @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();
View Full Code Here

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

        assertEquals("/content/clientlib/test.css", out.getValue(0));
    }

    @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);
View Full Code Here

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

        assertEquals("//static2.host.com/etc/clientlib/testA.css", out.getValue(0));
    }

    @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);
View Full Code Here

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

        assertEquals("/etc/clientlib/testABC.css", out.getValue(0));
    }

    @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);
View Full Code Here

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

    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,
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.