Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ea9f0f1c
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ea9f0f1c
编写于
10月 20, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 20, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5982 【Distributeddatamgr】【Master】ChangeEncryptKey用例修改
Merge pull request !5982 from Maowen/master
上级
2c366e5d
aecbb290
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
0 addition
and
167 deletion
+0
-167
distributeddatamgr/relationalStorejstest/hap/src/main/js/test/List.test.js
...r/relationalStorejstest/hap/src/main/js/test/List.test.js
+0
-2
distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreChangeEncryptKeyJsunit.test.js
...p/src/main/js/test/RdbstoreChangeEncryptKeyJsunit.test.js
+0
-165
未找到文件。
distributeddatamgr/relationalStorejstest/hap/src/main/js/test/List.test.js
浏览文件 @
ea9f0f1c
...
...
@@ -14,7 +14,6 @@
*/
import
rdbStoreBackupRestoreCallbackTest
from
'
./RdbstoreBackupRestoreCallbackJsunit.test.js
'
import
rdbStoreBackupRestoreWithFAContextTest
from
'
./RdbstoreBackupRestoreWithFAContextJsunit.test.js
'
import
rdbstoreChangeEncryptKeyTest
from
'
./RdbstoreChangeEncryptKeyJsunit.test.js
'
import
rdbStoreDeleteTest
from
'
./RdbstoreDeleteJsunit.test.js
'
import
rdbStoreDistributedTest
from
'
./RdbStoreDistributedJsunit.test.js
'
import
rdbstoreInsertTest
from
'
./RdbstoreInsertJsunit.test.js
'
...
...
@@ -30,7 +29,6 @@ import rdbStoreEncryptionTest from './RdbstoreEncryptionJsunit.test.js'
export
default
function
testsuite
()
{
rdbStoreBackupRestoreCallbackTest
()
rdbStoreBackupRestoreWithFAContextTest
()
rdbstoreChangeEncryptKeyTest
()
rdbStoreDeleteTest
()
rdbStoreDistributedTest
()
rdbstoreInsertTest
()
...
...
distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreChangeEncryptKeyJsunit.test.js
已删除
100644 → 0
浏览文件 @
2c366e5d
// @ts-nocheck
/*
* Copyright (C) 2021 Huawei Device Co., 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.
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
dataRdb
from
'
@ohos.data.rdb
'
;
const
TAG
=
"
[RDB_JSKITS_TEST]
"
const
CREATE_TABLE_TEST
=
"
CREATE TABLE IF NOT EXISTS test (
"
+
"
id INTEGER PRIMARY KEY AUTOINCREMENT,
"
+
"
name TEXT NOT NULL,
"
+
"
age INTEGER,
"
+
"
salary REAL,
"
+
"
blobType BLOB)
"
;
const
STORE_CONFIG
=
{
name
:
"
EncryptNoKeyInsertTest.db
"
,
encryptKey
:
new
Uint8Array
([
1
,
2
,
3
])
}
const
STORE_CONFIG_NO_KEY
=
{
name
:
"
EncryptNoKeyInsertTest.db
"
}
var
i
=
1
;
var
rdbStore
=
undefined
;
export
default
function
rdbstoreChangeEncryptKeyTest
()
{
describe
(
'
rdbstoreChangeEncryptKeyTest
'
,
function
()
{
beforeAll
(
async
function
()
{
console
.
info
(
TAG
+
'
beforeAll
'
)
})
beforeEach
(
async
function
()
{
if
(
i
==
2
){
rdbStore
=
await
dataRdb
.
getRdbStore
(
STORE_CONFIG_NO_KEY
,
1
);
}
rdbStore
=
await
dataRdb
.
getRdbStore
(
STORE_CONFIG
,
1
);
await
rdbStore
.
executeSql
(
CREATE_TABLE_TEST
);
console
.
info
(
TAG
+
'
beforeEach
'
)
})
afterEach
(
async
function
()
{
i
++
;
console
.
info
(
TAG
+
'
afterEach
'
)
rdbStore
=
null
await
dataRdb
.
deleteRdbStore
(
"
EncryptNoKeyInsertTest.db
"
);
})
afterAll
(
async
function
()
{
console
.
info
(
TAG
+
'
afterAll
'
)
})
console
.
info
(
TAG
+
"
*************Unit Test Begin*************
"
);
/**
* @tc.name testRdbStoreChangeEncryptKey0001
* @tc.number SUB_DDM_Encrypt_ChangeKey0001
* @tc.desc encrypt the db at start, then change the encrypt key
*/
it
(
'
testRdbStoreChangeEncryptKey0001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* testRdbStoreChangeEncryptKey0001 start *************
"
);
var
u8
=
new
Uint8Array
([
1
,
2
,
3
])
{
const
valueBucket
=
{
"
name
"
:
"
zhangsan
"
,
"
age
"
:
18
,
"
salary
"
:
100.5
,
"
blobType
"
:
u8
,
}
await
rdbStore
.
insert
(
"
test
"
,
valueBucket
)
}
var
newKey
=
new
Uint8Array
([
1
,
2
])
await
rdbStore
.
changeEncryptKey
(
newKey
);
let
predicates
=
new
dataRdb
.
RdbPredicates
(
"
test
"
);
predicates
.
equalTo
(
"
name
"
,
"
zhangsan
"
)
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
try
{
console
.
info
(
TAG
+
"
resultSet query done
"
);
resultSet
.
goToFirstRow
()
const
id
=
resultSet
.
getLong
(
resultSet
.
getColumnIndex
(
"
id
"
))
expect
(
1
).
assertEqual
(
id
);
}
catch
(
e
)
{
console
.
info
(
"
insert1 error
"
+
e
);
}
done
()
console
.
info
(
TAG
+
"
************* testRdbStoreChangeEncryptKey0001 end *************
"
);
})
/**
* @tc.name testRdbStoreChangeEncryptKey0002
* @tc.number SUB_DDM_Encrypt_ChangeKey0002
* @tc.desc encrypt the db at start, then change the encrypt key
*/
it
(
'
testRdbStoreChangeEncryptKey0002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* testRdbStoreChangeEncryptKey0002 start *************
"
);
var
u8
=
new
Uint8Array
([
1
,
2
,
3
])
let
result
=
1
;
{
const
valueBucket
=
{
"
name
"
:
"
zhangsan
"
,
"
age
"
:
18
,
"
salary
"
:
100.5
,
"
blobType
"
:
u8
,
}
await
rdbStore
.
insert
(
"
test
"
,
valueBucket
)
}
try
{
let
result
=
await
rdbStore
.
changeEncryptKey
(
new
Uint8Array
([
1
,
2
]));
}
catch
(
e
)
{
expect
(
1
).
assertEqual
(
result
);
console
.
info
(
TAG
+
"
can not change encrypt key, since config with no key
"
);
}
done
()
console
.
info
(
TAG
+
"
************* testRdbStoreChangeEncryptKey0002 end *************
"
);
})
/**
* @tc.name testRdbStoreChangeEncryptKey0003
* @tc.number SUB_DDM_Encrypt_ChangeKey0003
* @tc.desc encrypt the db at start, then clear the encrypt key
* now sqlite does not support this feature, switch encrypt to non-encrypt.
*/
it
(
'
testRdbStoreChangeEncryptKey0003
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* testRdbStoreChangeEncryptKey0003 start *************
"
);
let
result
=
-
1
;
var
u8
=
new
Uint8Array
([
1
,
2
,
3
])
{
const
valueBucket
=
{
"
name
"
:
"
zhangsan
"
,
"
age
"
:
18
,
"
salary
"
:
100.5
,
"
blobType
"
:
u8
,
}
await
rdbStore
.
insert
(
"
test
"
,
valueBucket
)
}
try
{
result
=
await
rdbStore
.
changeEncryptKey
(
new
Uint8Array
());
}
catch
(
e
)
{
expect
(
-
1
).
assertEqual
(
result
);
console
.
info
(
TAG
+
"
can not clear encrypt key 2
"
);
}
done
()
console
.
info
(
TAG
+
"
************* testRdbStoreChangeEncryptKey0003 end *************
"
);
})
console
.
info
(
TAG
+
"
*************Unit Test End*************
"
);
})}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录