当前位置: 首页>>代码示例>>Java>>正文


Java QueryStats类代码示例

本文整理汇总了Java中org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.QueryStats的典型用法代码示例。如果您正苦于以下问题:Java QueryStats类的具体用法?Java QueryStats怎么用?Java QueryStats使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


QueryStats类属于org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport包,在下文中一共展示了QueryStats类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBug58489

import org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.QueryStats; //导入依赖的package包/类
@Test
public void testBug58489() throws Exception {

    long[] testData = { 0, 0, 0, 1444225382010l, 0, 1444225382011l, 0,
            1444225382012l, 0, 1444225382056l, 0, 1444225382014l, 0,
            1444225382015l, 0, 1444225382016l, 0, 0, 1444225382017l, 0,
            1444225678350l, 0, 1444225680397l, 0, 1444225382018l,
            1444225382019l, 1444225382020l, 0, 1444225382021l, 0,
            1444225382022l, 1444225382023l

    };

    List<QueryStats> stats = new ArrayList<QueryStats>();

    for (int i = 0; i < testData.length; i++) {
        QueryStats qs = new QueryStats(String.valueOf(i));
        qs.add(0, testData[i]);
        stats.add(qs);
    }

    try {
        Collections.sort(stats, createComparator());
    } catch (IllegalArgumentException e) {
        Assert.fail(e.getMessage());
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:27,代码来源:TestSlowQueryComparator.java

示例2: testEqualQueryStatsWithLastInvocation

import org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.QueryStats; //导入依赖的package包/类
@Test
public void testEqualQueryStatsWithLastInvocation() throws Exception {
    Comparator<QueryStats> queryStatsComparator = createComparator();
    QueryStats q1 = new QueryStats("abc");
    q1.add(0, 100);
    Assert.assertEquals(0, queryStatsComparator.compare(q1, q1));
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:8,代码来源:TestSlowQueryComparator.java

示例3: testQueryStatsOneWithLastInvocation

import org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.QueryStats; //导入依赖的package包/类
@Test
public void testQueryStatsOneWithLastInvocation() throws Exception {
    Comparator<QueryStats> queryStatsComparator = createComparator();
    QueryStats q1 = new QueryStats("abc");
    QueryStats q2 = new QueryStats("def");
    q2.add(0, 100);
    Assert.assertEquals(1, queryStatsComparator.compare(q1, q2));
    Assert.assertEquals(-1, queryStatsComparator.compare(q2, q1));
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:10,代码来源:TestSlowQueryComparator.java

示例4: testQueryStatsBothWithSameLastInvocation

import org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.QueryStats; //导入依赖的package包/类
@Test
public void testQueryStatsBothWithSameLastInvocation() throws Exception {
    Comparator<QueryStats> queryStatsComparator = createComparator();
    QueryStats q1 = new QueryStats("abc");
    QueryStats q2 = new QueryStats("def");
    q1.add(0, 100);
    q2.add(0, 100);
    Assert.assertEquals(0, queryStatsComparator.compare(q1, q2));
    Assert.assertEquals(0, queryStatsComparator.compare(q2, q1));
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:11,代码来源:TestSlowQueryComparator.java

示例5: testQueryStatsBothWithSomeLastInvocation

import org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.QueryStats; //导入依赖的package包/类
@Test
public void testQueryStatsBothWithSomeLastInvocation() throws Exception {
    Comparator<QueryStats> queryStatsComparator = createComparator();
    QueryStats q1 = new QueryStats("abc");
    QueryStats q2 = new QueryStats("abc");
    q1.add(0, 100);
    q2.add(0, 150);
    Assert.assertEquals(-1, queryStatsComparator.compare(q1, q2));
    Assert.assertEquals(1, queryStatsComparator.compare(q2, q1));
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:11,代码来源:TestSlowQueryComparator.java

示例6: createComparator

import org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.QueryStats; //导入依赖的package包/类
private Comparator<QueryStats> createComparator()
        throws ClassNotFoundException, InstantiationException,
        IllegalAccessException, InvocationTargetException,
        SecurityException, NoSuchMethodException {
    Class<?> comparatorClass = Class
            .forName("org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport$QueryStatsComparator");
    Constructor<?> comparatorConstructor = comparatorClass
            .getDeclaredConstructor();
    comparatorConstructor.setAccessible(true);
    @SuppressWarnings("unchecked")
    Comparator<QueryStats> queryStatsComparator = (Comparator<QueryStats>) comparatorConstructor
            .newInstance();
    return queryStatsComparator;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:15,代码来源:TestSlowQueryComparator.java

示例7: testEqualQueryStatsWithNoLastInvocation

import org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.QueryStats; //导入依赖的package包/类
@Test
public void testEqualQueryStatsWithNoLastInvocation() throws Exception {
    Comparator<QueryStats> queryStatsComparator = createComparator();
    QueryStats q1 = new QueryStats("abc");
    Assert.assertEquals(0, queryStatsComparator.compare(q1, q1));
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:7,代码来源:TestSlowQueryComparator.java


注:本文中的org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.QueryStats类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。