KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > scriptella > jdbc > SqlTokenizerPerfTest


1 /*
2  * Copyright 2006-2007 The Scriptella Project Team.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package scriptella.jdbc;
17
18 import scriptella.AbstractTestCase;
19 import scriptella.util.RepeatingInputStream;
20
21 import java.io.IOException JavaDoc;
22 import java.io.InputStreamReader JavaDoc;
23
24 /**
25  * Performance tests for {@link SqlReaderTokenizer}.
26  *
27  * @author Fyodor Kupolov
28  * @version 1.0
29  */

30 public class SqlTokenizerPerfTest extends AbstractTestCase {
31     //600
32
public void test() throws IOException JavaDoc {
33         String JavaDoc text = "INSERT INTO Table VALUES(?v,$v2);--Hint $v;\n" +
34                 "/* Comment */\n//comment\nUPDATE Test SET V=?{v2}";
35         RepeatingInputStream ris = new RepeatingInputStream(text.getBytes(), 20000);
36         SqlTokenizer tok = new SqlReaderTokenizer(new InputStreamReader JavaDoc(ris));
37         while (tok.nextStatement()!=null) {
38         }
39     }
40     //700
41
public void testNewLineSeparator() throws IOException JavaDoc {
42         String JavaDoc text = "INSERT INTO Table VALUES(?v,$v2);--Hint $v\n / \r" +
43                 "/* Comment */\n//comment\nUPDATE Test SET V=?{v2}";
44         RepeatingInputStream ris = new RepeatingInputStream(text.getBytes(), 20000);
45         SqlTokenizer tok = new SqlReaderTokenizer(new InputStreamReader JavaDoc(ris));
46         while (tok.nextStatement()!=null) {
47         }
48     }
49
50 }
51
Popular Tags