Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
50dc1ea0
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看板
提交
50dc1ea0
编写于
3月 01, 2022
作者:
Y
yanglei1217
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
<yanglifeng5@huawei.com>
Signed-off-by:
N
yanglei1217
<
yanglifeng5@huawei.com
>
上级
82c2839d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
1598 addition
and
4 deletion
+1598
-4
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/DataAbilityPredicatesJsunit.test.js
.../main/js/default/test/DataAbilityPredicatesJsunit.test.js
+270
-3
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/DataShareJsunit.test.js
...test/hap/src/main/js/default/test/DataShareJsunit.test.js
+1081
-0
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/List.test.js
...ppdatamgrjstest/hap/src/main/js/default/test/List.test.js
+2
-0
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/RdbStoreDistributedJsunit.test.js
...rc/main/js/default/test/RdbStoreDistributedJsunit.test.js
+4
-1
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/RdbstorePredicatesJsunit.test.js
...src/main/js/default/test/RdbstorePredicatesJsunit.test.js
+241
-0
未找到文件。
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/DataAbilityPredicatesJsunit.test.js
浏览文件 @
50dc1ea0
...
...
@@ -27,7 +27,7 @@ const CREATE_TABLE_ALL_DATA_TYPE_SQL = "CREATE TABLE IF NOT EXISTS AllDataType "
+
"
primBooleanValue INTEGER , primByteValue INTEGER , primCharValue TEXT, `order` INTEGER);
"
;
const
STORE_CONFIG
=
{
name
:
"
DataAbility
Predicates.db
"
,
name
:
"
Predicates.db
"
,
}
var
rdbStore
=
undefined
;
var
DOUBLE_MAX
=
9223372036854775807
;
...
...
@@ -53,7 +53,7 @@ describe('dataAbilityPredicatesTest', function () {
afterAll
(
async
function
()
{
console
.
info
(
TAG
+
'
afterAll
'
)
rdbStore
=
null
await
dataRdb
.
deleteRdbStore
(
"
DataAbility
Predicates.db
"
);
await
dataRdb
.
deleteRdbStore
(
"
Predicates.db
"
);
})
function
resultSize
(
resultSet
)
{
...
...
@@ -1238,6 +1238,216 @@ describe('dataAbilityPredicatesTest', function () {
console
.
log
(
TAG
+
"
************* testBetween0008 end *************
"
);
})
/**
* @tc.name testNotBetween0001
* @tc.number I4JWCV
* @tc.desc test string value with notBetween.
*/
it
(
'
testNotBetween0001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotBetween0001 start *************
"
);
{
let
dataAbilityPredicates
=
await
new
dataAbility
.
DataAbilityPredicates
();
dataAbilityPredicates
.
notBetween
(
"
stringValue
"
,
"
ABB
"
,
"
ABD
"
);
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
AllDataType
"
,
dataAbilityPredicates
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
0
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testNotBetween0001 end *************
"
);
})
/**
* @tc.name testNotBetween0002
* @tc.number I4JWCV
* @tc.desc test double value with notBetween.
*/
it
(
'
testNotBetween0002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotBetween0002 start *************
"
);
{
let
dataAbilityPredicates
=
await
new
dataAbility
.
DataAbilityPredicates
();
dataAbilityPredicates
.
notBetween
(
"
doubleValue
"
,
0.0
,
DOUBLE_MAX
);
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
AllDataType
"
,
dataAbilityPredicates
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
0
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testNotBetween0002 end *************
"
);
})
/**
* @tc.name testNotBetween0003
* @tc.number I4JWCV
* @tc.desc test integer value with notBetween.
*/
it
(
'
testNotBetween0003
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotBetween0003 start *************
"
);
{
let
dataAbilityPredicates
=
await
new
dataAbility
.
DataAbilityPredicates
();
dataAbilityPredicates
.
notBetween
(
"
integerValue
"
,
0
,
1
);
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
AllDataType
"
,
dataAbilityPredicates
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
2
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testNotBetween0003 end *************
"
);
})
/**
* @tc.name testNotBetween0004
* @tc.number I4JWCV
* @tc.desc test long value with notBetween.
*/
it
(
'
testNotBetween0004
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotBetween0004 start *************
"
);
{
let
dataAbilityPredicates
=
await
new
dataAbility
.
DataAbilityPredicates
();
dataAbilityPredicates
.
notBetween
(
"
longValue
"
,
0
,
2
);
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
AllDataType
"
,
dataAbilityPredicates
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
2
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testNotBetween0004 end *************
"
);
})
/**
* @tc.name testGlob0001
* @tc.number I4JWCV
* @tc.desc end with ? by glob.
*/
it
(
'
testGlob0001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGlob0001 start *************
"
);
{
let
dataAbilityPredicates
=
await
new
dataAbility
.
DataAbilityPredicates
();
dataAbilityPredicates
.
glob
(
"
stringValue
"
,
"
ABC*
"
);
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
AllDataType
"
,
dataAbilityPredicates
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
3
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testGlob0001 end *************
"
);
})
/**
* @tc.name testGlob0002
* @tc.number I4JWCV
* @tc.desc begin with * by glob.
*/
it
(
'
testGlob0002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGlob0002 start *************
"
);
{
let
dataAbilityPredicates
=
await
new
dataAbility
.
DataAbilityPredicates
();
dataAbilityPredicates
.
glob
(
"
stringValue
"
,
"
*LMN
"
);
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
AllDataType
"
,
dataAbilityPredicates
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
3
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testGlob0002 end *************
"
);
})
/**
* @tc.name testGlob0003
* @tc.number I4JWCV
* @tc.desc end with ? by glob.
*/
it
(
'
testGlob0003
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGlob0003 start *************
"
);
{
let
dataAbilityPredicates
=
await
new
dataAbility
.
DataAbilityPredicates
();
dataAbilityPredicates
.
glob
(
"
stringValue
"
,
"
ABCDEFGHIJKLM?
"
);
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
AllDataType
"
,
dataAbilityPredicates
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
3
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testGlob0003 end *************
"
);
})
/**
* @tc.name testGlob0004
* @tc.number I4JWCV
* @tc.desc begin with ? by glob.
*/
it
(
'
testGlob0004
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGlob0004 start *************
"
);
{
let
dataAbilityPredicates
=
await
new
dataAbility
.
DataAbilityPredicates
();
dataAbilityPredicates
.
glob
(
"
stringValue
"
,
"
?BCDEFGHIJKLMN
"
);
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
AllDataType
"
,
dataAbilityPredicates
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
3
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testGlob0004 end *************
"
);
})
/**
* @tc.name testGlob0005
* @tc.number I4JWCV
* @tc.desc begin and end with * by glob.
*/
it
(
'
testGlob0005
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGlob0005 start *************
"
);
{
let
dataAbilityPredicates
=
await
new
dataAbility
.
DataAbilityPredicates
();
dataAbilityPredicates
.
glob
(
"
stringValue
"
,
"
*FGHI*
"
);
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
AllDataType
"
,
dataAbilityPredicates
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
3
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testGlob0005 end *************
"
);
})
/**
* @tc.name testGlob0006
* @tc.number I4JWCV
* @tc.desc begin and end with ? by glob.
*/
it
(
'
testGlob0006
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGlob0006 start *************
"
);
{
let
dataAbilityPredicates
=
await
new
dataAbility
.
DataAbilityPredicates
();
dataAbilityPredicates
.
glob
(
"
stringValue
"
,
"
?BCDEFGHIJKLM?
"
);
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
AllDataType
"
,
dataAbilityPredicates
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
3
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testGlob0006 end *************
"
);
})
/**
* @tc.name predicates contains normal test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_DataAbilityPredicates_0100
...
...
@@ -2098,5 +2308,62 @@ describe('dataAbilityPredicatesTest', function () {
done
();
console
.
log
(
TAG
+
"
************* testIndexedBy0002 end *************
"
);
})
/**
* @tc.name testNotIn0001
* @tc.number I4JWCV
* @tc.desc the common and min value test with notin.
*/
it
(
'
testNotIn0001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotIn0001 start *************
"
);
var
values
=
[
1
,
-
2147483648
];
let
dataAbilityPredicates
=
await
new
dataAbility
.
DataAbilityPredicates
();
dataAbilityPredicates
.
notIn
(
"
integerValue
"
,
values
);
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
AllDataType
"
,
dataAbilityPredicates
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
1
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
done
();
console
.
log
(
TAG
+
"
************* testNotIn0001 end *************
"
);
})
/**
* @tc.name testNotIn0002
* @tc.number I4JWCV
* @tc.desc the common and max value test with notin.
*/
it
(
'
testNotIn0002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotIn0002 start *************
"
);
let
values
=
[
1
,
2147483647
];
let
dataAbilityPredicates
=
await
new
dataAbility
.
DataAbilityPredicates
();
dataAbilityPredicates
.
notIn
(
"
integerValue
"
,
values
);
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
AllDataType
"
,
dataAbilityPredicates
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
1
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
done
();
console
.
log
(
TAG
+
"
************* testNotIn0002 end *************
"
);
})
/**
* @tc.name testNotIn0003
* @tc.number I4JWCV
* @tc.desc the min and max value test with notin.
*/
it
(
'
testNotIn0003
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotIn0003 start *************
"
);
var
values
=
[
-
2147483648
,
2147483647
];
let
dataAbilityPredicates
=
await
new
dataAbility
.
DataAbilityPredicates
();
dataAbilityPredicates
.
notIn
(
"
integerValue
"
,
values
);
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
AllDataType
"
,
dataAbilityPredicates
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
1
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
done
();
console
.
log
(
TAG
+
"
************* testNotIn0003 end *************
"
);
})
console
.
log
(
TAG
+
"
*************Unit Test End*************
"
);
})
\ No newline at end of file
})
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/DataShareJsunit.test.js
0 → 100644
浏览文件 @
50dc1ea0
/*
* Copyright (C) 2022 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
'
deccjsunit/index
'
import
dataShare
from
'
@ohos.data.dataShare
'
;
import
dataAbility
from
'
@ohos.data.dataAbility
'
;
const
TAG
=
"
[DATASHARE_JSKITS_TEST]
"
const
URI
=
(
"
datashare:///com.samples.datasharetest.DataShare
"
);
let
dseWant
=
{
"
bundleName
"
:
"
com.examples.datasharetest.service
"
,
"
abilityName
"
:
"
DataShareExtAbility
"
,
}
describe
(
'
dataShareTest
'
,
function
()
{
beforeAll
(
async
function
()
{
console
.
info
(
TAG
+
'
beforeAll
'
)
})
beforeEach
(
function
()
{
console
.
info
(
TAG
+
'
beforeEach
'
)
})
afterEach
(
function
()
{
console
.
info
(
TAG
+
'
afterEach
'
)
})
afterAll
(
async
function
()
{
console
.
info
(
TAG
+
'
afterAll
'
)
})
console
.
log
(
TAG
+
"
*************Unit Test Begin*************
"
);
function
onChangeNotify
()
{
console
.
info
(
"
==========================>onChangeNotify=======================>
"
);
}
/**
* @tc.name data share createDataShareHelper test
* @tc.number SUB_DDM_DataShare_JS_createDataShareHelper_0000
* @tc.desc data share createDataShareHelper test
*/
it
(
'
createDataShareHelper_0000
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:createDataShareHelper_0000 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
this
.
context
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:createDataShareHelper_0000 end
"
);
})
/**
* @tc.name data share createDataShareHelper test
* @tc.number SUB_DDM_DataShare_JS_createDataShareHelper_0010
* @tc.desc data share createDataShareHelper test
*/
it
(
'
createDataShareHelper_0010
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:createDataShareHelper_0010 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:createDataShareHelper_0010 end
"
);
})
/**
* @tc.name data share createDataShareHelper test
* @tc.number SUB_DDM_DataShare_JS_createDataShareHelper_0011
* @tc.desc data share createDataShareHelper test
*/
it
(
'
createDataShareHelper_0011
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:createDataShareHelper_0011 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
this
.
context
,
null
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:createDataShareHelper_0011 end
"
);
})
/**
* @tc.name data share createDataShareHelper test
* @tc.number SUB_DDM_DataShare_JS_createDataShareHelper_0012
* @tc.desc data share createDataShareHelper test
*/
it
(
'
createDataShareHelper_0012
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:createDataShareHelper_0012 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
this
.
context
,
dseWant
,
null
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:createDataShareHelper_0012 end
"
);
})
/**
* @tc.name data share onEvent test
* @tc.number SUB_DDM_DataShare_JS_on_0020
* @tc.desc data share onEvent test
*/
it
(
'
on_0020
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:on_0020 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
on
(
"
dataChange
"
,
URI
,
onChangeNotify
)
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:on_0020 end
"
);
})
/**
* @tc.name data share onEvent test
* @tc.number SUB_DDM_DataShare_JS_on_0021
* @tc.desc data share onEvent test
*/
it
(
'
on_0021
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:on_0021 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
on
(
"
dataChange
"
,
null
,
onChangeNotify
)
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:on_0021 end
"
);
})
/**
* @tc.name data share offEvent test
* @tc.number SUB_DDM_DataShare_JS_off_0030
* @tc.desc data share offEvent test
*/
it
(
'
off_0030
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:off_0030 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
off
(
"
dataChange
"
,
URI
,
)
helper
.
off
(
"
dataChange
"
,
URI
,
onChangeNotify
)
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:off_0030 end
"
);
})
/**
* @tc.name data share offEvent test
* @tc.number SUB_DDM_DataShare_JS_off_0031
* @tc.desc data share offEvent test
*/
it
(
'
off_0031
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:off_0031 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
off
(
"
dataChange
"
,
null
,
onChangeNotify
)
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:off_0031 end
"
);
})
/**
* @tc.name data share getType_callback test
* @tc.number SUB_DDM_DataShare_getType_0040
* @tc.desc data share getType_callback test
*/
it
(
'
getType_callback_0040
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:getType_callback_0040 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
getType
(
URI
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:getType_callback_0040 end
"
);
})
/**
* @tc.name data share getType_promise test
* @tc.number SUB_DDM_DataShare_JS_getType_promise_0041
* @tc.desc data share getType_promise test
*/
it
(
'
getType_promise_0041
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:getType_promise_0041 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
getType
(
URI
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>getTypeCallback=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:getType_promise_0041 end
"
);
})
/**
* @tc.name data share getFileType_callback test
* @tc.number SUB_DDM_DataShare_JS_getFileType_callback_0050
* @tc.desc data share getFileType_callback test
*/
it
(
'
getFileType_callback_0050
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:getFileType_callback_0050 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
getFileTypes
(
URI
,
"
image/*
"
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:getFileType_callback_0050 end
"
);
})
/**
* @tc.name data share getFileType_promise test
* @tc.number SUB_DDM_DataShare_JS_getFileType_promise_0051
* @tc.desc data share getFileType_promise test
*/
it
(
'
getFileType_promise_0051
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:getFileType_promise_0051 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
getFileTypes
(
URI
,
"
image/*
"
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>getFileTypesCallback=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:getFileType_promise_0051 end
"
);
})
/**
* @tc.name data share getFileType_callback test
* @tc.number SUB_DDM_DataShare_JS_getFileType_callback_0052
* @tc.desc data share getFileType_callback test
*/
it
(
'
getFileType_callback_0052
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:getFileType_callback_0052 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
getFileTypes
(
null
,
"
image/*
"
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:getFileType_callback_0052 end
"
);
})
/**
* @tc.name data share normalizeUri_callback test
* @tc.number SUB_DDM_DataShare_JS_normalizeUri_0060
* @tc.desc data share normalizeUri_callback test
*/
it
(
'
normalizeUri_callback_0060
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:normalizeUri_callback_0060 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
normalizeUri
(
URI
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:normalizeUri_callback_0060 end
"
);
})
/**
* @tc.name data share normalizeUri_promise test
* @tc.number SUB_DDM_DataShare_JS_normalizeUri_promise_0061
* @tc.desc data share normalizeUri_promise test
*/
it
(
'
normalizeUri_promise_0061
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:normalizeUri_promise_0061 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
normalizeUri
(
URI
,
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>normalizeUriCallback=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:normalizeUri_promise_0061 end
"
);
})
/**
* @tc.name data share normalizeUri_callback test
* @tc.number SUB_DDM_DataShare_JS_normalizeUri_0062
* @tc.desc data share normalizeUri_callback test
*/
it
(
'
normalizeUri_callback_0062
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:normalizeUri_callback_0062 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
normalizeUri
(
null
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:normalizeUri_callback_0062 end
"
);
})
/**
* @tc.name data share denormalizeUri_callback test
* @tc.number SUB_DDM_DataShare_JS_denormalizeUri_callback_0060
* @tc.desc data share denormalizeUri_callback test
*/
it
(
'
denormalizeUri_callback_0070
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:denormalizeUri_callback_0070 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
denormalizeUri
(
URI
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:denormalizeUri_callback_0070 end
"
);
})
/**
* @tc.name data share denormalizeUri_promise test
* @tc.number SUB_DDM_DataShare_JS_denormalizeUri_promise_0061
* @tc.desc data share denormalizeUri_promise test
*/
it
(
'
denormalizeUri_promise_0071
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:denormalizeUri_promise_0071 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
denormalizeUri
(
URI
,
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>denormalizeUriCallback=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:denormalizeUri_promise_0071 end
"
);
})
/**
* @tc.name data share denormalizeUri_callback test
* @tc.number SUB_DDM_DataShare_JS_denormalizeUri_callback_0072
* @tc.desc data share denormalizeUri_callback test
*/
it
(
'
denormalizeUri_callback_0072
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:denormalizeUri_callback_0072 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
denormalizeUri
(
null
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:denormalizeUri_callback_0072 end
"
);
})
/**
* @tc.name data share notifyChange_callback test
* @tc.number SUB_DDM_DataShare_JS_notifyChange_callback_0080
* @tc.desc data share notifyChange_callback test
*/
it
(
'
notifyChange_callback_0080
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:notifyChange_callback_0080 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
notifyChange
(
URI
,
(
err
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:notifyChange_callback_0080 end
"
);
})
/**
* @tc.name data share notifyChange_promise test
* @tc.number SUB_DDM_DataShare_JS_notifyChange_promise_0081
* @tc.desc data share notifyChange_promise test
*/
it
(
'
notifyChange_promise_0081
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:notifyChange_promise_0081 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
notifyChange
(
URI
,
).
then
(()
=>
{
console
.
info
(
"
==========================>notifyChangeCallback=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:notifyChange_promise_0081 end
"
);
})
/**
* @tc.name data share notifyChange_callback test
* @tc.number SUB_DDM_DataShare_JS_notifyChange_callback_0082
* @tc.desc data share notifyChange_callback test
*/
it
(
'
notifyChange_callback_0082
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:notifyChange_callback_0082 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
helper
.
notifyChange
(
null
,
(
err
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:notifyChange_callback_0082 end
"
);
})
/**
* @tc.name data share insert_callback test
* @tc.number SUB_DDM_DataShare_JS_insert_callback_0090
* @tc.desc data share insert_callback test
*/
it
(
'
insert_callback_0090
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:insert_callback_0090 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
const
valueBucket
=
{
"
name
"
:
"
rose
"
,
"
age
"
:
22
,
"
salary
"
:
200.5
,
"
blobType
"
:
u8
,
}
helper
.
insert
(
URI
,
valueBucket
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:insert_callback_0090 end
"
);
})
/**
* @tc.name data share insert_promise test
* @tc.number SUB_DDM_DataShare_JS_insert_promise_0091
* @tc.desc data share insert_promise test
*/
it
(
'
insert_promise_0091
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:insert_promise_0081 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
const
valueBucket
=
{
"
name
"
:
"
rose1
"
,
"
age
"
:
221
,
"
salary
"
:
20.5
,
"
blobType
"
:
u8
,
}
helper
.
insert
(
URI
,
valueBucket
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>insertCallback=======================>
"
);
});
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:insert_promise_0091 end
"
);
})
/**
* @tc.name data share insert_callback test
* @tc.number SUB_DDM_DataShare_JS_insert_callback_0092
* @tc.desc data share insert_callback test
*/
it
(
'
insert_callback_0092
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:insert_callback_0092 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
const
valueBucket
=
{
"
name
"
:
"
rose
"
,
"
age
"
:
22
,
"
salary
"
:
200.5
,
"
blobType
"
:
u8
,
}
helper
.
insert
(
null
,
valueBucket
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:insert_callback_0092 end
"
);
})
/**
* @tc.name data share batchInsert_callback test
* @tc.number SUB_DDM_DataShare_JS_batchInsert_callback_0090
* @tc.desc data share batchInsert_callback test
*/
it
(
'
batchInsert_callback_0100
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:batchInsert_callback_0100 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
var
cars
=
new
Array
({
"
name
"
:
"
roe11
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
u8
,},
{
"
name
"
:
"
roe12
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
u8
,},
{
"
name
"
:
"
roe13
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
u8
,})
helper
.
batchInsert
(
URI
,
cars
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:batchInsert_callback_0100 end
"
);
})
/**
* @tc.name data share batchInsert_promise test
* @tc.number SUB_DDM_DataShare_JS_batchInsert_promise_0101
* @tc.desc data share createDataShareHelper test
*/
it
(
'
batchInsert_promise_0101
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:batchInsert_promise_0101 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
var
cars
=
new
Array
({
"
name
"
:
"
roe11
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
u8
,},
{
"
name
"
:
"
roe12
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
u8
,},
{
"
name
"
:
"
roe13
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
u8
,})
helper
.
batchInsert
(
URI
,
cars
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>batchInsertCallback=======================>
"
);
});
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:batchInsert_promise_0101 end
"
);
})
/**
* @tc.name data share batchInsert_callback test
* @tc.number SUB_DDM_DataShare_JS_batchInsert_callback_0102
* @tc.desc data share batchInsert_callback test
*/
it
(
'
batchInsert_callback_0102
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:batchInsert_callback_0102 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
var
cars
=
new
Array
({
"
name
"
:
"
roe11
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
u8
,},
{
"
name
"
:
"
roe12
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
u8
,},
{
"
name
"
:
"
roe13
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
u8
,})
helper
.
batchInsert
(
null
,
cars
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:batchInsert_callback_0102 end
"
);
})
/**
* @tc.name data share delete_callback test
* @tc.number SUB_DDM_DataShare_JS_delete_callback_0110
* @tc.desc data share delete_callback test
*/
it
(
'
delete_callback_0110
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:delete_callback_0110 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
let
da
=
new
dataAbility
.
DataAbilityPredicates
()
helper
.
delete
(
URI
,
da
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:delete_callback_0110 end
"
);
})
/**
* @tc.name data share delete_promise test
* @tc.number SUB_DDM_DataShare_JS_delete_promise_0111
* @tc.desc data share delete_promise test
*/
it
(
'
delete_promise_0111
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:delete_promise_0111 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
let
da
=
new
dataAbility
.
DataAbilityPredicates
()
helper
.
delete
(
URI
,
da
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>deleteCallback=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:delete_promise_0111 end
"
);
})
/**
* @tc.name data share delete_callback test
* @tc.number SUB_DDM_DataShare_JS_delete_callback_0112
* @tc.desc data share delete_callback test
*/
it
(
'
delete_callback_0112
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:delete_callback_0112 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
let
da
=
new
dataAbility
.
DataAbilityPredicates
()
helper
.
delete
(
null
,
da
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:delete_callback_0112 end
"
);
})
/**
* @tc.name data share delete_callback test
* @tc.number SUB_DDM_DataShare_JS_delete_callback_0113
* @tc.desc data share delete_callback test
*/
it
(
'
delete_callback_0113
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:delete_callback_0113 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
this
.
context
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
let
da
=
new
dataAbility
.
DataAbilityPredicates
()
helper
.
delete
(
URI
,
da
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:delete_callback_0113 end
"
);
})
/**
* @tc.name data share update_callback test
* @tc.number SUB_DDM_DataShare_JS_update_callback_0120
* @tc.desc data share update_callback test
*/
it
(
'
update_callback_0120
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:update_callback_0120 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
const
va
=
{
"
name
"
:
"
roe1
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
u8
,
}
let
da
=
new
dataAbility
.
DataAbilityPredicates
()
helper
.
update
(
URI
,
va
,
da
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:update_callback_0120 end
"
);
})
/**
* @tc.name data share update_promise test
* @tc.number SUB_DDM_DataShare_JS_update_promise_0121
* @tc.desc data share update_promise test
*/
it
(
'
update_promise_0121
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:update_promise_0121 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
const
va
=
{
"
name
"
:
"
roe1
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
u8
,
}
let
da
=
new
dataAbility
.
DataAbilityPredicates
()
helper
.
update
(
URI
,
va
,
da
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>updateCallback=======================>
"
);
});
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:update_promise_0121 end
"
);
})
/**
* @tc.name data share update_callback test
* @tc.number SUB_DDM_DataShare_JS_update_callback_0122
* @tc.desc data share update_callback test
*/
it
(
'
update_callback_0122
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:update_callback_0122 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
const
va
=
{
"
name
"
:
"
roe1
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
u8
,
}
let
da
=
new
dataAbility
.
DataAbilityPredicates
()
helper
.
update
(
null
,
va
,
da
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:update_callback_0122 end
"
);
})
/**
* @tc.name data share update_callback test
* @tc.number SUB_DDM_DataShare_JS_update_callback_0123
* @tc.desc data share update_callback test
*/
it
(
'
update_callback_0123
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:update_callback_0123 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
let
da
=
new
dataAbility
.
DataAbilityPredicates
()
helper
.
update
(
URI
,
null
,
da
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:update_callback_0123 end
"
);
})
/**
* @tc.name data share query_callback test
* @tc.number SUB_DDM_DataShare_JS_query_callback_0130
* @tc.desc data share query_callback test
*/
it
(
'
query_callback_0130
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:query_callback_0130 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
let
da
=
new
dataAbility
.
DataAbilityPredicates
()
helper
.
query
(
URI
,
[
"
*
"
],
da
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:query_callback_0130 end
"
);
})
/**
* @tc.name data share query_promise test
* @tc.number SUB_DDM_DataShare_JS_query_promise_0131
* @tc.desc data share query_promise test
*/
it
(
'
query_promise_0131
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:query_promise_0131 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
let
da
=
new
dataAbility
.
DataAbilityPredicates
()
helper
.
query
(
URI
,
[
"
*
"
],
da
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>queryCallback=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:query_promise_0131 end
"
);
})
/**
* @tc.name data share query_callback test
* @tc.number SUB_DDM_DataShare_JS_query_callback_0132
* @tc.desc data share query_callback test
*/
it
(
'
query_callback_0132
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:query_callback_0132 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
let
da
=
new
dataAbility
.
DataAbilityPredicates
()
helper
.
query
(
null
,
[
"
*
"
],
da
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:query_callback_0130 end
"
);
})
/**
* @tc.name data share query_promise test
* @tc.number SUB_DDM_DataShare_JS_query_promise_0133
* @tc.desc data share query_promise test
*/
it
(
'
query_promise_0133
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
:query_promise_0133 start
"
);
try
{
let
helper
=
dataShare
.
createDataShareHelper
(
null
,
dseWant
,
URI
);
console
.
log
(
TAG
+
"
:DataShareHelper helper:
"
+
helper
);
let
da
=
new
dataAbility
.
DataAbilityPredicates
()
helper
.
query
(
URI
,
null
,
da
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>queryCallback=======================>
"
);
});
expect
(
true
).
assertTrue
();
}
catch
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
TAG
+
"
:DataShareHelper catch err:
"
+
err
);
}
done
();
console
.
log
(
TAG
+
"
:query_promise_0133 end
"
);
})
console
.
log
(
TAG
+
"
*************Unit Test End*************
"
);
})
\ No newline at end of file
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/List.test.js
浏览文件 @
50dc1ea0
...
...
@@ -27,3 +27,5 @@ require('./DataAbilityPredicatesJsunit.test.js')
require
(
'
./RdbstoreTransactionJsunit.test.js
'
)
require
(
'
./RdbstorePredicatesJoinJsunit.test.js
'
)
require
(
'
./RdbStoreDistributedJsunit.test.js
'
)
require
(
'
./DataShareJsunit.test.js
'
)
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/RdbStoreDistributedJsunit.test.js
浏览文件 @
50dc1ea0
...
...
@@ -301,7 +301,10 @@ describe('rdbStoreDistributedTest', function () {
let
predicates
=
new
dataRdb
.
RdbPredicates
(
"
employee
"
)
predicates
=
predicates
.
inDevices
(
"
12345678abcd
"
);
rdbStore
.
sync
(
dataRdb
.
SyncMode
.
SYNC_MODE_PUSH
,
predicates
);
console
.
log
(
TAG
+
"
sync success
"
);
console
.
log
(
TAG
+
"
sync push success
"
);
expect
(
rdbStore
).
assertEqual
(
rdbStore
);
rdbStore
.
sync
(
dataRdb
.
SyncMode
.
SYNC_MODE_PULL
,
predicates
);
console
.
log
(
TAG
+
"
sync pull success
"
);
expect
(
rdbStore
).
assertEqual
(
rdbStore
);
done
();
console
.
log
(
TAG
+
"
************* testRdbStoreDistributed0011 end *************
"
);
...
...
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/RdbstorePredicatesJsunit.test.js
浏览文件 @
50dc1ea0
...
...
@@ -1121,6 +1121,196 @@ describe('rdbPredicatesTest', function () {
console
.
log
(
TAG
+
"
************* testBetween0008 end *************
"
);
})
/**
* @tc.name testNotBetween0001
* @tc.number I4JWCV
* @tc.desc test string value with notBetween.
*/
it
(
'
testNotBetween0001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotBetween0001 start *************
"
);
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
AllDataType
"
);
predicates
.
notBetween
(
"
stringValue
"
,
"
ABB
"
,
"
ABD
"
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
0
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testNotBetween0001 end *************
"
);
})
/**
* @tc.name testNotBetween0002
* @tc.number I4JWCV
* @tc.desc test double value with notBetween.
*/
it
(
'
testNotBetween0002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotBetween0002 start *************
"
);
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
AllDataType
"
);
predicates
.
notBetween
(
"
doubleValue
"
,
0.0
,
DOUBLE_MAX
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
0
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testNotBetween0002 end *************
"
);
})
/**
* @tc.name testNotBetween0003
* @tc.number I4JWCV
* @tc.desc test integer value with notBetween.
*/
it
(
'
testNotBetween0003
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotBetween0003 start *************
"
);
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
AllDataType
"
);
predicates
.
notBetween
(
"
integerValue
"
,
0
,
1
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
2
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testNotBetween0003 end *************
"
);
})
/**
* @tc.name testNotBetween0004
* @tc.number I4JWCV
* @tc.desc test long value with notBetween.
*/
it
(
'
testNotBetween0004
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotBetween0004 start *************
"
);
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
AllDataType
"
);
predicates
.
notBetween
(
"
longValue
"
,
0
,
2
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
2
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testNotBetween0004 end *************
"
);
})
/**
* @tc.name testGlob0001
* @tc.number I4JWCV
* @tc.desc end with ? by glob.
*/
it
(
'
testGlob0001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGlob0001 start *************
"
);
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
AllDataType
"
);
predicates
.
glob
(
"
stringValue
"
,
"
ABC*
"
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
3
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testGlob0001 end *************
"
);
})
/**
* @tc.name testGlob0002
* @tc.number I4JWCV
* @tc.desc begin with * by glob.
*/
it
(
'
testGlob0002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGlob0002 start *************
"
);
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
AllDataType
"
);
predicates
.
glob
(
"
stringValue
"
,
"
*LMN
"
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
3
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testGlob0002 end *************
"
);
})
/**
* @tc.name testGlob0003
* @tc.number I4JWCV
* @tc.desc end with ? by glob.
*/
it
(
'
testGlob0003
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGlob0003 start *************
"
);
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
AllDataType
"
);
predicates
.
glob
(
"
stringValue
"
,
"
ABCDEFGHIJKLM?
"
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
3
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testGlob0003 end *************
"
);
})
/**
* @tc.name testGlob0004
* @tc.number I4JWCV
* @tc.desc begin with ? by glob.
*/
it
(
'
testGlob0004
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGlob0004 start *************
"
);
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
AllDataType
"
);
predicates
.
glob
(
"
stringValue
"
,
"
?BCDEFGHIJKLMN
"
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
3
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testGlob0004 end *************
"
);
})
/**
* @tc.name testGlob0005
* @tc.number I4JWCV
* @tc.desc begin and end with * by glob.
*/
it
(
'
testGlob0005
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGlob0005 start *************
"
);
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
AllDataType
"
);
predicates
.
glob
(
"
stringValue
"
,
"
*FGHI*
"
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
3
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testGlob0005 end *************
"
);
})
/**
* @tc.name testGlob0006
* @tc.number I4JWCV
* @tc.desc begin and end with ? by glob.
*/
it
(
'
testGlob0006
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGlob0006 start *************
"
);
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
AllDataType
"
);
predicates
.
glob
(
"
stringValue
"
,
"
?BCDEFGHIJKLM?
"
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
3
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
result
=
null
}
done
();
console
.
log
(
TAG
+
"
************* testGlob0006 end *************
"
);
})
/**
* @tc.name predicates contains normal test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0100
...
...
@@ -1866,6 +2056,57 @@ describe('rdbPredicatesTest', function () {
console
.
log
(
TAG
+
"
************* testIn0004 end *************
"
);
})
/**
* @tc.name testNotIn0001
* @tc.number I4JWCV
* @tc.desc the common and min value test with notin.
*/
it
(
'
testNotIn0001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotIn0001 start *************
"
);
var
values
=
[
1
,
-
2147483648
];
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
AllDataType
"
);
predicates
.
notIn
(
"
integerValue
"
,
values
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
1
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
done
();
console
.
log
(
TAG
+
"
************* testNotIn0001 end *************
"
);
})
/**
* @tc.name testNotIn0002
* @tc.number I4JWCV
* @tc.desc the common and max value test with notin.
*/
it
(
'
testNotIn0002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotIn0002 start *************
"
);
let
values
=
[
1
,
2147483647
];
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
AllDataType
"
);
predicates
.
notIn
(
"
integerValue
"
,
values
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
1
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
done
();
console
.
log
(
TAG
+
"
************* testNotIn0002 end *************
"
);
})
/**
* @tc.name testNotIn0003
* @tc.number I4JWCV
* @tc.desc the min and max value test with notin.
*/
it
(
'
testNotIn0003
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testNotIn0003 start *************
"
);
var
values
=
[
-
2147483648
,
2147483647
];
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
AllDataType
"
);
predicates
.
notIn
(
"
integerValue
"
,
values
);
let
result
=
await
rdbStore
.
query
(
predicates
);
expect
(
1
).
assertEqual
(
result
.
rowCount
);
result
.
close
();
done
();
console
.
log
(
TAG
+
"
************* testNotIn0003 end *************
"
);
})
/**
* @tc.name predicates constructor test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0200
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录