Package org.apache.cxf.frontend

Examples of org.apache.cxf.frontend.ServerFactoryBean


        ServiceReference httpSvcSR = EasyMock.createNiceMock(ServiceReference.class);
        EasyMock.replay(httpSvcSR);
        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() {
                    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.POJO_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>();
View Full Code Here


        ServiceReference httpSvcSR = EasyMock.createNiceMock(ServiceReference.class);
        EasyMock.replay(httpSvcSR);
        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) {
View Full Code Here

        ServiceReference httpSvcSR = EasyMock.createNiceMock(ServiceReference.class);
        EasyMock.replay(httpSvcSR);
        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) {
View Full Code Here

        ReflectionServiceFactoryBean sf = EasyMock.createNiceMock(ReflectionServiceFactoryBean.class);
        EasyMock.replay(sf);
       
        final StringBuilder serverURI = new StringBuilder();
       
        ServerFactoryBean sfb = EasyMock.createNiceMock(ServerFactoryBean.class);
        Server server = createMockServer(sfb);   
       
        EasyMock.expect(sfb.getServiceFactory()).andReturn(sf).anyTimes();
        EasyMock.expect(sfb.create()).andReturn(server);
        sfb.setAddress((String) EasyMock.anyObject());
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
            public Object answer() throws Throwable {
                serverURI.setLength(0);
                serverURI.append(EasyMock.getCurrentArguments()[0]);
                return null;
            }           
        }).anyTimes();
        EasyMock.expect(sfb.getAddress()).andAnswer(new IAnswer<String>() {
            public String answer() throws Throwable {
                return serverURI.toString();
            }           
        }).anyTimes();
        EasyMock.replay(sfb);
View Full Code Here

    public void testCreateServerPopulatesDistributionProvider() {
        BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
        EasyMock.replay(dswContext);

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

    public void testCreateServerWithAddressProprety() {
        BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
        EasyMock.replay(dswContext);

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

        ReflectionServiceFactoryBean sf = EasyMock.createNiceMock(ReflectionServiceFactoryBean.class);
        EasyMock.replay(sf);
       
        final StringBuilder serverURI = new StringBuilder();
       
        ServerFactoryBean sfb = EasyMock.createNiceMock(ServerFactoryBean.class);
        Server server = createMockServer(sfb);   
       
        EasyMock.expect(sfb.getServiceFactory()).andReturn(sf).anyTimes();
        EasyMock.expect(sfb.create()).andReturn(server);
        sfb.setAddress((String) EasyMock.anyObject());
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
            public Object answer() throws Throwable {
                serverURI.setLength(0);
                serverURI.append(EasyMock.getCurrentArguments()[0]);
                return null;
            }           
        });
        EasyMock.expect(sfb.getAddress()).andAnswer(new IAnswer<String>() {
            public String answer() throws Throwable {
                return serverURI.toString();
            }           
        });
        EasyMock.replay(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
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
View Full Code Here

        //    registers in the Service Registry.
        // 5. The test waits for this service to appear and then checks the results which are available as
        //    a service property.
       
        // Set up a Server in the test
        ServerFactoryBean factory = new ServerFactoryBean();
        factory.setServiceClass(GreeterService.class);
        factory.setAddress("http://localhost:9191/grrr");
        factory.getServiceFactory().setDataBinding(new AegisDatabinding());
        factory.setServiceBean(new TestGreeter());
       
        Server server = null;
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(ServerFactoryBean.class.getClassLoader());
            server = factory.create();
           
            System.out.println("Give the system a few seconds to breathe...");
            Thread.sleep(3000);
       
            Hashtable<String, Object> props = new Hashtable<String, Object>();
View Full Code Here

TOP

Related Classes of org.apache.cxf.frontend.ServerFactoryBean

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.