Example usage for org.apache.commons.configuration ConfigurationException getMessage

List of usage examples for org.apache.commons.configuration ConfigurationException getMessage

Introduction

In this page you can find the example usage for org.apache.commons.configuration ConfigurationException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.wso2.andes.configuration.qpid.ServerConfigurationTest.java

public void testManagementAccessRejected() throws ConfigurationException {
    // Check default
    _serverConfig.initialise();//from   w  w  w . j a va  2s .  c o m

    // Check value we set
    _config.setProperty("security.jmx.access(0)", "jmxremote.access");
    _serverConfig = new ServerConfiguration(_config);

    try {
        _serverConfig.initialise();
        fail("Exception not thrown");
    } catch (ConfigurationException ce) {
        assertEquals("Incorrect error message",
                "Validation error : security/jmx/access is no longer a supported element within the configuration xml.",
                ce.getMessage());
    }
}

From source file:org.wso2.andes.configuration.qpid.ServerConfigurationTest.java

public void testManagementPrincipalDatabaseRejected() throws ConfigurationException {
    // Check default
    _serverConfig.initialise();/*w  w  w  .  j a v  a2s  .c om*/

    // Check value we set
    _config.setProperty("security.jmx.principal-database(0)", "mydb");
    _serverConfig = new ServerConfiguration(_config);

    try {
        _serverConfig.initialise();
        fail("Exception not thrown");
    } catch (ConfigurationException ce) {
        assertEquals("Incorrect error message",
                "Validation error : security/jmx/principal-database is no longer a supported element within the configuration xml.",
                ce.getMessage());
    }
}

From source file:org.wso2.andes.configuration.qpid.ServerConfigurationTest.java

public void testPrincipalDatabasesRejected() throws ConfigurationException {
    _serverConfig.initialise();//  w w w  .  j av a 2  s. co m

    // Check value we set
    _config.setProperty("security.principal-databases.principal-database.class", "myclass");
    _serverConfig = new ServerConfiguration(_config);

    try {
        _serverConfig.initialise();
        fail("Exception not thrown");
    } catch (ConfigurationException ce) {
        assertEquals("Incorrect error message",
                "Validation error : security/principal-databases is no longer supported within the configuration xml.",
                ce.getMessage());
    }
}

From source file:org.wso2.andes.configuration.qpid.VirtualHostConfigurationTest.java

/**
 * Tests that the old element security.authentication.name is rejected.  This element
 * was never supported properly as authentication  is performed before the virtual host
 * is considered.//from   w ww  .j  a v a 2s .c om
 */
public void testSecurityAuthenticationNameRejected() throws Exception {
    getConfigXml().addProperty(
            "virtualhosts.virtualhost.testSecurityAuthenticationNameRejected.security.authentication.name",
            "testdb");

    try {
        super.createBroker();
        fail("Exception not thrown");
    } catch (ConfigurationException ce) {
        assertEquals("Incorrect error message",
                "Validation error : security/authentication/name is no longer a supported element within the configuration xml."
                        + " It appears in virtual host definition : " + getName(),
                ce.getMessage());
    }
}

From source file:org.wso2.andes.server.security.access.plugins.PlainConfigurationTest.java

public void testMissingACLConfig() throws Exception {
    try {/*from   w  w  w  .  j  av  a 2s .c  om*/
        // Load ruleset
        ConfigurationFile configFile = new PlainConfiguration(new File("doesnotexist"));
        configFile.load();

        fail("fail");
    } catch (ConfigurationException ce) {
        assertEquals(String.format(PlainConfiguration.CONFIG_NOT_FOUND_MSG, "doesnotexist"), ce.getMessage());
        assertTrue(ce.getCause() instanceof FileNotFoundException);
        assertEquals("doesnotexist (No such file or directory)", ce.getCause().getMessage());
    }
}

From source file:org.wso2.andes.server.security.access.plugins.PlainConfigurationTest.java

public void testACLFileSyntaxContinuation() throws Exception {
    try {// ww  w  .j a  v a2s  .  c om
        writeACLConfig("ACL ALLOW ALL \\ ALL");
        fail("fail");
    } catch (ConfigurationException ce) {
        assertEquals(String.format(PlainConfiguration.PREMATURE_CONTINUATION_MSG, 1), ce.getMessage());
    }
}

From source file:org.wso2.andes.server.security.access.plugins.PlainConfigurationTest.java

public void testACLFileSyntaxTokens() throws Exception {
    try {/*from w  w w.j ava 2s  .c  o  m*/
        writeACLConfig("ACL unparsed ALL ALL");
        fail("fail");
    } catch (ConfigurationException ce) {
        assertEquals(String.format(PlainConfiguration.PARSE_TOKEN_FAILED_MSG, 1), ce.getMessage());
        assertTrue(ce.getCause() instanceof IllegalArgumentException);
        assertEquals("Not a valid permission: unparsed", ce.getCause().getMessage());
    }
}

From source file:org.wso2.andes.server.security.access.plugins.PlainConfigurationTest.java

public void testACLFileSyntaxNotEnoughGroup() throws Exception {
    try {/*from w w  w  . j  a  v  a  2s.  co m*/
        writeACLConfig("GROUP blah");
        fail("fail");
    } catch (ConfigurationException ce) {
        assertEquals(String.format(PlainConfiguration.NOT_ENOUGH_GROUP_MSG, 1), ce.getMessage());
    }
}

From source file:org.wso2.andes.server.security.access.plugins.PlainConfigurationTest.java

public void testACLFileSyntaxNotEnoughACL() throws Exception {
    try {//from   w w w  .  java 2  s. c o m
        writeACLConfig("ACL ALLOW");
        fail("fail");
    } catch (ConfigurationException ce) {
        assertEquals(String.format(PlainConfiguration.NOT_ENOUGH_ACL_MSG, 1), ce.getMessage());
    }
}

From source file:org.wso2.andes.server.security.access.plugins.PlainConfigurationTest.java

public void testACLFileSyntaxNotEnoughConfig() throws Exception {
    try {//  w  w  w. j  a va 2s. c  o  m
        writeACLConfig("CONFIG");
        fail("fail");
    } catch (ConfigurationException ce) {
        assertEquals(String.format(PlainConfiguration.NOT_ENOUGH_TOKENS_MSG, 1), ce.getMessage());
    }
}