Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
3f000aa1
提交
3f000aa1
authored
5月 28, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shell test
上级
713b55c8
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
221 行增加
和
81 行删除
+221
-81
Shell.java
h2/src/main/org/h2/tools/Shell.java
+89
-55
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+7
-10
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+7
-1
TestShell.java
h2/src/test/org/h2/test/unit/TestShell.java
+101
-0
Build.java
h2/src/tools/org/h2/build/Build.java
+1
-1
BuildBase.java
h2/src/tools/org/h2/build/BuildBase.java
+15
-13
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+1
-1
没有找到文件。
h2/src/main/org/h2/tools/Shell.java
浏览文件 @
3f000aa1
差异被折叠。
点击展开。
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
3f000aa1
...
...
@@ -105,6 +105,7 @@ import org.h2.test.unit.TestRecovery;
import
org.h2.test.unit.TestSampleApps
;
import
org.h2.test.unit.TestScriptReader
;
import
org.h2.test.unit.TestSecurity
;
import
org.h2.test.unit.TestShell
;
import
org.h2.test.unit.TestStreams
;
import
org.h2.test.unit.TestStringCache
;
import
org.h2.test.unit.TestStringUtils
;
...
...
@@ -162,25 +163,20 @@ java org.h2.test.TestAll timer
long
time
=
System
.
currentTimeMillis
();
TestAll
test
=
new
TestAll
();
test
.
printSystem
();
System
.
setProperty
(
"h2.maxMemoryRowsDistinct"
,
"128"
);
/*
not tested:
ResultTempTable
HashIndex
HashCursor
Shell
ExecuteProcedure
PreparedProcedure
Procedure
DeallocateProcedure
PreparedProcedure PREPARE <name>(column,...) AS ...
Procedure
DeallocateProcedure DEALLOCATE [PLAN] <name>
ExecuteProcedure EXECUTE <name>[([p[,...])]
create an mbean for each database? server? (jconsole)
jazoon
upload and test javadoc/index.html
in help.csv, use complete examples for functions; add a test case
improve javadocs
...
...
@@ -539,6 +535,7 @@ Roadmap:
new
TestScriptReader
().
runTest
(
this
);
runTest
(
"org.h2.test.unit.TestServlet"
);
new
TestSecurity
().
runTest
(
this
);
new
TestShell
().
runTest
(
this
);
new
TestStreams
().
runTest
(
this
);
new
TestStringCache
().
runTest
(
this
);
new
TestStringUtils
().
runTest
(
this
);
...
...
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
3f000aa1
...
...
@@ -351,7 +351,13 @@ public abstract class TestBase {
error
(
result
+
" does not contain: "
+
contains
);
}
}
protected
void
checkStartsWith
(
String
text
,
String
expectedStart
)
throws
Exception
{
if
(!
text
.
startsWith
(
expectedStart
))
{
error
(
text
+
" does not start with: "
+
expectedStart
);
}
}
protected
void
check
(
double
a
,
double
b
)
throws
Exception
{
if
(
a
!=
b
)
{
error
(
"double a: "
+
a
+
" b: "
+
b
);
...
...
h2/src/test/org/h2/test/unit/TestShell.java
0 → 100644
浏览文件 @
3f000aa1
/*
* Copyright 2004-2008 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
test
.
unit
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.LineNumberReader
;
import
java.io.PipedInputStream
;
import
java.io.PipedOutputStream
;
import
java.io.PrintStream
;
import
java.sql.SQLException
;
import
org.h2.test.TestBase
;
import
org.h2.tools.Shell
;
/**
* Test the shell tool.
*/
public
class
TestShell
extends
TestBase
{
PrintStream
toolOut
;
InputStream
toolIn
;
PrintStream
testOut
;
PipedInputStream
testIn
;
LineNumberReader
lineReader
;
public
void
test
()
throws
Exception
{
testIn
=
new
PipedInputStream
();
PipedOutputStream
out
=
new
PipedOutputStream
(
testIn
);
toolOut
=
new
PrintStream
(
out
,
true
);
out
=
new
PipedOutputStream
();
testOut
=
new
PrintStream
(
out
,
true
);
toolIn
=
new
PipedInputStream
(
out
);
new
Thread
(
new
Runnable
()
{
public
void
run
()
{
try
{
Shell
shell
=
new
Shell
();
shell
.
setStreams
(
toolIn
,
toolOut
,
toolOut
);
shell
.
run
(
new
String
[
0
]);
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
finally
{
toolOut
.
close
();
}
}
}).
start
();
InputStreamReader
reader
=
new
InputStreamReader
(
testIn
);
lineReader
=
new
LineNumberReader
(
reader
);
read
(
""
);
read
(
"Welcome to H2 Shell"
);
read
(
"Exit with"
);
read
(
"[Enter]"
);
testOut
.
println
(
"jdbc:h2:mem:"
);
read
(
"URL"
);
testOut
.
println
(
"org.h2.Driver"
);
read
(
"Driver"
);
testOut
.
println
(
"sa"
);
read
(
"User"
);
testOut
.
println
(
"sa"
);
read
(
"Password"
);
read
(
"Commands are case insensitive"
);
read
(
"help or ?"
);
read
(
"list"
);
read
(
"maxwidth"
);
read
(
"show"
);
read
(
"describe"
);
read
(
"quit or exit"
);
read
(
""
);
testOut
.
println
(
"create table test(id int primary key, name varchar)\n;"
);
read
(
"sql> ...>"
);
testOut
.
println
(
"show public"
);
read
(
"sql>"
);
while
(
read
(
""
).
startsWith
(
"INFORMATION_SCHEMA"
))
{
// ignore
}
testOut
.
println
(
"insert into test values(1, 'Hello');"
);
read
(
"sql>"
);
testOut
.
println
(
"select * from test;"
);
read
(
"sql> ID"
);
read
(
"1 "
);
read
(
"(1 row,"
);
testOut
.
println
(
"describe test"
);
read
(
"sql> Column Name"
);
read
(
"ID"
);
read
(
"NAME"
);
testOut
.
println
(
"exit"
);
read
(
"sql>"
);
}
private
String
read
(
String
expectedStart
)
throws
Exception
{
String
line
=
lineReader
.
readLine
();
// System.out.println(": " + line);
checkStartsWith
(
line
,
expectedStart
);
return
line
;
}
}
h2/src/tools/org/h2/build/Build.java
浏览文件 @
3f000aa1
...
...
@@ -19,7 +19,7 @@ public class Build extends BuildBase {
/**
* Run the build.
*
* @param
s
args the command line arguments
* @param args the command line arguments
*/
public
static
void
main
(
String
[]
args
)
{
new
Build
().
run
(
args
);
...
...
h2/src/tools/org/h2/build/BuildBase.java
浏览文件 @
3f000aa1
...
...
@@ -226,10 +226,10 @@ public class BuildBase {
}
/**
* Read
a final static field in
a class using reflection.
* Read
s the value from a static method of
a class using reflection.
*
* @param className the name of the class
* @param
fiel
dName the field name
* @param
metho
dName the field name
* @return the value as a string
*/
protected
String
getStaticValue
(
String
className
,
String
methodName
)
{
...
...
@@ -371,9 +371,10 @@ public class BuildBase {
if
(
file
.
getName
().
startsWith
(
".svn"
))
{
// ignore
}
else
if
(
file
.
isDirectory
())
{
File
[]
files
=
file
.
listFiles
();
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
addFiles
(
list
,
files
[
i
]);
String
[]
fileNames
=
file
.
list
();
String
path
=
file
.
getPath
();
for
(
int
i
=
0
;
i
<
fileNames
.
length
;
i
++)
{
addFiles
(
list
,
new
File
(
path
,
fileNames
[
i
]));
}
}
else
{
list
.
add
(
file
);
...
...
@@ -628,16 +629,17 @@ public class BuildBase {
delete
(
new
File
(
dir
));
}
private
void
delete
(
File
f
)
{
if
(
f
.
exists
())
{
if
(
f
.
isDirectory
())
{
File
[]
list
=
f
.
listFiles
();
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
delete
(
list
[
i
]);
private
void
delete
(
File
file
)
{
if
(
file
.
exists
())
{
if
(
file
.
isDirectory
())
{
String
[]
fileNames
=
file
.
list
();
String
path
=
file
.
getPath
();
for
(
int
i
=
0
;
i
<
fileNames
.
length
;
i
++)
{
delete
(
new
File
(
path
,
fileNames
[
i
]));
}
}
if
(!
f
.
delete
())
{
throw
new
Error
(
"Can not delete "
+
f
.
getPath
());
if
(!
f
ile
.
delete
())
{
throw
new
Error
(
"Can not delete "
+
f
ile
.
getPath
());
}
}
}
...
...
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
3f000aa1
...
...
@@ -514,5 +514,5 @@ derbynet ado happy derbyclient unspecified federated sysadmin lengths doing
gives clunky cooperative paged conflicts ontology freely regards standards
placing refer informational unlocks memo unlimited unmounted keeping hints
hides heterogeneous construction rutema prepending rowscn overrides jconsole
mbean explicit directs leaves printing holds covariant redirector
mbean explicit directs leaves printing holds covariant redirector
piped
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论