Search in sources :

Example 1 with Benchmark

use of com.querydsl.core.testutil.Benchmark in project querydsl by querydsl.

the class QueryPerformanceTest method serialization.

@Test
public void serialization() throws Exception {
    QCompanies companies = QCompanies.companies;
    final QueryMetadata md = new DefaultQueryMetadata();
    md.addJoin(JoinType.DEFAULT, companies);
    md.addWhere(companies.id.eq(1L));
    md.setProjection(companies.name);
    Runner.run("ser1", new Benchmark() {

        @Override
        public void run(int times) throws Exception {
            for (int i = 0; i < times; i++) {
                SQLSerializer serializer = new SQLSerializer(conf);
                serializer.serialize(md, false);
                serializer.getConstants();
                serializer.getConstantPaths();
                assertNotNull(serializer.toString());
            }
        }
    });
}
Also used : DefaultQueryMetadata(com.querydsl.core.DefaultQueryMetadata) QueryMetadata(com.querydsl.core.QueryMetadata) DefaultQueryMetadata(com.querydsl.core.DefaultQueryMetadata) Benchmark(com.querydsl.core.testutil.Benchmark) Test(org.junit.Test)

Aggregations

DefaultQueryMetadata (com.querydsl.core.DefaultQueryMetadata)1 QueryMetadata (com.querydsl.core.QueryMetadata)1 Benchmark (com.querydsl.core.testutil.Benchmark)1 Test (org.junit.Test)1