Examples of Conf


Examples of org.lilyproject.runtime.conf.Conf

     */
    public void testConfig5() throws Exception {
        String configPath = "config5.xml";
        InputStream configStream = getClass().getResourceAsStream(configPath);

        Conf config = XmlConfBuilder.build(configStream, configPath);

        assertTrue(config.getChild("boolean").getValueAsBoolean());
        assertEquals(5, config.getChild("int").getValueAsInteger());
        assertEquals(6l, config.getChild("long").getValueAsLong());
        assertEquals(3.3f, config.getChild("float").getValueAsFloat(), 0.0001f);
        assertEquals(5.5d, config.getChild("double").getValueAsDouble(), 0.0001d);

        // Test fallback to default
        assertTrue(config.getChild("boolean2").getValueAsBoolean(true));
        assertEquals(new Integer(5), config.getChild("int2").getValueAsInteger(5));
        assertEquals(new Long(6l), config.getChild("long2").getValueAsLong(6l));
        assertEquals(3.3f, config.getChild("float2").getValueAsFloat(3.3f), 0.0001f);
        assertEquals(5.5d, config.getChild("double2").getValueAsDouble(5.5d), 0.0001d);

        // Test attributes
        assertTrue(config.getAttributeAsBoolean("boolean"));
        assertEquals(5, config.getAttributeAsInteger("int"));
        assertEquals(6l, config.getAttributeAsLong("long"));
        assertEquals(3.3f, config.getAttributeAsFloat("float"), 0.0001f);
        assertEquals(5.5d, config.getAttributeAsDouble("double"), 0.0001d);

        // Test attribute fallback to default
        assertTrue(config.getAttributeAsBoolean("boolean2", true));
        assertEquals(new Integer(5), config.getAttributeAsInteger("int2", 5));
        assertEquals(new Long(6l), config.getAttributeAsLong("long2", 6l));
        assertEquals(3.3f, config.getAttributeAsFloat("float2", 3.3f), 0.0001f);
        assertEquals(5.5d, config.getAttributeAsDouble("double2", 5.5d), 0.0001d);
    }
View Full Code Here

Examples of org.lilyproject.runtime.conf.Conf

import org.lilyproject.runtime.conf.XmlConfBuilder;

public class JXPathTest extends TestCase {
    public void testIt() throws Exception {
        String path = "jxpathconf.xml";
        Conf conf = XmlConfBuilder.build(getClass().getResourceAsStream(path), path);

        JXPathContext context = JXPathContext.newContext(conf);

        assertEquals("Venus", context.getValue("planet"));
        assertEquals("Mars", context.getValue("@planet"));
View Full Code Here

Examples of org.lilyproject.runtime.conf.Conf

        ApplicationContext appContext = runtime.getModuleById("confmod").getApplicationContext();

        Map beans = appContext.getBeansOfType(ConfRegistry.class);
        ConfRegistry confRegistry = (ConfRegistry)beans.get("conf");

        Conf conf = confRegistry.getConfiguration("test1");
        Assert.assertEquals("Jef", conf.getChild("name").getValue());

        conf = confRegistry.getConfiguration("test2");
        Assert.assertEquals("foobar@hotmail.com", conf.getChild("email").getValue());
        Assert.assertEquals("smtp.google.com", conf.getChild("smtp").getValue());

        conf = confRegistry.getConfiguration("test3");
        Assert.assertEquals(599, conf.getChild("delay").getValueAsInteger());

        String confTestBean1 = (String)appContext.getBean("confTestBean1");
        Assert.assertEquals("foobar@hotmail.com", confTestBean1);

        ConfDependentBean confTestBean2 = (ConfDependentBean)appContext.getBean("confTestBean2");
View Full Code Here

Examples of org.mvnsearch.wx.rewrite.Conf

    public void init(ServletConfig config) throws ServletException {
        this.token = config.getInitParameter("token");
        this.passCode = config.getInitParameter("passCode");
        String confFile = config.getInitParameter("confFile");
        try {
            Conf conf = new Conf(config.getServletContext(), confFile);
            this.urlRewriter = new UrlRewriter(conf);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

Examples of org.mvnsearch.wx.rewrite.Conf

     * test to construct conf
     *
     * @throws Exception exception
     */
    public void testConstructConf() throws Exception {
        Conf conf = new Conf(null, "classpath:weixin-router.xml");
        for (Rule rule : conf.getRules()) {
            System.out.println(rule);
        }
    }
View Full Code Here

Examples of org.tuckey.web.filters.urlrewrite.Conf

        if (document == null) {
            logger.error("creating rules document failed");
            return;
        }

        final Conf conf = new DocumentConf(document);
        conf.initialise();
        clearRewriter();

        if (conf.isOk()) {
            logger.info("rewrite configuration is ok");
        } else {
            logger.error("rewrite configuration is NOT ok");
            return;
        }

        rewriter = new UrlRewriter(conf);
        logger.info("rewrite engine is enabled: {}", conf.isEngineEnabled());
        if (conf.getRules() != null) {
            logger.info("number of rewrite rules: {}", conf.getRules().size());
        } else {
            logger.info("no rewrite rules");
        }
    }
View Full Code Here

Examples of org.tuckey.web.filters.urlrewrite.Conf

            urlRewriter = null;
         }

      }
      else {
         Conf conf = new Conf(context, inputStream, confPath, confUrlStr, false);
         checkConfLocal(conf);
      }
   }
View Full Code Here

Examples of org.tuckey.web.filters.urlrewrite.Conf

                    throw new IOException("Cannot load mod rewrite config file: " + modRewriteConfFile);
                }
                try {
                    String text = camelContext.getTypeConverter().mandatoryConvertTo(String.class, is);
                    ModRewriteConfLoader loader = new ModRewriteConfLoader();
                    conf = new Conf();
                    loader.process(text, conf);
                } finally {
                    IOHelper.close(is);
                }
            } else if (modRewriteConfText != null) {
                LOG.debug("Using modRewriteConfText: {} as config for urlRewrite", modRewriteConfText);
                ModRewriteConfLoader loader = new ModRewriteConfLoader();
                conf = new Conf();
                loader.process(modRewriteConfText, conf);
            } else if (configFile != null) {
                LOG.debug("Using config file: {} as config for urlRewrite", configFile);
                InputStream is = camelContext.getClassResolver().loadResourceAsStream(configFile);
                if (is == null) {
                    throw new IOException("Cannot load config file: " + configFile);
                }
                try {
                    conf = new Conf(is, configFile);
                } finally {
                    IOHelper.close(is);
                }
            }
            if (conf != null) {
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.