Package org.apache.cxf.dosgi.dsw.service

Examples of org.apache.cxf.dosgi.dsw.service.DistributionProviderImpl


        final BundleContext callingContext = control.createMock(BundleContext.class);       
        List<AbstractFeature> features = new ArrayList<AbstractFeature>();
        AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
        control.replay();
       
        DistributionProviderImpl dp = new DistributionProviderImpl(dswContext);

        Map<String, Object> props = new HashMap<String, Object>();
        props.put("osgi.remote.requires.intents", "B A");
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
       
View Full Code Here


        BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
        EasyMock.replay(dswContext);

        String myService = "Hi";               
        final ServerFactoryBean sfb = createMockServerFactoryBean();
        DistributionProviderImpl dp = new DistributionProviderImpl(dswContext);
        dp.addEventAdmin(ea);
       
        PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext, dp, handlerProps) {
            @Override
            ServerFactoryBean createServerFactoryBean() {
                return sfb;
View Full Code Here

        BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
        EasyMock.replay(dswContext);

        String myService = "Hi";               
        final ServerFactoryBean sfb = createMockServerFactoryBean();
        DistributionProviderImpl dp = new DistributionProviderImpl(dswContext);
        dp.addEventAdmin(ea);
       
        PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext, dp, handlerProps) {
            @Override
            ServerFactoryBean createServerFactoryBean() {
                return sfb;
View Full Code Here

        context.addServiceListener(this);                
        checkExistingServices();       
    }

    private CxfDistributionProvider registerDistributionProviderService() {
        DistributionProviderImpl dpService = new DistributionProviderImpl(bc);
        Hashtable<String, Object> props = new Hashtable<String, Object>();
       
        props.put(DistributionProvider.PRODUCT_NAME, getHeader("Bundle-Name"));
        props.put(DistributionProvider.PRODUCT_VERSION, getHeader("Bundle-Version"));
        props.put(DistributionProvider.VENDOR_NAME, getHeader("Bundle-Vendor"));
View Full Code Here

        EasyMock.expect(dswContext.getService(httpSvcSR)).andReturn(httpService).anyTimes();
        EasyMock.replay(dswContext);
       
        final ServerFactoryBean sfb = createMockServerFactoryBean();
       
        DistributionProviderImpl dp = new DistributionProviderImpl(dswContext);
        Map<String, Object> handlerProps = new HashMap<String, Object>();
        HttpServiceConfigurationTypeHandler h =
            new HttpServiceConfigurationTypeHandler(dswContext, dp, handlerProps) {
                @Override
                ServerFactoryBean createServerFactoryBean(String frontend) {
                    return sfb;
                }

                @Override
                String[] applyIntents(BundleContext dswContext, BundleContext callingContext,
                        List<AbstractFeature> features, AbstractEndpointFactory factory,
                        ServiceEndpointDescription sd) {
                    return new String [] {"a.b.c"};
                }           
        };
        h.httpServiceReferences.add(httpSvcSR);
       
        Runnable myService = new Runnable() {
            public void run() {
                System.out.println("blah");
            }           
        };
               
        ServiceReference sr = EasyMock.createNiceMock(ServiceReference.class);
        BundleContext callingContext = EasyMock.createNiceMock(BundleContext.class);
        EasyMock.replay(sr);
        EasyMock.replay(callingContext);

        Map<String, Object> props = new HashMap<String, Object>();
        props.put(Constants.WS_HTTP_SERVICE_CONTEXT, "/myRunnable");
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(Runnable.class.getName(), props);
       
        assertEquals("Precondition failed", 0, dp.getExposedServices().size());
        assertEquals("Precondition failed", "", sfb.getAddress());
        h.createServer(sr, dswContext, callingContext, sd, Runnable.class, myService);
        assertEquals("The address should be set to '/'. The Servlet context dictates the actual location.", "/", sfb.getAddress());
        assertEquals(1, dp.getExposedServices().size());
        assertSame(sr, dp.getExposedServices().iterator().next());
       
        String hostName = InetAddress.getLocalHost().getHostName();
        Map<String, String> expected = new HashMap<String, String>();
        expected.put("service.exported.configs", "org.apache.cxf.ws");
        expected.put("org.apache.cxf.ws.address", "http://" + hostName + ":1327/myRunnable");
        expected.put("service.intents", "a.b.c");
        assertEquals(expected, dp.getExposedProperties(sr));
    }
View Full Code Here

        EasyMock.expect(dswContext.getService(httpSvcSR)).andReturn(httpService).anyTimes();
        EasyMock.replay(dswContext);
       
        final ServerFactoryBean sfb = createMockServerFactoryBean();
       
        DistributionProviderImpl dp = new DistributionProviderImpl(dswContext);
        Map<String, Object> handlerProps = new HashMap<String, Object>();
        HttpServiceConfigurationTypeHandler h =
            new HttpServiceConfigurationTypeHandler(dswContext, dp, handlerProps) {
                @Override
                ServerFactoryBean createServerFactoryBean(String frontend) {
                    return sfb;
                }

                @Override
                String[] applyIntents(BundleContext dswContext, BundleContext callingContext,
                        List<AbstractFeature> features, AbstractEndpointFactory factory,
                        ServiceEndpointDescription sd) {
                    return new String [] {};
                }           
        };
        h.httpServiceReferences.add(httpSvcSR);
       
        Runnable myService = new Runnable() {
            public void run() {
                System.out.println("blah");
            }           
        };
               
        ServiceReference sr = EasyMock.createNiceMock(ServiceReference.class);
        BundleContext callingContext = EasyMock.createNiceMock(BundleContext.class);
        EasyMock.replay(sr);
        EasyMock.replay(callingContext);

        Map<String, Object> props = new HashMap<String, Object>();
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(Runnable.class.getName(), props);
       
        assertEquals("Precondition failed", 0, dp.getExposedServices().size());
        h.createServer(sr, dswContext, callingContext, sd, Runnable.class, myService);
        assertEquals(1, dp.getExposedServices().size());
        assertSame(sr, dp.getExposedServices().iterator().next());
       
        String hostname = InetAddress.getLocalHost().getHostName();
        Map<String, String> expected = new HashMap<String, String>();
        expected.put("service.exported.configs", "org.apache.cxf.ws");
        expected.put("org.apache.cxf.ws.address", "http://" + hostname + ":8080/java/lang/Runnable");
        assertEquals(expected, dp.getExposedProperties(sr));
    }
View Full Code Here

        EasyMock.expect(dswContext.getService(httpSvcSR)).andReturn(httpService).anyTimes();
        EasyMock.replay(dswContext);
       
        final ServerFactoryBean sfb = createMockServerFactoryBean();
       
        DistributionProviderImpl dp = new DistributionProviderImpl(dswContext);
        Map<String, Object> handlerProps = new HashMap<String, Object>();
        HttpServiceConfigurationTypeHandler h =
            new HttpServiceConfigurationTypeHandler(dswContext, dp, handlerProps) {
                @Override
                ServerFactoryBean createServerFactoryBean(String frontend) {
                    return sfb;
                }

                @Override
                String[] applyIntents(BundleContext dswContext, BundleContext callingContext,
                        List<AbstractFeature> features, AbstractEndpointFactory factory,
                        ServiceEndpointDescription sd) {
                    return new String [] {};
                }           
        };
        h.httpServiceReferences.add(httpSvcSR);
       
        Runnable myService = new Runnable() {
            public void run() {
                System.out.println("blah");
            }           
        };
               
        ServiceReference sr = EasyMock.createNiceMock(ServiceReference.class);
        BundleContext callingContext = EasyMock.createNiceMock(BundleContext.class);
        EasyMock.replay(sr);
        EasyMock.replay(callingContext);

        Map<String, Object> props = new HashMap<String, Object>();
        props.put("osgi.remote.configuration.type", Constants.WS_CONFIG_TYPE);
        props.put(Constants.WS_HTTP_SERVICE_CONTEXT, "/myRunnable");
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(Runnable.class.getName(), props);
       
        assertEquals("Precondition failed", 0, dp.getExposedServices().size());
        h.createServer(sr, dswContext, callingContext, sd, Runnable.class, myService);
        assertEquals(1, dp.getExposedServices().size());
        assertSame(sr, dp.getExposedServices().iterator().next());
       
        String hostName = InetAddress.getLocalHost().getHostName();
        Map<String, String> expected = new HashMap<String, String>();
        expected.put("service.exported.configs", "org.apache.cxf.ws");
        expected.put("org.apache.cxf.ws.address", "https://" + hostName + ":8432/myRunnable");
        assertEquals(expected, dp.getExposedProperties(sr));
    }
