提交 09aaa0db 编写于 作者: H HuangXW

XTS ServiceAbilityTest用例修改

Change-Id: I690725a7ba5e5a0be27a0f996330ee6cf1d653c5
Signed-off-by: NHuangXW <huangxinwei4@huawei.com>
上级 f9c07c93
......@@ -377,17 +377,19 @@ describe('ActsStServiceAbilityTest', function () {
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
if (data.event != "ACTS_SerivceAbilityServer_onDisConnect") {
expect("ACTS_SerivceAbilityServer_onConnect_PageConnectService_0500").assertEqual(
data.event);
featureAbility.disconnectAbility(mConnIdJsPromise).then(() => {
if (data.event == "ACTS_SerivceAbilityServer_onConnect_PageConnectService_0500") {
console.info("ACTS_JsServiceAbility_0500 disconnnectAbility start")
featureAbility.disconnectAbility(mConnIdJsPromise).then((err) => {
console.debug("=ACTS_JsServiceAbility_0500 disconnectAbility err====>"
+ ("json err=") + JSON.stringify(err));
}).catch(err => {
expect(".catch").assertEqual(err);
console.debug('ACTS_JsServiceAbility_0500====<end .catch(err)');
done();
expect().assertFail()
console.debug('ACTS_JsServiceAbility_0500==== err: ' + JSON.stringify(err));
done()
})
} else {
expect("ACTS_SerivceAbilityServer_onDisConnect").assertEqual(data.event);
expect("ACTS_SerivceAbilityServer_onDisConnect_PageConnectService_0500")
.assertEqual(data.event);
unsubscribe("ACTS_JsServiceAbility_0500_unsubscribe", subscriber0500);
console.debug('ACTS_JsServiceAbility_0500====<end');
done();
......
......@@ -49,6 +49,15 @@ class StubTest extends rpc.RemoteObject {
}
}
function sleep(delay) {
let start = new Date().getTime();
while (true) {
if (new Date().getTime() - start > delay) {
break;
}
}
}
export default {
onStart(want) {
console.debug('ACTS_SerivceAbilityServer 0425 ====>onStart .ts 0851 ='
......@@ -58,11 +67,6 @@ export default {
onStop() {
console.debug('ACTS_SerivceAbilityServer ====<onStop');
commonEvent.publish("ACTS_SerivceAbilityServer_onStop", (err) => { });
particleAbility.terminateSelf().then((data) => {
console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data));
}).catch((error) => {
console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error));
});
},
onCommand(want, restart, startId) {
console.debug('ACTS_SerivceAbilityServer ====>onCommand='
......@@ -79,11 +83,7 @@ export default {
},
}
);
particleAbility.terminateSelf().then((data) => {
console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data));
}).catch((error) => {
console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error));
});
sleep(600)
} else if (want.action == 'ServiceStartService_1000') {
particleAbility.startAbility(
{
......@@ -96,11 +96,6 @@ export default {
}, (err, data) => {
console.debug('ACTS_SerivceAbilityServer start Ability 1000 callback====='
+ err + ', data= ' + data + " , JSON." + JSON.stringify(data));
particleAbility.terminateSelf().then((data) => {
console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data));
}).catch((error) => {
console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error));
});
}
);
} else {
......@@ -108,13 +103,8 @@ export default {
if (!err.code) {
if (want.action == 'PageStartService_0100' || want.action == 'PageStartService_0200'
|| want.action == 'PageStartService_0301' || want.action == 'PageStartService_0401') {
console.debug('ACTS_SerivceAbilityServer_onCommand 100 200 301 401.terminateSelf()=====>'
console.debug('ACTS_SerivceAbilityServer_onCommand 100 200 301 401.=====>'
+ want.action);
particleAbility.terminateSelf().then((data) => {
console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data));
}).catch((error) => {
console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error));
});
}
} else {
console.debug('ACTS_SerivceAbilityServer_onCommand publish err=====>' + err);
......@@ -169,11 +159,11 @@ export default {
onDisconnect(want) {
console.debug('ACTS_SerivceAbilityServer ====>onDisConnect='
+ want + " , JSON." + JSON.stringify(want));
commonEvent.publish("ACTS_SerivceAbilityServer_onDisConnect", (err) => {
commonEvent.publish("ACTS_SerivceAbilityServer_onDisConnect" + want.action, (err) => {
if (err.code) {
console.debug('ACTS_SerivceAbilityServer_onDisConnect publish err=====>' + err);
} else {
console.debug('ACTS_SerivceAbilityServer_onDisConnect featureAbility.terminateSelf()=====<'
console.debug('ACTS_SerivceAbilityServer_onDisConnect =====<'
+ want.action);
if (want.action == 'ServiceConnectService_1300' || want.action == 'ServiceConnectService_1400'
|| want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501'
......@@ -184,11 +174,6 @@ export default {
+ ("json err=") + JSON.stringify(err) + " , " + want.action);
})
}
particleAbility.terminateSelf().then((data) => {
console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data));
}).catch((error) => {
console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error));
});
}
});
},
......
......@@ -49,6 +49,15 @@ class StubTest extends rpc.RemoteObject {
}
}
function sleep(delay) {
let start = new Date().getTime();
while (true) {
if (new Date().getTime() - start > delay) {
break;
}
}
}
export default {
onStart(want) {
console.debug('ACTS_SerivceAbilityServerSecond ====>onStart='
......@@ -58,22 +67,16 @@ export default {
onStop() {
console.debug('ACTS_SerivceAbilityServerSecond ====<onStop');
commonEvent.publish("ACTS_SerivceAbilityServerSecond_onStop", (err) => { });
particleAbility.terminateSelf().then((data) => {
console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data));
}).catch((error) => {
console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error));
});
},
onCommand(want, restart, startId) {
console.debug('ACTS_SerivceAbilityServerSecond ====>onCommand='
+ "JSON(want)=" + JSON.stringify(want)
+ " ,restart=" + restart + " ,startId=" + startId);
commonEvent.publish("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action, (err) => { });
particleAbility.terminateSelf().then((data) => {
console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data));
}).catch((error) => {
console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error));
commonEvent.publish("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action, (err) => {
console.debug("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action +
"err: " + JSON.stringify(err))
});
sleep(500)
},
onConnect(want) {
console.info('ACTS_SerivceAbilityServerSecond ====< onConnect');
......@@ -158,7 +161,7 @@ export default {
if (err.code) {
console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect publish err=====>' + err);
} else {
console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect featureAbility.terminateSelf()=====<'
console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect =====<'
+ want.action);
if (want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501'
|| want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601'
......@@ -168,11 +171,6 @@ export default {
+ ("json err=") + JSON.stringify(err) + " , " + want.action);
})
}
particleAbility.terminateSelf().then((data) => {
console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data));
}).catch((error) => {
console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error));
});
}
});
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册