Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
a9ed91ad
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a9ed91ad
编写于
10月 21, 2020
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#10000 Tycho headless surefire
Former-commit-id:
0a533947
上级
94985fb4
变更
31
显示空白变更内容
内联
并排
Showing
31 changed file
with
666 addition
and
107 deletion
+666
-107
plugins/pom.xml
plugins/pom.xml
+0
-2
test/org.jkiss.dbeaver.db.test/src/org/jkiss/dbeaver/ext/test/SQLServerFetchTest.java
...st/src/org/jkiss/dbeaver/ext/test/SQLServerFetchTest.java
+0
-62
test/org.jkiss.dbeaver.ext.postgresql.test/META-INF/MANIFEST.MF
...rg.jkiss.dbeaver.ext.postgresql.test/META-INF/MANIFEST.MF
+14
-0
test/org.jkiss.dbeaver.ext.postgresql.test/build.cmd
test/org.jkiss.dbeaver.ext.postgresql.test/build.cmd
+3
-0
test/org.jkiss.dbeaver.ext.postgresql.test/build.properties
test/org.jkiss.dbeaver.ext.postgresql.test/build.properties
+4
-0
test/org.jkiss.dbeaver.ext.postgresql.test/pom.xml
test/org.jkiss.dbeaver.ext.postgresql.test/pom.xml
+36
-0
test/org.jkiss.dbeaver.ext.postgresql.test/src/org/jkiss/dbeaver/ext/postgresql/PostgreValueParserTest.java
.../jkiss/dbeaver/ext/postgresql/PostgreValueParserTest.java
+0
-0
test/org.jkiss.dbeaver.ext.postgresql.test/src/org/jkiss/dbeaver/ext/postgresql/TestPreferenceStore.java
...org/jkiss/dbeaver/ext/postgresql/TestPreferenceStore.java
+0
-0
test/org.jkiss.dbeaver.ext.postgresql.test/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreServerExtensionBaseTest.java
.../ext/postgresql/model/PostgreServerExtensionBaseTest.java
+0
-0
test/org.jkiss.dbeaver.ext.postgresql.test/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreTableBaseTest.java
...ss/dbeaver/ext/postgresql/model/PostgreTableBaseTest.java
+2
-0
test/org.jkiss.dbeaver.headless/META-INF/MANIFEST.MF
test/org.jkiss.dbeaver.headless/META-INF/MANIFEST.MF
+1
-0
test/org.jkiss.dbeaver.headless/OSGI-INF/l10n/bundle.properties
...rg.jkiss.dbeaver.headless/OSGI-INF/l10n/bundle.properties
+0
-0
test/org.jkiss.dbeaver.headless/build.properties
test/org.jkiss.dbeaver.headless/build.properties
+0
-0
test/org.jkiss.dbeaver.headless/plugin.xml
test/org.jkiss.dbeaver.headless/plugin.xml
+13
-2
test/org.jkiss.dbeaver.headless/pom.xml
test/org.jkiss.dbeaver.headless/pom.xml
+0
-0
test/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/DBeaverHeadlessApplication.java
...rg/jkiss/dbeaver/headless/DBeaverHeadlessApplication.java
+8
-1
test/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/DBeaverTestActivator.java
.../src/org/jkiss/dbeaver/headless/DBeaverTestActivator.java
+110
-0
test/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/DBeaverTestPlatform.java
...s/src/org/jkiss/dbeaver/headless/DBeaverTestPlatform.java
+262
-0
test/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/DBeaverTestPlatformAdapterFactory.java
...s/dbeaver/headless/DBeaverTestPlatformAdapterFactory.java
+48
-0
test/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/DBeaverTestPlatformUI.java
...src/org/jkiss/dbeaver/headless/DBeaverTestPlatformUI.java
+28
-0
test/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/DBeaverTestWorkspace.java
.../src/org/jkiss/dbeaver/headless/DBeaverTestWorkspace.java
+39
-0
test/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/TestResourceHandler.java
...s/src/org/jkiss/dbeaver/headless/TestResourceHandler.java
+89
-0
test/org.jkiss.dbeaver.runtime.ide.core.tests/OSGI-INF/l10n/bundle.properties
...er.runtime.ide.core.tests/OSGI-INF/l10n/bundle.properties
+0
-20
test/org.jkiss.dbeaver.runtime.ide.core.tests/pom.xml
test/org.jkiss.dbeaver.runtime.ide.core.tests/pom.xml
+0
-14
test/org.jkiss.dbeaver.test.platform/META-INF/MANIFEST.MF
test/org.jkiss.dbeaver.test.platform/META-INF/MANIFEST.MF
+1
-1
test/org.jkiss.dbeaver.test.platform/OSGI-INF/l10n/bundle.properties
...iss.dbeaver.test.platform/OSGI-INF/l10n/bundle.properties
+0
-0
test/org.jkiss.dbeaver.test.platform/build.properties
test/org.jkiss.dbeaver.test.platform/build.properties
+0
-0
test/org.jkiss.dbeaver.test.platform/pom.xml
test/org.jkiss.dbeaver.test.platform/pom.xml
+1
-1
test/org.jkiss.dbeaver.test.platform/src/org/jkiss/dbeaver/test/platform/PlatformTest.java
...orm/src/org/jkiss/dbeaver/test/platform/PlatformTest.java
+2
-2
test/org.jkiss.dbeaver.test.platform/src/org/jkiss/dbeaver/test/platform/WorkspaceResourcesTest.java
...g/jkiss/dbeaver/test/platform/WorkspaceResourcesTest.java
+2
-1
test/pom.xml
test/pom.xml
+3
-1
未找到文件。
plugins/pom.xml
浏览文件 @
a9ed91ad
...
...
@@ -66,8 +66,6 @@
<module>
org.jkiss.dbeaver.net.ssh.sshj
</module>
<module>
org.jkiss.dbeaver.slf4j
</module>
<module>
org.jkiss.dbeaver.team.git
</module>
<module>
org.jkiss.dbeaver.headless
</module>
</modules>
<profiles>
...
...
test/org.jkiss.dbeaver.db.test/src/org/jkiss/dbeaver/ext/test/SQLServerFetchTest.java
已删除
100644 → 0
浏览文件 @
94985fb4
package
org.jkiss.dbeaver.ext.test
;
import
java.util.Properties
;
public
class
SQLServerFetchTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Class
.
forName
(
"com.microsoft.sqlserver.jdbc.SQLServerDriver"
);
Properties
props
=
new
Properties
();
props
.
put
(
"integratedSecurity"
,
"true"
);
Connection
dbCon
=
DriverManager
.
getConnection
(
"jdbc:sqlserver://;serverName=localhost;databaseName=master"
,
props
);
dbCon
.
setAutoCommit
(
false
);
try
(
Statement
dbStat
=
dbCon
.
createStatement
(
ResultSet
.
TYPE_FORWARD_ONLY
,
ResultSet
.
CONCUR_READ_ONLY
))
{
int
rsCount
=
0
;
if
(
dbStat
.
execute
(
"sp_help TestTable"
))
{
dumpResultSet
(
dbStat
,
rsCount
);
rsCount
++;
}
while
(
dbStat
.
getMoreResults
()
||
dbStat
.
getUpdateCount
()
!=
-
1
)
{
dumpResultSet
(
dbStat
,
rsCount
);
rsCount
++;
}
System
.
out
.
println
(
"Total result = "
+
rsCount
);
}
}
public
static
void
dumpResultSet
(
Statement
dbStat
,
int
number
)
throws
SQLException
{
System
.
out
.
println
(
"================================================ "
+
number
);
try
(
ResultSet
dbResult
=
dbStat
.
getResultSet
())
{
ResultSetMetaData
md
=
dbResult
.
getMetaData
();
int
count
=
md
.
getColumnCount
();
dumpResultSetMetaData
(
dbResult
);
while
(
dbResult
.
next
())
{
for
(
int
i
=
1
;
i
<=
count
;
i
++)
{
String
colValue
=
dbResult
.
getString
(
i
);
System
.
out
.
print
(
colValue
+
"\t"
);
}
System
.
out
.
println
();
}
System
.
out
.
println
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
public
static
void
dumpResultSetMetaData
(
ResultSet
dbResult
)
{
try
{
ResultSetMetaData
md
=
dbResult
.
getMetaData
();
int
count
=
md
.
getColumnCount
();
for
(
int
i
=
1
;
i
<=
count
;
i
++)
{
System
.
out
.
print
(
md
.
getColumnName
(
i
)
+
" ["
+
md
.
getColumnTypeName
(
i
)
+
"]\t"
);
}
System
.
out
.
println
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
}
test/org.jkiss.dbeaver.
runtime.ide.core.tests
/META-INF/MANIFEST.MF
→
test/org.jkiss.dbeaver.
ext.postgresql.test
/META-INF/MANIFEST.MF
浏览文件 @
a9ed91ad
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.jkiss.dbeaver.runtime.ide.core.tests
Bundle-Version: 4.2.2.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-SymbolicName: org.jkiss.dbeaver.ext.postgresql.test
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Vendor: DBeaver Corp
Bundle-ClassPath: .
Fragment-Host: org.jkiss.dbeaver.ext.postgresql
Require-Bundle: org.junit,
org.jkiss.dbeaver.model
org.mockito.mockito-all,
org.jkiss.dbeaver.headless,
org.jkiss.dbeaver.model,
org.jkiss.dbeaver.registry
test/org.jkiss.dbeaver.ext.postgresql.test/build.cmd
0 → 100644
浏览文件 @
a9ed91ad
set
MAVEN_OPTS
=
-Xmx
2048
m
call
mvn
clean
install
pause
test/org.jkiss.dbeaver.
runtime.ide.core.tests
/build.properties
→
test/org.jkiss.dbeaver.
ext.postgresql.test
/build.properties
浏览文件 @
a9ed91ad
source..
=
src/
output..
=
target/classes/
bin.includes
=
META-INF/,
\
.,
\
OSGI-INF/
bin.includes
=
.,
\
META-INF/
test/org.jkiss.dbeaver.ext.postgresql.test/pom.xml
0 → 100644
浏览文件 @
a9ed91ad
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.jkiss.dbeaver
</groupId>
<artifactId>
tests
</artifactId>
<version>
1.0.0-SNAPSHOT
</version>
<relativePath>
../
</relativePath>
</parent>
<artifactId>
org.jkiss.dbeaver.ext.postgresql.test
</artifactId>
<version>
1.0.0-SNAPSHOT
</version>
<packaging>
eclipse-test-plugin
</packaging>
<build>
<plugins>
<plugin>
<groupId>
org.eclipse.tycho
</groupId>
<artifactId>
tycho-surefire-plugin
</artifactId>
<version>
${tycho-version}
</version>
<configuration>
<useUIHarness>
false
</useUIHarness>
<useUIThread>
false
</useUIThread>
<includes>
<include>
**/*Test.java
</include>
</includes>
<application>
org.jkiss.dbeaver.headless.application
</application>
<product>
org.jkiss.dbeaver.headless.product
</product>
<testRuntime>
default
</testRuntime>
</configuration>
</plugin>
</plugins>
</build>
</project>
plugins/org.jkiss.dbeaver.ext.postgresql/tests
/org/jkiss/dbeaver/ext/postgresql/PostgreValueParserTest.java
→
test/org.jkiss.dbeaver.ext.postgresql.test/src
/org/jkiss/dbeaver/ext/postgresql/PostgreValueParserTest.java
浏览文件 @
a9ed91ad
文件已移动
plugins/org.jkiss.dbeaver.ext.postgresql/tests
/org/jkiss/dbeaver/ext/postgresql/TestPreferenceStore.java
→
test/org.jkiss.dbeaver.ext.postgresql.test/src
/org/jkiss/dbeaver/ext/postgresql/TestPreferenceStore.java
浏览文件 @
a9ed91ad
文件已移动
plugins/org.jkiss.dbeaver.ext.postgresql/tests
/org/jkiss/dbeaver/ext/postgresql/model/PostgreServerExtensionBaseTest.java
→
test/org.jkiss.dbeaver.ext.postgresql.test/src
/org/jkiss/dbeaver/ext/postgresql/model/PostgreServerExtensionBaseTest.java
浏览文件 @
a9ed91ad
文件已移动
plugins/org.jkiss.dbeaver.ext.postgresql/tests
/org/jkiss/dbeaver/ext/postgresql/model/PostgreTableBaseTest.java
→
test/org.jkiss.dbeaver.ext.postgresql.test/src
/org/jkiss/dbeaver/ext/postgresql/model/PostgreTableBaseTest.java
浏览文件 @
a9ed91ad
...
...
@@ -16,6 +16,7 @@
*/
package
org.jkiss.dbeaver.ext.postgresql.model
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
...
...
@@ -32,6 +33,7 @@ import org.junit.runner.RunWith;
import
org.mockito.Mock
;
import
org.mockito.Mockito
;
import
org.mockito.runners.MockitoJUnitRunner
;
import
java.sql.SQLException
;
import
java.util.Collections
;
import
java.util.List
;
...
...
plugins
/org.jkiss.dbeaver.headless/META-INF/MANIFEST.MF
→
test
/org.jkiss.dbeaver.headless/META-INF/MANIFEST.MF
浏览文件 @
a9ed91ad
...
...
@@ -8,6 +8,7 @@ Bundle-Version: 1.0.1.qualifier
Bundle-Release-Date: 20201019
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: .
Bundle-Activator: org.jkiss.dbeaver.headless.DBeaverTestActivator
Require-Bundle: org.eclipse.osgi,
org.eclipse.equinox.app,
org.jkiss.dbeaver.model,
...
...
plugins
/org.jkiss.dbeaver.headless/OSGI-INF/l10n/bundle.properties
→
test
/org.jkiss.dbeaver.headless/OSGI-INF/l10n/bundle.properties
浏览文件 @
a9ed91ad
文件已移动
plugins
/org.jkiss.dbeaver.headless/build.properties
→
test
/org.jkiss.dbeaver.headless/build.properties
浏览文件 @
a9ed91ad
文件已移动
plugins
/org.jkiss.dbeaver.headless/plugin.xml
→
test
/org.jkiss.dbeaver.headless/plugin.xml
浏览文件 @
a9ed91ad
...
...
@@ -21,15 +21,26 @@
<plugin>
<extension
point=
"org.eclipse.core.runtime.applications"
id=
"application"
name=
"
Headless
Application"
>
<extension
point=
"org.eclipse.core.runtime.applications"
id=
"application"
name=
"
Test
Application"
>
<application
visible=
"true"
>
<run
class=
"org.jkiss.dbeaver.headless.DBeaverHeadlessApplication"
/>
</application>
</extension>
<extension
point=
"org.eclipse.core.runtime.products"
id=
"product"
>
<product
application=
"org.jkiss.dbeaver.headless.application"
description=
"Headless product for unit tests"
name=
"DBeaver
Headless
Product"
>
<product
application=
"org.jkiss.dbeaver.headless.application"
description=
"Headless product for unit tests"
name=
"DBeaver
Test
Product"
>
</product>
</extension>
<extension
point=
"org.eclipse.core.runtime.adapters"
>
<factory
adaptableType=
"org.jkiss.dbeaver.runtime.DBWorkbench"
class=
"org.jkiss.dbeaver.headless.DBeaverTestPlatformAdapterFactory"
>
<adapter
type=
"org.jkiss.dbeaver.model.app.DBPPlatform"
/>
<adapter
type=
"org.jkiss.dbeaver.runtime.ui.DBPPlatformUI"
/>
</factory>
</extension>
<extension
point=
"org.jkiss.dbeaver.application"
>
<application
id=
"headless-test-app"
name=
"DBeaver Headless Test Application"
description=
"DBeaver Headless Test Application"
/>
</extension>
</plugin>
plugins
/org.jkiss.dbeaver.headless/pom.xml
→
test
/org.jkiss.dbeaver.headless/pom.xml
浏览文件 @
a9ed91ad
文件已移动
plugins
/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/DBeaverHeadlessApplication.java
→
test
/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/DBeaverHeadlessApplication.java
浏览文件 @
a9ed91ad
...
...
@@ -31,9 +31,16 @@ public class DBeaverHeadlessApplication extends BaseApplicationImpl {
@Override
public
Object
start
(
IApplicationContext
context
)
{
System
.
out
.
println
(
"Starting headless test application"
);
DBPApplication
application
=
DBWorkbench
.
getPlatform
().
getApplication
();
return
null
;
return
EXIT_OK
;
}
@Override
public
void
stop
()
{
System
.
out
.
println
(
"Starting headless test application"
);
super
.
stop
();
}
@Override
...
...
test/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/DBeaverTestActivator.java
0 → 100644
浏览文件 @
a9ed91ad
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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
org.jkiss.dbeaver.headless
;
import
org.eclipse.core.resources.IWorkspace
;
import
org.eclipse.core.resources.ResourcesPlugin
;
import
org.eclipse.core.runtime.Plugin
;
import
org.jkiss.dbeaver.ModelPreferences
;
import
org.jkiss.dbeaver.model.impl.preferences.BundlePreferenceStore
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.osgi.framework.Bundle
;
import
org.osgi.framework.BundleContext
;
import
java.io.File
;
import
java.io.PrintStream
;
/**
* The activator class controls the plug-in life cycle
*/
public
class
DBeaverTestActivator
extends
Plugin
{
// The shared instance
private
static
DBeaverTestActivator
instance
;
private
static
File
configDir
;
private
PrintStream
debugWriter
;
private
DBPPreferenceStore
preferences
;
public
DBeaverTestActivator
()
{
}
public
static
DBeaverTestActivator
getInstance
()
{
return
instance
;
}
@Override
public
void
start
(
BundleContext
context
)
throws
Exception
{
super
.
start
(
context
);
instance
=
this
;
Bundle
bundle
=
getBundle
();
ModelPreferences
.
setMainBundle
(
bundle
);
preferences
=
new
BundlePreferenceStore
(
bundle
);
}
@Override
public
void
stop
(
BundleContext
context
)
throws
Exception
{
this
.
shutdownCore
();
if
(
debugWriter
!=
null
)
{
debugWriter
.
close
();
debugWriter
=
null
;
}
instance
=
null
;
super
.
stop
(
context
);
}
/**
* Returns configuration file
*/
public
static
synchronized
File
getConfigurationFile
(
String
fileName
)
{
if
(
configDir
==
null
)
{
configDir
=
getInstance
().
getStateLocation
().
toFile
();
}
return
new
File
(
configDir
,
fileName
);
}
public
DBPPreferenceStore
getPreferences
()
{
return
preferences
;
}
/**
* Returns the workspace instance.
*/
public
static
IWorkspace
getWorkspace
()
{
return
ResourcesPlugin
.
getWorkspace
();
}
private
void
shutdownCore
()
{
try
{
// Dispose core
if
(
DBeaverTestActivator
.
instance
!=
null
)
{
DBeaverTestActivator
.
instance
=
null
;
}
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
System
.
err
.
println
(
"Internal error after shutdown process:"
+
e
.
getMessage
());
//$NON-NLS-1$
}
}
}
test/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/DBeaverTestPlatform.java
0 → 100644
浏览文件 @
a9ed91ad
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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
org.jkiss.dbeaver.headless
;
import
org.eclipse.core.resources.ResourcesPlugin
;
import
org.eclipse.core.runtime.Platform
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPExternalFileManager
;
import
org.jkiss.dbeaver.model.app.*
;
import
org.jkiss.dbeaver.model.impl.app.DefaultCertificateStorage
;
import
org.jkiss.dbeaver.model.impl.preferences.SimplePreferenceStore
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.model.qm.QMController
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.registry.BaseApplicationImpl
;
import
org.jkiss.dbeaver.registry.BasePlatformImpl
;
import
org.jkiss.dbeaver.registry.DataSourceProviderRegistry
;
import
org.jkiss.dbeaver.runtime.qm.QMControllerImpl
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.utils.StandardConstants
;
import
org.osgi.framework.Bundle
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.Files
;
/**
* DBeaverTestPlatform
*/
public
class
DBeaverTestPlatform
extends
BasePlatformImpl
{
public
static
final
String
PLUGIN_ID
=
"org.jkiss.dbeaver.headless"
;
//$NON-NLS-1$
private
static
final
String
TEMP_PROJECT_NAME
=
".dbeaver-temp"
;
//$NON-NLS-1$
private
static
final
Log
log
=
Log
.
getLog
(
DBeaverTestPlatform
.
class
);
static
DBeaverTestPlatform
instance
;
@NotNull
private
static
volatile
boolean
isClosing
=
false
;
private
File
tempFolder
;
private
DBeaverTestWorkspace
workspace
;
private
static
boolean
disposed
=
false
;
private
QMControllerImpl
qmController
;
private
DefaultCertificateStorage
defaultCertificateStorage
;
public
static
DBeaverTestPlatform
getInstance
()
{
if
(
instance
==
null
)
{
synchronized
(
DBeaverTestPlatform
.
class
)
{
if
(
disposed
)
{
throw
new
IllegalStateException
(
"DBeaverTestPlatform core already disposed"
);
}
if
(
instance
==
null
)
{
// Initialize DBeaver Core
DBeaverTestPlatform
.
createInstance
();
}
}
}
return
instance
;
}
private
static
DBeaverTestPlatform
createInstance
()
{
log
.
debug
(
"Initializing "
+
GeneralUtils
.
getProductTitle
());
if
(
Platform
.
getProduct
()
!=
null
)
{
Bundle
definingBundle
=
Platform
.
getProduct
().
getDefiningBundle
();
if
(
definingBundle
!=
null
)
{
log
.
debug
(
"Host plugin: "
+
definingBundle
.
getSymbolicName
()
+
" "
+
definingBundle
.
getVersion
());
}
else
{
log
.
debug
(
"!!! No product bundle found"
);
}
}
try
{
instance
=
new
DBeaverTestPlatform
();
instance
.
initialize
();
return
instance
;
}
catch
(
Throwable
e
)
{
log
.
error
(
"Error initializing DBeaverCore"
,
e
);
throw
new
IllegalStateException
(
"Error initializing DBeaverCore"
,
e
);
}
}
public
static
String
getCorePluginID
()
{
return
PLUGIN_ID
;
}
public
static
boolean
isStandalone
()
{
return
BaseApplicationImpl
.
getInstance
().
isStandalone
();
}
public
static
boolean
isClosing
()
{
return
isClosing
;
}
private
static
void
setClosing
(
boolean
closing
)
{
isClosing
=
closing
;
}
private
DBeaverTestPlatform
()
{
}
protected
void
initialize
()
{
long
startTime
=
System
.
currentTimeMillis
();
log
.
debug
(
"Initialize Test Platform..."
);
this
.
defaultCertificateStorage
=
new
DefaultCertificateStorage
(
DBeaverTestActivator
.
getConfigurationFile
(
"cert-storage"
));
// Register properties adapter
this
.
workspace
=
new
DBeaverTestWorkspace
(
this
,
ResourcesPlugin
.
getWorkspace
());
this
.
workspace
.
initializeProjects
();
this
.
qmController
=
new
QMControllerImpl
();
super
.
initialize
();
log
.
debug
(
"Test Platform initialized ("
+
(
System
.
currentTimeMillis
()
-
startTime
)
+
"ms)"
);
}
public
synchronized
void
dispose
()
{
long
startTime
=
System
.
currentTimeMillis
();
log
.
debug
(
"Shutdown Core..."
);
DBeaverTestPlatform
.
setClosing
(
true
);
super
.
dispose
();
workspace
.
dispose
();
DataSourceProviderRegistry
.
getInstance
().
dispose
();
// Remove temp folder
if
(
tempFolder
!=
null
)
{
if
(!
ContentUtils
.
deleteFileRecursive
(
tempFolder
))
{
log
.
warn
(
"Can't delete temp folder '"
+
tempFolder
.
getAbsolutePath
()
+
"'"
);
}
tempFolder
=
null
;
}
DBeaverTestPlatform
.
instance
=
null
;
DBeaverTestPlatform
.
disposed
=
true
;
System
.
gc
();
log
.
debug
(
"Test platform shutdown completed in "
+
(
System
.
currentTimeMillis
()
-
startTime
)
+
"ms"
);
}
@NotNull
@Override
public
DBPWorkspace
getWorkspace
()
{
return
workspace
;
}
@NotNull
@Override
public
DBPResourceHandler
getDefaultResourceHandler
()
{
return
TestResourceHandler
.
INSTANCE
;
}
@NotNull
@Override
public
DBPApplication
getApplication
()
{
return
BaseApplicationImpl
.
getInstance
();
}
@NotNull
public
QMController
getQueryManager
()
{
return
qmController
;
}
@NotNull
@Override
public
DBPPreferenceStore
getPreferenceStore
()
{
return
DBeaverTestActivator
.
getInstance
().
getPreferences
();
}
@NotNull
@Override
public
DBACertificateStorage
getCertificateStorage
()
{
return
defaultCertificateStorage
;
}
@NotNull
@Override
public
DBASecureStorage
getSecureStorage
()
{
return
getApplication
().
getSecureStorage
();
}
@NotNull
@Override
public
DBPExternalFileManager
getExternalFileManager
()
{
return
workspace
;
}
@NotNull
public
File
getTempFolder
(
DBRProgressMonitor
monitor
,
String
name
)
{
if
(
tempFolder
==
null
)
{
// Make temp folder
monitor
.
subTask
(
"Create temp folder"
);
try
{
final
java
.
nio
.
file
.
Path
tempDirectory
=
Files
.
createTempDirectory
(
TEMP_PROJECT_NAME
);
tempFolder
=
tempDirectory
.
toFile
();
}
catch
(
IOException
e
)
{
final
String
sysTempFolder
=
System
.
getProperty
(
StandardConstants
.
ENV_TMP_DIR
);
if
(!
CommonUtils
.
isEmpty
(
sysTempFolder
))
{
tempFolder
=
new
File
(
sysTempFolder
,
TEMP_PROJECT_NAME
);
if
(!
tempFolder
.
mkdirs
())
{
final
String
sysUserFolder
=
System
.
getProperty
(
StandardConstants
.
ENV_USER_HOME
);
if
(!
CommonUtils
.
isEmpty
(
sysUserFolder
))
{
tempFolder
=
new
File
(
sysUserFolder
,
TEMP_PROJECT_NAME
);
if
(!
tempFolder
.
mkdirs
())
{
tempFolder
=
new
File
(
TEMP_PROJECT_NAME
);
}
}
}
}
}
}
if
(!
tempFolder
.
exists
()
&&
!
tempFolder
.
mkdirs
())
{
log
.
error
(
"Can't create temp directory "
+
tempFolder
.
getAbsolutePath
());
}
return
tempFolder
;
}
@NotNull
@Override
public
File
getConfigurationFile
(
String
fileName
)
{
return
DBeaverTestActivator
.
getConfigurationFile
(
fileName
);
}
@Override
public
boolean
isShuttingDown
()
{
return
isClosing
();
}
private
static
class
TestPreferenceStore
extends
SimplePreferenceStore
{
@Override
public
void
save
()
throws
IOException
{
}
}
}
test/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/DBeaverTestPlatformAdapterFactory.java
0 → 100644
浏览文件 @
a9ed91ad
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
* Copyright (C) 2017-2018 Alexander Fedorov (alexander.fedorov@jkiss.org)
*
* 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
org.jkiss.dbeaver.headless
;
import
org.eclipse.core.runtime.IAdapterFactory
;
import
org.jkiss.dbeaver.model.app.DBPPlatform
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.runtime.resource.WorkspaceResourceResolver
;
import
org.jkiss.dbeaver.runtime.ui.DBPPlatformUI
;
public
class
DBeaverTestPlatformAdapterFactory
implements
IAdapterFactory
{
private
static
final
Class
<?>[]
CLASSES
=
new
Class
[]
{
WorkspaceResourceResolver
.
class
,
DBPPlatform
.
class
,
DBPPlatformUI
.
class
};
@Override
public
<
T
>
T
getAdapter
(
Object
adaptableObject
,
Class
<
T
>
adapterType
)
{
if
(
adaptableObject
instanceof
DBWorkbench
)
{
if
(
adapterType
==
DBPPlatform
.
class
)
{
return
adapterType
.
cast
(
DBeaverTestPlatform
.
getInstance
());
}
else
if
(
adapterType
==
DBPPlatformUI
.
class
)
{
return
adapterType
.
cast
(
DBeaverTestPlatformUI
.
INSTANCE
);
}
}
return
null
;
}
@Override
public
Class
<?>[]
getAdapterList
()
{
return
CLASSES
;
}
}
test/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/DBeaverTestPlatformUI.java
0 → 100644
浏览文件 @
a9ed91ad
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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
org.jkiss.dbeaver.headless
;
import
org.jkiss.dbeaver.runtime.ui.console.ConsoleUserInterface
;
/**
* DBeaverTestPlatformUI
*/
public
class
DBeaverTestPlatformUI
extends
ConsoleUserInterface
{
public
static
final
DBeaverTestPlatformUI
INSTANCE
=
new
DBeaverTestPlatformUI
();
}
test/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/DBeaverTestWorkspace.java
0 → 100644
浏览文件 @
a9ed91ad
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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
org.jkiss.dbeaver.headless
;
import
org.eclipse.core.resources.IWorkspace
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.model.app.DBPPlatform
;
import
org.jkiss.dbeaver.registry.BaseWorkspaceImpl
;
/**
* DBeaver test workspace.
*/
public
class
DBeaverTestWorkspace
extends
BaseWorkspaceImpl
{
DBeaverTestWorkspace
(
DBPPlatform
platform
,
IWorkspace
eclipseWorkspace
)
{
super
(
platform
,
eclipseWorkspace
);
}
@NotNull
@Override
public
String
getWorkspaceId
()
{
return
"test"
;
}
}
\ No newline at end of file
test/org.jkiss.dbeaver.headless/src/org/jkiss/dbeaver/headless/TestResourceHandler.java
0 → 100644
浏览文件 @
a9ed91ad
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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
org.jkiss.dbeaver.headless
;
import
org.eclipse.core.resources.IFile
;
import
org.eclipse.core.resources.IFolder
;
import
org.eclipse.core.resources.IResource
;
import
org.eclipse.core.runtime.CoreException
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.app.DBPResourceHandler
;
import
org.jkiss.dbeaver.model.navigator.DBNNode
;
import
org.jkiss.dbeaver.model.navigator.DBNResource
;
import
java.util.Collections
;
import
java.util.List
;
/**
* Default resource handler
*/
public
class
TestResourceHandler
implements
DBPResourceHandler
{
public
static
final
TestResourceHandler
INSTANCE
=
new
TestResourceHandler
();
@Override
public
int
getFeatures
(
IResource
resource
)
{
if
(
resource
instanceof
IFile
)
{
return
FEATURE_OPEN
|
FEATURE_DELETE
|
FEATURE_RENAME
;
}
else
if
(
resource
instanceof
IFolder
)
{
return
FEATURE_DELETE
|
FEATURE_RENAME
|
FEATURE_CREATE_FOLDER
|
FEATURE_MOVE_INTO
;
}
return
0
;
}
@NotNull
@Override
public
String
getTypeName
(
@NotNull
IResource
resource
)
{
return
"resource"
;
//$NON-NLS-1$
}
@Override
public
String
getResourceDescription
(
@NotNull
IResource
resource
)
{
return
""
;
}
@Override
public
List
<
DBPDataSourceContainer
>
getAssociatedDataSources
(
DBNResource
resource
)
{
return
Collections
.
emptyList
();
}
@NotNull
@Override
public
String
getResourceNodeName
(
@NotNull
IResource
resource
)
{
return
resource
.
getName
();
}
@NotNull
@Override
public
DBNResource
makeNavigatorNode
(
@NotNull
DBNNode
parentNode
,
@NotNull
IResource
resource
)
throws
CoreException
,
DBException
{
DBNResource
node
=
new
DBNResource
(
parentNode
,
resource
,
this
);
updateNavigatorNode
(
node
,
resource
);
return
node
;
}
@Override
public
void
updateNavigatorNode
(
@NotNull
DBNResource
node
,
@NotNull
IResource
resource
)
{
}
@Override
public
void
openResource
(
@NotNull
IResource
resource
)
throws
CoreException
,
DBException
{
System
.
out
.
println
(
"Open resource "
+
resource
);
}
}
test/org.jkiss.dbeaver.runtime.ide.core.tests/OSGI-INF/l10n/bundle.properties
已删除
100644 → 0
浏览文件 @
94985fb4
#Properties file for org.jkiss.dbeaver.runtime.ide.core.tests
# DBeaver - Universal Database Manager
# Copyright (C) 2010-2020 DBeaver Corp and others
# Copyright (C) 2017 Alexander Fedorov (alexander.fedorov@jkiss.org)
#
# 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.
Bundle-Vendor
=
JKISS
Bundle-Name
=
DBeaver Runtime IDE Core Tests
\ No newline at end of file
test/org.jkiss.dbeaver.runtime.ide.core.tests/pom.xml
已删除
100644 → 0
浏览文件 @
94985fb4
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.jkiss.dbeaver
</groupId>
<artifactId>
dbeaver
</artifactId>
<version>
1.0.0-SNAPSHOT
</version>
<relativePath>
../../
</relativePath>
</parent>
<artifactId>
org.jkiss.dbeaver.runtime.ide.core.tests
</artifactId>
<version>
4.2.2-SNAPSHOT
</version>
<packaging>
eclipse-test-plugin
</packaging>
</project>
test/
dbeaver.test.suite
/META-INF/MANIFEST.MF
→
test/
org.jkiss.dbeaver.test.platform
/META-INF/MANIFEST.MF
浏览文件 @
a9ed91ad
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.jkiss.dbeaver.test.
suite
Bundle-SymbolicName: org.jkiss.dbeaver.test.
platform
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
...
...
test/
dbeaver.test.suite
/OSGI-INF/l10n/bundle.properties
→
test/
org.jkiss.dbeaver.test.platform
/OSGI-INF/l10n/bundle.properties
浏览文件 @
a9ed91ad
文件已移动
test/
dbeaver.test.suite
/build.properties
→
test/
org.jkiss.dbeaver.test.platform
/build.properties
浏览文件 @
a9ed91ad
文件已移动
test/
dbeaver.test.suite
/pom.xml
→
test/
org.jkiss.dbeaver.test.platform
/pom.xml
浏览文件 @
a9ed91ad
...
...
@@ -9,7 +9,7 @@
<version>
1.0.0-SNAPSHOT
</version>
<relativePath>
../
</relativePath>
</parent>
<artifactId>
org.jkiss.dbeaver.test.
suite
</artifactId>
<artifactId>
org.jkiss.dbeaver.test.
platform
</artifactId>
<version>
1.0.0-SNAPSHOT
</version>
<packaging>
eclipse-test-plugin
</packaging>
...
...
test/
dbeaver.test.suite/src/org/jkiss/dbeaver/runtime/ide/core
/PlatformTest.java
→
test/
org.jkiss.dbeaver.test.platform/src/org/jkiss/dbeaver/test/platform
/PlatformTest.java
浏览文件 @
a9ed91ad
...
...
@@ -16,7 +16,7 @@
* limitations under the License.
*/
package
org.jkiss.dbeaver.
runtime.ide.core
;
package
org.jkiss.dbeaver.
test.platform
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.junit.After
;
...
...
@@ -37,7 +37,7 @@ public class PlatformTest {
public
void
testPlatformPresence
()
{
try
{
String
infoDetails
=
DBWorkbench
.
getPlatform
().
getApplication
().
getInfoDetails
();
System
.
out
.
println
(
infoDetails
);
System
.
out
.
println
(
"DBeaver application: "
+
infoDetails
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
test/org.jkiss.dbeaver.
runtime.ide.core.tests/src/org/jkiss/dbeaver/runtime/ide/core
/WorkspaceResourcesTest.java
→
test/org.jkiss.dbeaver.
test.platform/src/org/jkiss/dbeaver/test/platform
/WorkspaceResourcesTest.java
浏览文件 @
a9ed91ad
...
...
@@ -16,12 +16,13 @@
* limitations under the License.
*/
package
org.jkiss.dbeaver.
runtime.ide.core
;
package
org.jkiss.dbeaver.
test.platform
;
import
org.eclipse.core.resources.*
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.core.runtime.IStatus
;
import
org.eclipse.core.runtime.Platform
;
import
org.jkiss.dbeaver.runtime.resource.WorkspaceResources
;
import
org.junit.*
;
import
org.junit.rules.TemporaryFolder
;
...
...
test/pom.xml
浏览文件 @
a9ed91ad
...
...
@@ -14,7 +14,9 @@
<packaging>
pom
</packaging>
<modules>
<module>
dbeaver.test.suite
</module>
<module>
org.jkiss.dbeaver.headless
</module>
<module>
org.jkiss.dbeaver.test.platform
</module>
<module>
org.jkiss.dbeaver.ext.postgresql.test
</module>
<module>
org.jkiss.dbeaver.ext.test
</module>
</modules>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录