mirror of
https://gitee.com/openharmony/xts_dcts
synced 2024-11-23 15:50:20 +00:00
Stage模型整改
Signed-off-by: yuxiaoya2 <yuxiaoya@huawei.com> Change-Id: I9aae537d22fedad7bccb82ed9a348b63cac12ed6
This commit is contained in:
parent
bc8b63f834
commit
796c73b89b
@ -4,8 +4,8 @@
|
||||
"type": "OHJSUnitTest",
|
||||
"test-timeout": "60000",
|
||||
"testcase-timeout": 60000,
|
||||
"bundle-name": "com.ohos.distributerdbdisjs",
|
||||
"package-name": "com.ohos.distributerdbdisjs",
|
||||
"bundle-name": "com.acts.distributerdbdisjs",
|
||||
"package-name": "com.acts.distributerdbdisjs",
|
||||
"shell-timeout": "60000"
|
||||
},
|
||||
"kits": [
|
||||
|
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.distributerdbdisjs",
|
||||
"bundleName": "com.acts.distributerdbdisjs",
|
||||
"vendor": "ohos",
|
||||
"version": {
|
||||
"code": 1000000,
|
||||
@ -14,7 +14,7 @@
|
||||
},
|
||||
"deviceConfig": {},
|
||||
"module": {
|
||||
"package": "com.ohos.distributerdbdisjs",
|
||||
"package": "com.acts.distributerdbdisjs",
|
||||
"name": ".entry",
|
||||
"mainAbility":".MainAbility",
|
||||
"srcPath":"",
|
||||
|
@ -42,7 +42,7 @@ let remoteHelpers = null;
|
||||
let deviceId = null;
|
||||
let syncDeviceIds = undefined;
|
||||
let deviceList = undefined;
|
||||
const TEST_BUNDLE_NAME = 'com.ohos.distributerdbdisjs';
|
||||
const TEST_BUNDLE_NAME = 'com.acts.distributerdbdisjs';
|
||||
|
||||
|
||||
function sleep(ms) {
|
||||
@ -87,30 +87,10 @@ export default function rdbSyncCustomDirlTest(){
|
||||
|
||||
let dmInstance = deviceManager.createDeviceManager(TEST_BUNDLE_NAME);
|
||||
deviceList = dmInstance.getAvailableDeviceListSync();
|
||||
deviceId = deviceList[0].networkId;
|
||||
deviceId = deviceList[0].networkId;
|
||||
console.info(logTag + "deviceId is: " + deviceId);
|
||||
syncDeviceIds = [deviceId];
|
||||
|
||||
try{
|
||||
console.info(logTag + "deviceId: " + deviceId);
|
||||
let wantValue = {
|
||||
bundleName: "com.ohos.distributerdbdisjs",
|
||||
abilityName: "com.ohos.distributerdbdisjs.MainAbility",
|
||||
deviceId: deviceId
|
||||
};
|
||||
await featureAbility.startAbility({
|
||||
want: wantValue
|
||||
}).then((data) => {
|
||||
console.info(logTag + 'beforeAll startAbility data success' + JSON.stringify(data));
|
||||
}).catch((err) => {
|
||||
console.info(logTag + 'beforeAll startAbility err: ' + err.code);
|
||||
console.info(logTag + 'beforeAll startAbility err: ' + err.message);
|
||||
});
|
||||
}catch(error){
|
||||
console.info(logTag + "beforeAll startAbility:error = " + error);
|
||||
}
|
||||
await sleep(100);
|
||||
|
||||
testservice = new TestService();
|
||||
await testservice.toConnectRdbAbility().then(data => {
|
||||
gIRemoteObject = data;
|
||||
|
@ -41,7 +41,7 @@ let remoteHelpers = null;
|
||||
let deviceId = null;
|
||||
let syncDeviceIds = undefined;
|
||||
let deviceList = undefined;
|
||||
const TEST_BUNDLE_NAME = 'com.ohos.distributerdbdisjs';
|
||||
const TEST_BUNDLE_NAME = 'com.acts.distributerdbdisjs';
|
||||
|
||||
|
||||
function sleep(ms) {
|
||||
@ -90,26 +90,6 @@ export default function rdbSyncFirstLevelTest(){
|
||||
console.info(logTag + "deviceId is: " + deviceId);
|
||||
syncDeviceIds = [deviceId];
|
||||
|
||||
try{
|
||||
console.info(logTag + "deviceId: " + deviceId);
|
||||
let wantValue = {
|
||||
bundleName: "com.ohos.distributerdbdisjs",
|
||||
abilityName: "com.ohos.distributerdbdisjs.MainAbility",
|
||||
deviceId: deviceId
|
||||
};
|
||||
await featureAbility.startAbility({
|
||||
want: wantValue
|
||||
}).then((data) => {
|
||||
console.info(logTag + 'beforeAll startAbility data success' + JSON.stringify(data));
|
||||
}).catch((err) => {
|
||||
console.info(logTag + 'beforeAll startAbility err: ' + err.code);
|
||||
console.info(logTag + 'beforeAll startAbility err: ' + err.message);
|
||||
});
|
||||
}catch(error){
|
||||
console.info(logTag + "beforeAll startAbility:error = " + error);
|
||||
}
|
||||
await sleep(100);
|
||||
|
||||
testservice = new TestService();
|
||||
await testservice.toConnectRdbAbility().then(data => {
|
||||
gIRemoteObject = data;
|
||||
@ -181,9 +161,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
})
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_0100
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_1000
|
||||
* @tc.name testRdbSyncTest0010
|
||||
* @tc.desc Server rdbStore Insert first and synchronize
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0010", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0010 start");
|
||||
@ -234,9 +217,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
})
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_0200
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_1800
|
||||
* @tc.name testRdbSyncTest0020
|
||||
* @tc.desc Server rdbStore Insert twice and synchronize twice
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0020", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0020 start");
|
||||
@ -310,9 +296,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
})
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_0300
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_2300
|
||||
* @tc.name testRdbSyncTest0030
|
||||
* @tc.desc Server rdbStore Insert synchronization and then update synchronization
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0030", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0030 start");
|
||||
@ -386,9 +375,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_0400
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_2100
|
||||
* @tc.name testRdbSyncTest0040
|
||||
* @tc.desc Server rdbStore Insert synchronization, and then delete synchronization
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0040", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0040 start");
|
||||
@ -449,9 +441,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_0500
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_1100
|
||||
* @tc.name testRdbSyncTest0050
|
||||
* @tc.desc Server rdbStore batchInsert sync
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0050", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0050 start");
|
||||
@ -516,9 +511,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_0600
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_1600
|
||||
* @tc.name testRdbSyncTest0060
|
||||
* @tc.desc Server rdbStore BatchInsert synchronization and then update synchronization
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0060", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0060 start");
|
||||
@ -611,9 +609,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_0700
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_1300
|
||||
* @tc.name testRdbSyncTest0070
|
||||
* @tc.desc Server rdbStore BatchInsert synchronization, and then delete synchronization
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0070", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0070 start");
|
||||
@ -689,9 +690,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
})
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_0800
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_1500
|
||||
* @tc.name testRdbSyncTest0080
|
||||
* @tc.desc Server rdbStore BatchInsert synchronization, and then delete synchronization,and then update synchronization
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0080", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0080 start");
|
||||
@ -801,9 +805,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_0900
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_1400
|
||||
* @tc.name testRdbSyncTest0090
|
||||
* @tc.desc Server rdbStore BatchInsert synchronization, and then delete synchronization, and then insert synchronization
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0090", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0090 start");
|
||||
@ -914,9 +921,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_1000
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_1200
|
||||
* @tc.name testRdbSyncTest0100
|
||||
* @tc.desc Server rdbStore BatchInsert synchronization callback,
|
||||
* @tc.desc Server rdbStore BatchInsert synchronization callback
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0100", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0100 start");
|
||||
@ -985,9 +995,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_1100
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_0800
|
||||
* @tc.name testRdbSyncTest0110
|
||||
* @tc.desc Server rdbStore Insert first and synchronize salary Number.MIN_VALUE-1
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0110", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0110 start");
|
||||
@ -1038,9 +1051,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_1200
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_1700
|
||||
* @tc.name testRdbSyncTest0120
|
||||
* @tc.desc Server rdbStore BatchInsert synchronization, and then update synchronization,and then update synchronization
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0120", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0120 start");
|
||||
@ -1168,9 +1184,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_1300
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_0700
|
||||
* @tc.name testRdbSyncTest0130
|
||||
* @tc.desc Server rdbStore Insert first and synchronize salary Number.MAX_VALUE+1
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0130", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0130 start");
|
||||
@ -1221,9 +1240,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_1400
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_2200
|
||||
* @tc.name testRdbSyncTest0140
|
||||
* @tc.desc Server rdbStore Insert first and synchronize,delete all
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0140", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0140 start");
|
||||
@ -1291,9 +1313,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
})
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_1600
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_1900
|
||||
* @tc.name testRdbSyncTest0160
|
||||
* @tc.desc Server rdbStore Insert first and synchronize, Sync the null character of the pre-device id
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0160", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0160 start");
|
||||
@ -1347,9 +1372,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_1700
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_2000
|
||||
* @tc.name testRdbSyncTest0170
|
||||
* @tc.desc Server rdbStore Insert first and synchronize, Error in synchronization of pre-tableName
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0170", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0170 start");
|
||||
@ -1405,9 +1433,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
})
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_1800
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_0900
|
||||
* @tc.name testRdbSyncTest0180
|
||||
* @tc.desc Server rdbStore Insert first and synchronize, Pass null in synchronous mode
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0180", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0180 start");
|
||||
@ -1463,9 +1494,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
})
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_1900
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_2500
|
||||
* @tc.name testRdbSyncTest0190
|
||||
* @tc.desc Server get rdbStoreS2 level, Name different
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0190", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0190 start");
|
||||
@ -1542,9 +1576,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_2000
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_2400
|
||||
* @tc.name testRdbSyncTest0200
|
||||
* @tc.desc Server get rdbStoreS2 level, Name different
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0200", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0200 start");
|
||||
@ -1619,9 +1656,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
})
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_2100
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_2600
|
||||
* @tc.name testRdbSyncTest0210
|
||||
* @tc.desc Server rdbStore get rdbStoreS2 level, Name equal
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0210", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0210 start");
|
||||
@ -1658,9 +1698,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_2200
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_0100
|
||||
* @tc.name testRdbSyncTest0220
|
||||
* @tc.desc Server get rdbStoreS2 level, Name different
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0220", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0220 start");
|
||||
@ -1694,9 +1737,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_2300
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_2700
|
||||
* @tc.name testRdbSyncTest0230
|
||||
* @tc.desc Server get rdbStoreS2 level, Name different
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0230", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0230 start");
|
||||
@ -1728,9 +1774,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
})
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_2400
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_0500
|
||||
* @tc.name testRdbSyncTest0240
|
||||
* @tc.desc Server rdbStore Insert first and synchronize, intValue = Max
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0240", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0240 start");
|
||||
@ -1782,9 +1831,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_2500
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_0600
|
||||
* @tc.name testRdbSyncTest0250
|
||||
* @tc.desc Server rdbStore Insert first and synchronize, intValue = Min
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0250", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0250 start");
|
||||
@ -1835,9 +1887,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_2600
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_0200
|
||||
* @tc.name testRdbSyncTest0260
|
||||
* @tc.desc Server rdbStore Insert first and synchronize, intValue = NaN
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0260", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0260 start");
|
||||
@ -1888,9 +1943,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_2700
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_0400
|
||||
* @tc.name testRdbSyncTest0270
|
||||
* @tc.desc Server rdbStore Insert first and synchronize, intValue = POSITIVE_INFINITY
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0270", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0270 start");
|
||||
@ -1941,9 +1999,12 @@ export default function rdbSyncFirstLevelTest(){
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number SUB_DISTRIBUTEDDATAMGR_SyncRDBTest_2800
|
||||
* @tc.number SUB_DistributedData_RelastionStore_CrossDevice_SDK_RemoteQueryJsAPITest_0300
|
||||
* @tc.name testRdbSyncTest0280
|
||||
* @tc.desc Server rdbStore Insert first and synchronize, intValue = NEGATIVE_INFINITY
|
||||
* @tc.size MediumTest
|
||||
* @tc.type Function
|
||||
* @tc.level Level 2
|
||||
*/
|
||||
it("testRdbSyncTest0280", 0, async function (done) {
|
||||
console.info(logTag + "testRdbSyncTest0280 start");
|
||||
|
@ -0,0 +1,21 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.acts.distributerdbdisjs",
|
||||
"vendor": "huawei",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"debug": false,
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:app_name",
|
||||
"description": "$string:description_application",
|
||||
"distributedNotificationEnabled": true,
|
||||
"keepAlive": true,
|
||||
"singleUser": true,
|
||||
"minAPIVersion": 9,
|
||||
"targetAPIVersion": 9,
|
||||
"car": {
|
||||
"apiCompatibleVersion": 9,
|
||||
"singleUser": false
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"string":[
|
||||
{
|
||||
"name":"app_name",
|
||||
"value":"rdbserver"
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2023 Huawei Device Co., Ltd.
|
||||
# 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
|
||||
@ -11,22 +11,34 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("../../../../../../tools/build/suite.gni")
|
||||
import("//test/xts/tools/build/suite.gni")
|
||||
|
||||
ohos_hap_assist_suite("distributerdbdisjs_server") {
|
||||
hap_profile = "./src/main/config.json"
|
||||
hap_profile = "entry/src/main/module.json"
|
||||
hap_name = "DctsDistributeRdbDisJsServer"
|
||||
|
||||
testonly = true
|
||||
deps = [
|
||||
":distributerdbdisjs_assets",
|
||||
":distributerdbdisjs_resources",
|
||||
]
|
||||
certificate_profile = "./signature/openharmony_sx.p7b"
|
||||
hap_name = "DctsDistributeRdbDisJsServer"
|
||||
ets2abc = true
|
||||
certificate_profile = "signature/openharmony_sx.p7b"
|
||||
subsystem_name = "ability"
|
||||
part_name = "ability_runtime"
|
||||
}
|
||||
|
||||
ohos_app_scope("distributerdbdisjs_app_profile") {
|
||||
app_profile = "AppScope/app.json"
|
||||
sources = [ "AppScope/resources" ]
|
||||
}
|
||||
|
||||
ohos_js_assets("distributerdbdisjs_assets") {
|
||||
source_dir = "./src/main/js"
|
||||
hap_profile = "./src/main/config.json"
|
||||
source_dir = "entry/src/main/ets"
|
||||
}
|
||||
|
||||
ohos_resources("distributerdbdisjs_resources") {
|
||||
sources = [ "./src/main/resources" ]
|
||||
hap_profile = "./src/main/config.json"
|
||||
sources = [ "entry/src/main/resources" ]
|
||||
deps = [ ":distributerdbdisjs_app_profile" ]
|
||||
hap_profile = "entry/src/main/module.json"
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
{
|
||||
"description": "Configuration for hjunit demo Tests",
|
||||
"driver": {
|
||||
"type": "JSUnitTest",
|
||||
"test-timeout": "1200000",
|
||||
"package": "com.ohos.distributerdbdisjs",
|
||||
"shell-timeout": "60000"
|
||||
},
|
||||
"kits": [
|
||||
{
|
||||
"test-file-name": [
|
||||
"DctsDistributeRdbDisJsServer.hap"
|
||||
],
|
||||
"type": "AppInstallKit",
|
||||
"cleanup-apps": true
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 AbilityStage from "@ohos.app.ability.AbilityStage"
|
||||
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
console.log("[Demo] MyAbilityStage onCreate")
|
||||
globalThis.stageOnCreateRun = 1;
|
||||
globalThis.stageContext = this.context;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 Ability from '@ohos.app.ability.UIAbility'
|
||||
import AcCtrl from '@ohos.abilityAccessCtrl'
|
||||
let AcManager = AcCtrl.createAtManager()
|
||||
export default class MainAbility3 extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
console.log("[Demo] MainAbility onCreate")
|
||||
globalThis.abilityWant = want;
|
||||
AcManager.requestPermissionsFromUser(this.context, ['ohos.permission.DISTRIBUTED_DATASYNC'], function (result) {
|
||||
console.info('Calc[IndexPage] grantPermission,requestPermissionsFromUser')
|
||||
})
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.log("[Demo] MainAbility onDestroy")
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
// Main window is created, set main page for this ability
|
||||
console.log("[Demo] MainAbility onWindowStageCreate")
|
||||
globalThis.abilityContext = this.context;
|
||||
windowStage.setUIContent(this.context, "MainAbility/pages/MainAbility_pages", null)
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
// Main window is destroyed, release UI related resources
|
||||
console.log("[Demo] MainAbility onWindowStageDestroy")
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
// Ability has brought to foreground
|
||||
console.log("[Demo] MainAbility onForeground")
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
// Ability has back to background
|
||||
console.log("[Demo] MainAbility onBackground")
|
||||
}
|
||||
};
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 router from '@ohos.router';
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State message: string = 'MainAbility'
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Column() {
|
||||
Text(this.message)
|
||||
.fontSize(50)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.width('100%')
|
||||
}
|
||||
.height('100%')
|
||||
}
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 UIAbility from '@ohos.app.ability.UIAbility';
|
||||
import rpc from '@ohos.rpc';
|
||||
import commonEvent from '@ohos.commonEvent';
|
||||
import data_rdb from '@ohos.data.relationalStore';
|
||||
// import TestApi from '../../../../../../../../../../../testtools/disjsTest/server/testApi.js';
|
||||
|
||||
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)";
|
||||
|
||||
var rdbStore = undefined;
|
||||
const STORE_CONFIG = {
|
||||
name: "RemoteRdb.db",
|
||||
securityLevel: data_rdb.SecurityLevel.S1
|
||||
};
|
||||
class StubTest extends rpc.RemoteObject {
|
||||
constructor(descriptor) {
|
||||
super(descriptor);
|
||||
}
|
||||
onRemoteRequest(code, data, reply, option) {
|
||||
console.info("onRemoteRequest: " + code)
|
||||
let tmp1 = data.readInt()
|
||||
let tmp2 = data.readInt()
|
||||
let tmp3 = tmp1 + tmp2;
|
||||
let result = reply.writeInt(tmp3)
|
||||
console.info("The server's writeInt result is " + result);
|
||||
commonEvent.publish("RDBService_RemoteObject", {
|
||||
parameters:{
|
||||
"msg":"receiveMessage = " + data.readInt()
|
||||
}
|
||||
}, (err, data) => {
|
||||
console.info("RDBService_ConnectAbility onCreate");
|
||||
});
|
||||
return true
|
||||
}
|
||||
}
|
||||
export default class ServiceAbility extends UIAbility {
|
||||
onCreate(want) {
|
||||
// Called to return a FormBindingData object.
|
||||
console.info("RdbStageServer ServiceAbility onCreate")
|
||||
if(want.parameters != undefined){
|
||||
if(want.parameters.startReason == "terminateSelf"){
|
||||
setTimeout(()=>{
|
||||
this.context.terminateSelf()
|
||||
}, 2000)
|
||||
}
|
||||
}
|
||||
this.createRDBStore();
|
||||
}
|
||||
|
||||
onConnect(want) {
|
||||
// Called when the form provider is notified that a temporary form is successfully
|
||||
// converted to a normal form.
|
||||
console.info("RdbStageServer ServiceAbility onConnect")
|
||||
let CommonEventPublishData = {
|
||||
parameters: {
|
||||
"life": "onConnect"
|
||||
}
|
||||
}
|
||||
commonEvent.publish("RDBService_ConnectAbility", CommonEventPublishData, (err) => {
|
||||
console.info("RDBService_ConnectAbility onCreate");
|
||||
});
|
||||
return new StubTest("test");
|
||||
}
|
||||
|
||||
onDisconnect(want) {
|
||||
// Called to notify the form provider to update a specified form.
|
||||
console.info("RdbStageServer ServiceAbility onDisconnect")
|
||||
|
||||
}
|
||||
|
||||
onRequest(want, startId){
|
||||
console.info("RdbStageServer ServiceAbility onRequest")
|
||||
globalThis.extensionContext = this.context
|
||||
globalThis.startAbilityReault = true
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
// Called to notify the form provider that a specified form has been destroyed.
|
||||
console.info("RdbStageServer ServiceAbility onCronDestroyeate")
|
||||
|
||||
}
|
||||
|
||||
async createRDBStore(){
|
||||
console.log("first context " + this.context);
|
||||
let promise = data_rdb.getRdbStore(this.context, STORE_CONFIG);
|
||||
promise.then(async (back) => {
|
||||
rdbStore = back;
|
||||
console.log("Get RdbStore successfully rdbStore " + rdbStore);
|
||||
}).catch((err) => {
|
||||
console.log("Get RdbStore failed, err: " + err);
|
||||
})
|
||||
await promise;
|
||||
await rdbStore.executeSql(CREATE_TABLE_TEST, null);
|
||||
this.setDistributedTables();
|
||||
}
|
||||
setDistributedTables(){
|
||||
console.info("setDistributedTables before");
|
||||
let back = rdbStore.setDistributedTables(["test"]);
|
||||
back.then(() => {
|
||||
console.info("SetDistributedTables successfully.");
|
||||
this.insertData();
|
||||
}).catch((err) => {
|
||||
console.info("SetDistributedTables failed, err: " + err.code);
|
||||
})
|
||||
}
|
||||
|
||||
async insertData(){
|
||||
const valueBucket = {
|
||||
"id": 1,
|
||||
"name": "Lisa",
|
||||
"age": 18,
|
||||
"salary": 100.5,
|
||||
"blobType": new Uint8Array([1, 2, 3, 4, 5])
|
||||
}
|
||||
console.log("Insert insertData start.");
|
||||
let promise = rdbStore.insert("test", valueBucket);
|
||||
promise.then((rowId) => {
|
||||
console.log("Insert is successful, rowId = " + rowId);
|
||||
}).catch((err) => {
|
||||
console.log("Insert is failed err: "+err.code+" "+err.message);
|
||||
})
|
||||
await promise;
|
||||
}
|
||||
};
|
@ -0,0 +1,63 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "phone",
|
||||
"type": "entry",
|
||||
"srcEntrance": "./ets/Application/AbilityStage.ts",
|
||||
"description": "$string:phone_entry_dsc",
|
||||
"mainElement": "MainAbility",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"uiSyntax": "ets",
|
||||
"pages": "$profile:main_pages",
|
||||
"abilities": [
|
||||
{
|
||||
"continuable":true,
|
||||
"name": "com.acts.distributerdbdisjs",
|
||||
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
|
||||
"description": "$string:phone_entry_main",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:entry_label",
|
||||
"visible": true,
|
||||
"orientation": "portrait",
|
||||
"skills": [
|
||||
{
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
],
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"extensionAbilities": [
|
||||
{
|
||||
"name": "com.acts.distributerdbdisjs.ServiceAbility",
|
||||
"srcEntrance": "./ets/serviceability/ServiceAbility.ts",
|
||||
"label": "$string:MainAbility_label",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"type": "service",
|
||||
"visible": true
|
||||
}
|
||||
],
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name":"ohos.permission.GET_BUNDLE_INFO"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_DISTRIBUTED_DEVICE_INFO"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.ACCESS_SERVICE_DM"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "phone_entry_dsc",
|
||||
"value": "i am an entry for phone"
|
||||
},
|
||||
{
|
||||
"name": "phone_entry_main",
|
||||
"value": "the phone entry ability"
|
||||
},
|
||||
{
|
||||
"name": "entry_label",
|
||||
"value": "ActsLifecycleMultihapTest"
|
||||
},
|
||||
{
|
||||
"name": "form_description",
|
||||
"value": "my form"
|
||||
},
|
||||
{
|
||||
"name": "description_application",
|
||||
"value": "demo for test"
|
||||
},
|
||||
{
|
||||
"name": "entry_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility1_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility1_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility2_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility2_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility3_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility3_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility4_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility4_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility5_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility5_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility6_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility6_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility7_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility7_label",
|
||||
"value": "label"
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,5 @@
|
||||
{
|
||||
"src": [
|
||||
"MainAbility/pages/MainAbility_pages"
|
||||
]
|
||||
}
|
Binary file not shown.
@ -1,96 +0,0 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.distributerdbdisjs",
|
||||
"vendor": "rpc",
|
||||
"version": {
|
||||
"code": 1000000,
|
||||
"name": "1.0.0"
|
||||
},
|
||||
"apiVersion": {
|
||||
"compatible": 7,
|
||||
"target": 7
|
||||
}
|
||||
},
|
||||
"deviceConfig": {},
|
||||
"module": {
|
||||
"reqPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_DISTRIBUTED_DEVICE_INFO"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_BUNDLE_INFO"
|
||||
},
|
||||
{
|
||||
"name":"ohos.permission.KEEP_BACKGROUND_RUNNING"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.ACCESS_SERVICE_DM"
|
||||
}
|
||||
],
|
||||
"package": "com.ohos.distributerdbdisjs",
|
||||
"name": ".MyApplication",
|
||||
"mainAbility": ".MainAbility",
|
||||
"deviceType": [
|
||||
"tablet",
|
||||
"default",
|
||||
"phone"
|
||||
],
|
||||
"distro": {
|
||||
"deliveryWithInstall": true,
|
||||
"moduleName": "entry",
|
||||
"moduleType": "entry",
|
||||
"installationFree": false
|
||||
},
|
||||
"abilities": [
|
||||
{
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
],
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
]
|
||||
}
|
||||
],
|
||||
"orientation": "unspecified",
|
||||
"visible": true,
|
||||
"srcPath": "MainAbility",
|
||||
"name": ".MainAbility",
|
||||
"srcLanguage": "js",
|
||||
"icon": "$media:icon",
|
||||
"description": "$string:mainability_description",
|
||||
"formsEnabled": false,
|
||||
"label": "$string:entry_MainAbility",
|
||||
"type": "page",
|
||||
"launchType": "standard"
|
||||
},
|
||||
{
|
||||
"srcPath": "ServiceAbility",
|
||||
"name": ".ServiceAbility",
|
||||
"icon": "$media:icon",
|
||||
"srcLanguage": "js",
|
||||
"description": "$string:serviceability_description",
|
||||
"type": "service",
|
||||
"visible": true,
|
||||
"formsEnabled": false,
|
||||
"backgroundModes": ["dataTransfer", "location","multiDeviceConnection"]
|
||||
}
|
||||
],
|
||||
"js": [
|
||||
{
|
||||
"pages": [
|
||||
"pages/index/index"
|
||||
],
|
||||
"name": ".MainAbility",
|
||||
"window": {
|
||||
"designWidth": 720,
|
||||
"autoDesignWidth": false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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 { Core } from 'deccjsunit/index';
|
||||
import featureAbility from '@ohos.ability.featureAbility';
|
||||
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
onCreate() {
|
||||
|
||||
console.info('AceApplication onCreate');
|
||||
const core = Core.getInstance();
|
||||
core.init();
|
||||
const configService = core.getDefaultService('config');
|
||||
configService.setConfig(this);
|
||||
|
||||
console.info('Calc[IndexPage] grantPermission')
|
||||
let context = featureAbility.getContext()
|
||||
context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, function (result) {
|
||||
console.info('Calc[IndexPage] grantPermission,requestPermissionsFromUser,' + result.requestCode);
|
||||
setTimeout(() => {
|
||||
require('./test/List.test');
|
||||
core.execute();
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
},
|
||||
onDestroy() {
|
||||
console.info('AceApplication onDestroy');
|
||||
}
|
||||
};
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"strings": {
|
||||
"hello": "Hello",
|
||||
"world": "World"
|
||||
},
|
||||
"Files": {
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"strings": {
|
||||
"hello": "您好",
|
||||
"world": "世界"
|
||||
},
|
||||
"Files": {
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
.container {
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 100px;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<div class="container">
|
||||
<text class="title">
|
||||
{{ $t('strings.hello') }} {{title}}
|
||||
</text>
|
||||
</div>
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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 featureAbility from '@ohos.ability.featureAbility';
|
||||
|
||||
import data_rdb from '@ohos.data.relationalStore';
|
||||
import deviceManager from '@ohos.distributedDeviceManager';
|
||||
import TestApi from '../../../../../../../../../../../testtools/disjsTest/server/testApi.js';
|
||||
|
||||
let context = featureAbility.getContext();
|
||||
|
||||
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)";
|
||||
|
||||
var rdbStore = undefined;
|
||||
const STORE_CONFIG = {
|
||||
name: "RemoteRdb.db",
|
||||
securityLevel: data_rdb.SecurityLevel.S1
|
||||
};
|
||||
|
||||
export default {
|
||||
|
||||
data: {
|
||||
title: ""
|
||||
},
|
||||
|
||||
onInit() {
|
||||
this.createRDBStore();
|
||||
},
|
||||
onShow(){
|
||||
|
||||
},
|
||||
|
||||
getIndexContext(){
|
||||
console.log("rdbStore " + rdbStore);
|
||||
return rdbStore;
|
||||
|
||||
},
|
||||
|
||||
async initDeviceMonitor() {
|
||||
console.log("create device manager before");
|
||||
try {
|
||||
await deviceManager.createDeviceManager('com.ohos.distributerdbdisjs', (err, manager) => {
|
||||
if (err) {
|
||||
console.log("create device manager failed, err=" + err);
|
||||
return;
|
||||
}
|
||||
let dmInstance = manager;
|
||||
console.log("create device manager success dmInstance: "+ JSON.stringify(dmInstance));
|
||||
dmInstance.on("deviceStateChange", (data) => {
|
||||
console.log("deviceStateChange: " + JSON.stringify(data));
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("createDeviceManager error : " + error.message);
|
||||
}
|
||||
|
||||
},
|
||||
async createRDBStore(){
|
||||
console.log("first context " + context);
|
||||
let promise = data_rdb.getRdbStore(context, STORE_CONFIG);
|
||||
promise.then(async (back) => {
|
||||
rdbStore = back;
|
||||
console.log("Get RdbStore successfully rdbStore " + rdbStore);
|
||||
}).catch((err) => {
|
||||
console.log("Get RdbStore failed, err: " + err);
|
||||
})
|
||||
await promise;
|
||||
await rdbStore.executeSql(CREATE_TABLE_TEST, null);
|
||||
let testApi = new TestApi();
|
||||
this.setDistributedTables();
|
||||
},
|
||||
|
||||
setDistributedTables(){
|
||||
console.info("setDistributedTables before");
|
||||
let back = rdbStore.setDistributedTables(["test"]);
|
||||
back.then(() => {
|
||||
console.info("SetDistributedTables successfully.");
|
||||
this.insertData();
|
||||
}).catch((err) => {
|
||||
console.info("SetDistributedTables failed, err: " + err.code);
|
||||
})
|
||||
},
|
||||
|
||||
async insertData(){
|
||||
const valueBucket = {
|
||||
"id": 1,
|
||||
"name": "Lisa",
|
||||
"age": 18,
|
||||
"salary": 100.5,
|
||||
"blobType": new Uint8Array([1, 2, 3, 4, 5])
|
||||
}
|
||||
console.log("Insert insertData start.");
|
||||
let promise = rdbStore.insert("test", valueBucket);
|
||||
promise.then((rowId) => {
|
||||
console.log("Insert is successful, rowId = " + rowId);
|
||||
}).catch((err) => {
|
||||
console.log("Insert is failed err: "+err.code+" "+err.message);
|
||||
})
|
||||
await promise;
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
//require('./ObjectStoreJsunit.test.js')
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 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 Stub from '../../../../../../../../../testtools/disjsTest/server/service.js'
|
||||
import backgroundTaskManager from '@ohos.backgroundTaskManager';
|
||||
import wantAgent from '@ohos.wantAgent';
|
||||
import featureAbility from '@ohos.ability.featureAbility';
|
||||
|
||||
|
||||
function startContinuousTask() {
|
||||
let wantAgentInfo = {
|
||||
wants: [
|
||||
{
|
||||
bundleName: "com.ohos.distributerdbdisjs",
|
||||
abilityName: "com.ohos.distributerdbdisjs.ServiceAbility"
|
||||
}
|
||||
],
|
||||
operationType: wantAgent.OperationType.START_SERVICE,
|
||||
requestCode: 0,
|
||||
wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG]
|
||||
};
|
||||
|
||||
wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
|
||||
try{
|
||||
backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(),
|
||||
backgroundTaskManager.BackgroundMode.MULTI_DEVICE_CONNECTION, wantAgentObj).then(() => {
|
||||
console.info("Operation startBackgroundRunning succeeded");
|
||||
}).catch((err) => {
|
||||
console.error("Operation startBackgroundRunning failed Cause: " + err);
|
||||
});
|
||||
}catch(error){
|
||||
console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function stopContinuousTask() {
|
||||
try{
|
||||
backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()).then(() => {
|
||||
console.info("Operation stopBackgroundRunning succeeded");
|
||||
}).catch((err) => {
|
||||
console.error("Operation stopBackgroundRunning failed Cause: " + err);
|
||||
});
|
||||
}catch(error){
|
||||
console.error(`Operation stopBackgroundRunning failed. code is ${error.code} message is ${error.message}`);
|
||||
}
|
||||
}
|
||||
export default {
|
||||
onStart() {
|
||||
console.log('RDBServer: onStart')
|
||||
startContinuousTask();
|
||||
console.info('RDBServer: startContinuousTask');
|
||||
},
|
||||
onStop() {
|
||||
console.log('RDBServer: onStop')
|
||||
stopContinuousTask();
|
||||
console.info('RDBServer: stopContinuousTask');
|
||||
},
|
||||
onCommand(want, startId) {
|
||||
console.log('RDBServer: onCommand, want: ' + JSON.stringify(want) + ', startId: ' + startId)
|
||||
},
|
||||
onConnect(want) {
|
||||
console.log('RDBServer: service onConnect called.')
|
||||
return new Stub("disjsAbility")
|
||||
},
|
||||
onDisconnect(want) {
|
||||
console.log('RDBServer: service onDisConnect called.')
|
||||
},
|
||||
onReconnect(want) {
|
||||
console.log('RDBServer: service onReConnect called.')
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "entry_MainAbility",
|
||||
"value": "distributerdbdisjs"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "JS_Empty Ability"
|
||||
},
|
||||
{
|
||||
"name": "serviceability_description",
|
||||
"value": "hap sample empty service"
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 6.6 KiB |
@ -113,15 +113,15 @@ export default class TestService {
|
||||
console.info(logTag + " toConnectRdbAbility");
|
||||
return new Promise(resolve=>{
|
||||
let self = this;
|
||||
let dmInstance = deviceManager.createDeviceManager('com.ohos.distributerdbdisjs');
|
||||
let dmInstance = deviceManager.createDeviceManager('com.acts.distributerdbdisjs');
|
||||
self.getDeviceList(dmInstance);
|
||||
console.info(logTag + "got deviceManager: " + dmInstance);
|
||||
let deviceId = deviceList[0].networkId;
|
||||
console.info(logTag + "deviceid : " + deviceId);
|
||||
console.info(logTag + "online deviceList id: " + JSON.stringify(deviceList));
|
||||
let want = {
|
||||
"bundleName": "com.ohos.distributerdbdisjs",
|
||||
"abilityName": "com.ohos.distributerdbdisjs.ServiceAbility",
|
||||
"bundleName": "com.acts.distributerdbdisjs",
|
||||
"abilityName": "com.acts.distributerdbdisjs.ServiceAbility",
|
||||
"deviceId": deviceId,
|
||||
"flags": 256
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user