mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
48 lines
1.6 KiB
Java
48 lines
1.6 KiB
Java
/*
|
|
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
package com.alibaba.druid.benckmark.wall;
|
|
|
|
import junit.framework.TestCase;
|
|
|
|
import com.alibaba.druid.wall.WallProvider;
|
|
import com.alibaba.druid.wall.spi.OracleWallProvider;
|
|
|
|
public class WallBenchmarkTest extends TestCase {
|
|
|
|
WallProvider provider = new OracleWallProvider();
|
|
|
|
public final static int COUNT = 1000 * 1000;
|
|
|
|
public void test_0() throws Exception {
|
|
String sql = "SELECT t1.department_id, t2.*\n" + //
|
|
"FROM hr_info t1, TABLE(t1.people) t2\n" + //
|
|
"WHERE t2.department_id = t1.department_id;";
|
|
for (int i = 0; i < 10; ++i) {
|
|
provider.clearCache();
|
|
long startMillis = System.currentTimeMillis();
|
|
perf(sql);
|
|
long millis = System.currentTimeMillis() - startMillis;
|
|
System.out.println("millis : " + millis);
|
|
}
|
|
}
|
|
|
|
public void perf(String sql) {
|
|
for (int i = 0; i < COUNT; ++i) {
|
|
provider.check(sql);
|
|
}
|
|
}
|
|
}
|