Package org.osgi.service.component

Examples of org.osgi.service.component.ComponentContext


    }

    @Test
    public void testPackageAdditionWithFailingItemDelivery() throws Exception {
        PriorityPathDistributionStrategy priorityPathDistributionStrategy = new PriorityPathDistributionStrategy();
        ComponentContext context = mock(ComponentContext.class);
        Dictionary properties = mock(Dictionary.class);
        when(properties.get("priority.paths")).thenReturn(new String[]{"/content", "/apps"});
        when(context.getProperties()).thenReturn(properties);
        priorityPathDistributionStrategy.activate(context);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getPaths()).thenReturn(new String[]{"/etc"});
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);
View Full Code Here


    }

    @Test
    public void testPackageAdditionWithFailingItemDeliveryOnPriorityPath() throws Exception {
        PriorityPathDistributionStrategy priorityPathDistributionStrategy = new PriorityPathDistributionStrategy();
        ComponentContext context = mock(ComponentContext.class);
        Dictionary properties = mock(Dictionary.class);
        when(properties.get("priority.paths")).thenReturn(new String[]{"/content", "/apps"});
        when(context.getProperties()).thenReturn(properties);
        priorityPathDistributionStrategy.activate(context);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getPaths()).thenReturn(new String[]{"/content/sample2"});
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);
View Full Code Here

    }

    @Test
    public void testPackageAdditionWithNullItemStateFromTheQueue() throws Exception {
        PriorityPathDistributionStrategy priorityPathDistributionStrategy = new PriorityPathDistributionStrategy();
        ComponentContext context = mock(ComponentContext.class);
        Dictionary properties = mock(Dictionary.class);
        when(properties.get("priority.paths")).thenReturn(new String[]{"/content", "/apps"});
        when(context.getProperties()).thenReturn(properties);
        priorityPathDistributionStrategy.activate(context);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getPaths()).thenReturn(new String[]{"/etc"});
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);
View Full Code Here

    }

    @Test
    public void testPackageAdditionWithNullItemStateFromTheQueueOnPriorityPath() throws Exception {
        PriorityPathDistributionStrategy priorityPathDistributionStrategy = new PriorityPathDistributionStrategy();
        ComponentContext context = mock(ComponentContext.class);
        Dictionary properties = mock(Dictionary.class);
        when(properties.get("priority.paths")).thenReturn(new String[]{"/content", "/apps"});
        when(context.getProperties()).thenReturn(properties);
        priorityPathDistributionStrategy.activate(context);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getPaths()).thenReturn(new String[]{"/apps/some/stuff"});
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);
View Full Code Here

    }

    @Test
    public void testPackageAdditionWithNotNullItemStateFromTheQueue() throws Exception {
        PriorityPathDistributionStrategy priorityPathDistributionStrategy = new PriorityPathDistributionStrategy();
        ComponentContext context = mock(ComponentContext.class);
        Dictionary properties = mock(Dictionary.class);
        when(properties.get("priority.paths")).thenReturn(new String[]{"/content", "/apps"});
        when(context.getProperties()).thenReturn(properties);
        priorityPathDistributionStrategy.activate(context);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getPaths()).thenReturn(new String[]{"/etc"});
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);
View Full Code Here

    }

    @Test
    public void testPackageAdditionWithNotNullItemStateFromTheQueueOnPriorityPath() throws Exception {
        PriorityPathDistributionStrategy priorityPathDistributionStrategy = new PriorityPathDistributionStrategy();
        ComponentContext context = mock(ComponentContext.class);
        Dictionary properties = mock(Dictionary.class);
        when(properties.get("priority.paths")).thenReturn(new String[]{"/content", "/apps"});
        when(context.getProperties()).thenReturn(properties);
        priorityPathDistributionStrategy.activate(context);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getPaths()).thenReturn(new String[]{"/apps"});
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);
View Full Code Here

    protected ReferrerFilter filter;

    @Before public void setup() {
        filter = new ReferrerFilter();
        final ComponentContext ctx = mock(ComponentContext.class);
        final BundleContext bundleCtx = mock(BundleContext.class);
        final ServiceRegistration reg = mock(ServiceRegistration.class);
        final Dictionary<String, Object> props = new Hashtable<String, Object>(){{
            put("allow.hosts", new String[]{"relhost"});
            put("allow.hosts.regexp", new String[]{"http://([^.]*.)?abshost:80"});
 
View Full Code Here

        verifyPrivate(provider, times(1)).invoke("createResourceBundle", eq(null), eq(Locale.ENGLISH));
        verifyPrivate(provider, times(1)).invoke("createResourceBundle", eq(null), eq(Locale.GERMAN));
    }

    private ComponentContext createComponentContext(Hashtable<String, Object> config) {
        final ComponentContext componentContext = PowerMockito.mock(ComponentContext.class);
        Mockito.when(componentContext.getBundleContext()).thenReturn(PowerMockito.mock(BundleContext.class));
        Mockito.when(componentContext.getProperties()).thenReturn(config);
        return componentContext;
    }
View Full Code Here

    private static ComponentContext COMPONENT_CONTEXT;
    static ComponentContext getMockComponentContext() {
        if ( COMPONENT_CONTEXT == null ) {
            // Setup fake ComponentContext to allow JcrInstaller to start
            final ComponentContext cc = mockery.mock(ComponentContext.class);
            final BundleContext bc = mockery.mock(BundleContext.class);

            final Dictionary<String, Object> emptyDict = new Hashtable<String, Object>();
            mockery.checking(new Expectations() {{
                allowing(cc).getProperties();
View Full Code Here

    }
   
    public void testStopAndRestart() throws Exception {
        assertRegisteredPaths(contentHelper.FAKE_RESOURCES);
        assertRegisteredPaths(contentHelper.FAKE_CONFIGS);
        final ComponentContext cc = MiscUtil.getMockComponentContext();
       
        // With the installer deactivated, remove two resources and add some new ones
        osgiInstaller.clearRecordedCalls();
        installer.deactivate(cc);
        assertEquals("Expected no calls to OsgiInstaller when deactivating JcrInstaller",
View Full Code Here

TOP

Related Classes of org.osgi.service.component.ComponentContext

Copyright © 2018 www.massapicom. 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.