Package javax.jbi.component

Examples of javax.jbi.component.Component


        NMR nmr = getOsgiService(NMR.class);
        assertNotNull(nmr);
        installBundle("org.apache.servicemix", "servicemix-shared-compat", "installer", "zip");
        installBundle("org.apache.servicemix", "servicemix-eip", "installer", "zip");
        System.out.println("Waiting for JBI Component");
        Component cmp = (Component) getOsgiService(Component.class);
        assertNotNull(cmp);
    }
View Full Code Here


        // Create mocks
        ExtMockControl bootstrapMock = ExtMockControl.createControl(Bootstrap.class);
        Bootstrap bootstrap = (Bootstrap) bootstrapMock.getMock();
        Bootstrap1.setDelegate(bootstrap);
        ExtMockControl componentMock = ExtMockControl.createControl(Component.class);
        Component component = (Component) componentMock.getMock();
        Component1.setDelegate(component);

        // configure bootstrap
        bootstrapMock.reset();
        bootstrap.init(null);
View Full Code Here

        // Create mocks
        ExtMockControl bootstrapMock = ExtMockControl.createControl(Bootstrap.class);
        Bootstrap bootstrap = (Bootstrap) bootstrapMock.getMock();
        Bootstrap1.setDelegate(bootstrap);
        ExtMockControl componentMock = ExtMockControl.createControl(Component.class);
        Component component = (Component) componentMock.getMock();
        Component1.setDelegate(component);
        ExtMockControl lifecycleMock = ExtMockControl.createControl(ComponentLifeCycle.class);
        ComponentLifeCycle lifecycle = (ComponentLifeCycle) lifecycleMock.getMock();

        // configure bootstrap
        bootstrapMock.reset();
        bootstrap.init(null);
        bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
        bootstrap.onInstall();
        bootstrap.getExtensionMBeanName();
        bootstrapMock.setReturnValue(null);
        bootstrap.cleanUp();
        bootstrapMock.replay();
        // configure component
        componentMock.reset();
        componentMock.replay();
        // configure lifecycle
        lifecycleMock.reset();
        lifecycleMock.replay();
        // test component installation
        startContainer(true);
        String installJarUrl = createInstallerArchive("component1").getAbsolutePath();
        ObjectName installerName = getInstallationService().loadNewInstaller(installJarUrl);
        InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
                        installerName, InstallerMBean.class, false);
        assertFalse(installer.isInstalled());
        ObjectName lifecycleName = installer.install();
        LifeCycleMBean lifecycleMBean = (LifeCycleMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(),
                        lifecycleName, LifeCycleMBean.class, false);
        assertEquals(LifeCycleMBean.SHUTDOWN, lifecycleMBean.getCurrentState());
        // check mocks
        bootstrapMock.verify();
        componentMock.verify();
        lifecycleMock.verify();

        // configure bootstrap
        bootstrapMock.reset();
        bootstrapMock.replay();
        // configure component
        componentMock.reset();
        component.getLifeCycle();
        componentMock.setReturnValue(lifecycle);
        componentMock.replay();
        // configure lifecycle
        lifecycleMock.reset();
        lifecycle.init(null);
        lifecycleMock.setMatcher(MockControl.ALWAYS_MATCHER);
        lifecycle.start();
        lifecycleMock.replay();
        // test component installation
        lifecycleMBean.start();
        assertEquals(LifeCycleMBean.STARTED, lifecycleMBean.getCurrentState());
        // check mocks
        bootstrapMock.verify();
        componentMock.verify();
        lifecycleMock.verify();

        // configure bootstrap
        bootstrapMock.reset();
        bootstrapMock.replay();
        // configure component
        componentMock.reset();
        componentMock.replay();
        // configure lifecycle
        lifecycleMock.reset();
        lifecycle.stop();
        lifecycle.shutDown();
        lifecycleMock.replay();
        // shutdown container
        shutdownContainer();
        // check mocks
        bootstrapMock.verify();
        componentMock.verify();
        lifecycleMock.verify();

        // configure bootstrap
        bootstrapMock.reset();
        bootstrap.init(null);
        bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
        bootstrap.getExtensionMBeanName();
        bootstrapMock.setReturnValue(null);
        bootstrapMock.replay();
        // configure component
        componentMock.reset();
        component.getLifeCycle();
        componentMock.setDefaultReturnValue(lifecycle);
        componentMock.replay();
        // configure lifecycle
        lifecycleMock.reset();
        lifecycle.getExtensionMBeanName();
