Examples of ServiceElement


Examples of org.rioproject.opstring.ServiceElement

     * @param newElem The ServiceElement for the ServiceBean
     */
    public void setServiceElement(final ServiceElement newElem) {
        if(newElem==null)
            throw new IllegalArgumentException("sElem is null");               
        ServiceElement preElem = sElem;
        this.sElem = newElem;                       
        try {
            updating = true;
            stateChange(preElem, sElem);
        } finally {
View Full Code Here

Examples of org.rioproject.opstring.ServiceElement

        if(updating) {           
            if(logger.isTraceEnabled())
                logger.trace("Updating ServiceElement, ServiceBeanConfig update ignored");
            return;
        }
        ServiceElement preElem = ServiceElementUtil.copyServiceElement(sElem);
        Long instanceID = sElem.getServiceBeanConfig().getInstanceID();
        sElem.setServiceBeanConfig(sbConfig);
        if(instanceID!=null)
            sElem = ServiceElementUtil.prepareInstanceID(sElem, false, instanceID);
        else
View Full Code Here

Examples of org.rioproject.opstring.ServiceElement

            if (!artifactDir.exists()) {
                artifactDir.mkdirs();
            }
            FileUtils.copy(new File("src/test/resources/darkside-1.0.config"),
                           new File(artifactDir, "darkside-1.0.config"));
            ServiceElement service = new ServiceElement();
            service.getServiceBeanConfig().setConfigArgs("rio-test.something.something:darkside:config:1.0");
            String[] args = ConfigHelper.getConfigArgs(service);
            Assert.assertNotNull(args);
            Assert.assertEquals(1, args.length);
            Configuration configuration = new GroovyConfig(args, Thread.currentThread().getContextClassLoader());
            Assert.assertNotNull(configuration);
View Full Code Here

Examples of org.rioproject.opstring.ServiceElement

        File file = new File("src/test/resources/opstring/simple_opstring_with_http_config.groovy");
        List<OpString> opStrings = opStringParser.parse(file,   // opstring
                                                        null,     // parent classloader
                                                        null,     // defaultGroups
                                                        null);    // loadPath
        ServiceElement serviceElement = opStrings.get(0).getServices()[0];

        ServiceBeanContext context = new ServiceContextFactory().create(serviceElement,
                                                                    new DefaultServiceBeanManager(serviceElement,
                                                                                   InetAddress.getLocalHost().getHostName(),
                                                                                   InetAddress.getLocalHost().getHostAddress(),
View Full Code Here

Examples of org.rioproject.opstring.ServiceElement

        int[] res = new int[cybernodes.length];
        for (int i = 0; i < cybernodes.length; i++) {
            Cybernode cybernode = cybernodes[i];
            ServiceRecord[] records = cybernode.getServiceRecords(ServiceRecord.ACTIVE_SERVICE_RECORD);
            for (ServiceRecord record : records) {
                ServiceElement element = record.getServiceElement();
                ClassBundle[] exportBundles = element.getExportBundles();
                for (ClassBundle bundle : exportBundles) {
                    if (bundle.getClassName().equals(type.getName())) {
                        res[i]++;
                        break;
                    }
View Full Code Here

Examples of org.rioproject.opstring.ServiceElement

        OperationalStringManager mgr = testManager.getOperationalStringManager();
        testManager.waitForDeployment(mgr);

        DeploymentMap dMap = mgr.getDeploymentMap();
        Assert.assertEquals(1, dMap.getServiceElements().length);
        ServiceElement elem = dMap.getServiceElements()[0];
        List<DeployedService> list = dMap.getDeployedServices(elem);
        Assert.assertEquals(1, list.size());
        DeployedService deployed =  list.get(0);
        Assert.assertNotNull(deployed);
View Full Code Here

Examples of org.rioproject.opstring.ServiceElement

            loader.parseOperationalString(
                new File("src/test/resources/opstring/simple_opstring.groovy"));
        Assert.assertEquals(1, opstrings.length);
        OpString opstring = (OpString)opstrings[0];
        Assert.assertEquals(1, opstring.getServices().length);
        ServiceElement service = opstring.getServices()[0];
        service.setPlanned(maintain);
        service.setProvisionType(provisionType);               

        int[] counts = CybernodeUtils.calcServices(cyberMon.getServices(),
                                                   Simple.class);
        logger.info("Services found before deploying the OpString: {}",
                   Arrays.asList(ArrayUtils.asObjects(counts)).toString());
View Full Code Here

Examples of org.rioproject.opstring.ServiceElement

        OperationalString[] opstrings =
            loader.parseOperationalString(new File("src/test/resources/opstring/simple_opstring.groovy"));
        org.junit.Assert.assertEquals(1, opstrings.length);
        OpString opstring = (OpString)opstrings[0];
        org.junit.Assert.assertEquals(1, opstring.getServices().length);
        ServiceElement service = opstring.getServices()[0];
        service.setPlanned(maintain);
        service.setMaxPerMachine(maxPerMachine);
        service.setProvisionType(fixed? ServiceElement.ProvisionType.FIXED: ServiceElement.ProvisionType.DYNAMIC);

        prevCounts = CybernodeUtils.calcServices(cyberMon.getServices(),Simple.class);
        logger.info("**** Services found before deploying the OpString: {}",
                   Arrays.asList(ArrayUtils.asObjects(prevCounts)));
        logger.debug("Service details: ["+service.getProvisionType()+"]");
        if (maxPerMachine == -1) {
            maxPerMachine = Integer.MAX_VALUE;
        }

        testManager.deploy(opstring, monitor);
View Full Code Here

Examples of org.rioproject.opstring.ServiceElement

            loader.parseOperationalString(
                new File("src/test/resources/opstring/simple_opstring.groovy"));
        org.junit.Assert.assertEquals(1, opstrings.length);
        OpString opstring = (OpString)opstrings[0];
        org.junit.Assert.assertEquals(1, opstring.getServices().length);
        ServiceElement service = opstring.getServices()[0];
        service.setPlanned(maintain);
        service.setMaxPerMachine(maxPerMachine);
            service.setProvisionType(fixed?
                                     ServiceElement.ProvisionType.FIXED:
                                     ServiceElement.ProvisionType.DYNAMIC);

        prevCounts = CybernodeUtils.calcServices(cyberMon.getServices(),
                                                 Simple.class);
View Full Code Here

Examples of org.rioproject.opstring.ServiceElement

            loader.parseOperationalString(new File("src/test/resources/opstring/simple_opstring.groovy"));
        org.junit.Assert.assertEquals(1, opstrings.length);
        OpString opstring = (OpString)opstrings[0];
        logger.info("Loaded "+opstring.getName());
        org.junit.Assert.assertEquals(1, opstring.getServices().length);
        ServiceElement service = opstring.getServices()[0];
        service.setProvisionType(fixed? ServiceElement.ProvisionType.FIXED : ServiceElement.ProvisionType.DYNAMIC);
        if (maintain < 0) {
            try {
                service.setPlanned(maintain);
                Assert.fail("IllegalArgumentException expected but not thrown");
            } catch (IllegalArgumentException e) {
            }
            logger.info("checkState, prevFixed: "+prevFixed+", prevMaintainInt: "+prevMaintainInt+", cybernode service count: "+cyberMon.getServices().size());
            checkState(prevFixed, prevMaintainInt, cyberMon.getServices());
        } else {
            logger.info(service.getName()+" set planned="+maintain);
            service.setPlanned(maintain);
            logger.info("Deploy "+opstring.getName());
            testManager.deploy(opstring, monitor);
            logger.info("Deployed "+opstring.getName());
            checkState(fixed, maintain, cyberMon.getServices());
            prevFixed = fixed;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.