View Full Code Here

        EasyMock.replay(bc);
       
        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
       
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface");
        CxfDistributionProvider dp = new DistributionProviderImpl(bc);
        ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
        assertTrue(handler instanceof PojoConfigurationTypeHandler);       
        assertSame(dp, ((PojoConfigurationTypeHandler) handler).getDistributionProvider());
    }
View Full Code Here

        ConfigTypeHandlerFactory f = ConfigTypeHandlerFactory.getInstance();
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(Constants.EXPORTED_CONFIGS, Constants.RS_CONFIG_TYPE);
       
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
        CxfDistributionProvider dp = new DistributionProviderImpl(bc);
        ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);       
        assertSame(dp, ((PojoConfigurationTypeHandler) handler).getDistributionProvider());
    }
View Full Code Here

        Map<String, Object> props = new HashMap<String, Object>();
        props.put(Constants.EXPORTED_CONFIGS, Constants.RS_CONFIG_TYPE);
        props.put(Constants.EXPORTED_INTENTS, "HTTP");
       
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl("MyInterface", props);
        CxfDistributionProvider dp = new DistributionProviderImpl(bc);
        ConfigurationTypeHandler handler = f.getHandler(bc, sd, dp, new HashMap<String, Object>());
        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);       
        assertSame(dp, ((PojoConfigurationTypeHandler) handler).getDistributionProvider());
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.dosgi.dsw.service.DistributionProviderImpl

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.