View Full Code Here

        // Create mocks
        ExtMockControl bootstrapMock = ExtMockControl.createControl(Bootstrap.class);
        Bootstrap bootstrap = (Bootstrap) bootstrapMock.getMock();
        Bootstrap1.setDelegate(bootstrap);
        ExtMockControl componentMock = ExtMockControl.createControl(Component.class);
        Component component = (Component) componentMock.getMock();
        Component1.setDelegate(component);
        ExtMockControl lifecycleMock = ExtMockControl.createControl(ComponentLifeCycle.class);
        ComponentLifeCycle lifecycle = (ComponentLifeCycle) lifecycleMock.getMock();

        // configure bootstrap
        bootstrapMock.reset();
        bootstrap.init(null);
        bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);
        bootstrap.onInstall();
        bootstrap.getExtensionMBeanName();
        bootstrapMock.setReturnValue(null);
        bootstrap.cleanUp();
        bootstrapMock.replay();
        // configure component
        componentMock.reset();
        component.getLifeCycle();
        componentMock.setDefaultReturnValue(lifecycle);
        componentMock.replay();
        // configure lifecycle
        lifecycleMock.reset();
        lifecycleMock.replay();
View Full Code Here

        // Create mocks
        ExtMockControl bootstrapMock = ExtMockControl.createControl(Bootstrap.class);
        Bootstrap bootstrap = (Bootstrap) bootstrapMock.getMock();
        Bootstrap1.setDelegate(bootstrap);
        ExtMockControl componentMock = ExtMockControl.createControl(Component.class);
        Component component = (Component) componentMock.getMock();
        Component1.setDelegate(component);

        // configure bootstrap
        bootstrapMock.reset();
        bootstrap.init(null);
View Full Code Here

            }
        }
    }

    protected MessageExchangeListener getExchangeListener() {
        Component comp = this.component.getComponent();
        if (comp instanceof MessageExchangeListener) {
            return (MessageExchangeListener) comp;
        }
        ComponentLifeCycle lifecycle = this.component.getLifeCycle();
        if (lifecycle instanceof MessageExchangeListener) {
View Full Code Here

            for (Iterator it = endpoints.entrySet().iterator(); it.hasNext();) {
                Map.Entry e = (Map.Entry) it.next();
                List l = (List) e.getValue();
                for (Iterator itEp = l.iterator(); itEp.hasNext();) {
                    Object endpoint = itEp.next();
                    Component c = endpointToComponent.remove(endpoint);
                    ((DefaultComponent) c).removeEndpoint((Endpoint) endpoint);
                }
            }
        }
        // Deactivate components
View Full Code Here

            Map.Entry e = (Map.Entry) it.next();
            String key = (String) e.getKey();
            List l = (List) e.getValue();
            for (Iterator itEp = l.iterator(); itEp.hasNext();) {
                Object endpoint = itEp.next();
                Component c = null;
                if (key.length() > 0) {
                    Component comp = (Component) components.get(key);
                    if (comp == null) {
                        throw new JBIException("Could not find component '" + key + "' specified for endpoint");
                    }
                    c = comp;
                } else {
                    for (Iterator itCmp = components.values().iterator(); itCmp.hasNext();) {
                        Component comp = (Component) itCmp.next();
                        Class[] endpointClasses = (Class[]) getEndpointClassesMethod.invoke(comp, null);
                        if (isKnownEndpoint(endpoint, endpointClasses)) {
                            c = comp;
                            break;
                        }
View Full Code Here

            String uri = NamespaceHelper.createDiscoveryPathName(namespaceURI);
            Properties props = PropertiesLoaderUtils.loadAllProperties(uri);
            String compClassName = props.getProperty("component");
            if (compClassName != null) {
                Class compClass = ClassUtils.forName(compClassName);
                Component comp = (Component) BeanUtils.instantiateClass(compClass);
                Class[] endpointClasses = (Class[]) getEndpointClassesMethod.invoke(comp, null);
                if (isKnownEndpoint(endpoint, endpointClasses)) {
                    String name = chooseComponentName(comp);
                    getContainer().activateComponent(comp, name);
                    components.put(name, comp);
View Full Code Here

            unzip(context, new JarFile(new File(targetDir, zip)), installUri);
            // Add component config as a dependency
            Artifact sl = new Artifact("servicemix-components", comp, "0.0", "car");
            environment.addDependency(sl, ImportType.ALL);
             // Deploy the SU on the component
             Component jbiServiceUnit = null;
             try {
                 jbiServiceUnit = getAssociatedJbiServiceUnit(comp, sl);
             } catch (GBeanNotFoundException e) {
                 throw new DeploymentException("Can not find the associated service unit for this service assembly. "
                         + "Check if it's deployed and started.", e);
             }
             ServiceUnitManager serviceUnitManager = jbiServiceUnit.getServiceUnitManager();
             File installDir = new File(context.getBaseDir(), installUri.toString());
             String deploy = serviceUnitManager.deploy(name, installDir.getAbsolutePath())
             serviceUnitReferences.add(new ServiceUnitReference(sl, name, installDir.getAbsolutePath()));
             log.debug(deploy);
        }
View Full Code Here

TOP

Related Classes of javax.jbi.component.Component

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.