Examples of LocatableProperties


Examples of com.opensymphony.xwork2.util.location.LocatableProperties

    }

    public void selfRegister() {
        //this cannot be done in the constructor, as it causes an infinite loop
        builder.factory(Configuration.class, MockConfiguration.class, Scope.SINGLETON);
        LocatableProperties props = new LocatableProperties();
        new XWorkConfigurationProvider().register(builder, props);
        builder.constant(XWorkConstants.DEV_MODE, "false");
        builder.constant(XWorkConstants.RELOAD_XML_CONFIGURATION, "true");
        builder.constant(XWorkConstants.ENABLE_OGNL_EXPRESSION_CACHE, "true");
        container = builder.create(true);
View Full Code Here

Examples of com.opensymphony.xwork2.util.location.LocatableProperties

       
        if (settingsUrl == null) {
            if (LOG.isDebugEnabled()) {
          LOG.debug(name + ".properties missing");
            }
            settings = new LocatableProperties();
            return;
        }
       
        settings = new LocatableProperties(new LocationImpl(null, settingsUrl.toString()));

        // Load settings
        InputStream in = null;
        try {
            in = settingsUrl.openStream();
View Full Code Here

Examples of com.opensymphony.xwork2.util.location.LocatableProperties

        ContainerBuilder builder = new ContainerBuilder();
        builder.constant("foo", "bar");
        builder.constant("struts.locale", "DE_de");

        PropertiesConfigurationProvider prov = new PropertiesConfigurationProvider();
        prov.register(builder, new LocatableProperties());

        Container container = builder.create(true);

        String localeStr = container.getInstance(String.class, StrutsConstants.STRUTS_LOCALE);
        Locale locale = LocalizedTextUtil.localeFromString(localeStr, Locale.FRANCE);
View Full Code Here

Examples of com.opensymphony.xwork2.util.location.LocatableProperties

        ContainerBuilder builder = new ContainerBuilder();
        builder.constant("foo", "bar");

        PropertiesConfigurationProvider prov = new PropertiesConfigurationProvider();
        prov.register(builder, new LocatableProperties());

        Container container = builder.create(true);

        String localeStr = container.getInstance(String.class, StrutsConstants.STRUTS_LOCALE);
        Locale locale = LocalizedTextUtil.localeFromString(localeStr, Locale.getDefault());
View Full Code Here

Examples of com.opensymphony.xwork2.util.location.LocatableProperties

    }

    public void testDefaultSettings() throws Exception {
        // given
        PropertiesConfigurationProvider prov = new PropertiesConfigurationProvider();
        LocatableProperties props = new LocatableProperties();
        prov.register(new ContainerBuilder(), props);

        // when
        Object encoding = props.get(StrutsConstants.STRUTS_I18N_ENCODING);

        // then
        assertEquals("ISO-8859-1", encoding);
    }
View Full Code Here

Examples of com.opensymphony.xwork2.util.location.LocatableProperties

        LocalizedTextUtil.clearDefaultResourceBundles();
        LocalizedTextUtil.addDefaultResourceBundle("org/apache/struts2/struts-messages");
        assertEquals("The form has already been processed or no token was supplied, please try again.", LocalizedTextUtil.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));
       
        LocatableProperties props = new LocatableProperties();
        props.setProperty(StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES, "testmessages,testmessages2");
       
        new DefaultBeanSelectionProvider().register(new ContainerBuilder(), props);

        assertEquals("Replaced message for token tag", LocalizedTextUtil.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));
    }
View Full Code Here

Examples of com.opensymphony.xwork2.util.location.LocatableProperties

       
        if (settingsUrl == null) {
            if (LOG.isDebugEnabled()) {
          LOG.debug(name + ".properties missing");
            }
            settings = new LocatableProperties();
            return;
        }
       
        settings = new LocatableProperties(new LocationImpl(null, settingsUrl.toString()));

        // Load settings
        InputStream in = null;
        try {
            in = settingsUrl.openStream();
View Full Code Here

Examples of com.opensymphony.xwork2.util.location.LocatableProperties

        LocalizedTextUtil.clearDefaultResourceBundles();
        LocalizedTextUtil.addDefaultResourceBundle("org/apache/struts2/struts-messages");
        assertEquals("The form has already been processed or no token was supplied, please try again.", LocalizedTextUtil.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));
       
        LocatableProperties props = new LocatableProperties();
        props.setProperty(StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES, "testmessages,testmessages2");
       
        new DefaultBeanSelectionProvider().register(new ContainerBuilder(), props);

        assertEquals("Replaced message for token tag", LocalizedTextUtil.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));
    }
View Full Code Here

Examples of com.opensymphony.xwork2.util.location.LocatableProperties

       
        URL settingsUrl = Thread.currentThread().getContextClassLoader().getResource(name + ".properties");
       
        if (settingsUrl == null) {
            LOG.debug(name + ".properties missing");
            settings = new LocatableProperties();
            return;
        }
       
        settings = new LocatableProperties(new LocationImpl(null, settingsUrl.toString()));

        // Load settings
        InputStream in = null;
        try {
            in = settingsUrl.openStream();
View Full Code Here

Examples of com.opensymphony.xwork2.util.location.LocatableProperties

    }

    public void selfRegister() {
        //this cannot be done in the constructor, as it causes an infinite loop
        builder.factory(Configuration.class, MockConfiguration.class, Scope.SINGLETON);
        LocatableProperties props = new LocatableProperties();
        new XWorkConfigurationProvider().register(builder, props);
        builder.constant("devMode", "false");
        container = builder.create(true);
    }
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.