Package org.osgi.framework

Examples of org.osgi.framework.Bundle.findEntries()


   
    public void testRemoteServicesXMLFiles() {
        URL rs1URL = getClass().getResource("/rs1.xml");
       
        Bundle b = EasyMock.createNiceMock(Bundle.class);
        EasyMock.expect(b.findEntries(
            EasyMock.eq("OSGI-INF/remote-service"),
            EasyMock.eq("*.xml"), EasyMock.anyBoolean())).andReturn(
                Collections.enumeration(Arrays.asList(rs1URL))).anyTimes();
        EasyMock.replay(b);
       
View Full Code Here


    public void testMultiRemoteServicesXMLFiles() {
        URL rs1URL = getClass().getResource("/rs1.xml");
        URL rs2URL = getClass().getResource("/rs2.xml");
       
        Bundle b = EasyMock.createNiceMock(Bundle.class);
        EasyMock.expect(b.findEntries(
            EasyMock.eq("OSGI-INF/remote-service"),
            EasyMock.eq("*.xml"), EasyMock.anyBoolean())).andReturn(
                Collections.enumeration(Arrays.asList(rs1URL, rs2URL))).anyTimes();
        EasyMock.replay(b);
       
View Full Code Here

        headers.put("Remote-Service", "META-INF/osgi");
        headers.put("Bundle-Name", "testing bundle");
       
        Bundle b = EasyMock.createNiceMock(Bundle.class);
        EasyMock.expect(b.getHeaders()).andReturn(headers).anyTimes();
        EasyMock.expect(b.findEntries(
            EasyMock.eq("META-INF/osgi"),
            EasyMock.eq("*.xml"), EasyMock.anyBoolean())).andReturn(
                Collections.enumeration(Arrays.asList(rs1URL))).anyTimes();
        EasyMock.replay(b);
       
View Full Code Here

   
    public void testAllRemoteReferences() {
        URL rs1URL = getClass().getResource("/rs1.xml");
       
        Bundle b = EasyMock.createNiceMock(Bundle.class);
        EasyMock.expect(b.findEntries("OSGI-INF/remote-service", "*.xml", false)).
                andReturn(Collections.enumeration(Arrays.asList(rs1URL)));
        EasyMock.replay(b);
       
        List<ServiceEndpointDescription> seds = LocalDiscoveryUtils.getAllRemoteReferences(b);
        assertEquals(2, seds.size());
View Full Code Here

    private void doTestPublishHook(String remoteServices,
                                   String[] serviceNames,
                                   String[] addresses) throws Exception {
       
        Bundle bundle = control.createMock(Bundle.class);
        bundle.findEntries(EasyMock.eq("OSGI-INF/remote-service"),
            EasyMock.eq("*.xml"), EasyMock.anyBoolean());
        EasyMock.expectLastCall().andReturn(Collections.enumeration(
            Arrays.asList(getClass().getResource("/OSGI-INF/remote-service/" + remoteServices))));
        Dictionary<String, String> bundleHeaders = new Hashtable<String, String>();
        bundleHeaders.put(org.osgi.framework.Constants.BUNDLE_NAME,
View Full Code Here

   
    @SuppressWarnings("unchecked")
    @Test
    public void testPublishMultipleTimes() {
        Bundle bundle = control.createMock(Bundle.class);
        bundle.findEntries(EasyMock.eq("OSGI-INF/remote-service"),
                EasyMock.eq("*.xml"), EasyMock.anyBoolean());
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
            public Object answer() throws Throwable {
                return Collections.enumeration(Arrays.asList(
                    getClass().getResource("/OSGI-INF/remote-service/remote-services.xml")));
View Full Code Here

   
    public void testRemoteServicesXMLFiles() {
        URL rs1URL = getClass().getResource("/test-resources/rs1.xml");
       
        Bundle b = EasyMock.createNiceMock(Bundle.class);
        EasyMock.expect(b.findEntries(
            EasyMock.eq("OSGI-INF/remote-service"),
            EasyMock.eq("*.xml"), EasyMock.anyBoolean())).andReturn(
                Collections.enumeration(Arrays.asList(rs1URL))).anyTimes();
        EasyMock.replay(b);
       
View Full Code Here

    public void testMultiRemoteServicesXMLFiles() {
        URL rs1URL = getClass().getResource("/test-resources/rs1.xml");
        URL rs2URL = getClass().getResource("/test-resources/rs2.xml");
       
        Bundle b = EasyMock.createNiceMock(Bundle.class);
        EasyMock.expect(b.findEntries(
            EasyMock.eq("OSGI-INF/remote-service"),
            EasyMock.eq("*.xml"), EasyMock.anyBoolean())).andReturn(
                Collections.enumeration(Arrays.asList(rs1URL, rs2URL))).anyTimes();
        EasyMock.replay(b);
       
View Full Code Here

        headers.put("Remote-Service", "META-INF/osgi");
        headers.put("Bundle-Name", "testing bundle");
       
        Bundle b = EasyMock.createNiceMock(Bundle.class);
        EasyMock.expect(b.getHeaders()).andReturn(headers).anyTimes();
        EasyMock.expect(b.findEntries(
            EasyMock.eq("META-INF/osgi"),
            EasyMock.eq("*.xml"), EasyMock.anyBoolean())).andReturn(
                Collections.enumeration(Arrays.asList(rs1URL))).anyTimes();
        EasyMock.replay(b);
       
View Full Code Here

        }

        @Override
        public List<URL> findEntries(String path, String filePattern, boolean recurse) {
            Bundle bundle = context.getBundle(module.getModuleId());
            Enumeration<URL> paths = bundle.findEntries(path, filePattern, recurse);
            List<URL> result = new ArrayList<URL>();
            if (paths != null) {
                while (paths.hasMoreElements()) {
                    URL element = paths.nextElement();
                    result.add(element);
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.