Package org.objectweb.celtix

Examples of org.objectweb.celtix.Bus


        bus.shutdown(true);
    }
   
    public void testEndpointInterfaceAnnotation() throws Exception {
       
        Bus bus = Bus.init();
       
        Object implementor = new AnotherDerivedGreeterImpl();
       
        WSDLManager manager = bus.getWSDLManager();
        EndpointReferenceType ref = EndpointReferenceUtils
                .getEndpointReference(manager, implementor);
        Definition def = EndpointReferenceUtils.getWSDLDefinition(manager, ref);
        assertNotNull("Could not load wsdl", def);
       
        Port port = EndpointReferenceUtils.getPort(bus.getWSDLManager(), ref);

        assertNull("Port should not be present in the reference.", port);
       
        bus.shutdown(true);
       
    }
View Full Code Here


    protected MBServerStart() {       
    }
   
    public static void main(String[] args) throws BusException {
        // Create the InstrumentationsManager
        Bus bus = Bus.init(args);
        System.out.println("BusID is " + bus.getBusID());
        //AutomaticWorkQueue awq =
        bus.getWorkQueueManager().getAutomaticWorkQueue();
        //need to use awq to run the programe
        System.out.println("Waiting forever...");
        try {
            Thread.sleep(Long.MAX_VALUE);
        } catch (InterruptedException e) {
View Full Code Here

        assertTrue(writer.toString().indexOf("jms:address") != -1);
    }

    public void testExtensionReturnsProperJAXBType() throws Exception {
        URL neturl = getClass().getResource("/wsdl/jms_test.wsdl");
        Bus bus = Bus.init();
        assertNotNull("Could not find WSDL", neturl);
        WSDLManager wsdlManager = bus.getWSDLManager();
        JAXBExtensionHelper.addExtensions(wsdlManager.getExtenstionRegistry(),
                                          javax.wsdl.Port.class,
                                         JMSAddressPolicyType.class);

        QName serviceName = new QName("http://celtix.objectweb.org/hello_world_jms", "HelloWorldService");
View Full Code Here

    public void testPlugableWSDLManager() throws Exception {
        WSDLManager wsdlManager = new WSDLManagerImpl(null);
        Map<String, Object> properties = new WeakHashMap<String, Object>();
        properties.put("celtix.WSDLManager", wsdlManager);
        Bus bus = Bus.init(new String[0], properties);

        WSDLManager wsdlManagerNew = bus.getWSDLManager();

        //Verify that the WSDLManger is the one we plugged into bus previously
        assertEquals("wsdlManager is the one we expected", wsdlManager, wsdlManagerNew);
    }
View Full Code Here

    public void testPlugableTransportFactoryManager() throws Exception {
        TransportFactoryManagerImpl transportFactoryManagerImpl = createTransportFactory();
        Map<String, Object> properties = new WeakHashMap<String, Object>();
        properties.put("celtix.TRANSPORTFACTORYMANAGER", transportFactoryManagerImpl);
        Bus bus = Bus.init(new String[0], properties);

        TransportFactoryManager transportFactoryManagerImplNew = bus.getTransportFactoryManager();

        //Verify that the TransportFactoryManager is the one we plugged into bus previously,
        //other than the one created inside Bus
        assertEquals("wsdlManager is the one we expected", transportFactoryManagerImpl,
            transportFactoryManagerImplNew);
View Full Code Here

        assertEquals("wsdlManager is the one we expected", transportFactoryManagerImpl,
            transportFactoryManagerImplNew);
    }

    private TransportFactoryManagerImpl createTransportFactory() throws BusException {
        Bus bus = EasyMock.createMock(Bus.class);
        Configuration bc = EasyMock.createMock(Configuration.class);

        ObjectFactory of = new ObjectFactory();
        ClassNamespaceMappingListType mappings = of.createClassNamespaceMappingListType();
        bus.getConfiguration();
        EasyMock.expectLastCall().andReturn(bc);
        bc.getObject("transportFactories");
        EasyMock.expectLastCall().andReturn(mappings);
        EasyMock.replay(bus);
        EasyMock.replay(bc);
View Full Code Here

public class ServiceImplTest extends TestCase {

    public void testHandlerResolverAttribute() {
        QName sn = new QName("http://objectweb.org/hello_world_soap_http", "Greeter");
        Bus bus = org.easymock.classextension.EasyMock.createMock(CeltixBus.class);
        Configuration bc = EasyMock.createMock(Configuration.class);
        bus.getConfiguration();
        org.easymock.classextension.EasyMock.expectLastCall().andReturn(bc);
        bc.getChild(ServiceImpl.PORT_CONFIGURATION_URI, sn.toString());
        EasyMock.expectLastCall().andReturn(null);
        WorkQueueManager wm = EasyMock.createMock(WorkQueueManager.class);
        bus.getWorkQueueManager();
        EasyMock.expectLastCall().andReturn(wm);
        wm.getAutomaticWorkQueue();
        EasyMock.expectLastCall().andReturn(null);

        org.easymock.classextension.EasyMock.replay(bus);
View Full Code Here

    }


    public void testCtorWithBus() throws Exception {
       
        Bus bus = EasyMock.createMock(Bus.class);
        Configuration conf = EasyMock.createMock(Configuration.class);
       
        StringListType resolverList = new StringListType();
        resolverList.getItem().add(ClassLoaderResolver.class.getName());
        resolverList.getItem().add(ClasspathResolver.class.getName());

        new ClassLoaderResolver();

        bus.getConfiguration();
        EasyMock.expectLastCall().andReturn(conf);
        conf.getObject("resourceResolvers");
        EasyMock.expectLastCall().andReturn(resolverList);

        EasyMock.replay(bus);
View Full Code Here

    /*
     * Test method for 'javax.xml.ws.Service.getPorts()'
     */
    public void testGetPorts() throws Exception {
        Bus bus = Bus.init();
        QName endpoint = new QName("http://objectweb.org/hello_world_soap_http",
                                   "SoapPort");
       
        try {
            SOAPService hwService = new SOAPService();
            assertNotNull(hwService);
            Iterator iter = hwService.getPorts();
            assertFalse("Should have no element", iter.hasNext());

            Greeter port = hwService.getSoapPort();
            assertNotNull(port);
            assertTrue("Should be a proxy class. "
                        + port.getClass().getName(),
                        Proxy.isProxyClass(port.getClass()));
           
            iter = hwService.getPorts();
            assertTrue("Should have one element", iter.hasNext());           
            assertEquals("Activated EndPoints are not the same", endpoint, iter.next());           
        } finally {
            bus.shutdown(true);
        }
    }
View Full Code Here

    }
   
    public String registerCallback(EndpointReferenceType callback) {
       
        try {
            Bus bus = Bus.init();
            WSDLManager manager = new WSDLManagerImpl(bus);
       
            QName interfaceName = EndpointReferenceUtils.getInterfaceName(callback);
            String wsdlLocation = EndpointReferenceUtils.getWSDLLocation(callback);
            QName serviceName = EndpointReferenceUtils.getServiceName(callback);

           
            String portString = EndpointReferenceUtils.getPortName(callback);
           
            QName portName = new QName(serviceName.getNamespaceURI(), portString);
           
            StringBuffer seiName = new StringBuffer();
            seiName.append(JAXBUtils.namespaceURIToPackage(interfaceName.getNamespaceURI()));
            seiName.append(".");
            seiName.append(JAXBUtils.nameToIdentifier(interfaceName.getLocalPart(),
                                                      JAXBUtils.IdentifierType.INTERFACE));
           
            Class<?> sei = null;   
            try {
                sei = Class.forName(seiName.toString(),
                                    true, manager.getClass().getClassLoader());
            } catch (ClassNotFoundException ex) {
                ex.printStackTrace();
            }
           
            URL wsdlURL = (new File(wsdlLocation)).toURL();            
           
            Service service = Service.create(wsdlURL, serviceName);
            CallbackPortType port =  (CallbackPortType)service.getPort(portName, sei);

            port.serverSayHi("Sean");
 
            bus.shutdown(true);
           
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
View Full Code Here

TOP

Related Classes of org.objectweb.celtix.Bus

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.