Java Code Examples for org.apache.tomcat.jdbc.pool.PoolProperties.InterceptorDefinition

The following examples show how to use org.apache.tomcat.jdbc.pool.PoolProperties.InterceptorDefinition. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Test
public void testBasic() throws Exception {
    String interceptorConfig = "FirstInterceptor;SecondInterceptor(parm1=value1,parm2=value2)";
    PoolProperties props = new PoolProperties();
    props.setJdbcInterceptors(interceptorConfig);
    InterceptorDefinition[] interceptorDefs = props.getJdbcInterceptorsAsArray();
    Assert.assertNotNull(interceptorDefs);

    // 3 items because parser automatically inserts TrapException interceptor to front of list
    Assert.assertEquals(interceptorDefs.length, 3);
    Assert.assertEquals(interceptorDefs[0].getClassName(), TrapException.class.getName());

    Assert.assertNotNull(interceptorDefs[1]);
    Assert.assertEquals(interceptorDefs[1].getClassName(), "FirstInterceptor");
    Assert.assertNotNull(interceptorDefs[2]);
    Assert.assertEquals(interceptorDefs[2].getClassName(), "SecondInterceptor");

    Map<String, InterceptorProperty> secondProps = interceptorDefs[2].getProperties();
    Assert.assertNotNull(secondProps);
    Assert.assertEquals(secondProps.size(), 2);
    Assert.assertNotNull(secondProps.get("parm1"));
    Assert.assertEquals(secondProps.get("parm1").getValue(), "value1");
    Assert.assertNotNull(secondProps.get("parm2"));
    Assert.assertEquals(secondProps.get("parm2").getValue(), "value2");
}
 
Example 2
Source Project: Tomcat8-Source-Read   Source File: DataSourceProxy.java    License: MIT License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */

@Override
public InterceptorDefinition[] getJdbcInterceptorsAsArray() {
    return getPoolProperties().getJdbcInterceptorsAsArray();
}
 
Example 3
Source Project: Tomcat8-Source-Read   Source File: ConnectionPool.java    License: MIT License 4 votes vote down vote up
@Override
public InterceptorDefinition[] getJdbcInterceptorsAsArray() {
    return getPoolProperties().getJdbcInterceptorsAsArray();
}
 
Example 4
@Test
public void testWhitespace() throws Exception {
    String interceptorConfig = "FirstInterceptor ; \n" +
        "SecondInterceptor (parm1  = value1 , parm2= value2 ) ; \n\n" +
        "\t org.cyb.ThirdInterceptor(parm1=value1);  \n" +
        "EmptyParmValInterceptor(parm1=  )";
    PoolProperties props = new PoolProperties();
    props.setJdbcInterceptors(interceptorConfig);
    InterceptorDefinition[] interceptorDefs = props.getJdbcInterceptorsAsArray();
    Assert.assertNotNull(interceptorDefs);

    // 5 items because parser automatically inserts TrapException interceptor to front of list
    Assert.assertEquals(interceptorDefs.length, 5);
    Assert.assertEquals(interceptorDefs[0].getClassName(), TrapException.class.getName());

    Assert.assertNotNull(interceptorDefs[1]);
    Assert.assertEquals(interceptorDefs[1].getClassName(), "FirstInterceptor");
    Assert.assertNotNull(interceptorDefs[2]);
    Assert.assertEquals(interceptorDefs[2].getClassName(), "SecondInterceptor");
    Assert.assertNotNull(interceptorDefs[3]);
    Assert.assertEquals(interceptorDefs[3].getClassName(), "org.cyb.ThirdInterceptor");

    Map<String, InterceptorProperty> secondProps = interceptorDefs[2].getProperties();
    Assert.assertNotNull(secondProps);
    Assert.assertEquals(secondProps.size(), 2);
    Assert.assertNotNull(secondProps.get("parm1"));
    Assert.assertEquals(secondProps.get("parm1").getValue(), "value1");
    Assert.assertNotNull(secondProps.get("parm2"));
    Assert.assertEquals(secondProps.get("parm2").getValue(), "value2"); // Bug 54395

    Map<String, InterceptorProperty> thirdProps = interceptorDefs[3].getProperties();
    Assert.assertNotNull(thirdProps);
    Assert.assertEquals(thirdProps.size(), 1);
    Assert.assertNotNull(thirdProps.get("parm1"));
    Assert.assertEquals(thirdProps.get("parm1").getValue(), "value1");

    Map<String, InterceptorProperty> emptyParmValProps = interceptorDefs[4].getProperties();
    Assert.assertNotNull(emptyParmValProps);
    Assert.assertEquals(emptyParmValProps.size(), 1);
    Assert.assertNotNull(emptyParmValProps.get("parm1"));
    Assert.assertEquals(emptyParmValProps.get("parm1").getValue(), "");
}
 
Example 5
Source Project: Tomcat7.0.67   Source File: DataSourceProxy.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */

@Override
public InterceptorDefinition[] getJdbcInterceptorsAsArray() {
    return getPoolProperties().getJdbcInterceptorsAsArray();
}
 
Example 6
Source Project: Tomcat7.0.67   Source File: ConnectionPool.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public InterceptorDefinition[] getJdbcInterceptorsAsArray() {
    return getPoolProperties().getJdbcInterceptorsAsArray();
}
 
Example 7
Source Project: tomcatsrc   Source File: DataSourceProxy.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */

@Override
public InterceptorDefinition[] getJdbcInterceptorsAsArray() {
    return getPoolProperties().getJdbcInterceptorsAsArray();
}
 
Example 8
Source Project: tomcatsrc   Source File: ConnectionPool.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public InterceptorDefinition[] getJdbcInterceptorsAsArray() {
    return getPoolProperties().getJdbcInterceptorsAsArray();
}
 
Example 9
Source Project: Tomcat8-Source-Read   Source File: PoolConfiguration.java    License: MIT License 2 votes vote down vote up
/**
 * Returns the {@link #getJdbcInterceptors()} as an array of objects with properties and the classes.
 * @return an array of interceptors that have been configured
 */
public InterceptorDefinition[] getJdbcInterceptorsAsArray();
 
Example 10
Source Project: Tomcat7.0.67   Source File: PoolConfiguration.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Returns the {@link #getJdbcInterceptors()} as an array of objects with properties and the classes.
 * @return an array of interceptors that have been configured
 */
public InterceptorDefinition[] getJdbcInterceptorsAsArray();
 
Example 11
Source Project: tomcatsrc   Source File: PoolConfiguration.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Returns the {@link #getJdbcInterceptors()} as an array of objects with properties and the classes.
 * @return an array of interceptors that have been configured
 */
public InterceptorDefinition[] getJdbcInterceptorsAsArray();