Examples of createFilter()


Examples of org.osgi.framework.BundleContext.createFilter()

        ServiceTracker tracker = mock(ServiceTracker.class);
        when(tracker.getService()).thenReturn(mockEA);

        BundleContext bundleContext = mock(BundleContext.class);
        when(bundleContext.createFilter(any(String.class))).thenReturn(null);
        when(bundleContext.getServiceReference(any(String.class))).thenReturn(null);
        when(bundleContext.getService(null)).thenReturn(mockEA);
        when(bundleContext.registerService(any(String.class), any(Object.class), any(Dictionary.class)))
                .thenAnswer(new Answer<ServiceRegistration>() {
                    public ServiceRegistration answer(InvocationOnMock invocation) throws Throwable {
View Full Code Here

Examples of org.osgi.framework.BundleContext.createFilter()

        final ServiceTracker tracker = mock(ServiceTracker.class);
        when(tracker.getService()).thenReturn(mockEA);

        final BundleContext bundleContext = mock(BundleContext.class);
        when(bundleContext.createFilter(any(String.class))).thenReturn(null);
        when(bundleContext.getServiceReference(any(String.class))).thenReturn(null);
        when(bundleContext.getService(null)).thenReturn(mockEA);

        this.listener = new SynchronousJcrResourceListener(RepositoryUtil.getRepository(),
                        bundleContext, resolver, tracker);
View Full Code Here

Examples of org.osgi.framework.BundleContext.createFilter()

        EasyMock.expect(systemBundle.adapt(BundleRevision.class)).andReturn(systemBundleRevision);
        bundleContext.addBundleListener((BundleListener) EasyMock.anyObject());
        bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject());
        EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle });
        final Capture c = new Capture();
        EasyMock.expect(bundleContext.createFilter((String) capture(c))).andAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                return FilterImpl.newInstance((String) c.getValue());
            }
        }).anyTimes();
        EasyMock.replay(new Object[] { bundleContext, systemBundle, systemBundleRevision });
View Full Code Here

Examples of org.osgi.framework.BundleContext.createFilter()

        EasyMock.expect(systemBundle.adapt(BundleRevision.class)).andReturn(systemBundleRevision);
        bundleContext.addBundleListener((BundleListener) EasyMock.anyObject());
        bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject());
        EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle });
        final Capture c = new Capture();
        EasyMock.expect(bundleContext.createFilter((String) capture(c))).andAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                return FilterImpl.newInstance((String) c.getValue());
            }
        }).anyTimes();
        EasyMock.replay(new Object[] { bundleContext, systemBundle, systemBundleRevision });
View Full Code Here

Examples of org.osgi.framework.BundleContext.createFilter()

        EasyMock.expect(systemBundleRevision.getCapabilities(null)).andReturn(Collections.<Capability>emptyList());
        EasyMock.expect(systemBundle.adapt(BundleRevision.class)).andReturn(systemBundleRevision);
        bundleContext.addBundleListener((BundleListener) EasyMock.anyObject());
        bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject());
        EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle });
        EasyMock.expect(bundleContext.createFilter(null)).andReturn(new Filter() {
            public boolean match(ServiceReference reference) {
                return true;
            }
            public boolean match(Dictionary dictionary) {
                return true;
View Full Code Here

Examples of org.osgi.framework.BundleContext.createFilter()

        EasyMock.expect(systemBundle.adapt(BundleRevision.class)).andReturn(systemBundleRevision);
        bundleContext.addBundleListener((BundleListener) EasyMock.anyObject());
        bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject());
        EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle });
        final Capture c = new Capture();
        EasyMock.expect(bundleContext.createFilter((String) capture(c))).andAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                return FilterImpl.newInstance((String) c.getValue());
            }
        }).anyTimes();
        EasyMock.replay(new Object[] { bundleContext, systemBundle, systemBundleRevision });
View Full Code Here

Examples of org.osgi.framework.BundleContext.createFilter()

        BundleContext bundleContext = m_componentManager.getBundleContext();
        if ( bundleContext != null )
        {
            try
            {
                m_targetFilter = bundleContext.createFilter( filterString );
            }
            catch ( InvalidSyntaxException ise )
            {
                m_componentManager.log( LogService.LOG_ERROR, "Invalid syntax in target property for dependency {0} to {1}", new Object[]
                        {getName(), target}, null );
View Full Code Here

Examples of org.osgi.framework.BundleContext.createFilter()

               
                //create a filter that will never be satisfied
                filterString = "(component.id=-1)";
                try
                {
                    m_targetFilter = bundleContext.createFilter( filterString );
                }
                catch ( InvalidSyntaxException e )
                {
                    //this should not happen
                    return;
View Full Code Here

Examples of org.osgi.framework.BundleContext.createFilter()

        BundleContext bundleContext = ctx.getBundleContext();
        StringBuilder builder = new StringBuilder();
        builder.append("(&(");
        builder.append(Constants.OBJECTCLASS).append("=").append(Importer.SERVICE_NAME).append(")");
        builder.append("(displayName=*))");
        Filter filter = bundleContext.createFilter(builder.toString());
        this.tracker = new ServiceTracker(bundleContext, filter, null);
        this.tracker.open();
    }

    @Deactivate
View Full Code Here

Examples of org.osgi.framework.BundleContext.createFilter()

            Filter mockFilter = control.createMock(Filter.class);
            ServiceReference sr = control.createMock(ServiceReference.class);
            TestDiscoveredServiceTracker dst = new TestDiscoveredServiceTracker();
   
            EasyMock.expect(bc.getBundles()).andReturn(new Bundle[] {b0}).anyTimes();
            EasyMock.expect(bc.createFilter("(blah <= 5)")).andReturn(mockFilter).anyTimes();
            EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.FILTER_MATCH_CRITERIA)).
                    andReturn(Collections.singleton("(blah <= 5)")).anyTimes();
           
            EasyMock.expect(bc.getService(sr)).andReturn(dst).anyTimes();
           
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.