Package org.rioproject.impl.opstring

Examples of org.rioproject.impl.opstring.OpStringLoader


     * @return The OpStringLoader
     *
     * @throws Exception if the OpStringLoader cannot be created
     */
    protected OpStringLoader getOpStringLoader() throws Exception {
        return(new OpStringLoader(this.getClass().getClassLoader()));
    }
View Full Code Here


* @author Dennis Reedy
*/
public class OpStringLoaderTest {
    @Test
    public void testOpStringLoader() throws Exception {
        OpStringLoader opStringLoader = new OpStringLoader();
        opStringLoader.setDefaultGroups("banjo");
        String baseDir = System.getProperty("user.dir");
        File calculator = new File(baseDir, "src/test/resources/opstrings/opstringloadertest.groovy");
        OperationalString[] opStrings = opStringLoader.parseOperationalString(calculator);
        Assert.assertNotNull(opStrings);
        Assert.assertEquals("Should have only 1 opstring", 1, opStrings.length);
        Assert.assertEquals("Should have 1 service", 1, opStrings[0].getServices().length);
        Assert.assertEquals(1, opStrings[0].getServices()[0].getServiceBeanConfig().getGroups().length);
        Assert.assertEquals("banjo", opStrings[0].getServices()[0].getServiceBeanConfig().getGroups()[0]);
View Full Code Here

     */
    public Map<String, Object> activate(File opstring, String... beans) throws Exception {
         if(opstring==null)
            throw new IllegalArgumentException("opstring file must not be null");
        Map<String, Object> map = new HashMap<String, Object>();
        OpStringLoader opl = new OpStringLoader();
        OperationalString[] opStrings = opl.parseOperationalString(opstring);
        for(OperationalString ops : opStrings) {
            if(beans!=null && beans.length>0)
                map.putAll(activate(ops, beans));
            else
                map.putAll(activate(ops));
View Full Code Here

        logger.info("Deployment parameters:\n"
                    + "provisionType: {}\n"
                    + "maintain:      {}",
                    provisionType,maintain);

        OpStringLoader loader = new OpStringLoader();
        OperationalString[] opstrings =
            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];
View Full Code Here

        logBanner("Test combination:, fixed="+fixed+ ", maintain="+maintain+", maxPerMachine="+maxPerMachine+"]");

        testManager.undeployAll(monitor);

        // Prepare OpString
        OpStringLoader loader = new OpStringLoader();
        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);
View Full Code Here

                  + ", maxPerMachine=" + maxPerMachine + "]");

        testManager.undeployAll(monitor);
       
        // Prepare OpString
        OpStringLoader loader = new OpStringLoader();
        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];
View Full Code Here

                    "------------------------------------------------");
        testManager.undeployAll(monitor);
        int prevMaintainInt = 0;

        // Prepare OpString
        OpStringLoader loader = new OpStringLoader();
        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];
        logger.info("Loaded "+opstring.getName());
        org.junit.Assert.assertEquals(1, opstring.getServices().length);
        ServiceElement service = opstring.getServices()[0];
View Full Code Here

    GraphView getGraphView() {
        return graphView;
    }

    private OperationalString[] parseOperationalString(File file) throws Exception {
        OpStringLoader loader = new OpStringLoader();
        return(loader.parseOperationalString(file));
    }
View Full Code Here

        void load(URL deploymentURL) {
            if(deploymentURL == null)
                throw new IllegalArgumentException("Deployment URL cannot be null");
            try {
                /* Get the OperationalString loader */
                OpStringLoader opStringLoader = new OpStringLoader(this.getClass().getClassLoader());
                OperationalString[] opStrings = opStringLoader.parseOperationalString(deploymentURL);
                if(opStrings != null) {
                    for (OperationalString opString : opStrings) {
                        logger.debug("Activating Deployment [{}]", opString.getName());
                        ServiceElement[] services = opString.getServices();
                        for (ServiceElement service : services) {
View Full Code Here

     */
    static OperationalString loadDeployment(final String deployment) throws Exception {
        OperationalString deploy = null;
        File deployFile = getDeploymentFile(deployment);
        if (deployFile.exists()) {
            OpStringLoader opStringLoader = new OpStringLoader(new GroovyClassLoader(CLI.class.getClassLoader()));
            OperationalString[] opstrings = opStringLoader.parseOperationalString(deployFile);
            deploy = opstrings[0];
        }
        return (deploy);
    }
View Full Code Here

TOP

Related Classes of org.rioproject.impl.opstring.OpStringLoader

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.