Package org.rioproject.opstring

Examples of org.rioproject.opstring.OperationalString


        OperationalStringManager[] opStringMgrs = da.getOperationalStringManagers();
        if (opStringMgrs == null || opStringMgrs.length == 0) {
            return;
        }
        for (OperationalStringManager opStringMgr : opStringMgrs) {
            OperationalString ops = opStringMgr.getOperationalString();
            if(getGraphView().getOpStringNode(ops.getName())!=null)
                return;
            getGraphView().addOpString(monitor, ops);
            ServiceElement[] elems = ops.getServices();
            for(ServiceElement elem : elems) {
                ServiceBeanInstance[] instances = opStringMgr.getServiceBeanInstances(elem);
                for(ServiceBeanInstance instance : instances) {
                    GraphNode node =
                            getGraphView().serviceUp(elem, instance);
                    if(node!=null)
                        ServiceItemFetchQ.write(node, pmp.getGraphView());
                    else {
                        System.err.println("### Cant get GraphNode for ["+elem.getName()+"], " +
                                           "instance ["+instance.getServiceBeanConfig().getInstanceID()+"]");
                    }
                }
            }
            getGraphView().setOpStringState(ops.getName());
        }
    }
View Full Code Here


                    OperationalStringManager[] opStringMgrs = da.getOperationalStringManagers();
                    if (opStringMgrs.length == 0) {
                        return;
                    }
                    for (OperationalStringManager opStringMgr : opStringMgrs) {
                        OperationalString ops = opStringMgr.getOperationalString();
                        if(pmp.getGraphView().getOpStringNode(ops.getName())!=null)
                           return;
                        pmp.getGraphView().addOpString(monitor, ops);
                        ServiceElement[] elems = ops.getServices();
                        for(ServiceElement elem : elems) {
                            ServiceBeanInstance[] instances = opStringMgr.getServiceBeanInstances(elem);
                            for(ServiceBeanInstance instance : instances) {
                                GraphNode node = pmp.getGraphView().serviceUp(elem, instance);
                                if(node!=null)
                                    ServiceItemFetchQ.write(node, pmp.getGraphView());
                                else {
                                    System.err.println("### Cant get GraphNode " +
                                                       "for ["+elem.getName()+"], " +
                                                       "instance ["+instance.getServiceBeanConfig().getInstanceID()+"]");
                                }
                            }
                        }
                        pmp.getGraphView().setOpStringState(ops.getName());
                    }
                }
                if(item.service instanceof Cybernode) {
                    Cybernode c = (Cybernode)item.service;
                    CybernodeAdmin cAdmin;
View Full Code Here

     *          if there are errors processing
     *          the OperationalStrings
     */
    void processUpdatedOpStrings() throws OperationalStringException {
        for (RecordHolder holder : updatedOpstrings) {
            OperationalString opString = holder.getOperationalString();
            try {
                if (holder.getAction() == RecordHolder.MODIFIED) {
                    if (!opStringMangerController.opStringExists(opString.getName())) {
                        Map<String, Throwable> map = new HashMap<String, Throwable>();
                        opStringMangerController.addOperationalString(opString, map, null, null, null);
                        opStringMangerController.dumpOpStringError(map);
                    } else {
                        OpStringManager opMgr = opStringMangerController.getOpStringManager(opString.getName());
                        Map map = opMgr.doUpdateOperationalString(opString);
                        opStringMangerController.dumpOpStringError(map);
                    }
                } /*else {
                    undeploy(opString.getName(), false);
View Full Code Here

        this.deploymentVerifier = deploymentVerifier;
    }

    public void undeploy(final OpStringManager opStringManager, final boolean terminate) {
        opStringManager.setDeploymentStatus(OperationalString.UNDEPLOYED);
        OperationalString opString = opStringManager.doGetOperationalString();
        logger.trace("Terminating Operational String [{}]", opString.getName());
        OperationalString[] terminated = opStringManager.terminate(terminate);
        logger.info("Undeployed Operational String [{}]", opString.getName());
        for(OperationalString os : terminated) {
            eventProcessor.processEvent(new ProvisionMonitorEvent(serviceProxy,
                                                                  ProvisionMonitorEvent.Action.OPSTRING_UNDEPLOYED,
                                                                  os));
        }
View Full Code Here

        Assert.assertNotNull(cybernode);
        Throwable thrown = null;
        try {
            OperationalStringManager mgr = testManager.getOperationalStringManager();
            Assert.assertNotNull("Expected non-null OperationalStringManager", mgr);
            OperationalString opstring = mgr.getOperationalString();
            Assert.assertNotNull(opstring);
            Assert.assertEquals(1, opstring.getServices().length);
            ServiceElement elem = opstring.getServices()[0];
            Assert.assertNotNull("Expected a non-null ExecDescriptor", elem.getExecDescriptor());
            testManager.waitForDeployment(mgr);
            String jvmVersion = System.getProperty("java.version");
            if(jvmVersion.contains("1.5")) {
                logger.info("The JMX Attach APIs require Java 6 or above. You are running Java "+jvmVersion);
            } else {
                RuntimeMXBean runtime = attach("T62___W_FL___SK_-1");
                Assert.assertNotNull("Expected a RuntimeMXBean", runtime);
                verifyJVMArgs(runtime, elem.getExecDescriptor());
            }
            ServiceBeanInstance[] instances = cybernode.getServiceBeanInstances(opstring.getServices()[0]);
            Assert.assertEquals(1, instances.length);
            Fork fork = (Fork)instances[0].getService();
            Assert.assertTrue("Expected verify() to return true, check service log for details", fork.verify());
            //logger.info("Wait for 5 minutes, make sure that only one service remains....");
            //Thread.sleep(TimeUnit.MINUTES.toMillis(5));
View Full Code Here

            /* Count the generated groovy config files in /tmp. We want to
             * make sure that if we generate a temp config file it is removed*/
            int configFilesInTmp = countTempConfigFiles();
            OperationalStringManager mgr = testManager.deploy();
            Assert.assertNotNull("Expected non-null OperationalStringManager", mgr);
            OperationalString opstring = mgr.getOperationalString();
            Assert.assertNotNull(opstring);
            Assert.assertEquals(1, opstring.getServices().length);
            testManager.waitForDeployment(mgr);
            ServiceBeanInstance[] instances =
                cybernode.getServiceBeanInstances(opstring.getServices()[0]);
            Assert.assertEquals(1, instances.length);
            Simple simple = (Simple)instances[0].getService();
            Assert.assertEquals("Hello visitor : 1", simple.hello("hi"));

            Assert.assertEquals(configFilesInTmp, countTempConfigFiles());

            testManager.undeploy(opstring.getName());
        } catch(Exception e) {
            thrown = e;
            e.printStackTrace();
        }
        Assert.assertNull("Should not have thrown an exception", thrown);
View Full Code Here

        Assert.assertNotNull(cybernode);
        Throwable thrown = null;
        try {
            OperationalStringManager mgr = testManager.deploy();
            Assert.assertNotNull("Expected non-null OperationalStringManager", mgr);
            OperationalString opstring = mgr.getOperationalString();
            Assert.assertNotNull(opstring);
            Assert.assertEquals(1, opstring.getServices().length);
            testManager.waitForDeployment(mgr);
            ServiceBeanInstance[] instances =
                cybernode.getServiceBeanInstances(opstring.getServices()[0]);
            Assert.assertEquals(1, instances.length);           
            mgr.increment(opstring.getServices()[0], true, null);
            ServiceMonitor<Simple> sMon =
                new ServiceMonitor<Simple>(testManager.getServiceDiscoveryManager(), Simple.class);
            sMon.waitFor(2);
            instances =
                cybernode.getServiceBeanInstances(opstring.getServices()[0]);
            Assert.assertEquals(2, instances.length);
            for(ServiceBeanInstance sbi : instances) {
                Simple h = (Simple)sbi.getService();
                Assert.assertEquals("Hello visitor : 1", h.hello("hi"));
            }
            testManager.undeploy(opstring.getName());
        } catch(Exception e) {
            thrown = e;
            e.printStackTrace();
        }
        Assert.assertNull("Should not have thrown an exception", thrown);
View Full Code Here

        Assert.assertNotNull(testManager);
        Throwable thrown = null;
        try {
            OperationalStringManager mgr = testManager.deploy();
            Assert.assertNotNull("Expected non-null OperationalStringManager", mgr);
            OperationalString opstring = mgr.getOperationalString();
            Assert.assertNotNull(opstring);
            Assert.assertEquals(1, opstring.getServices().length);
            testManager.waitForDeployment(mgr);
            ServiceBeanInstance[] instances =
                cybernode.getServiceBeanInstances(opstring.getServices()[0]);
            Assert.assertEquals(1, instances.length);
            Simple simple = (Simple)instances[0].getService();
            Assert.assertEquals("Hello visitor : 1", simple.hello("hi"));
            mgr.decrement(instances[0], true, true);
            ServiceMonitor<Simple> sMon =
                new ServiceMonitor<Simple>(testManager.getServiceDiscoveryManager(), Simple.class);
            sMon.waitFor(0);
            instances =
                cybernode.getServiceBeanInstances(opstring.getServices()[0]);
            Assert.assertEquals(0, instances.length);
            testManager.undeploy(opstring.getName());
        } catch(Exception e) {
            thrown = e;
            e.printStackTrace();
        }
        Assert.assertNull("Should not have thrown an exception", thrown);
View Full Code Here

     * @param opStringName The name of the OperationalString to check
     *
     * @return  Return the OperationalString if found, otherwise return null
     */
    public OperationalString getNestedOperationalString(String opStringName) {
        OperationalString nested=null;
        synchronized(nestedOpStrings) {
            for (OperationalString nestedOpString : nestedOpStrings) {
                if (nestedOpString.getName().equals(opStringName)) {
                    nested = nestedOpString;
                    break;
View Full Code Here

* @author Dennis Reedy
*/
public class OpStringManagerControllerTest {
    @Test
    public void testAddRemove() throws Exception {
        OperationalString opString = new OpString("test", null);
        opString.addService(TestUtil.makeServiceElement("foo", "test"));
        Configuration config = new DynamicConfiguration();
        OpStringManagerController opStringManagerController = new OpStringManagerController();
        opStringManagerController.setServiceProxy(TestUtil.createProvisionMonitor());
        opStringManagerController.setEventProcessor(new ProvisionMonitorEventProcessor(config));
        opStringManagerController.setConfig(config);
View Full Code Here

TOP

Related Classes of org.rioproject.opstring.OperationalString

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.