Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
a55cd699
提交
a55cd699
authored
17 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
26e617c5
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
225 行增加
和
89 行删除
+225
-89
Service.java
h2/src/main/org/h2/server/Service.java
+1
-0
TcpServer.java
h2/src/main/org/h2/server/TcpServer.java
+4
-0
FtpServer.java
h2/src/main/org/h2/server/ftp/FtpServer.java
+12
-7
PgServer.java
h2/src/main/org/h2/server/pg/PgServer.java
+4
-0
WebServer.java
h2/src/main/org/h2/server/web/WebServer.java
+4
-0
Server.java
h2/src/main/org/h2/tools/Server.java
+145
-81
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+7
-0
TestTools.java
h2/src/test/org/h2/test/unit/TestTools.java
+48
-1
没有找到文件。
h2/src/main/org/h2/server/Service.java
浏览文件 @
a55cd699
...
...
@@ -14,5 +14,6 @@ public interface Service {
void
stop
();
boolean
isRunning
();
boolean
getAllowOthers
();
String
getName
();
String
getType
();
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/TcpServer.java
浏览文件 @
a55cd699
...
...
@@ -248,6 +248,10 @@ public class TcpServer implements Service {
return
"TCP"
;
}
public
String
getName
()
{
return
"H2 TCP Server"
;
}
public
void
logInternalError
(
String
string
)
{
if
(
TcpServer
.
logInternalErrors
)
{
System
.
out
.
println
(
string
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/ftp/FtpServer.java
浏览文件 @
a55cd699
...
...
@@ -157,19 +157,20 @@ public class FtpServer implements Service {
public
void
init
(
String
[]
args
)
throws
Exception
{
for
(
int
i
=
0
;
args
!=
null
&&
i
<
args
.
length
;
i
++)
{
if
(
"-ftpPort"
.
equals
(
args
[
i
]))
{
String
a
=
args
[
i
];
if
(
"-ftpPort"
.
equals
(
a
))
{
port
=
MathUtils
.
decodeInt
(
args
[++
i
]);
}
else
if
(
"-ftpDir"
.
equals
(
a
rgs
[
i
]
))
{
}
else
if
(
"-ftpDir"
.
equals
(
a
))
{
root
=
FileUtils
.
normalize
(
args
[++
i
]);
}
else
if
(
"-ftpRead"
.
equals
(
a
rgs
[
i
]
))
{
}
else
if
(
"-ftpRead"
.
equals
(
a
))
{
readUserName
=
args
[++
i
];
}
else
if
(
"-ftpWrite"
.
equals
(
a
rgs
[
i
]
))
{
}
else
if
(
"-ftpWrite"
.
equals
(
a
))
{
writeUserName
=
args
[++
i
];
}
else
if
(
"-ftpWritePassword"
.
equals
(
a
rgs
[
i
]
))
{
}
else
if
(
"-ftpWritePassword"
.
equals
(
a
))
{
writePassword
=
args
[++
i
];
}
else
if
(
"-log"
.
equals
(
a
rgs
[
i
]
))
{
}
else
if
(
"-log"
.
equals
(
a
))
{
log
=
Boolean
.
valueOf
(
args
[++
i
]).
booleanValue
();
}
else
if
(
"-ftpTask"
.
equals
(
a
rgs
[
i
]
))
{
}
else
if
(
"-ftpTask"
.
equals
(
a
))
{
allowTask
=
Boolean
.
valueOf
(
args
[++
i
]).
booleanValue
();
}
}
...
...
@@ -216,6 +217,10 @@ public class FtpServer implements Service {
return
"FTP"
;
}
public
String
getName
()
{
return
"H2 FTP Server"
;
}
void
log
(
String
s
)
{
if
(
log
)
{
System
.
out
.
println
(
s
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/pg/PgServer.java
浏览文件 @
a55cd699
...
...
@@ -177,6 +177,10 @@ public class PgServer implements Service {
public
String
getType
()
{
return
"PG"
;
}
public
String
getName
()
{
return
"H2 PG Server"
;
}
public
boolean
getIfExists
()
{
return
ifExists
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
a55cd699
...
...
@@ -336,6 +336,10 @@ public class WebServer implements Service {
return
"Web"
;
}
public
String
getName
()
{
return
"H2 Console Server"
;
}
void
setAllowOthers
(
boolean
b
)
{
allowOthers
=
b
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Server.java
浏览文件 @
a55cd699
差异被折叠。
点击展开。
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
a55cd699
...
...
@@ -150,6 +150,13 @@ java org.h2.test.TestAll timer
/*
write more tests for the command line tools
Changelog:
Certain setting in the Server didn't work (see bug...)
avoid creating thousands of trace.db files
Known Problems:
link to history page, bug page
Add a link to the google code bug page
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestTools.java
浏览文件 @
a55cd699
...
...
@@ -4,7 +4,9 @@
*/
package
org
.
h2
.
test
.
unit
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.PrintStream
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.ResultSet
;
...
...
@@ -28,6 +30,7 @@ public class TestTools extends TestBase {
public
void
test
()
throws
Exception
{
deleteDb
(
"utils"
);
testServerMain
();
testRemove
();
testConvertTraceFile
();
testManagementDb
();
...
...
@@ -39,6 +42,51 @@ public class TestTools extends TestBase {
testRecover
();
}
private
void
testServerMain
()
throws
Exception
{
String
result
;
Connection
conn
;
org
.
h2
.
Driver
.
load
();
result
=
runServer
(
new
String
[]{
"-?"
},
1
);
check
(
result
.
indexOf
(
"[options]"
)
>=
0
);
check
(
result
.
indexOf
(
"Unknown option"
)
<
0
);
result
=
runServer
(
new
String
[]{
"-xy"
},
1
);
check
(
result
.
indexOf
(
"[options]"
)
>=
0
);
check
(
result
.
indexOf
(
"Unknown option"
)
>=
0
);
result
=
runServer
(
new
String
[]{
"-tcp"
,
"-tcpAllowOthers"
,
"false"
,
"-tcpPort"
,
"9001"
,
"-tcpPassword"
,
"abc"
},
0
);
check
(
result
.
indexOf
(
"tcp://"
)
>=
0
);
check
(
result
.
indexOf
(
":9001"
)
>=
0
);
check
(
result
.
indexOf
(
"only local"
)
>=
0
);
check
(
result
.
indexOf
(
"[options]"
)
<
0
);
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:tcp://localhost:9001/mem:"
,
"sa"
,
"sa"
);
conn
.
close
();
result
=
runServer
(
new
String
[]{
"-tcpShutdown"
,
"tcp://localhost:9001"
,
"-tcpPassword"
,
"abc"
,
"-tcpShutdownForce"
,
"true"
},
0
);
check
(
result
.
indexOf
(
"Shutting down"
)
>=
0
);
result
=
runServer
(
new
String
[]{
"-tcp"
,
"-tcpAllowOthers"
,
"true"
,
"-tcpPort"
,
"9001"
,
"-tcpPassword"
,
"def"
,
"-tcpSSL"
,
"true"
},
0
);
check
(
result
.
indexOf
(
"ssl://"
)
>=
0
);
check
(
result
.
indexOf
(
":9001"
)
>=
0
);
check
(
result
.
indexOf
(
"others can"
)
>=
0
);
check
(
result
.
indexOf
(
"[options]"
)
<
0
);
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:ssl://localhost:9001/mem:"
,
"sa"
,
"sa"
);
conn
.
close
();
result
=
runServer
(
new
String
[]{
"-tcpShutdown"
,
"ssl://localhost:9001"
,
"-tcpPassword"
,
"def"
,
"-tcpShutdownForce"
,
"false"
},
0
);
check
(
result
.
indexOf
(
"Shutting down"
)
>=
0
);
}
private
String
runServer
(
String
[]
args
,
int
exitCode
)
throws
Exception
{
ByteArrayOutputStream
buff
=
new
ByteArrayOutputStream
();
PrintStream
ps
=
new
PrintStream
(
buff
);
int
gotCode
=
new
Server
().
run
(
args
,
ps
);
check
(
exitCode
,
gotCode
);
ps
.
flush
();
String
s
=
new
String
(
buff
.
toByteArray
());
return
s
;
}
private
void
testConvertTraceFile
()
throws
Exception
{
deleteDb
(
"toolsConvertTraceFile"
);
Class
.
forName
(
"org.h2.Driver"
);
...
...
@@ -213,7 +261,6 @@ public class TestTools extends TestBase {
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:tcp://localhost/test"
,
"sa"
,
""
);
conn
.
close
();
server
.
stop
();
server
=
Server
.
createTcpServer
(
new
String
[]
{
"-ifExists"
,
"true"
,
"-tcpPassword"
,
"abc"
,
"-baseDir"
,
baseDir
}).
start
();
try
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论