Package org.mule.common

Examples of org.mule.common.DefaultTestResult


    @Override
    public TestResult test()
    {
        if (isConnected())
        {
            return new DefaultTestResult(TestResult.Status.SUCCESS);
        }
        Connection con = null;
        try
        {
            con = dataSource.getConnection();
            return new DefaultTestResult(TestResult.Status.SUCCESS);
        }
        catch (Exception e)
        {
            // this surely doesn't cover all cases for all kinds of jdbc drivers but it is better than nothing
            FailureType failureType = FailureType.UNSPECIFIED;
            String msg = e.getMessage();
            if (msg != null && msg.contains("Communications link failure"))
            {
                failureType = FailureType.CONNECTION_FAILURE;
            }
            else if (msg != null && msg.contains("Access denied for user"))
            {
                failureType = FailureType.INVALID_CREDENTIALS;
            }
            return new DefaultTestResult(TestResult.Status.FAILURE, e.getMessage(), failureType, e);
        }
        finally
        {
            if (con != null)
            {
View Full Code Here


        Connection connection = null;

        try
        {
            connection = dataSource.getConnection();
            return new DefaultTestResult(Result.Status.SUCCESS);
        }
        catch (SQLException e)
        {
            return new DefaultTestResult(Result.Status.FAILURE, e.getMessage());
        }
        finally
        {
            if (connection != null)
            {
View Full Code Here

TOP

Related Classes of org.mule.common.DefaultTestResult

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.