diff --git a/adapter/LICENSE b/adapter/LICENSE
deleted file mode 100755
index 26a59c991604c6350aa817af57d75189c49f854f..0000000000000000000000000000000000000000
--- a/adapter/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-Copyright (c) 2021 Huawei Device Co., Ltd.
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-***************************************************************
-Copyright (C) 2013 The Android Open Source Project
-
-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
-
-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.
\ No newline at end of file
diff --git a/adapter/aw/python/__init__.py b/adapter/aw/python/__init__.py
deleted file mode 100755
index ce8eae4f3e947550186936c3c64a562c07f6c70e..0000000000000000000000000000000000000000
--- a/adapter/aw/python/__init__.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env python3
-# coding=utf-8
-
-#
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
diff --git a/adapter/aw/python/test_adapter_tools.py b/adapter/aw/python/test_adapter_tools.py
deleted file mode 100755
index 6bb8f779ead04cbea8612362de7a8301fbfee0ca..0000000000000000000000000000000000000000
--- a/adapter/aw/python/test_adapter_tools.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env python3
-# coding=utf-8
-
-#
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Copyright (C) 2013 The Android Open Source Project
-# 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.
-#
-
-
-class TestAdapterTools(object):
- """
- test tools
- """
- # default usb tools
- USB_TOOLS_CONST = "adb"
-
- @property
- def default_type(self):
- return TestAdapterTools.USB_TOOLS_CONST
-
diff --git a/adapter/examples/studentmgr/test/common/main/java/BUILD.gn b/adapter/examples/studentmgr/test/common/main/java/BUILD.gn
deleted file mode 100755
index f04af73d09864f852d75c4025c49eb0ea139a4e7..0000000000000000000000000000000000000000
--- a/adapter/examples/studentmgr/test/common/main/java/BUILD.gn
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//build/config/ohos/rules.gni")
-
-java_library("test_customize_hap_ability_java") {
- emma_never_instrument = true
- java_files = [
- "./src/ohos/zunit/MainAbility.java",
- "./src/ohos/zunit/ZtestAppSlice.java",
- ]
- final_jar_path =
- "$root_out_dir/test_platform/libs/test_customize_hap_ability_java.jar"
- aosp_deps = [ "maple:framework" ]
- deps = [ "//test/developertest/libs/jtr/main/java:test_app_executor_java" ]
- external_deps = [
- "ability:abilitykit_java",
- "aafwk:intent_java",
- "appexecfwk:abilityshell_java",
- "appexecfwk:appexecfwk_base_java",
- "appexecfwk:appexecfwk_java",
- "graphic:agp_java",
- "intent:intent_java",
- ]
-
- external_deps += [
- "ability:abilitykit_java_maple",
- "aafwk:intent_java_maple",
- "appexecfwk:abilityshell_java_maple",
- "appexecfwk:appexecfwk_base_java_maple",
- "appexecfwk:appexecfwk_java_maple",
- "graphic:agp_maple_java",
- "intent:intent_java_maple",
- ]
-}
diff --git a/adapter/examples/studentmgr/test/common/main/java/config.json b/adapter/examples/studentmgr/test/common/main/java/config.json
deleted file mode 100755
index 2e2ce8f17e4800f8f4ecc0d93246d22b4db92544..0000000000000000000000000000000000000000
--- a/adapter/examples/studentmgr/test/common/main/java/config.json
+++ /dev/null
@@ -1,103 +0,0 @@
-{
- "app": {
- "bundleName": "ohos.zunit",
- "vendor": "ohos",
- "version": {
- "code": 1,
- "name": "1.0"
- }
- },
- "deviceConfig": {
- "default": {
- "reqSdk": {
- "compatible": "zsdk 1.0.0",
- "target": "zsdk 1.0.1"
- }
- }
- },
- "module": {
- "package": "ohos.zunit",
- "name": ".HapTest",
- "distro": {
- "moduleType": "entry",
- "deliveryWithInstall": true,
- "moduleName": "hap-phone"
- },
- "deviceType": [
- "default",
- "tv"
- ],
- "reqCapabilities": [
- "video_support"
- ],
- "abilities": [
- {
- "name": ".MainAbility",
- "description": "HapTest main ability",
- "icon": "$media:ic_launcher",
- "label": "page",
- "launchType": "standard",
- "orientation": "portrait",
- "visible": false,
- "permissions": [
- "ohos.permission.AUDIO"
- ],
- "skills": [
- {
- "actions": [
- "ohos.aafwk.content.Intent.ACTION_HOME"
- ],
- "entities": [
- "ohos.aafwk.content.Intent.ENTITY_HOME"
- ],
- "attributes": []
- }
- ],
- "type": "page",
- "formEnabled": false
- }
- ],
- "reqPermissions": [
- {
- "name": "ohos.permission.servicebus.ACCESS_SERVICE",
- "reason": "",
- "usedScene": {
- "ability": [
- "MainAbility"
- ],
- "when": "inuse"
- }
- },
- {
- "name": "ohos.permission.GET_NETWORK_INFO",
- "reason": "",
- "usedScene": {
- "ability": [
- ".MainAbility"
- ],
- "when": "inuse"
- }
- },
- {
- "name": "ohos.permission.GET_WIFI_INFO",
- "reason": "",
- "usedScene": {
- "ability": [
- ".MainAbility"
- ],
- "when": "inuse"
- }
- },
- {
- "name": "ohos.permission.FOREGROUND_SERVICE",
- "reason": "",
- "usedScene": {
- "ability": [
- "PlayService"
- ],
- "when": "inuse"
- }
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/adapter/examples/studentmgr/test/common/main/java/res/drawable/ic_launcher.png b/adapter/examples/studentmgr/test/common/main/java/res/drawable/ic_launcher.png
deleted file mode 100755
index 9912d33f4d8336f8f08e9597f4a0361ea06e87cf..0000000000000000000000000000000000000000
Binary files a/adapter/examples/studentmgr/test/common/main/java/res/drawable/ic_launcher.png and /dev/null differ
diff --git a/adapter/examples/studentmgr/test/common/main/java/resources/base/media/ic_launcher.png b/adapter/examples/studentmgr/test/common/main/java/resources/base/media/ic_launcher.png
deleted file mode 100755
index 9912d33f4d8336f8f08e9597f4a0361ea06e87cf..0000000000000000000000000000000000000000
Binary files a/adapter/examples/studentmgr/test/common/main/java/resources/base/media/ic_launcher.png and /dev/null differ
diff --git a/adapter/examples/studentmgr/test/common/main/java/src/ohos/zunit/MainAbility.java b/adapter/examples/studentmgr/test/common/main/java/src/ohos/zunit/MainAbility.java
deleted file mode 100755
index d469753e11776416bc6a47709b55f7c3b575fc5a..0000000000000000000000000000000000000000
--- a/adapter/examples/studentmgr/test/common/main/java/src/ohos/zunit/MainAbility.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ohos.zunit;
-
-import ohos.aafwk.content.Intent;
-import ohos.unittest.log.HiLogUtil;
-import ohos.unittest.TestAbility;
-import ohos.unittest.AppContext;
-
-
-/**
- * The main frame of the AppZUnit testing
- * AppZUnit testing startup processing
- */
-public class MainAbility extends TestAbility {
- @Override
- public void onStart(Intent intent) {
- HiLogUtil.info(this.getClass(), "onStart begin");
- AppContext.getInstance().setCurrentAbility(this);
- super.onStart(intent);
- super.setMainRoute(ZtestAppSlice.class.getName());
- executeTestCase(intent);
- HiLogUtil.info(this.getClass(), "onStart end");
- }
-}
diff --git a/adapter/examples/studentmgr/test/common/main/java/src/ohos/zunit/ZtestAppSlice.java b/adapter/examples/studentmgr/test/common/main/java/src/ohos/zunit/ZtestAppSlice.java
deleted file mode 100755
index 92ef1c0230318a4ab4874c13f97dfac59ad5ab80..0000000000000000000000000000000000000000
--- a/adapter/examples/studentmgr/test/common/main/java/src/ohos/zunit/ZtestAppSlice.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ohos.zunit;
-
-import ohos.aafwk.ability.AbilitySlice;
-import ohos.aafwk.content.Intent;
-import ohos.agp.components.PositionLayout;
-import ohos.unittest.log.HiLogUtil;
-
-/**
- * testAppSlice
- */
-public class ZtestAppSlice extends AbilitySlice {
- @Override
- public void onStart(Intent intent) {
- super.onStart(intent);
- HiLogUtil.info(this.getClass(), "onStart begin");
- PositionLayout absoluteLayout = new PositionLayout(this);
- super.setUIContent(absoluteLayout);
- HiLogUtil.info(this.getClass(), "onStart end");
- }
-}
diff --git a/adapter/examples/studentmgr/test/common/shell/java/AndroidManifest.xml b/adapter/examples/studentmgr/test/common/shell/java/AndroidManifest.xml
deleted file mode 100755
index 482c5504576af547c5065ad0a1387ee9cddb870b..0000000000000000000000000000000000000000
--- a/adapter/examples/studentmgr/test/common/shell/java/AndroidManifest.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/adapter/examples/studentmgr/test/common/shell/java/BUILD.gn b/adapter/examples/studentmgr/test/common/shell/java/BUILD.gn
deleted file mode 100755
index d5d63e857a11144dd06196d66d1a68c2ae5afc3a..0000000000000000000000000000000000000000
--- a/adapter/examples/studentmgr/test/common/shell/java/BUILD.gn
+++ /dev/null
@@ -1,70 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Copyright (C) 2013 The Android Open Source Project
-# 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("//build/config/ohos/rules.gni")
-
-java_library("test_customize_shell_java") {
- emma_never_instrument = true
- java_files = [
- "./src/ohos/zunit/TestApplication.java",
- "./src/ohos/zunit/MainAbilityShellActivity.java",
- ]
- final_jar_path = "$root_out_dir/test_platform/libs/test_customize_shell_java.jar"
- aosp_deps = [ "maple:framework" ]
- deps =
- [ "//test/developertest/libs/jtr/shell/java:test_app_shell_context_java" ]
-
- external_deps = [
- "ability:abilitykit_java",
- "aafwk:intent_java",
- "appexecfwk:abilityshell_java",
- "appexecfwk:appexecfwk_java",
- "appexecfwk:appexecfwk_base_java",
- "hilog:hilog_java",
- "intent:intent_java",
- ]
-
- external_deps += [
- "ability:abilitykit_java_maple",
- "aafwk:intent_java_maple",
- "appexecfwk:abilityshell_java_maple",
- "appexecfwk:appexecfwk_java_maple",
- "appexecfwk:appexecfwk_base_java_maple",
- "hilog:hilog_maple_java",
- "intent:intent_java_maple",
- ]
-}
-
-ohos_assets("customize_shell_assets") {
- sources = []
-}
-
-ohos_resources("customize_shell_res") {
- resource_dirs = [ "./res" ]
- custom_package = "ohos.customize"
-}
-
-############### build test app begin ####################
-ohos_app("customize_shell_app") {
- #java_files = []
- deps = [
- ":customize_shell_assets",
- ":customize_shell_res",
- ":test_customize_shell_java",
- ]
- subsystem_name = "subsystem_examples"
- manifest = "./AndroidManifest.xml"
- app_name = "customize_Entry_app"
-}
-############### build test app end ####################
diff --git a/adapter/examples/studentmgr/test/common/shell/java/res/values/strings.xml b/adapter/examples/studentmgr/test/common/shell/java/res/values/strings.xml
deleted file mode 100755
index 46c7bca860f2698945cfd7fd39bcffe0ac931abe..0000000000000000000000000000000000000000
--- a/adapter/examples/studentmgr/test/common/shell/java/res/values/strings.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- OHOS Test App
- Hello OHOS!
- Settings
- MainActivity
-
diff --git a/adapter/examples/studentmgr/test/common/shell/java/resources/base/element/strings.json b/adapter/examples/studentmgr/test/common/shell/java/resources/base/element/strings.json
deleted file mode 100755
index d2e3c9e2389976ad1593333e039c532e92774dd6..0000000000000000000000000000000000000000
--- a/adapter/examples/studentmgr/test/common/shell/java/resources/base/element/strings.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "string":[
- {
- "name":"app_name",
- "value":"OHOS Test App"
- },
- {
- "name":"hello_msg",
- "value":"Hello OHOS!"
- },
- {
- "name":"menu_settings",
- "value":"Settings"
- },
- {
- "name":"title_activity_main",
- "value":"MainActivity"
- }
- ]
-}
\ No newline at end of file
diff --git a/adapter/examples/studentmgr/test/common/shell/java/src/ohos/zunit/MainAbilityShellActivity.java b/adapter/examples/studentmgr/test/common/shell/java/src/ohos/zunit/MainAbilityShellActivity.java
deleted file mode 100755
index f6b1b01e55f1f12414c3c666bc944cd922653e8d..0000000000000000000000000000000000000000
--- a/adapter/examples/studentmgr/test/common/shell/java/src/ohos/zunit/MainAbilityShellActivity.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Copyright (C) 2013 The Android Open Source Project
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ohos.zunit;
-
-import android.os.Bundle;
-
-import android.view.WindowManager;
-
-import ohos.abilityshell.AbilityShellActivity;
-
-import ohos.unittest.AppContext;
-
-import ohos.unittest.log.HiLogUtil;
-
-
-/**
- * Main ability shell activity
- */
-public class MainAbilityShellActivity extends AbilityShellActivity {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- HiLogUtil.info(this.getClass(), "onCreate begin");
- super.onCreate(savedInstanceState);
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- AppContext.getInstance().setCurrentActivity(this);
- HiLogUtil.info(this.getClass(), "onCreate end");
- }
-
- @Override
- protected void onResume() {
- HiLogUtil.info(this.getClass(), "onResume begin");
- super.onResume();
- AppContext.getInstance().setCurrentActivity(this);
- HiLogUtil.info(this.getClass(), "onResume end");
- }
-
- @Override
- protected void onPause() {
- HiLogUtil.info(this.getClass(), "onPause begin");
- super.onPause();
- AppContext.getInstance().setCurrentActivity(this);
- HiLogUtil.info(this.getClass(), "onPause end");
- }
-
- @Override
- protected void onDestroy() {
- HiLogUtil.info(this.getClass(), "onDestroy begin");
- super.onDestroy();
- HiLogUtil.info(this.getClass(), "onDestroy end");
- }
-}
diff --git a/adapter/examples/studentmgr/test/common/shell/java/src/ohos/zunit/TestApplication.java b/adapter/examples/studentmgr/test/common/shell/java/src/ohos/zunit/TestApplication.java
deleted file mode 100755
index f49412bb13ef2f354e1bea1a26dbac5e1b0940a3..0000000000000000000000000000000000000000
--- a/adapter/examples/studentmgr/test/common/shell/java/src/ohos/zunit/TestApplication.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Copyright (C) 2013 The Android Open Source Project
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ohos.zunit;
-
-import android.content.ComponentCallbacks;
-
-import android.content.res.Configuration;
-
-import ohos.abilityshell.HarmonyApplication;
-
-import ohos.unittest.log.HiLogUtil;
-
-
-/**
- * System APP test Application
- */
-public class TestApplication extends HarmonyApplication {
- /**
- * TestApplication Constructor
- */
- public TestApplication() {
- }
-
- @Override
- public void onCreate() {
- HiLogUtil.info(this.getClass(), "onCreate begin");
- super.onCreate();
- HiLogUtil.info(this.getClass(), "onCreate end");
- }
-
- @Override
- public void onTerminate() {
- HiLogUtil.info(this.getClass(), "onTerminate begin");
- super.onTerminate();
- HiLogUtil.info(this.getClass(), "onTerminate end");
- }
-
- @Override
- public void onConfigurationChanged(Configuration newConfig) {
- HiLogUtil.info(this.getClass(), "onConfigurationChanged begin");
- super.onConfigurationChanged(newConfig);
- HiLogUtil.info(this.getClass(), "onConfigurationChanged end");
- }
-
- @Override
- public void onLowMemory() {
- HiLogUtil.info(this.getClass(), "onLowMemory begin");
- super.onLowMemory();
- HiLogUtil.info(this.getClass(), "onLowMemory end");
- }
-
- @Override
- public void onTrimMemory(int level) {
- HiLogUtil.info(this.getClass(), "onTrimMemory begin");
- super.onTrimMemory(level);
- HiLogUtil.info(this.getClass(), "onTrimMemory end");
- }
-
- @Override
- public void registerComponentCallbacks(ComponentCallbacks callback) {
- HiLogUtil.info(this.getClass(), "registerComponentCallbacks begin");
- super.registerComponentCallbacks(callback);
- HiLogUtil.info(this.getClass(), "registerComponentCallbacks end");
- }
-
- @Override
- public void unregisterComponentCallbacks(ComponentCallbacks callback) {
- HiLogUtil.info(this.getClass(), "unregisterComponentCallbacks begin");
- super.unregisterComponentCallbacks(callback);
- HiLogUtil.info(this.getClass(), "unregisterComponentCallbacks end");
- }
-
- @Override
- public void registerActivityLifecycleCallbacks(
- ActivityLifecycleCallbacks callback) {
- HiLogUtil.info(this.getClass(),
- "registerActivityLifecycleCallbacks begin");
- super.registerActivityLifecycleCallbacks(callback);
- HiLogUtil.info(this.getClass(), "registerActivityLifecycleCallbacks end");
- }
-
- @Override
- public void unregisterActivityLifecycleCallbacks(
- ActivityLifecycleCallbacks callback) {
- HiLogUtil.info(this.getClass(),
- "unregisterActivityLifecycleCallbacks begin");
- super.unregisterActivityLifecycleCallbacks(callback);
- HiLogUtil.info(this.getClass(),
- "unregisterActivityLifecycleCallbacks end");
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/BUILD.gn b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/BUILD.gn
deleted file mode 100755
index 4b652e0f9944e778c0976967eba458f91ae73f71..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/BUILD.gn
+++ /dev/null
@@ -1,98 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//build/test.gni")
-import("sdk.gni")
-
-############### build main aa bengin ####################
-MAIN_SRC_PATH = "src/main/java/com/ohos/aa/st/abilitydelegator"
-TEST_FILE_PATH = "src/main/java/com/ohos/aa/st/abilitydelegator"
-
-test_files = [
- # test files must be ended with "Test"
- "$TEST_FILE_PATH/AbilityDelegatorBaseTest.java",
- "$TEST_FILE_PATH/AbilityDelegatorEventTest.java",
-
- #"$TEST_FILE_PATH/AbilityMonitorTest.java",
- "$TEST_FILE_PATH/StopAbilityTest.java",
- "$TEST_FILE_PATH/AbilitySliceTest.java",
-]
-
-java_library("main_java") {
- java_files = [
- # abilityslice
- "$MAIN_SRC_PATH/slice/PageAbilitySlice.java",
- "$MAIN_SRC_PATH/slice/SecondAbilitySlice.java",
- "$MAIN_SRC_PATH/slice/ThirdAbilitySlice.java",
-
- # constants
- "$MAIN_SRC_PATH/Global.java",
-
- # ability
- "$MAIN_SRC_PATH/PageAbility.java",
- "$MAIN_SRC_PATH/SecondAbility.java",
- "$MAIN_SRC_PATH/ThirdAbility.java",
- ]
-
- classpath_deps = [ "//utils/java:utils_java" ]
-
- if (is_double_framework) {
- aosp_deps = [ "maple:framework" ]
- }
-
- external_deps = java_external_deps
-}
-
-#
-#ohos_resources("main_res") {
-# resource_dirs = [
-# "./src/main/resources",
-# ]
-# custom_package = "com.ohos.aa.st.api"
-#
-# hap_profile = "./src/main/config.json"
-#}
-############### build main aa end ##################
-
-############### build hap begin ####################
-ohos_java_systemtest("build_abilitdelegator_st_hap") {
- java_files = test_files
-
- deps = [
- ":main_java",
-
- #":main_res",
- "//utils/java:utils_maple_java",
- ]
-
- external_deps = maple_external_deps
-
- hap_profile = "./src/main/config.json"
-
- entry_app_dep = [ "./shell:build_ability_delegator_st_app" ]
-
- certificate_profile = "test_abilitydelegator.p7b"
-
- hap_name = "AbilityDelegatorSt"
-
- subsystem_name = "aafwk"
-
- sub_output_dir = "test_subsystem_examples/studentmgr"
-}
-
-############### build hap end ####################
-
-group("systemtest") {
- testonly = true
- deps = [ ":build_abilitdelegator_st_hap" ]
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/sdk.gni b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/sdk.gni
deleted file mode 100755
index 1548df27e7c30c0b78be3f348f36e79907d6f47c..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/sdk.gni
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-maple_external_deps = [
- "ability:abilitydelegation_java_maple",
- "ability:abilitykit_base_java_maple",
- "ability:abilitykit_java_maple",
- "ans:notification_base_java_maple",
- "ans:notification_kit_java_maple",
- "appdatamgr:appdatafwk_base_maple_java",
- "appexecfwk:abilityshell_java_maple",
- "appexecfwk:appexecfwk_base_java_maple",
- "appexecfwk:appexecfwk_java_maple",
- "appexecfwk:eventhandler_java_maple",
- "communication:ipc_maple_java",
- "distributedschedule:samgr_java_maple",
- "distributedschedule:uri_java_maple",
- "global:kits_java",
- "graphic:agp_maple_java",
- "graphic:agpwindow_maple_java",
- "graphic:agpwindowkit_maple_java",
- "hilog:hilog_maple_java",
- "hilog:hilog_maple_java",
- "intent:intent_java_maple",
- "multimodalinput:mmi_event_maple_java",
-]
-
-java_external_deps = [
- "ability:abilitydelegation_java",
- "ability:abilitykit_base_java",
- "ability:abilitykit_java",
- "ans:notification_base_java",
- "ans:notification_kit_java",
- "appdatamgr:appdatafwk_base_java",
- "appexecfwk:abilityshell_java",
- "appexecfwk:appexecfwk_base_java",
- "appexecfwk:appexecfwk_java",
- "appexecfwk:eventhandler_java",
- "communication:ipc_java",
- "distributedschedule:samgr_java",
- "distributedschedule:uri_java",
- "global:kits_maple_java",
- "graphic:agp_java",
- "graphic:agpwindow_java",
- "graphic:agpwindowkit_java",
- "hilog:hilog_java",
- "intent:intent_java",
- "multimodalinput:mmi_event_java",
-]
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/AndroidManifest.xml b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/AndroidManifest.xml
deleted file mode 100755
index fbc05cdf6035726599edd53650c91710d5fe52c2..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/AndroidManifest.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/BUILD.gn b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/BUILD.gn
deleted file mode 100755
index 50195c586f77eec630b4347a245dad21d3c26395..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/BUILD.gn
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Copyright (C) 2013 The Android Open Source Project
-# 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("//build/config/ohos/rules.gni")
-import("//build/config/ohos/app_bundle.gni")
-
-import("../sdk.gni")
-
-SHELL_PATH = "java/com/ohos/aa/st/abilitydelegator"
-
-############### build main aa begin ####################
-java_library("shell_java") {
- java_files = [
- "$SHELL_PATH/PageAbilityShellActivity.java",
- "$SHELL_PATH/SecondAbilityShellActivity.java",
- "$SHELL_PATH/ShellAbilityDelegatorSt.java",
- "$SHELL_PATH/ThirdAbilityShellActivity.java",
- ]
-
- classpath_deps = [ "//utils/java:utils_java" ]
-
- if (is_double_framework) {
- aosp_deps = [ "maple:framework" ]
- }
-
- external_deps = java_external_deps
-}
-
-ohos_resources("shell_res") {
- resource_dirs = [ "res" ]
- custom_package = "com.ohos.aa.st.abilitydelegator"
-}
-
-############### build main aa end ####################
-
-############### build application test begin ####################
-ohos_app("build_ability_delegator_st_app") {
- java_files = []
- deps = [
- ":shell_java",
- ":shell_res",
- "//utils/java:utils_maple_java",
- ]
-
- external_deps = maple_external_deps
-
- manifest = "./AndroidManifest.xml"
-
- app_name = "Entry"
-
- module_install_dir = "priv-app/AbilityDelegatorSt"
-
- subsystem_name = "aafwk"
-}
-############### build application test end ####################
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/java/com/ohos/aa/st/abilitydelegator/PageAbilityShellActivity.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/java/com/ohos/aa/st/abilitydelegator/PageAbilityShellActivity.java
deleted file mode 100755
index 6ff7b5be6ce2c2ead50afbd40a95a5a672075b89..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/java/com/ohos/aa/st/abilitydelegator/PageAbilityShellActivity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Copyright (C) 2013 The Android Open Source Project
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator;
-
-import android.os.Bundle;
-
-import ohos.abilityshell.AbilityShellActivity;
-
-/**
- * PageAbilityShellActivity of UnitTest Hap.
- */
-public class PageAbilityShellActivity extends AbilityShellActivity {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/java/com/ohos/aa/st/abilitydelegator/SecondAbilityShellActivity.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/java/com/ohos/aa/st/abilitydelegator/SecondAbilityShellActivity.java
deleted file mode 100755
index fbc984adc509758eda81b42db9c6f294ce5ed756..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/java/com/ohos/aa/st/abilitydelegator/SecondAbilityShellActivity.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Copyright (C) 2013 The Android Open Source Project
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator;
-
-import android.os.Bundle;
-import ohos.abilityshell.AbilityShellActivity;
-
-/**
- * SecondAbilityShellActivity of UnitTest Hap.
- */
-public class SecondAbilityShellActivity extends AbilityShellActivity {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/java/com/ohos/aa/st/abilitydelegator/ShellAbilityDelegatorSt.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/java/com/ohos/aa/st/abilitydelegator/ShellAbilityDelegatorSt.java
deleted file mode 100755
index aba3fd5971c70d3e325eb214ac2ebd7fe51ffc4b..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/java/com/ohos/aa/st/abilitydelegator/ShellAbilityDelegatorSt.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator;
-
-import ohos.abilityshell.HarmonyApplication;
-
-/**
- * ShellAbilityDelegatorSt of UnitTest Hap.
- */
-public class ShellAbilityDelegatorSt extends HarmonyApplication {
- @Override
- public void onCreate() {
- super.onCreate();
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/java/com/ohos/aa/st/abilitydelegator/ThirdAbilityShellActivity.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/java/com/ohos/aa/st/abilitydelegator/ThirdAbilityShellActivity.java
deleted file mode 100755
index 531d2192f4093fa6ecb1fbfc984fe096f0a848be..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/java/com/ohos/aa/st/abilitydelegator/ThirdAbilityShellActivity.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Copyright (C) 2013 The Android Open Source Project
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator;
-
-import android.os.Bundle;
-import ohos.abilityshell.AbilityShellActivity;
-
-/**
- * ThirdAbilityShellActivity of UnitTest Hap.
- */
-public class ThirdAbilityShellActivity extends AbilityShellActivity {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/res/drawable/aa_icon.png b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/res/drawable/aa_icon.png
deleted file mode 100755
index 9912d33f4d8336f8f08e9597f4a0361ea06e87cf..0000000000000000000000000000000000000000
Binary files a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/res/drawable/aa_icon.png and /dev/null differ
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/res/drawable/application_icon.png b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/res/drawable/application_icon.png
deleted file mode 100755
index 9912d33f4d8336f8f08e9597f4a0361ea06e87cf..0000000000000000000000000000000000000000
Binary files a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/res/drawable/application_icon.png and /dev/null differ
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/res/values/strings.xml b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/res/values/strings.xml
deleted file mode 100755
index db5bf45e31f84522aff9a82db475344a9c557748..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/shell/res/values/strings.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- AbilityDelegatorSt
- FirstPage
- SecondPage
- ThirdPage
-
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/config.json b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/config.json
deleted file mode 100755
index 883d5a323557a1070a117fbeed1a0eda2cd78c60..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/config.json
+++ /dev/null
@@ -1,107 +0,0 @@
-{
- "app": {
- "bundleName": "com.ohos.aa.st.abilitydelegator",
- "vendor": "example",
- "version": {
- "code": 1,
- "name": "1.0"
- }
- },
- "deviceConfig": {
- "default": {
- "reqSdk": {
- "compatible": "zsdk 1.0.0",
- "target": "zsdk 1.0.0"
- }
- }
- },
- "module": {
- "package": "com.ohos.aa.st.abilitydelegator",
- "name": ".AbilityDelegatorSt",
- "distro": {
- "moduleType": "entry",
- "deliveryWithInstall": true,
- "moduleName": "entry"
- },
- "deviceType": [
- "default",
- "car",
- "watch",
- "tv"
- ],
- "reqCapabilities": [
- "video_support"
- ],
- "abilities": [
- {
- "name": ".PageAbility",
- "description": "@string/pageability_description",
- "icon": "@drawable/aa_icon",
- "label": "First",
- "launchType": "standard",
- "orientation": "portrait",
- "visible": true,
- "permissions": [],
- "skills": [
- {
- "actions": [
- "custom action"
- ],
- "entities": [
- "entity.system.home"
- ],
- "attributes": []
- }
- ],
- "type": "page",
- "formEnabled": false
- },
- {
- "name": ".SecondAbility",
- "description": "@string/secondability_description",
- "icon": "@drawable/aa_icon",
- "label": "Second",
- "launchType": "standard",
- "orientation": "portrait",
- "visible": true,
- "permissions": [],
- "skills": [
- {
- "actions": [
- "action.system.home"
- ],
- "entities": [
- "entity.system.home"
- ],
- "attributes": []
- }
- ],
- "type": "page",
- "formEnabled": false
- },
- {
- "name": ".ThirdAbility",
- "description": "@string/thirdability_description",
- "icon": "@drawable/aa_icon",
- "label": "Third",
- "launchType": "standard",
- "orientation": "portrait",
- "visible": true,
- "permissions": [],
- "skills": [
- {
- "actions": [
- "action.system.home"
- ],
- "entities": [
- "entity.system.home"
- ],
- "attributes": []
- }
- ],
- "type": "page",
- "formEnabled": false
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/AbilityDelegatorBaseTest.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/AbilityDelegatorBaseTest.java
deleted file mode 100755
index 794b511ba6ab4946f85e6e1445820e864819fbcf..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/AbilityDelegatorBaseTest.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator;
-
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import java.util.Map;
-import java.util.Optional;
-
-import ohos.aafwk.ability.Ability;
-import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
-import ohos.aafwk.ability.delegation.IAbilityDelegator;
-import ohos.aafwk.ability.delegation.IAbilityDelegatorArgs;
-import ohos.aafwk.ability.delegation.IAbilityMonitor;
-import ohos.aafwk.content.Intent;
-import ohos.hiviewdfx.HiLog;
-import ohos.hiviewdfx.HiLogLabel;
-
-/**
- * Test AbilityDelegator base functions.
- */
-public class AbilityDelegatorBaseTest {
- private static final HiLogLabel LABEL_LOG = new HiLogLabel(3, 0xD001100, "PageAbilityTest");
-
- private static IAbilityDelegator abilityDelegator;
-
- /**
- * setUp
- *
- * @apiNote BeforeClass process for all test
- */
- @BeforeClass
- public static void setUp() {
- abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
- }
-
- /**
- * stopAbility
- *
- * @apiNote AfterClass test stopAbility
- */
- @AfterClass
- public static void stopAbility() {
- // stop ability at here for clean test environment.
- }
-
- /**
- * jumpBack
- *
- * @apiNote Before test jumpBack
- */
- @Before
- public void jumpBack() {
- abilityDelegator.startAbilitySync(Global.intentPageAbility);
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * testChangeAbiltiyState
- *
- * @apiNote testChangeAbiltiyState
- * @throws InterruptedException
- */
- @Ignore
- @Test
- public void testChangeAbiltiyState() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started", new Object() {}.getClass().getEnclosingMethod().getName());
-
- Optional ability = abilityDelegator.startAbilitySync(Global.intentSecondAbility);
- Assert.assertTrue("Get Secondability failed", ability.isPresent());
- SecondAbility secondability = null;
- if (ability.get() instanceof SecondAbility) {
- secondability = (SecondAbility) ability.get();
- int expect = Global.ON_INACTIVE_HITS + 1;
- Assert.assertTrue("inactive ability", abilityDelegator.doAbilityInactive(secondability));
- Assert.assertEquals(Global.ON_INACTIVE_HITS, expect);
-
- expect = Global.ON_BACKGROUND_HITS + 1;
- Assert.assertTrue("background ability", abilityDelegator.doAbilityBackground(secondability));
- Assert.assertEquals(Global.ON_BACKGROUND_HITS, expect);
-
- expect = Global.ON_FOREGROUND_HITS + 1;
- Assert.assertTrue("foreground ability", abilityDelegator.doAbilityForeground(secondability, new Intent()));
- Assert.assertEquals(Global.ON_FOREGROUND_HITS, expect);
-
- expect = Global.ON_ACTIVE_HITS + 1;
- Assert.assertTrue("active ability", abilityDelegator.doAbilityActive(secondability, new Intent()));
- Assert.assertEquals(Global.ON_ACTIVE_HITS, expect);
- } else {
- Assert.fail("get second ability failed");
- }
- }
-
- /**
- * testStartAbilitySync
- *
- * @apiNote testStartAbilitySync
- * @throws InterruptedException
- */
- @Test
- public void testStartAbilitySync() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started", new Object() {}.getClass().getEnclosingMethod().getName());
-
- {
- Optional ability = abilityDelegator.startAbilitySync(Global.intentSecondAbility);
- Assert.assertTrue("Get Secondability failed", ability.isPresent());
- }
-
- {
- Thread.sleep(10);
- Optional ability = abilityDelegator.startAbilitySync(Global.intentPageAbility);
- Assert.assertTrue("Get PageAbility failed", ability.isPresent());
- }
- }
-
- /**
- * testRunOnUIThreadSync
- *
- * @apiNote testRunOnUIThreadSync
- * @throws InterruptedException
- */
- @Test
- public void testRunOnUIThreadSync() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started", new Object() {}.getClass().getEnclosingMethod().getName());
-
- Optional ability = abilityDelegator.startAbilitySync(Global.intentSecondAbility);
- Assert.assertTrue("Get Secondability failed", ability.isPresent());
- if (ability.get() instanceof SecondAbility) {
- SecondAbility secondability = (SecondAbility) ability.get();
- IAbilityMonitor monitor = abilityDelegator.addAbilityMonitor(PageAbility.class.getName());
- abilityDelegator.runOnUIThreadSync(() -> secondability.startAbility(Global.intentPageAbility));
- Ability aa = monitor.waitForAbility();
- Assert.assertNotNull("PagetAbility is null", aa);
- } else {
- Assert.fail("get second ability failed");
- }
- }
-
- /**
- * testGetCurrentTopAbility
- *
- * @apiNote testGetCurrentTopAbility
- * @throws InterruptedException
- */
- @Test
- public void testGetCurrentTopAbility() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started", new Object() {}.getClass().getEnclosingMethod().getName());
-
- Optional ability = abilityDelegator.startAbilitySync(Global.intentSecondAbility);
- Assert.assertTrue("Get Secondability failed", ability.isPresent());
- if (ability.get() instanceof SecondAbility) {
- ability.get();
- Thread.sleep(10);
- Ability aa = abilityDelegator.getCurrentTopAbility();
- Assert.assertNotNull("PagetAbility is null", aa);
- Assert.assertEquals("top ability is SecondAbility.class", aa, ability.get());
- } else {
- Assert.fail("get second ability failed");
- }
- }
-
- /**
- * testGetCurrentTopAbility
- *
- * @apiNote testGetCurrentTopAbility
- */
- @Test
- public void invaidArgTest0() {
- Assert.assertFalse("startAbilitySync", abilityDelegator.startAbilitySync(null).isPresent());
- Assert.assertFalse("startAbilitySync", abilityDelegator.startAbilitySync(null, 10L).isPresent());
- Assert.assertFalse("doAbilityBackground", abilityDelegator.doAbilityBackground(null));
- Assert.assertFalse("doAbilityForeground", abilityDelegator.doAbilityForeground(null, null));
- Assert.assertFalse("doAbilityInactive", abilityDelegator.doAbilityInactive(null));
- Assert.assertFalse("stopAbility", abilityDelegator.stopAbility(null));
- Assert.assertFalse("triggerClickEvent", abilityDelegator.triggerClickEvent(null, null));
- Assert.assertFalse("triggerKeyEvent", abilityDelegator.triggerKeyEvent(null, null));
- Assert.assertFalse("triggerTouchEvent", abilityDelegator.triggerTouchEvent(null, null));
- Assert.assertFalse("runOnUIThreadSync", abilityDelegator.runOnUIThreadSync(null));
- }
-
- /**
- * invaidArgTest1
- *
- * @apiNote invaidArgTest1
- */
- @Test(expected = IllegalArgumentException.class)
- public void invaidArgTest1() {
- abilityDelegator.getAbilityState(null);
- }
-
- /**
- * invaidArgTest2
- *
- * @apiNote invaidArgTest2
- */
- @Test
- public void invaidArgTest2() {
- abilityDelegator.removeAbilityMonitor(null);
- }
-
- /**
- * getTestParameters
- *
- * @apiNote getTestParameters
- */
- @Test
- public void getTestParameters() {
- IAbilityDelegatorArgs iAbilityDelegatorArgs = AbilityDelegatorRegistry.getArguments();
- Assert.assertNotNull("abilitydelegator args", iAbilityDelegatorArgs);
- Assert.assertFalse("abilitydelegator args parameters", iAbilityDelegatorArgs.getTestParameters().isEmpty());
- Map parameters = iAbilityDelegatorArgs.getTestParameters();
- for (Map.Entry entry : parameters.entrySet()) {
- abilityDelegator.print("unittest parameter key is:" + entry.getKey() + System.lineSeparator());
- }
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/AbilityDelegatorEventTest.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/AbilityDelegatorEventTest.java
deleted file mode 100755
index 34f4a5a9ece02c7627476b23d66782fdd66085aa..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/AbilityDelegatorEventTest.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator;
-
-import ohos.aafwk.ability.Ability;
-import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
-import ohos.aafwk.ability.delegation.IAbilityDelegator;
-import ohos.agp.components.Component;
-import ohos.agp.components.Text;
-import ohos.hiviewdfx.HiLog;
-import ohos.hiviewdfx.HiLogLabel;
-import ohos.multimodalinput.event.KeyBoardEvent;
-import ohos.multimodalinput.event.KeyEvent;
-import ohos.multimodalinput.event.MmiPoint;
-import ohos.multimodalinput.event.TouchEvent;
-
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.util.Optional;
-
-/**
- * Test AbilityDelegator dispatch events.
- */
-public class AbilityDelegatorEventTest {
- private static final HiLogLabel LABEL_LOG = new HiLogLabel(3, 0xD001100, "TestKeyEvent");
-
- private static IAbilityDelegator abilityDelegator;
-
- private TouchEvent touchEvent = new TouchEvent() {
- @Override
- public float getForcePrecision() {
- return 0;
- }
-
- @Override
- public float getMaxForce() {
- return 0;
- }
-
- @Override
- public int getTapCount() {
- return 0;
- }
-
- @Override
- public int getAction() {
- return TouchEvent.PRIMARY_POINT_UP;
- }
-
- @Override
- public int getIndex() {
- return 0;
- }
-
- @Override
- public long getStartTime() {
- return 0;
- }
-
- @Override
- public int getPhase() {
- return 0;
- }
-
- @Override
- public MmiPoint getPointerPosition(int i) {
- return new MmiPoint(0, 0);
- }
-
- @Override
- public void setScreenOffset(float v, float v1) {
- }
-
- @Override
- public MmiPoint getPointerScreenPosition(int i) {
- return new MmiPoint(0, 0);
- }
-
- @Override
- public int getPointerCount() {
- return 0;
- }
-
- @Override
- public int getPointerId(int i) {
- return 0;
- }
-
- @Override
- public float getForce(int i) {
- return 0;
- }
-
- @Override
- public float getRadius(int i) {
- return 0;
- }
-
- @Override
- public int getSourceDevice() {
- return 0;
- }
-
- @Override
- public String getDeviceId() {
- return "";
- }
-
- @Override
- public int getInputDeviceId() {
- return 0;
- }
-
- @Override
- public long getOccurredTime() {
- return 0;
- }
- };
-
- private KeyBoardEvent keyBoardEvent = new KeyBoardEvent() {
- @Override
- public boolean isNoncharacterKeyPressed(int i) {
- return false;
- }
-
- @Override
- public boolean isNoncharacterKeyPressed(int i, int i1) {
- return false;
- }
-
- @Override
- public boolean isNoncharacterKeyPressed(int i, int i1, int i2) {
- return false;
- }
-
- @Override
- public int getUnicode() {
- return 0;
- }
-
- @Override
- public boolean isKeyDown() {
- return true;
- }
-
- @Override
- public int getKeyCode() {
- return KeyEvent.KEY_VOLUME_DOWN;
- }
-
- @Override
- public long getKeyDownDuration() {
- return 0;
- }
-
- @Override
- public int getSourceDevice() {
- return 0;
- }
-
- @Override
- public String getDeviceId() {
- return "";
- }
-
- @Override
- public int getInputDeviceId() {
- return 0;
- }
-
- @Override
- public long getOccurredTime() {
- return System.currentTimeMillis();
- }
- };
-
- /**
- * setUp
- *
- * @apiNote BeforeClass process for all test
- */
- @BeforeClass
- public static void setUp() {
- abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
- }
-
- /**
- * stopAbility
- *
- * @apiNote AfterClass process for all test
- */
- @AfterClass
- public static void stopAbility() {
- // stop ability at here for clean test environment.
- }
-
- /**
- * jumpBack
- *
- * @apiNote Before process for test
- */
- @Before
- public void jumpBack() {
- abilityDelegator.startAbilitySync(Global.intentPageAbility);
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * testTriggerTouchEvent
- *
- * @apiNote testTriggerTouchEvent
- * @throws InterruptedException
- */
- @Test
- public void testTriggerTouchEvent() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started", new Object() {}.getClass().getEnclosingMethod().getName());
-
- Optional ability = abilityDelegator.startAbilitySync(Global.intentSecondAbility);
- Assert.assertTrue("Get Secondability failed", ability.isPresent());
- if (ability.get() instanceof SecondAbility) {
- SecondAbility secondability = (SecondAbility) ability.get();
-
- Thread.sleep(10);
- Component view = secondability.findComponentById(Global.TOUCH_RESULT_TEXTVIEW_ID);
- if (view instanceof Text) {
- Text textView = (Text) view;
- Assert.assertNotNull("touch result textview is null", textView);
-
- String expectedValue = Integer.valueOf(textView.getText()) + 1 + "";
- abilityDelegator.triggerTouchEvent(secondability, touchEvent);
- HiLog.info(LABEL_LOG, "textview value: %{public}s", textView.getText());
- Assert.assertEquals("textview value must be " + expectedValue, expectedValue, textView.getText());
- } else {
- Assert.fail("get textview failed!");
- }
- } else {
- Assert.fail("get secondability failed");
- }
- }
-
- /**
- * testTriggerClickEvent
- *
- * @apiNote testTriggerClickEvent
- * @throws InterruptedException
- */
- @Test
- public void testTriggerClickEvent() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started", new Object() {}.getClass().getEnclosingMethod().getName());
-
- Optional ability = abilityDelegator.startAbilitySync(Global.intentSecondAbility);
- Assert.assertTrue("Get Secondability failed", ability.isPresent());
- if (ability.get() instanceof SecondAbility) {
- SecondAbility secondability = (SecondAbility) ability.get();
-
- Thread.sleep(10);
- Component view = secondability.findComponentById(Global.CLICK_RESULT_TEXTVIEW_ID);
- if (view instanceof Text) {
- Text textView = (Text) view;
- Assert.assertNotNull("clieck result textview is null", textView);
- String expectedValue = Integer.valueOf(textView.getText()) + 1 + "";
- abilityDelegator.triggerClickEvent(secondability, textView);
- HiLog.info(LABEL_LOG, "textview content: %{public}s", textView.getText());
- Assert.assertTrue("textview value must be " + expectedValue, textView.getText().equals(expectedValue));
- } else {
- Assert.fail("get textview failed!");
- }
- } else {
- Assert.fail("get secondability failed");
- }
- }
-
- /**
- * testTriggerKeyEvent
- *
- * @apiNote testTriggerKeyEvent
- * @throws InterruptedException
- */
- @Test
- public void testTriggerKeyEvent() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started", new Object() {}.getClass().getEnclosingMethod().getName());
-
- Optional ability = abilityDelegator.startAbilitySync(Global.intentSecondAbility);
- Assert.assertTrue("Get Secondability failed", ability.isPresent());
- if (ability.get() instanceof SecondAbility) {
- SecondAbility secondability = (SecondAbility) ability.get();
- Component textView = secondability.findComponentById(Global.KEYEVENT_RESULT_TEXTVIEW_ID);
- Assert.assertNotNull("keyevent result textview is null", textView);
- abilityDelegator.triggerKeyEvent(secondability, keyBoardEvent);
- } else {
- Assert.fail("get secondability failed");
- }
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/AbilityMonitorTest.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/AbilityMonitorTest.java
deleted file mode 100755
index 8414d06a29822f63cee75c0d76209486791f0e92..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/AbilityMonitorTest.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.ohos.aa.st.abilitydelegator;
-
-import ohos.aafwk.ability.Ability;
-import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
-import ohos.aafwk.ability.delegation.IAbilityDelegator;
-import ohos.aafwk.ability.delegation.IAbilityMonitor;
-
-import ohos.aafwk.content.Intent;
-import ohos.aafwk.content.IntentFilter;
-
-import ohos.hiviewdfx.HiLog;
-import ohos.hiviewdfx.HiLogLabel;
-
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.util.Optional;
-
-
-/**
- * Test AbilityMonitor.
- */
-public class AbilityMonitorTest {
- private static final HiLogLabel LABEL_LOG = new HiLogLabel(3, 0xD001100,
- "AbilityMonitorTestCases");
- private static IAbilityDelegator abilityDelegator;
-
- /**
- * setUp
- *
- * @apiNote BeforeClass process for all test
- */
- @BeforeClass
- public static void setUp() {
- abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
- }
-
- /**
- * stopAbility
- *
- * @apiNote AfterClass process for all test
- */
- @AfterClass
- public static void stopAbility() {
- // stop ability at here for clean test environment.
- }
-
- /**
- * testWaitForAbility
- *
- * @apiNote testWaitForAbility
- * @throws InterruptedException
- */
- @Test
- public void testWaitForAbility() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started",
- new Object() {
- }.getClass().getEnclosingMethod().getName());
- Thread.sleep(10);
-
- IAbilityMonitor monitor = abilityDelegator.addAbilityMonitor(SecondAbility.class.getName());
- abilityDelegator.startAbilitySync(Global.intentSecondAbility);
-
- Ability aa = monitor.waitForAbility();
- Assert.assertNotNull("ability is null", aa);
- Assert.assertEquals("there is 1 monitor in memory", 1,
- abilityDelegator.getMonitorsNum());
- abilityDelegator.removeAbilityMonitor(monitor); // remove monitor
- Assert.assertEquals("there is no monitor in memory", 0,
- abilityDelegator.getMonitorsNum());
- }
-
- /**
- * testIntentFilter
- *
- * @apiNote testIntentFilter
- * @throws InterruptedException
- */
- @Test
- public void testIntentFilter() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started",
- new Object() {
- }.getClass().getEnclosingMethod().getName());
- Thread.sleep(10);
-
- Intent newIntent = new Intent(Global.intentThirdAbility);
- newIntent.setAction("custom action");
-
- IntentFilter intentFilter = new IntentFilter();
- intentFilter.addAction("custom action");
- Assert.assertTrue("match intent", intentFilter.match(newIntent));
-
- IAbilityMonitor monitor = abilityDelegator.addAbilityMonitor(intentFilter);
- abilityDelegator.startAbilitySync(newIntent);
-
- Ability aa = monitor.waitForAbility(50);
- Assert.assertNotNull("ability is null", aa);
- abilityDelegator.clearAllMonitors();
- }
-
- /**
- * testWaitAbilityMonitor
- *
- * @apiNote testWaitAbilityMonitor
- * @throws InterruptedException
- */
- @Test
- public void testWaitAbilityMonitor() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started",
- new Object() {
- }.getClass().getEnclosingMethod().getName());
-
- IAbilityMonitor monitor = abilityDelegator.addAbilityMonitor(SecondAbility.class.getName());
- abilityDelegator.startAbilitySync(Global.intentSecondAbility);
-
- Optional aaOpt = abilityDelegator.waitAbilityMonitor(monitor);
- Assert.assertTrue("ability is null", aaOpt.isPresent());
- Assert.assertEquals("There is no ability monitor in memory",
- abilityDelegator.getMonitorsNum(), 0);
- }
-
- /**
- * testClearAbilityMonitor
- *
- * @apiNote testClearAbilityMonitor
- * @throws InterruptedException
- */
- @Test
- public void testClearAbilityMonitor() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started",
- new Object() {
- }.getClass().getEnclosingMethod().getName());
- abilityDelegator.addAbilityMonitor(SecondAbility.class.getName());
- Assert.assertEquals("there is 1 monitor in memory", 1,
- abilityDelegator.getMonitorsNum());
- abilityDelegator.clearAllMonitors(); // remove monitor
- Assert.assertEquals("there is no monitor in memory", 0,
- abilityDelegator.getMonitorsNum());
- }
-
- /**
- * jumpBack
- *
- * @apiNote Before process for test
- */
- @Before
- public void jumpBack() {
- abilityDelegator.startAbilitySync(Global.intentPageAbility);
- abilityDelegator.clearAllMonitors();
-
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/AbilitySliceTest.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/AbilitySliceTest.java
deleted file mode 100755
index a9003eb840ea0f360eb34a7abb2a795378ede992..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/AbilitySliceTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator;
-
-import ohos.aafwk.ability.Ability;
-import ohos.aafwk.ability.AbilitySlice;
-import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
-import ohos.aafwk.ability.delegation.IAbilityDelegator;
-import ohos.aafwk.content.Intent;
-import ohos.hiviewdfx.HiLog;
-import ohos.hiviewdfx.HiLogLabel;
-
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import java.util.Optional;
-
-/**
- * Test AbilitySlice base functions.
- */
-public class AbilitySliceTest {
- private static final HiLogLabel LABEL_LOG = new HiLogLabel(3, 0xD001100, "AbilitySliceTest");
-
- private static IAbilityDelegator abilityDelegator;
-
- /**
- * setUp
- *
- * @apiNote BeforeClass process for all test
- */
- @BeforeClass
- public static void setUp() {
- abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
- }
-
- /**
- * stopAbility
- *
- * @apiNote AfterClass process for all test
- */
- @AfterClass
- public static void stopAbility() {
- // stop ability at here for clean test environment.
- }
-
- /**
- * jumpBack
- *
- * @apiNote Before process for test
- */
- @Before
- public void jumpBack() {
- abilityDelegator.startAbilitySync(Global.intentPageAbility);
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * testAbilitySliceOperations
- *
- * @apiNote testAbilitySliceOperations
- * @throws InterruptedException
- */
- @Ignore
- @Test
- public void testAbilitySliceOperations() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started", new Object() {}.getClass().getEnclosingMethod().getName());
-
- Optional ability = abilityDelegator.startAbilitySync(Global.intentSecondAbility);
- Assert.assertTrue("Get Secondability failed", ability.isPresent());
- SecondAbility secondability = null;
- if (ability.get() instanceof SecondAbility) {
- secondability = (SecondAbility) ability.get();
-
- AbilitySlice slice = abilityDelegator.getCurrentAbilitySlice(secondability);
- Assert.assertNotNull(slice);
- Assert.assertEquals("getAllAbilitySlice", abilityDelegator.getAllAbilitySlice(secondability).size(), 1);
- Assert.assertTrue("doAbilitySliceInactive", abilityDelegator.doAbilitySliceInactive(secondability));
- Assert.assertTrue("doAbilitySliceBackground", abilityDelegator.doAbilitySliceBackground(secondability));
- Assert.assertTrue("doAbilitySliceStop", abilityDelegator.doAbilitySliceStop(secondability));
- Assert.assertFalse("doAbilitySliceStop", abilityDelegator.doAbilitySliceStart(secondability, new Intent()));
- Assert.assertEquals(IAbilityDelegator.INITIAL, abilityDelegator.getAbilitySliceState(slice));
- } else {
- Assert.fail("get second ability failed");
- }
- }
-
- /**
- * testErrorLifeCycle
- *
- * @apiNote testErrorLifeCycle
- * @throws InterruptedException
- */
- @Test
- public void testErrorLifeCycle() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started", new Object() {}.getClass().getEnclosingMethod().getName());
-
- Optional ability = abilityDelegator.startAbilitySync(Global.intentSecondAbility);
- Assert.assertTrue("Get Secondability failed", ability.isPresent());
- SecondAbility secondability = null;
- if (ability.get() instanceof SecondAbility) {
- secondability = (SecondAbility) ability.get();
-
- AbilitySlice slice = abilityDelegator.getCurrentAbilitySlice(secondability);
- Assert.assertEquals(abilityDelegator.getAbilitySliceState(slice), IAbilityDelegator.ACTIVE);
- Assert.assertFalse("background ability slice", abilityDelegator.doAbilitySliceBackground(secondability));
- } else {
- Assert.fail("get second ability failed");
- }
- }
-
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/Global.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/Global.java
deleted file mode 100755
index 914314334fdc6c6c5a072ac3ccdc999409b70a40..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/Global.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator;
-
-import ohos.aafwk.content.Intent;
-import ohos.bundle.ElementName;
-
-/**
- * Storing global variables.
- */
-public class Global {
- /**
- * result textview
- */
- public static int CLICK_RESULT_TEXTVIEW_ID = 1001;
- /**
- * result textview
- */
- public static int TOUCH_RESULT_TEXTVIEW_ID = 1002;
- /**
- * result textview
- */
- public static int KEYEVENT_RESULT_TEXTVIEW_ID = 1003;
- /**
- * result hits
- */
- public static int ON_STOP_HITS = 0;
- /**
- * result hits
- */
- public static int ON_ACTIVE_HITS = 0;
- /**
- * result hits
- */
- public static int ON_INACTIVE_HITS = 0;
- /**
- * result hits
- */
- public static int ON_BACKGROUND_HITS = 0;
- /**
- * result hits
- */
- public static int ON_FOREGROUND_HITS = 0;
-
- /**
- * intent for jump
- */
- public static Intent intentPageAbility = new Intent();
- /**
- * intent for jump
- */
- public static Intent intentSecondAbility = new Intent();
- /**
- * intent for jump
- */
- public static Intent intentThirdAbility = new Intent();
-
- static {
- ElementName elementName = new ElementName();
- elementName.setBundleName(SecondAbility.class.getPackage().getName());
- elementName.setAbilityName(SecondAbility.class.getSimpleName());
- intentSecondAbility.setElement(elementName);
- }
-
- static {
- ElementName elementName = new ElementName();
- elementName.setBundleName(PageAbility.class.getPackage().getName());
- elementName.setAbilityName(PageAbility.class.getSimpleName());
- intentPageAbility.setElement(elementName);
- }
-
- static {
- ElementName elementName = new ElementName();
- elementName.setBundleName(ThirdAbility.class.getPackage().getName());
- elementName.setAbilityName(ThirdAbility.class.getSimpleName());
- intentThirdAbility.setElement(elementName);
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/PageAbility.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/PageAbility.java
deleted file mode 100755
index 314f43cec65183c2b3fee3c22a33e7552cf2d5e9..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/PageAbility.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator;
-
-import com.ohos.aa.st.abilitydelegator.slice.PageAbilitySlice;
-
-import ohos.aafwk.ability.Ability;
-import ohos.aafwk.content.Intent;
-
-/**
- * PageAbility for test hap.
- */
-public class PageAbility extends Ability {
- @Override
- public void onStart(Intent intent) {
- super.onStart(intent);
- super.setMainRoute(PageAbilitySlice.class.getName());
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/SecondAbility.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/SecondAbility.java
deleted file mode 100755
index 38f5654d0ab8ca99fd8835fc208366f00d5b30c8..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/SecondAbility.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator;
-
-import com.ohos.aa.st.abilitydelegator.slice.SecondAbilitySlice;
-
-import ohos.aafwk.ability.Ability;
-import ohos.aafwk.content.Intent;
-import ohos.hiviewdfx.HiLog;
-import ohos.hiviewdfx.HiLogLabel;
-import ohos.rpc.IRemoteObject;
-import ohos.utils.PacMap;
-
-/**
- * SecondAbility for test hap.
- */
-public class SecondAbility extends Ability {
- private static final HiLogLabel LABEL_LOG = new HiLogLabel(3, 0xD001100, "SecondAbility");
-
- @Override
- public void onStart(Intent intent) {
- super.onStart(intent);
- super.setMainRoute(SecondAbilitySlice.class.getName());
- HiLog.info(LABEL_LOG, "onStart() end");
- }
-
- @Override
- protected void onPostStart(PacMap pacMap) {
- super.onPostStart(pacMap);
- HiLog.info(LABEL_LOG, "onPostStart() end");
- }
-
- @Override
- protected void onStop() {
- super.onStop();
- HiLog.info(LABEL_LOG, "onStop() end");
- Global.ON_STOP_HITS += 1;
- }
-
- @Override
- protected void onActive() {
- super.onActive();
- HiLog.info(LABEL_LOG, "onActive() end");
- Global.ON_ACTIVE_HITS += 1;
- }
-
- @Override
- protected void onPostActive() {
- super.onPostActive();
- HiLog.info(LABEL_LOG, "onPostActive() end");
- }
-
- @Override
- protected void onInactive() {
- super.onInactive();
- HiLog.info(LABEL_LOG, "onInactive() end");
- Global.ON_INACTIVE_HITS += 1;
- }
-
- @Override
- protected void onForeground(Intent intent) {
- super.onForeground(intent);
- HiLog.info(LABEL_LOG, "onForeground() end");
- Global.ON_FOREGROUND_HITS += 1;
- }
-
- @Override
- protected void onBackground() {
- super.onBackground();
- HiLog.info(LABEL_LOG, "onBackground() end");
- Global.ON_BACKGROUND_HITS += 1;
- }
-
- @Override
- protected IRemoteObject onConnect(Intent intent) {
- return super.onConnect(intent);
- }
-
- @Override
- protected void onDisconnect(Intent intent) {
- super.onDisconnect(intent);
- }
-
- @Override
- protected void onCommand(Intent intent, boolean restart, int startId) {
- super.onCommand(intent, restart, startId);
- }
-
- @Override
- protected void onNewIntent(Intent intent) {
- super.onNewIntent(intent);
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/StopAbilityTest.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/StopAbilityTest.java
deleted file mode 100755
index 37af9fa70e10f0d225199af7ef2531c971199b76..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/StopAbilityTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator;
-
-import ohos.aafwk.ability.Ability;
-import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
-import ohos.aafwk.ability.delegation.IAbilityDelegator;
-import ohos.hiviewdfx.HiLog;
-import ohos.hiviewdfx.HiLogLabel;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.util.Optional;
-
-/**
- * Test stop ability.
- */
-public class StopAbilityTest {
- private static final HiLogLabel LABEL_LOG = new HiLogLabel(3, 0xD001100, "StopAbilityTest");
-
- private static IAbilityDelegator abilityDelegator;
-
- /**
- * setUp, get abilityDelegator
- *
- * @apiNote BeforeClass setUp
- */
- @BeforeClass
- public static void setUp() {
- abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
- }
-
- /**
- * jumpBack
- *
- * @apiNote Before test jumpBack
- */
- @Before
- public void jumpBack() {
- abilityDelegator.startAbilitySync(Global.intentPageAbility);
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * testStopAbility
- *
- * @apiNote testStopAbility
- * @throws InterruptedException
- */
- @Test
- public void testStopAbility() throws InterruptedException {
- HiLog.info(LABEL_LOG, "%{public}s started", new Object() {}.getClass().getEnclosingMethod().getName());
-
- /**
- * @tc.steps: step1. start second ability.
- */
- Optional ability = abilityDelegator.startAbilitySync(Global.intentSecondAbility);
- Assert.assertTrue("get Secondability", ability.isPresent());
-
- if (ability.get() instanceof SecondAbility) {
- /**
- * @tc.steps: step2. stop second ability.
- */
- SecondAbility secondability = (SecondAbility) ability.get();
- Assert.assertTrue("inactive ability", abilityDelegator.doAbilityInactive(secondability));
- Assert.assertTrue("background ability", abilityDelegator.doAbilityBackground(secondability));
- abilityDelegator.print("start stop ability" + System.lineSeparator());
- boolean result = abilityDelegator.stopAbility(secondability);
- abilityDelegator.print("stop ability " + result + System.lineSeparator() + System.lineSeparator());
-
- /**
- * @tc.steps: step3. start second ability again.
- */
- Optional bb = abilityDelegator.startAbilitySync(Global.intentSecondAbility);
- Assert.assertTrue("restart ability", bb.isPresent());
- } else {
- Assert.fail("get second ability failed");
- }
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/ThirdAbility.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/ThirdAbility.java
deleted file mode 100755
index 48ec4dca5ff59999220fb5141e79a15d1fb0cb27..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/ThirdAbility.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator;
-
-import com.ohos.aa.st.abilitydelegator.slice.ThirdAbilitySlice;
-
-import ohos.aafwk.ability.Ability;
-import ohos.aafwk.content.Intent;
-
-/**
- * SecondAbility for test hap.
- */
-public class ThirdAbility extends Ability {
- @Override
- public void onStart(Intent intent) {
- super.onStart(intent);
- super.setMainRoute(ThirdAbilitySlice.class.getName());
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/slice/PageAbilitySlice.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/slice/PageAbilitySlice.java
deleted file mode 100755
index 926b5e30d0af5fc63e42d0d22d3abd5e48f48f42..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/slice/PageAbilitySlice.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator.slice;
-
-import com.ohos.aa.st.abilitydelegator.SecondAbility;
-
-import ohos.aafwk.ability.AbilitySlice;
-import ohos.aafwk.content.Intent;
-import ohos.agp.colors.RgbColor;
-import ohos.agp.components.PositionLayout;
-import ohos.agp.components.Button;
-import ohos.agp.utils.Color;
-import ohos.agp.components.ComponentContainer.LayoutConfig;
-import ohos.agp.components.element.ShapeElement;
-import ohos.bundle.ElementName;
-
-/**
- * PageAbilitySlice for test hap.
- */
-public class PageAbilitySlice extends AbilitySlice {
- private static final int COLOR_WHITE = 0xFFFFFFFF;
-
- private PositionLayout myLayout = new PositionLayout(this);
-
- @Override
- public void onStart(Intent intent) {
- super.onStart(intent);
-
- LayoutConfig params = new LayoutConfig(LayoutConfig.MATCH_PARENT, LayoutConfig.MATCH_PARENT);
- myLayout.setLayoutConfig(params);
-
- {
- ShapeElement drawable = new ShapeElement();
- drawable.setShape(ShapeElement.RECTANGLE);
- drawable.setRgbColor(new RgbColor(COLOR_WHITE));
- myLayout.setBackground(drawable);
- }
-
- {
- ShapeElement drawable = new ShapeElement();
- drawable.setShape(ShapeElement.RECTANGLE);
- drawable.setRgbColor(new RgbColor(Color.GRAY.getValue()));
-
- Button button = new Button(this);
- button.setWidth(400);
- button.setHeight(200);
- button.setBackground(drawable);
- button.setText("JUMP");
- button.setTextSize(50);
- button.setTextColor(Color.RED);
- button.setContentPosition(100, 100);
-
- button.setClickedListener(view -> {
- Intent intent1 = new Intent();
- ElementName elementName = new ElementName();
- elementName.setBundleName(SecondAbility.class.getPackage().getName());
- elementName.setAbilityName(SecondAbility.class.getSimpleName());
- intent1.setElement(elementName);
- startAbility(intent1);
- });
-
- myLayout.addComponent(button);
- }
-
- super.setUIContent(myLayout);
- }
-
- @Override
- public void onActive() {
- super.onActive();
- }
-
- @Override
- public void onForeground(Intent intent) {
- super.onForeground(intent);
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/slice/SecondAbilitySlice.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/slice/SecondAbilitySlice.java
deleted file mode 100755
index 4a85bdac244c6d09932bd3bdb44bff522c39fa3b..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/slice/SecondAbilitySlice.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator.slice;
-
-import com.ohos.aa.st.abilitydelegator.Global;
-
-import ohos.aafwk.ability.AbilitySlice;
-import ohos.aafwk.content.Intent;
-import ohos.agp.colors.RgbColor;
-import ohos.agp.components.PositionLayout;
-import ohos.agp.components.Text;
-import ohos.agp.utils.Color;
-import ohos.agp.components.Component;
-import ohos.agp.components.ComponentContainer.LayoutConfig;
-import ohos.agp.components.element.ShapeElement;
-import ohos.hiviewdfx.HiLog;
-import ohos.hiviewdfx.HiLogLabel;
-import ohos.multimodalinput.event.KeyEvent;
-import ohos.multimodalinput.event.TouchEvent;
-
-/**
- * SecondAbilitySlice for test hap.
- */
-public class SecondAbilitySlice extends AbilitySlice {
- private static final HiLogLabel LABEL_LOG = new HiLogLabel(3, 0xD001100, "SecondAbility");
- private static final int COLOR_WHITE = 0xFFFFFFFF;
-
- private PositionLayout myLayout = new PositionLayout(this);
-
- private void initClickTextView() {
- ShapeElement drawable = new ShapeElement();
- drawable.setShape(ShapeElement.RECTANGLE);
- drawable.setRgbColor(new RgbColor(Color.GRAY.getValue()));
-
- Text textView = new Text(this);
- textView.setId(Global.CLICK_RESULT_TEXTVIEW_ID);
- textView.setWidth(100);
- textView.setHeight(100);
- textView.setText("0");
- textView.setTextSize(50);
- textView.setTextColor(new Color(0x7F000000));
- textView.setContentPosition(100, 100);
- textView.setBackground(drawable);
-
- textView.setClickedListener(new Component.ClickedListener() {
- @Override
- public void onClick(Component view) {
- HiLog.info(LABEL_LOG, "1111111111111~~");
- textView.setText(String.valueOf(Integer.valueOf(textView.getText()) + 1));
- textView.invalidate();
- }
- });
-
- myLayout.addComponent(textView);
- }
-
- private void initTouchTextView() {
- ShapeElement drawable = new ShapeElement();
- drawable.setShape(ShapeElement.RECTANGLE);
- drawable.setRgbColor(new RgbColor(Color.GRAY.getValue()));
-
- Text textView = new Text(this);
- textView.setId(Global.TOUCH_RESULT_TEXTVIEW_ID);
- textView.setWidth(100);
- textView.setHeight(100);
- textView.setText("0");
- textView.setTextSize(50);
- textView.setTextColor(new Color(0x7F000000));
- textView.setContentPosition(220, 100);
- textView.setBackground(drawable);
-
- myLayout.addComponent(textView);
-
- myLayout.setTouchEventListener(new Component.TouchEventListener() {
- @Override
- public boolean onTouchEvent(Component view, TouchEvent touchEvent) {
- HiLog.info(LABEL_LOG, "22222222222222~~");
- textView.setText(Integer.valueOf(textView.getText()) + 1 + "");
- textView.invalidate();
- return false;
- }
- });
- }
-
- private void initKeyEventTextView() {
- ShapeElement drawable = new ShapeElement();
- drawable.setShape(ShapeElement.RECTANGLE);
- drawable.setRgbColor(new RgbColor(Color.GRAY.getValue()));
-
- Text textView = new Text(this);
- textView.setId(Global.KEYEVENT_RESULT_TEXTVIEW_ID);
- textView.setWidth(100);
- textView.setHeight(100);
- textView.setText("");
- textView.setTextSize(50);
- textView.setTextColor(new Color(0x7F000000));
- textView.setContentPosition(340, 100);
- textView.setBackground(drawable);
-
- myLayout.setKeyEventListener(new Component.KeyEventListener() {
- @Override
- public boolean onKeyEvent(Component view, KeyEvent keyEvent) {
- HiLog.info(LABEL_LOG, "33333333333~~");
- textView.setText(keyEvent.getKeyCode() + "");
- textView.invalidate();
- return true;
- }
- });
-
- myLayout.addComponent(textView);
- }
-
- @Override
- public void onStart(Intent intent) {
- super.onStart(intent);
-
- LayoutConfig params = new LayoutConfig(LayoutConfig.MATCH_PARENT, LayoutConfig.MATCH_PARENT);
- myLayout.setLayoutConfig(params);
- myLayout.setId(100);
-
- {
- ShapeElement drawable = new ShapeElement();
- drawable.setShape(ShapeElement.RECTANGLE);
- drawable.setRgbColor(new RgbColor(COLOR_WHITE));
- myLayout.setBackground(drawable);
- }
-
- initClickTextView();
-
- initTouchTextView();
-
- initKeyEventTextView();
-
- super.setUIContent(myLayout);
- }
-
- @Override
- public void onActive() {
- super.onActive();
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/slice/ThirdAbilitySlice.java b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/slice/ThirdAbilitySlice.java
deleted file mode 100755
index 0a08758341147ce511316d4bfb252db3216acdc6..0000000000000000000000000000000000000000
--- a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/src/main/java/com/ohos/aa/st/abilitydelegator/slice/ThirdAbilitySlice.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.aa.st.abilitydelegator.slice;
-
-import ohos.aafwk.ability.AbilitySlice;
-import ohos.aafwk.content.Intent;
-import ohos.agp.colors.RgbColor;
-import ohos.agp.components.PositionLayout;
-import ohos.agp.components.Text;
-import ohos.agp.utils.Color;
-import ohos.agp.components.ComponentContainer.LayoutConfig;
-import ohos.agp.components.element.ShapeElement;
-
-/**
- * ThirdAbilitySlice for test hap.
- */
-public class ThirdAbilitySlice extends AbilitySlice {
- private static final int COLOR_WHITE = 0xFFFFFFFF;
-
- private PositionLayout myLayout = new PositionLayout(this);
-
- @Override
- public void onStart(Intent intent) {
- super.onStart(intent);
-
- LayoutConfig params = new LayoutConfig(LayoutConfig.MATCH_PARENT, LayoutConfig.MATCH_PARENT);
- myLayout.setLayoutConfig(params);
-
- ShapeElement drawable = new ShapeElement();
- drawable.setShape(ShapeElement.RECTANGLE);
- drawable.setRgbColor(new RgbColor(COLOR_WHITE));
- myLayout.setBackground(drawable);
-
- Text text = new Text(this);
- text.setText("Hello World");
- text.setTextColor(Color.BLACK);
- myLayout.addComponent(text);
-
- super.setUIContent(myLayout);
- }
-
- @Override
- public void onActive() {
- super.onActive();
- }
-
- @Override
- public void onForeground(Intent intent) {
- super.onForeground(intent);
- }
-}
diff --git a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/test_abilitydelegator.p7b b/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/test_abilitydelegator.p7b
deleted file mode 100755
index b4bd2470fb81ccab64441ebc7cf995c78090ddb3..0000000000000000000000000000000000000000
Binary files a/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt/test_abilitydelegator.p7b and /dev/null differ
diff --git a/adapter/libs/jtr/main/java/src/ohos/unittest/TestAbility.java b/adapter/libs/jtr/main/java/src/ohos/unittest/TestAbility.java
deleted file mode 100755
index e13bc518193ed030642fbcfb9863e2d9a97851fc..0000000000000000000000000000000000000000
--- a/adapter/libs/jtr/main/java/src/ohos/unittest/TestAbility.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ohos.unittest;
-
-import ohos.aafwk.ability.Ability;
-import ohos.aafwk.content.Intent;
-import ohos.unittest.log.HiLogUtil;
-import ohos.unittest.runner.UtTestRunner;
-
-/**
- * TestAbility
- */
-public class TestAbility extends Ability {
- @Override
- public void onStart(Intent intent) {
- HiLogUtil.info(this.getClass(), "onStart begin");
- AppContext.getInstance().setCurrentAbility(this);
- super.onStart(intent);
- HiLogUtil.info(this.getClass(), "onStart end");
- }
-
- /**
- * executeTestCase
- *
- * @apiNote executeTestCase
- * @param intent intent object
- */
- public void executeTestCase(Intent intent) {
- new Thread(() -> {
- HiLogUtil.info(this.getClass(), "Run test in child thread begin");
- executeTesting(intent);
- HiLogUtil.info(this.getClass(), "Run test in child thread end");
- }).start();
- }
-
- /**
- * executeTestCaseInMainThread
- *
- * @apiNote executeTestCaseInMainThread
- * @param intent intent object
- */
- public void executeTestCaseInMainThread(Intent intent) {
- HiLogUtil.info(this.getClass(), "runTestCase begin");
- executeTesting(intent);
- HiLogUtil.info(this.getClass(), "runTestCase end");
- }
-
- /**
- * executeTesting
- *
- * @apiNote execute Testing by TestRunner
- * @param intent intent object
- */
- private void executeTesting(Intent intent) {
- HiLogUtil.info(this.getClass(), "ExecuteTesting begin");
- String param = "";
- if (intent != null) {
- if (intent.hasParameter("param")) {
- param = intent.getStringParam("param");
- HiLogUtil.info(this.getClass(), "param = " + param);
- } else {
- HiLogUtil.info(this.getClass(), "param is empty");
- }
- } else {
- HiLogUtil.info(this.getClass(), "intent is null");
- }
- HiLogUtil.info(this.getClass(), "Run test by TestRunner begin");
- String xmlPath = "/data/data/" + getAbilityInfo().getBundleName() + "/files/test/result/";
- param += "#OUTPUT_DIR=" + xmlPath;
- param += "#OUTPUT_FILE=testcase_result";
- String[] args = param.split("#");
- UtTestRunner testRunner = new UtTestRunner();
- testRunner.run(args);
- HiLogUtil.info(this.getClass(), "Run test by TestRunner end");
- HiLogUtil.info(this.getClass(), "ExecuteTesting end");
- }
-}
\ No newline at end of file
diff --git a/adapter/libs/jtr/shell/java/src/ohos/unittest/AppContext.java b/adapter/libs/jtr/shell/java/src/ohos/unittest/AppContext.java
deleted file mode 100755
index af8d64b18938ff6320e04e0fee7f2de0759d6d8d..0000000000000000000000000000000000000000
--- a/adapter/libs/jtr/shell/java/src/ohos/unittest/AppContext.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Copyright (C) 2013 The Android Open Source Project
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package ohos.unittest;
-
-import android.app.Activity;
-
-import ohos.aafwk.ability.Ability;
-
-
-/**
- * Saved App Context for system APP unit test
- */
-public class AppContext {
- /**
- * Current test Activity
- */
- private Activity curActivity = null;
-
- /**
- * Current test Ability
- */
- private Ability curAbility = null;
-
- /**
- * Message Constructor
- */
- private AppContext() {
- }
-
- /**
- * Get AppContext singleton instance
- *
- * @return AppContext AppContext instance
- */
- public static AppContext getInstance() {
- return LazyHolder.instance;
- }
-
- /**
- * Record current test Activity
- *
- * @param activity currentActivity
- */
- public void setCurrentActivity(Activity activity) {
- this.curActivity = activity;
- }
-
- /**
- * Get Current Activity
- *
- * @return Activity
- */
- public Activity getCurrentActivity() {
- return this.curActivity;
- }
-
- /**
- * Record current test Ability
- *
- * @param ability currentAbility
- */
- public void setCurrentAbility(Ability ability) {
- this.curAbility = ability;
- }
-
- /**
- * Get Current Ability
- *
- * @return Ability currentAbility
- */
- public Ability getCurrentAbility() {
- return this.curAbility;
- }
-
- /**
- * LazyHolder
- */
- private static class LazyHolder {
- static AppContext instance = new AppContext();
- }
-}
diff --git a/examples/BUILD.gn b/examples/BUILD.gn
index 589e049accffd1945b621d7463028760b326249b..c7e66c1e19e4e3c533f8ea585d6a5d0d3f7ddd42 100755
--- a/examples/BUILD.gn
+++ b/examples/BUILD.gn
@@ -28,10 +28,6 @@ ohos_subsystem_test("subsystem_examples_test") {
test_packages = [
"calculator/test:unittest",
"detector/test:unittest",
- "studentmgr/test:unittest",
- "studentmgr/test:performance",
- "test/systemtest:systemtest",
- "distributedb/test:distributedtest",
"sleep/test:performance",
]
}
diff --git a/examples/distributedb/test/BUILD.gn b/examples/distributedb/test/BUILD.gn
deleted file mode 100755
index 02f1aa783d1f9bf4a074bdee30114d47593dbd9c..0000000000000000000000000000000000000000
--- a/examples/distributedb/test/BUILD.gn
+++ /dev/null
@@ -1,94 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//build/test.gni")
-
-module_output_path = "subsystem_examples/distributedb"
-
-###############################################################################
-config("module_private_config") {
- visibility = [ ":*" ]
-
- include_dirs = [
- "//utils/native/base/include",
- "//foundation/distributeddatamgr/distributeddatamgr/frameworks/innerkitsimpl/distributeddatafwk/include",
- "//foundation/distributeddatamgr/distributeddatamgr/frameworks/innerkitsimpl/distributeddatafwk/src",
- "//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/app_distributeddata/include",
- "//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/distributeddata/include",
- "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/app/include",
- "//test/developertest/aw/distributed",
- ]
-
- # link library
- #ldflags = [ "-llog" ]
-
- # library path
- lib_dirs = [
- "//libs/aosp_libs/lib64",
- "//foundation/appexecfwk/libs",
- ]
-}
-
-ohos_distributedtest("DistributeDemo") {
- module_out_path = module_output_path
-
- sources = [ "//test/developertest/examples/distributedb/test/distributedtest/common/distribute_demo.cpp" ]
-
- configs = [ ":module_private_config" ]
-
- external_deps = [
- "hilog:libhilog",
- "ipc:ipc_core",
- "safwk:system_ability_fwk",
- "samgr:samgr_proxy",
- ]
-
- deps = [
- "//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/app_distributeddata/:app_distributeddata",
- "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter:distributeddata_adapter",
- "//third_party/googletest:gtest",
- "//utils/native/base:utils",
- ]
-}
-
-ohos_distributedtest("DistributeDemoAgent") {
- module_out_path = module_output_path
-
- sources = [ "//test/developertest/examples/distributedb/test/distributedtest/common/distribute_demo_agent.cpp" ]
-
- configs = [ ":module_private_config" ]
-
- external_deps = [
- "hilog:libhilog",
- "ipc:ipc_core",
- "safwk:system_ability_fwk",
- "samgr:samgr_proxy",
- ]
-
- deps = [
- "//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/app_distributeddata/:app_distributeddata",
- "//foundation/distributeddatamgr/distributeddatamgr/services/distributeddataservice/adapter:distributeddata_adapter",
- "//third_party/googletest:gtest",
- "//utils/native/base:utils",
- ]
-}
-
-###############################################################################
-group("distributedtest") {
- testonly = true
- deps = [
- ":DistributeDemo",
- ":DistributeDemoAgent",
- ]
-}
-###############################################################################
diff --git a/examples/distributedb/test/distributedtest/common/distribute_demo.cpp b/examples/distributedb/test/distributedtest/common/distribute_demo.cpp
deleted file mode 100755
index c0f0e51c2ba6a3123913339ee9de1ecc8f886479..0000000000000000000000000000000000000000
--- a/examples/distributedb/test/distributedtest/common/distribute_demo.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include
-
-#include "distributed_major.h"
-
-#include "app_types.h"
-#include "refbase.h"
-#include "app_kvstore.h"
-#include "app_distributed_kv_data_manager.h"
-#include "hilog/log.h"
-
-
-using namespace std;
-using namespace OHOS;
-using namespace testing::ext;
-using namespace OHOS::DistributeSystemTest;
-using namespace OHOS::HiviewDFX;
-using namespace OHOS::AppDistributedKv;
-
-namespace {
- constexpr HiLogLabel LABEL = {LOG_CORE, 0, "DistributeDemo"};
- const int SYNC_REC_TIME = 3;
- const int MSG_LENGTH = 100;
- const int EXPECT_RETURN_VALUE = 111;
- const int EXPECT_ADD_TEST_SUM = 500;
- const int SLEEP_TIME = 100000;
-}
-
-class DistributeDemo : public DistributeTest {
-public:
- DistributeDemo() = default;
- ~DistributeDemo() = default;
-
- static void SetUpTestCase(void) {};
- static void TearDownTestCase(void) {};
-
- virtual void SetUp() {};
- virtual void TearDown() {};
-};
-
-/**
- * @tc.name: msgsendtest_001
- * @tc.desc: Verify the distributed test framework interface SendMessage.
- * @tc.type: FUNC
- * @tc.require: AR000CQGMV
- */
-HWTEST_F(DistributeDemo, msgsendtest_001, TestSize.Level0)
-{
- char msgbuf[MSG_LENGTH] = "I am testcase 1.";
- EXPECT_TRUE(SendMessage(AGENT_NO::ONE, msgbuf, MSG_LENGTH));
-};
-
-/**
- * @tc.name: msgsendtest_002
- * @tc.desc: Verify the distributed test framework interface SendMessage, Maximum data length.
- * @tc.type: FUNC
- * @tc.require: AR000CQGMV
- */
-HWTEST_F(DistributeDemo, msgsendtest_002, TestSize.Level0)
-{
- char msgbuf[MAX_BUFF_LEN - DST_COMMAND_HEAD_LEN] = "I am testcase 2.";
- EXPECT_TRUE(SendMessage(AGENT_NO::ONE, msgbuf, MAX_BUFF_LEN - DST_COMMAND_HEAD_LEN));
-};
-
-/**
- * @tc.name: msgsendtest_003
- * @tc.desc: Verify the distributed test framework interface SendMessage,
- * Verify the data maximum length of the sent message interface .
- * @tc.type: FUNC
- * @tc.require: AR000CQGMV
- */
-HWTEST_F(DistributeDemo, msgsendtest_003, TestSize.Level0)
-{
- char msgbuf[MAX_BUFF_LEN - DST_COMMAND_HEAD_LEN + 1] = "too big message.";
- EXPECT_FALSE(SendMessage(AGENT_NO::ONE, msgbuf, MAX_BUFF_LEN - DST_COMMAND_HEAD_LEN + 1));
-};
-
-/**
- * @tc.name: msgsendtest_004
- * @tc.desc: Verify the distributed test framework interface SendMessage, constains callback.
- * @tc.type: FUNC
- * @tc.require: AR000CQGMV
- */
-HWTEST_F(DistributeDemo, msgsendtest_004, TestSize.Level0)
-{
- std::string msgBuf = "recall function message test.";
- int ret = SendMessage(AGENT_NO::ONE, msgBuf, MSG_LENGTH,
- [&](const std::string &szreturnbuf, int rlen)->bool {
- std::string szbuf = "I get recall message.";
- EXPECT_TRUE(szbuf == szreturnbuf);
- HiLog::Info(LABEL, "msgsendtest_004 strncmp=%s", szbuf.c_str());
- return true;
- });
- EXPECT_TRUE(ret > 0);
-};
-
-/**
- * @tc.name: runcmdonagent_001
- * @tc.desc: Verify the distributed test framework interface RunCmdOnAgent.
- * @tc.type: FUNC
- * @tc.require: AR000CQGMV
- */
-HWTEST_F(DistributeDemo, runcmdonagent_001, TestSize.Level0)
-{
- std::string command = "query_command";
- std::string cmdArgs = "query a name?";
- std::string expectValue = "111";
- RunCmdOnAgent(AGENT_NO::ONE, command, cmdArgs, expectValue);
- EXPECT_EQ(GetReturnVal(), EXPECT_RETURN_VALUE);
-};
-
-/**
- * @tc.name: runcmdonagent_002
- * @tc.desc: Verify the distributed test framework interface RunCmdOnAgent, Using command map.
- * @tc.type: FUNC
- * @tc.require: AR000CQGMV
- */
-HWTEST_F(DistributeDemo, runcmdonagent_002, TestSize.Level0) {
- std::string command = "add_for_two_int";
- std::string cmdArgs = "200 300";
- std::string expectValue = "500";
- RunCmdOnAgent(AGENT_NO::ONE, command, cmdArgs, expectValue);
- EXPECT_EQ(GetReturnVal(), EXPECT_ADD_TEST_SUM);
-};
-
-/**
- * @tc.name: getkvstore_001
- * @tc.desc: Verify distributed data read and write and synchronization.
- * @tc.type: FUNC
- * @tc.require: AR000CQGMV
- */
-HWTEST_F(DistributeDemo, getkvstore_001, TestSize.Level0) {
- /**
- * @tc.steps: step1.init appkvstore, Get the kvstore pointer for the specified appId and storeId
- */
- static std::shared_ptr manager;
- Options options;
- options.createIfMissing = true;
- options.encrypt = false;
- options.persistant = true;
- std::string appId = "com.ohos.nb.service.user1_test";
- std::string storeId = "student_1";
- manager = AppDistributedKvDataManager::GetInstance(appId, "/data/test");
- std::unique_ptr kvStorePtr;
- Status status = manager->GetKvStore(options, storeId, [&](std::unique_ptr kvStore) {
- kvStorePtr = std::move(kvStore);
- });
- if (!kvStorePtr) {
- HiLog::Error(LABEL, "client get kvStorePtr error.");
- }
-
- ASSERT_TRUE(kvStorePtr != nullptr);
-
- /**
- * @tc.steps: step2.Write specific K and V values to the database
- */
- if (status == Status::SUCCESS) {
- WriteOptions writeOptions;
- writeOptions.local = false;
- Key key("student_name_user1");
- Value value = "good boy.";
- kvStorePtr->Put(writeOptions, key, value);
- }
-
- /**
- * @tc.steps: step3.Synchronize data to a specific remote device
- */
- std::vector deviceIdList;
- deviceIdList.push_back("192.168.43.200");
- std::map sync_map;
- Status syncinfo = kvStorePtr->Sync(deviceIdList, SyncMode::PUSH,
- [&](const std::map &syncMapinfo){
- sync_map = std::move(syncMapinfo);
- });
- if (syncinfo == Status::SUCCESS) {
- HiLog::Info(LABEL, "agent sync success");
- }
-
- /**
- * @tc.steps: step4.Judge if the data is successfully synchronized to the remote device
- */
- int n = 0;
- while (n < SYNC_REC_TIME) {
- std::string id = "";
- for (auto mapstatus: sync_map) {
- HiLog::Info(LABEL, "client map_id==%s", mapstatus.first.c_str());
- if (mapstatus.second == Status::SUCCESS) {
- id = mapstatus.first;
- HiLog::Info(LABEL, "real client Sync success.");
- } else {
- HiLog::Info(LABEL, "mapstatus.second=%d.", (int)mapstatus.second);
- }
- n++;
- }
- if (id != "") {
- break;
- }
- usleep(SLEEP_TIME);
- }
- if (syncinfo == Status::SUCCESS) {
- HiLog::Info(LABEL, "client sync success.");
- }
-
- /**
- * @tc.steps: step5.Query whether the value inserted in the local database is correct
- */
- std::string command = "getkvstore";
- std::string cmdArgs = "student_name_user1";
- std::string expectValue = "good boy.";
- ReadOptions readOptions;
- readOptions.local = false;
- Key key(cmdArgs);
- Value getValue;
- Status getTstatus = kvStorePtr->Get(readOptions, key, getValue);
- if (getTstatus == Status::SUCCESS) {
- HiLog::Info(LABEL, "Get Value SUCCESS, key=%s.", key.ToString().c_str());
- } else {
- HiLog::Error(LABEL, "Get Value Failed.");
- }
-
- /**
- * @tc.steps: step6.Send a command to the remote device to query the database with parameters and
- * expected return values
- */
- RunCmdOnAgent(AGENT_NO::ONE, command, cmdArgs, expectValue);
-
- /**
- * @tc.steps: step7.Judge the return value
- * @tc.expected: step7. The remote device queried the data successfully.
- */
- EXPECT_TRUE(GetReturnVal() == EXPECT_RETURN_VALUE);
-};
-
-int main(int argc, char *argv[])
-{
- g_pDistributetestEnv = new DistributeTestEnvironment("major.desc");
- testing::AddGlobalTestEnvironment(g_pDistributetestEnv);
- testing::GTEST_FLAG(output) = "xml:./";
- testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
\ No newline at end of file
diff --git a/examples/distributedb/test/distributedtest/common/distribute_demo_agent.cpp b/examples/distributedb/test/distributedtest/common/distribute_demo_agent.cpp
deleted file mode 100755
index 95dab2bc559b84e81ae266e7a1548826e1161287..0000000000000000000000000000000000000000
--- a/examples/distributedb/test/distributedtest/common/distribute_demo_agent.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "distributed_agent.h"
-
-#include
-#include
-
-#include "app_types.h"
-#include "refbase.h"
-#include "app_kvstore.h"
-#include "app_distributed_kv_data_manager.h"
-#include "hilog/log.h"
-
-using namespace testing;
-using namespace OHOS;
-using namespace OHOS::DistributeSystemTest;
-using namespace OHOS::HiviewDFX;
-using namespace OHOS::AppDistributedKv;
-
-namespace {
- constexpr HiLogLabel LABEL = {LOG_CORE, 0, "DistributeDemoAgent"};
- std::shared_ptr g_manager;
- std::string g_appId = "com.ohos.nb.service.user1_test";
- std::string g_storeId = "student_1";
- std::unique_ptr g_kvStorePtr;
- const int CMD_LEN = 4;
- const int RETURN_HALF = 2;
- const int MSG_CALL_LEN = 6;
- const int CMD_RETURN_TWO = 111;
-}
-
-class DistributeDemoAgent : public DistributedAgent {
-public:
- DistributeDemoAgent();
- ~DistributeDemoAgent();
-
- virtual bool SetUp();
- virtual bool TearDown();
- virtual int OnProcessMsg(const std::string &strMsg, int len, std::string &strReturnValue, int returnBufLen);
- virtual int OnProcessCmd(const std::string &strCommand, int cmdLen, const std::string &strArgs, int argsLen,
- const std::string &strExpectValue, int expectValueLen);
-
- int GetKvValue(const std::string &strArgs, int argsLen, const std::string &strExpectValue,
- int expectValueLen);
- int AddTwoValue(const std::string &strArgs, int argsLen, const std::string &strExpectValue,
- int expectValueLen);
- int ProcessByUseMap(const std::string &strCommand, int cmdLen, const std::string &strArgs, int argsLen,
- const std::string &strExpectValue, int expectValueLen);
-
-private:
- typedef int (DistributeDemoAgent::*self_func)(const std::string &, int, const std::string &, int);
- std::map cmdFunMap_;
-};
-
-DistributeDemoAgent::DistributeDemoAgent()
-{
-}
-DistributeDemoAgent::~DistributeDemoAgent()
-{
-}
-
-bool DistributeDemoAgent::SetUp()
-{
- /**
- * @tc.setup: Initialize test agent, start data management service
- */
- cmdFunMap_["getkvstore"] = &DistributeDemoAgent::GetKvValue;
- cmdFunMap_["add_for_two_int"] = &DistributeDemoAgent::AddTwoValue;
- g_manager = AppDistributedKvDataManager::GetInstance(g_appId, "/data/test");
- Options options;
- options.createIfMissing = true;
- options.encrypt = false;
- options.persistant = true;
- std::string storeId = g_storeId;
- Status status = g_manager->GetKvStore(options, storeId, [&](std::unique_ptr kvStore) {
- g_kvStorePtr = std::move(kvStore);
- });
- if (status == Status::SUCCESS) {
- return true;
- }
- return false;
-}
-
-bool DistributeDemoAgent::TearDown()
-{
- /**
- * @tc.teardown: Recovery test agent device environment
- */
- return true;
-}
-
-// The entry of handlingthe major test case message
-int DistributeDemoAgent::OnProcessMsg(const std::string &strMsg, int len,
- std::string &strReturnValue, int returnValueLen)
-{
- int nret = 0;
- std::string returnStr = "agent return message.";
- if ((len > CMD_LEN) && (strMsg.find("\0\1\0\1") == 1)) {
- for (int i = 0; i < returnValueLen; i++) {
- strReturnValue += std::to_string((i + 1) % RETURN_HALF);
- }
- nret = returnValueLen;
- } else {
- HiLog::Info(LABEL, "receive message=%s.", strMsg.c_str());
- if (strncmp(strMsg.c_str(), "recall", MSG_CALL_LEN) == 0) {
- returnStr = "I get recall message.";
- int ptrlen = returnStr.size();
- if (ptrlen > returnValueLen) {
- ptrlen = returnValueLen - 1;
- }
- strReturnValue = returnStr;
- nret = ptrlen;
- } else {
- nret = DistributedAgent::OnProcessMsg(strMsg, len, strReturnValue, returnValueLen);
- }
- }
- return nret;
-}
-
-// The entry of handling the major test case command
-int DistributeDemoAgent::OnProcessCmd(const std::string &strCommand, int cmdLen, const std::string &strArgs,
- int argsLen, const std::string &strExpectValue, int expectValueLen)
-{
- if (strCommand == "query_command") {
- if (strArgs == "query a name?") {
- return CMD_RETURN_TWO;
- }
- }
- return DistributeDemoAgent::ProcessByUseMap(strCommand, cmdLen, strArgs, argsLen, strExpectValue, expectValueLen);
-}
-
-// Handling major test case command: getkvstore
-int DistributeDemoAgent::GetKvValue(const std::string &strArgs, int argsLen, const std::string &strExpectValue,
- int expectValueLen)
-{
- if (!g_kvStorePtr || (int)strArgs.length() > argsLen) {
- HiLog::Error(LABEL, "[ohos-test-fm]agent ERROR.");
- return -1;
- }
- ReadOptions readOptions;
- readOptions.local = false;
- Key key(strArgs);
- Value getValue;
- Status status = g_kvStorePtr->Get(readOptions, key, getValue);
- if (status == Status::SUCCESS) {
- HiLog::Info(LABEL, "Get Value SUCCESS, key=%s.", key.ToString().c_str());
- } else {
- HiLog::Error(LABEL, "Get Value Failed.");
- }
- std::vector allEntry;
- Status entryStatus = g_kvStorePtr->GetEntries("", allEntry);
- if (entryStatus == Status::SUCCESS) {
- HiLog::Info(LABEL, "GetEntries SUCCESS.");
- for (auto entry : allEntry) {
- HiLog::Info(LABEL, "GetEntries key= %s.", entry.key.ToString().c_str());
- }
- }
- if (getValue.ToString() == strExpectValue) {
- if (expectValueLen < (int)getValue.ToString().length()) {
- HiLog::Error(LABEL, "[ohos-test-fm]agent end xxx.");
- return -1;
- }
- HiLog::Error(LABEL, "[ohos-test-fm]agent end 200.");
- return CMD_RETURN_TWO;
- }
- return -1;
-}
-
-// Handling major test case command: add_for_two_int
-int DistributeDemoAgent::AddTwoValue(const std::string &strArgs, int argsLen, const std::string &strExpectValue,
- int expectValueLen)
-{
- int val1 = 0;
- int val2 = 0;
- int val3 = 0;
- sscanf_s(strArgs.c_str(), "%d %d", &val1, &val2);
- sscanf_s(strExpectValue.c_str(), "%d", &val3);
- EXPECT_TRUE(val3 == (val1 + val2));
- return val1 + val2;
-}
-
-// Handling major test cases through already registered commands and function mappings
-int DistributeDemoAgent::ProcessByUseMap(const std::string &strCommand, int cmdLen, const std::string &strArgs,
- int argsLen, const std::string &strExpectValue, int expectValueLen)
-{
- std::map::iterator ite = cmdFunMap_.find(strCommand);
- if (ite != cmdFunMap_.end()) {
- self_func callProcCmd = cmdFunMap_[strCommand];
- if (callProcCmd != nullptr) {
- return (this->*callProcCmd)(strArgs, argsLen, strExpectValue, expectValueLen);
- } else {
- return DistributedAgent::OnProcessCmd(strCommand,
- cmdLen,
- strArgs,
- argsLen,
- strExpectValue,
- expectValueLen);
- }
- }
- return -1;
-}
-
-int main()
-{
- // Test agent main function
- DistributeDemoAgent obj;
- if (obj.SetUp()) {
- obj.Start("agent.desc");
- obj.Join();
- } else {
- HiLog::Error(LABEL, "Init environment failed.");
- }
- if (obj.TearDown()) {
- return 0;
- } else {
- HiLog::Error(LABEL, "Clear environment failed.");
- return -1;
- }
-}
\ No newline at end of file
diff --git a/examples/ohos.build b/examples/ohos.build
index 30e0c1a00197e6ed5f90eb987c253fd38482dad1..60c02299ecdd7493c0eef39f2cddef8070936c98 100755
--- a/examples/ohos.build
+++ b/examples/ohos.build
@@ -10,19 +10,7 @@
"test_list": [
"//test/developertest/examples/calculator/test:unittest",
"//test/developertest/examples/detector/test:unittest",
- "//test/developertest/examples/sleep/test:performance",
- "//test/developertest/examples/distributedb/test:distributedtest"
- ]
- },
- "test_subsystem_examples": {
- "module_list": [
- "//test/developertest/examples/string_utils:string_utils_maple_java",
- "//test/developertest/examples/string_utils:string_app_maple_java"
- ],
- "test_list": [
- "//test/developertest/examples/studentmgr/test:unittest",
- "//test/developertest/examples/studentmgr/test:performance",
- "//test/developertest/examples/test/systemtest:systemtest"
+ "//test/developertest/examples/sleep/test:performance"
]
}
}
diff --git a/examples/studentmgr/BUILD.gn b/examples/studentmgr/BUILD.gn
deleted file mode 100755
index 47cfcf04d66bb9b1af7160e5d72cebb76315be0c..0000000000000000000000000000000000000000
--- a/examples/studentmgr/BUILD.gn
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//build/config/ohos/rules.gni")
-
-java_library("studentmgr_java") {
- java_files = [
- "./src/com/ohos/demo/service/Istudent.java",
- "./src/com/ohos/demo/application/StudentMgr.java",
- ]
-}
-
-java_library("calculator_java") {
- java_files = [ "./src/com/ohos/demo/model/Calculator.java" ]
-}
-
-ohos_maple_java("studentmgr_maple_java") {
- deps = [ ":studentmgr_java" ]
- so_name = "studentmgr_maple_java"
- output_dir = "$root_build_dir/subsystem_examples/"
-}
-
-ohos_maple_java("calculator_maple_java") {
- deps = [ ":calculator_java" ]
- so_name = "calculator_maple_java"
- output_dir = "$root_build_dir/subsystem_examples/"
-}
-
-group("studentmgr") {
- deps = [
- ":calculator_maple_java",
- ":studentmgr_maple_java",
- ]
-}
diff --git a/examples/studentmgr/src/com/ohos/demo/application/StudentMgr.java b/examples/studentmgr/src/com/ohos/demo/application/StudentMgr.java
deleted file mode 100755
index fd3f33f756f03c2568d27d7708a63bd3bae5e2f3..0000000000000000000000000000000000000000
--- a/examples/studentmgr/src/com/ohos/demo/application/StudentMgr.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.ohos.demo.application;
-
-import com.ohos.demo.service.Istudent;
-
-
-/**
- * Demo StudentMgr
- */
-public class StudentMgr {
- private Istudent student = null;
-
- /**
- * construction method
- */
- public StudentMgr() {
- }
-
- /**
- * get student Info
- *
- * @apiNote getInfo
- * @return student Info
- */
- public String getInfo() {
- StringBuffer buffer = new StringBuffer(student.getName());
- buffer.append(" ");
- buffer.append(student.getAge());
- buffer.append(" ");
- buffer.append(student.getGrade());
-
- return buffer.toString();
- }
-
- public Istudent getStudent() {
- return student;
- }
-
- public void setStudent(Istudent student) {
- this.student = student;
- }
-}
diff --git a/examples/studentmgr/src/com/ohos/demo/model/Calculator.java b/examples/studentmgr/src/com/ohos/demo/model/Calculator.java
deleted file mode 100755
index 274cab33388d2fdc13e80e17fca75e387244a7be..0000000000000000000000000000000000000000
--- a/examples/studentmgr/src/com/ohos/demo/model/Calculator.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.demo.model;
-
-/**
- * Demo Calculator
- */
-public class Calculator {
- /**
- * construction method
- */
- public Calculator() {
- }
-
- /**
- * add function
- *
- * @apiNote add
- * @param data1 data1
- * @param data2 data2
- * @return the value about "data1 + data2"
- */
- public int add(int data1, int data2) {
- return data1 + data2;
- }
-
- /**
- * sub function
- *
- * @apiNote sub
- * @param data1 data1
- * @param data2 data2
- * @return the value about "data1 - data2"
- */
- public int sub(int data1, int data2) {
- return data1 - data2;
- }
-}
diff --git a/examples/studentmgr/src/com/ohos/demo/service/Istudent.java b/examples/studentmgr/src/com/ohos/demo/service/Istudent.java
deleted file mode 100755
index dbd5df0c5bdeb267e59a7df2c52828b17591c28d..0000000000000000000000000000000000000000
--- a/examples/studentmgr/src/com/ohos/demo/service/Istudent.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.demo.service;
-
-/**
- * Demo IStudent
- */
-public interface Istudent {
- /**
- * getName
- *
- * @apiNote getName
- * @return get Name
- */
- String getName();
-
- /**
- * getAge
- *
- * @apiNote getAge
- * @return get Age
- */
- String getAge();
-
- /**
- * getGrade
- *
- * @apiNote getGrade
- * @return get Grade
- */
- String getGrade();
-}
diff --git a/examples/studentmgr/summator/BUILD.gn b/examples/studentmgr/summator/BUILD.gn
deleted file mode 100755
index 4a3105f9eb3785a7802b778b51f589c77cf757c3..0000000000000000000000000000000000000000
--- a/examples/studentmgr/summator/BUILD.gn
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-group("make_test") {
- testonly = true
- deps = []
-}
diff --git a/examples/studentmgr/summator/include/IParser.h b/examples/studentmgr/summator/include/IParser.h
deleted file mode 100755
index 08fd01456f7f3d8aa83387565c8ed7dc18cadacf..0000000000000000000000000000000000000000
--- a/examples/studentmgr/summator/include/IParser.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef IPARSER_H
-#define IPARSER_H
-
-#include
-
-class IParser {
-public:
- virtual ~IParser() { }
- virtual std::vector parse(const char* str) const = 0;
-};
-
-#endif // IPARSER_H
\ No newline at end of file
diff --git a/examples/studentmgr/summator/include/Summator.h b/examples/studentmgr/summator/include/Summator.h
deleted file mode 100755
index 120c4ec13ce5a05a95cc4ad0d6d851c05ec91e62..0000000000000000000000000000000000000000
--- a/examples/studentmgr/summator/include/Summator.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SUMMATOR_H
-#define SUMMATOR_H
-
-#include "IParser.h"
-
-class Summator {
-public:
- template
- Summator(T& parser);
- int compute(const char* str) const;
-
-private:
- IParser& m_parser;
-};
-
-template
-Summator::Summator(T& parser) : m_parser(parser)
-{
-}
-
-#endif // SUMMATOR_H
\ No newline at end of file
diff --git a/examples/studentmgr/summator/src/Summator.cpp b/examples/studentmgr/summator/src/Summator.cpp
deleted file mode 100755
index 1d5d0f8deb7e6ad523300abe23e41ae66d905f30..0000000000000000000000000000000000000000
--- a/examples/studentmgr/summator/src/Summator.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Summator.h"
-#include "IParser.h"
-
-int Summator::compute(const char* str) const
-{
- if (str == nullptr) {
- return 0;
- }
-
- int sum = 0;
- std::vector arr = m_parser.parse(str);
- for (const auto& el : arr) {
- sum += el;
- }
-
- return sum;
-}
\ No newline at end of file
diff --git a/examples/studentmgr/summator/test/BUILD.gn b/examples/studentmgr/summator/test/BUILD.gn
deleted file mode 100755
index 57e3a6b15d89099ada005ed42348eeadc0b7e7d0..0000000000000000000000000000000000000000
--- a/examples/studentmgr/summator/test/BUILD.gn
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//build/test.gni")
-
-#################################group#########################################
-group("unittest") {
- testonly = true
- deps = []
-
- deps += [ "unittest/common:unittest" ]
-
- if (is_phone_product) {
- deps += [
- # "unittest/phone:unittest",
- ]
- }
-}
-###############################################################################
diff --git a/examples/studentmgr/summator/test/include/ParserMock.h b/examples/studentmgr/summator/test/include/ParserMock.h
deleted file mode 100755
index 92be1f5589b0bdbbe408e042aef7e203196de0ea..0000000000000000000000000000000000000000
--- a/examples/studentmgr/summator/test/include/ParserMock.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef PARSER_MOCK_H
-#define PARSER_MOCK_H
-
-#include "IParser.h"
-#include
-#include
-
-class ParserMock : public IParser {
-public:
- MOCK_CONST_METHOD1(parse, std::vector(const char*));
-};
-
-#endif // PARSER_MOCK_H
\ No newline at end of file
diff --git a/examples/studentmgr/summator/test/unittest/common/BUILD.gn b/examples/studentmgr/summator/test/unittest/common/BUILD.gn
deleted file mode 100755
index 58d169af71893b080e6c40f18fd189b40a677f7a..0000000000000000000000000000000000000000
--- a/examples/studentmgr/summator/test/unittest/common/BUILD.gn
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//build/test.gni")
-
-module_output_path = "subsystem_examples/summator"
-
-###############################################################################
-config("module_private_config") {
- visibility = [ ":*" ]
-
- include_dirs = [
- "../../../include",
- "../../include",
- ]
-}
-
-##############################unittest##########################################
-ohos_unittest("SummatorComputeTest") {
- module_out_path = module_output_path
-
- sources = [
- "../../../include/IParser.h",
- "../../../include/Summator.h",
- "../../../src/Summator.cpp",
- "../../include/ParserMock.h",
- ]
-
- sources += [ "summator_compute_test.cpp" ]
-
- configs = [ ":module_private_config" ]
-
- deps = [
- "//third_party/googletest:gmock",
- "//third_party/googletest:gtest_main",
- ]
-}
-
-###############################################################################
-group("unittest") {
- testonly = true
- deps = []
-
- deps += [
- # deps file
- ":SummatorComputeTest",
- ]
-}
-###############################################################################
diff --git a/examples/studentmgr/summator/test/unittest/common/summator_compute_test.cpp b/examples/studentmgr/summator/test/unittest/common/summator_compute_test.cpp
deleted file mode 100755
index 76d45a041cf1c52b67dbfea48b14ab85c2667790..0000000000000000000000000000000000000000
--- a/examples/studentmgr/summator/test/unittest/common/summator_compute_test.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include
-#include "Summator.h"
-#include "ParserMock.h"
-
-#include
-
-using namespace testing::ext;
-
-
-class SummatorComputeTest : public testing::TestWithParam, int>>
-{
-public:
- SummatorComputeTest() { }
- ~SummatorComputeTest() { }
-};
-
-/**
- * @tc.name: compute_001
- * @tc.desc: Detecting the function of addition.
- * @tc.type: PERF
- * @tc.require: AR000CQGNT
- */
-HWTEST_P(SummatorComputeTest, compute_001, TestSize.Level0)
-{
- ParserMock parser;
- Summator summator(parser);
-
- const char* str = std::get<0>(GetParam());
- std::vector mockRes = std::get<1>(GetParam());
- int result = std::get<2>(GetParam());
-
- EXPECT_CALL(parser, parse(str)).WillOnce(testing::Return(mockRes));
- EXPECT_EQ(result, summator.compute(str));
-}
-
-INSTANTIATE_TEST_CASE_P(ComputeTest, SummatorComputeTest,
- testing::Values(std::tuple, int>("12 -1 14 78", { 12, -1, 14, 78 }, 103),
- std::tuple, int>("0 0 0 0", { 0, 0, 0, 0 }, 0),
- std::tuple, int>("1 2 3 4", { 1, 2, 3, 4 }, 10),
- std::tuple, int>("", { }, 0),
- std::tuple, int>("10 10 85", { 10, 10, 85}, 105),
- std::tuple, int>("-1 1 -1 1", { -1, 1, -1, 1 }, 0)));
-
diff --git a/examples/studentmgr/test/BUILD.gn b/examples/studentmgr/test/BUILD.gn
deleted file mode 100755
index 49331a709ba1e0bc7be2b545bc570ed81cb67184..0000000000000000000000000000000000000000
--- a/examples/studentmgr/test/BUILD.gn
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//build/test.gni")
-
-###############################################################################
-group("unittest") {
- testonly = true
- deps = [
- "../summator/test:unittest",
- "unittest:unittest",
- ]
-}
-
-group("performance") {
- testonly = true
- deps = [ "performance:performance" ]
-}
diff --git a/examples/studentmgr/test/performance/BUILD.gn b/examples/studentmgr/test/performance/BUILD.gn
deleted file mode 100755
index 8021b0916e768b5b225783e8b582b2ec67fb498b..0000000000000000000000000000000000000000
--- a/examples/studentmgr/test/performance/BUILD.gn
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//build/test.gni")
-
-module_output_path = "test_subsystem_examples/studentmgr/submodule"
-
-###############################################################################
-ohos_java_performancetest("perf_test_dex_java_maple") {
- java_files = [ "./src/com/ohos/demo/test/model/PerformanceTest.java" ]
- deps = [ "//test/developertest/examples/studentmgr:calculator_java" ]
-
- sub_output_dir = module_output_path
-}
-
-ohos_java_performancetest("perf_test_no_config_app_java_maple") {
- test_as_app = true
- sub_output_dir = module_output_path
-
- java_files = [ "./src/com/ohos/demo/test/model/PerformanceTest.java" ]
-
- deps = [
- "//test/developertest/examples/studentmgr:calculator_java",
-
- # customize hap ability
- "//test/developertest/adapter/examples/studentmgr/test/common/main/java:test_customize_hap_ability_java",
-
- # common from test subsystem
- "//test/developertest/libs/jtr/main/java:test_app_executor_java",
- ]
-
- hap_profile = "//test/developertest/adapter/examples/studentmgr/test/common/main/java/config.json"
-
- entry_app_dep = [ "//test/developertest/adapter/examples/studentmgr/test/common/shell/java:customize_shell_app" ]
-}
-
-group("performance") {
- testonly = true
- deps = [
- ":perf_test_dex_java_maple",
- ":perf_test_no_config_app_java_maple",
- ]
-}
diff --git a/examples/studentmgr/test/performance/src/com/ohos/demo/test/model/PerformanceTest.java b/examples/studentmgr/test/performance/src/com/ohos/demo/test/model/PerformanceTest.java
deleted file mode 100755
index b148f14fbc3f3d96f25cfd498c66d02ffa9f0500..0000000000000000000000000000000000000000
--- a/examples/studentmgr/test/performance/src/com/ohos/demo/test/model/PerformanceTest.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.demo.test.model;
-
-import com.ohos.demo.model.Calculator;
-import ohos.unittest.perf.BaseLine;
-import ohos.unittest.perf.PerfVerify;
-import ohos.unittest.log.Logger;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import ohos.unittest.CaseLevel;
-import ohos.unittest.CaseType;
-import ohos.unittest.Level;
-import ohos.unittest.Type;
-import ohos.unittest.TestTarget;
-
-import java.util.Locale;
-
-/**
- * 〈PerformanceTest〉
- */
-public class PerformanceTest {
- private static BaseLine baseLine = null;
-
- /**
- * Calculator instance
- */
- private Calculator instance = new Calculator();
-
- /**
- * beforeClass
- *
- * @apiNote beforeClass
- * @throws Exception beforeClass Exception
- */
- @BeforeClass
- public static void beforeClass() throws Exception {
- String baseLineConfigFile = "/data/test/perftimetest.xml";
- baseLine = new BaseLine(baseLineConfigFile);
- }
-
- /**
- * afterClass
- *
- * @apiNote afterClass
- * @throws Exception afterClass Exception
- */
- @AfterClass
- public static void afterClass() throws Exception {
- }
-
- /**
- * before
- *
- * @apiNote before
- * @throws Exception before Exception
- */
- @Before
- public void before() throws Exception {
- }
-
- /**
- * after
- *
- * @apiNote after
- * @throws Exception after Exception
- */
- @After
- public void after() throws Exception {
- }
-
- /**
- * testSub1
- */
- @Test
- @CaseType(type = Type.SECU)
- @CaseLevel(level = Level.LEVEL_0)
- public void testSub1() {
- PerfVerify verify = new PerfVerify(baseLine, 1);
- long startTime = System.currentTimeMillis();
-
- int cyclesNumber = 100;
- for (int time = 0; time <= cyclesNumber; time++) {
- Assert.assertEquals(80, instance.sub(100, 20));
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- Logger.info(String.format(Locale.ROOT, "InterruptedException: %s", e.getMessage()));
- }
- }
-
- long endTime = System.currentTimeMillis();
- double spentTime = (endTime - startTime) / cyclesNumber;
- verify.expectSmaller(spentTime);
- }
-
- /**
- * testSub2
- */
- @Test
- @CaseType(type = Type.SECU)
- @CaseLevel(level = Level.LEVEL_1)
- public void testSub2() {
- PerfVerify verify = new PerfVerify(baseLine, 1);
- long startTime = System.currentTimeMillis();
-
- int cyclesNumber = 100;
- for (int time = 0; time <= cyclesNumber; time++) {
- Assert.assertEquals(40, instance.sub(60, 20));
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- Logger.info(String.format(Locale.ROOT, "InterruptedException: %s", e.getMessage()));
- }
- }
-
- long endTime = System.currentTimeMillis();
- double spentTime = (endTime - startTime) / cyclesNumber;
- verify.expectLarger(spentTime);
- }
-
- /**
- * testSub3
- */
- @Test
- @CaseType(type = Type.SECU)
- @CaseLevel(level = Level.LEVEL_2)
- public void testSub3() {
- PerfVerify verify = new PerfVerify(baseLine, 1);
- long startTime = System.currentTimeMillis();
-
- int cyclesNumber = 100;
- for (int time = 0; time <= cyclesNumber; time++) {
- Assert.assertEquals(-20, instance.sub(0, 20));
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- Logger.info(String.format(Locale.ROOT, "InterruptedException: %s", e.getMessage()));
- }
- }
-
- long endTime = System.currentTimeMillis();
- double spentTime = (endTime - startTime) / cyclesNumber;
- verify.expectSmaller(spentTime);
- }
-
- /**
- * testAddAndSub
- */
- @Test
- @CaseType(type = Type.SECU)
- @CaseLevel(level = Level.LEVEL_3)
- @TestTarget(className = "com.ohos.demo.model.Calculator", methodName = "public int sub(int data1, int data2)")
- public void testAddAndSub() {
- PerfVerify verify = new PerfVerify(baseLine, 1);
- long startTime = System.currentTimeMillis();
-
- int cyclesNumber = 50;
- for (int time = 0; time <= cyclesNumber; time++) {
- Assert.assertEquals(80, instance.sub(100, 20));
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- Logger.info(String.format(Locale.ROOT, "InterruptedException: %s", e.getMessage()));
- }
- }
-
- long endTime = System.currentTimeMillis();
- double spentTime = (endTime - startTime) / cyclesNumber;
- verify.expectLarger(spentTime);
- }
-
- /**
- * testAdd5
- */
- @Test
- @CaseType(type = Type.SECU)
- @CaseLevel(level = Level.LEVEL_4)
- @TestTarget(className = "com.ohos.demo.model.Calculator", methodName = "public int add(int data1, int data2)")
- public void testAdd() {
- PerfVerify verify = new PerfVerify(baseLine, 1);
- long startTime = System.currentTimeMillis();
-
- int cyclesNumber = 50;
- for (int time = 0; time <= cyclesNumber; time++) {
- Assert.assertEquals(50, instance.add(30, 20));
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- Logger.info(String.format(Locale.ROOT, "InterruptedException: %s", e.getMessage()));
- }
- }
-
- long endTime = System.currentTimeMillis();
- double spentTime = (endTime - startTime) / cyclesNumber;
- verify.expectLarger(spentTime);
- }
-}
diff --git a/examples/studentmgr/test/unittest/BUILD.gn b/examples/studentmgr/test/unittest/BUILD.gn
deleted file mode 100755
index 382c615b61a06543b16c973b2258e3f4666bee3d..0000000000000000000000000000000000000000
--- a/examples/studentmgr/test/unittest/BUILD.gn
+++ /dev/null
@@ -1,92 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//build/test.gni")
-
-module_output_path = "test_subsystem_examples/studentmgr"
-
-###############################################################################
-
-ohos_resources("hap_res") {
- resource_dirs = [ "//test/developertest/adapter/examples/studentmgr/test/common/main/java/resources" ]
- custom_package = "ohos.zunit"
- hap_profile = "//test/developertest/adapter/examples/studentmgr/test/common/main/java/config.json"
-}
-
-ohos_java_unittest("test_studentmgr_dex_java_maple") {
- java_files =
- [ "./src/com/ohos/demo/test/service/EasyMockStudentMgrTest.java" ]
- deps = [
- "//test/developertest/examples/studentmgr:studentmgr_java",
- "//test/developertest/libs/jtr/common/java:unittest_utils_parts_java",
- ]
- sub_output_dir = module_output_path
-}
-
-ohos_java_unittest("test_studentmgr_app_java_maple") {
- test_as_app = true
- sub_output_dir = module_output_path
-
- # Test files
- java_files =
- [ "./src/com/ohos/demo/test/service/EasyMockStudentMgrTest.java" ]
-
- deps = [
- ":hap_res",
- "//test/developertest/examples/studentmgr:studentmgr_java",
-
- # customize hap ability
- "//test/developertest/adapter/examples/studentmgr/test/common/main/java:test_customize_hap_ability_java",
-
- # common from test subsystem
- "//test/developertest/libs/jtr/common/java:base_test_framework_java",
- ]
- hap_profile = "//test/developertest/adapter/examples/studentmgr/test/common/main/java/config.json"
- entry_app_dep = [ "//test/developertest/adapter/examples/studentmgr/test/common/shell/java:customize_shell_app" ]
-}
-
-ohos_java_unittest("test_calculator_app_java_maple") {
- test_as_app = true
- sub_output_dir = module_output_path
- java_files = [
- "./src/com/ohos/demo/test/model/CalculatorTest.java",
- "./src/com/ohos/demo/test/BaseJunit.java",
- ]
-
- deps = [
- ":hap_res",
- "//test/developertest/examples/studentmgr:calculator_java",
-
- # customize hap ability
- "//test/developertest/adapter/examples/studentmgr/test/common/main/java:test_customize_hap_ability_java",
-
- # common from test subsystem
- "//test/developertest/libs/jtr/main/java:test_app_executor_java",
- ]
-
- external_deps = [ "ability:abilitykit_java" ]
-
- external_deps += [ "ability:abilitykit_java_maple" ]
-
- hap_profile = "//test/developertest/adapter/examples/studentmgr/test/common/main/java/config.json"
- entry_app_dep = [ "//test/developertest/adapter/examples/studentmgr/test/common/shell/java:customize_shell_app" ]
-}
-
-group("unittest") {
- testonly = true
- deps = [
- ":test_calculator_app_java_maple",
- ":test_studentmgr_app_java_maple",
- ":test_studentmgr_dex_java_maple",
- ]
-}
diff --git a/examples/studentmgr/test/unittest/src/com/ohos/demo/test/BaseJunit.java b/examples/studentmgr/test/unittest/src/com/ohos/demo/test/BaseJunit.java
deleted file mode 100755
index 5d065ee461e143f7c13d2738ee31b25fef4d8f6f..0000000000000000000000000000000000000000
--- a/examples/studentmgr/test/unittest/src/com/ohos/demo/test/BaseJunit.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.demo.test;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-/**
- * Demo BaseJunit
- */
-public class BaseJunit {
- /**
- * beforeClass
- *
- * @apiNote beforeClass
- * @throws Exception beforeClass Exception
- */
- @BeforeClass
- public static void beforeClass() throws Exception {
- }
-
- /**
- * afterClass
- *
- * @apiNote afterClass
- * @throws Exception afterClass Exception
- */
- @AfterClass
- public static void afterClass() throws Exception {
- }
-
- /**
- * before
- *
- * @apiNote before
- * @throws Exception before Exception
- */
- @Before
- public void before() throws Exception {
- }
-
- /**
- * after
- *
- * @apiNote after
- * @throws Exception after Exception
- */
- @After
- public void after() throws Exception {
- }
-}
diff --git a/examples/studentmgr/test/unittest/src/com/ohos/demo/test/model/CalculatorTest.java b/examples/studentmgr/test/unittest/src/com/ohos/demo/test/model/CalculatorTest.java
deleted file mode 100755
index f087f98e985178a2ddca81a290316b702907fe9e..0000000000000000000000000000000000000000
--- a/examples/studentmgr/test/unittest/src/com/ohos/demo/test/model/CalculatorTest.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.ohos.demo.test.model;
-
-import org.junit.Assert;
-import org.junit.Test;
-import com.ohos.demo.model.Calculator;
-import com.ohos.demo.test.BaseJunit;
-import ohos.unittest.AppContext;
-import ohos.unittest.log.Logger;
-import ohos.unittest.CaseLevel;
-import ohos.unittest.CaseType;
-import ohos.unittest.Level;
-import ohos.unittest.Type;
-
-/**
- * Demo CalculatorTest
- */
-public class CalculatorTest extends BaseJunit {
- /**
- * test data 180
- */
- private static final int DATA_180 = 180;
-
- /**
- * test data 900
- */
- private static final int DATA_900 = 900;
-
- /**
- * test data 40
- */
- private static final int DATA_40 = 40;
-
- /**
- * test data 30
- */
- private static final int DATA_30 = 30;
-
- /**
- * test data 80
- */
- private static final int DATA_80 = 80;
-
- /**
- * test data 10
- */
- private static final int DATA_10 = 10;
-
- /**
- * test data 450
- */
- private static final int DATA_450 = 450;
-
- /**
- * test data 200
- */
- private static final int DATA_200 = 200;
-
- /**
- * test data 100
- */
- private static final int DATA_100 = 100;
-
- /**
- * test data 20
- */
- private static final int DATA_20 = 20;
-
- /**
- * Calculator instance
- */
- private Calculator instance = new Calculator();
-
- /**
- * construction method
- */
- public CalculatorTest() {
- }
-
- /**
- * testAdd0
- */
- @Test
- @CaseType(type = Type.FUNC)
- @CaseLevel(level = Level.LEVEL_0)
- public void testAdd0() {
- Assert.assertEquals(DATA_30, instance.add(DATA_10, DATA_20));
- }
-
- /**
- * testAdd1
- */
- @Test
- @CaseType(type = Type.PERF)
- @CaseLevel(level = Level.LEVEL_1)
- public void testAdd1() {
- Assert.assertEquals(DATA_40, instance.add(DATA_20, DATA_20));
- }
-
- /**
- * testAdd2
- */
- @Test
- @CaseType(type = Type.RELI)
- @CaseLevel(level = Level.LEVEL_2)
- public void testAdd2() {
- Assert.assertEquals(DATA_900, instance.add(DATA_450, DATA_450));
- }
-
- /**
- * testAdd3
- */
- @Test
- @CaseType(type = Type.RELI)
- @CaseLevel(level = Level.LEVEL_2)
- public void testAdd3() {
- Assert.assertEquals(DATA_180, instance.add(DATA_450, DATA_450));
- }
-
- /**
- * testSub3
- */
- @Test
- @CaseType(type = Type.COMP)
- @CaseLevel(level = Level.LEVEL_3)
- public void testSub3() {
- if (AppContext.getInstance().getCurrentActivity() != null) {
- Logger.info("AppContext.getInstance().getCurrentActivity()!=null");
- } else {
- Logger.info("AppContext.getInstance().getCurrentActivity()==null");
- }
- Assert.assertTrue(AppContext.getInstance().getCurrentActivity() != null);
-
- if (AppContext.getInstance().getCurrentAbility() != null) {
- Logger.info("AppContext.getInstance().getCurrentAbility()!=null");
- } else {
- Logger.info("AppContext.getInstance().getCurrentAbility()==null");
- }
- Assert.assertTrue(AppContext.getInstance().getCurrentAbility() != null);
-
- Assert.assertEquals(-DATA_10, instance.sub(DATA_10, DATA_20));
- }
-
- /**
- * testSub4
- */
- @Test
- @CaseType(type = Type.USAB)
- @CaseLevel(level = Level.LEVEL_4)
- public void testSub4() {
- Assert.assertEquals(DATA_80, instance.sub(DATA_100, DATA_20));
- }
-
- /**
- * testSub5
- */
- @Test
- @CaseType(type = Type.SERV)
- @CaseLevel(level = Level.LEVEL_4)
- public void testSub5() {
- Assert.assertEquals(-DATA_100, instance.sub(DATA_100, DATA_200));
- }
-
- /**
- * testSub6
- */
- @Test
- @CaseType(type = Type.SECU)
- @CaseLevel(level = Level.LEVEL_4)
- public void testSub6() {
- Assert.assertEquals(DATA_180, instance.sub(DATA_200, DATA_20));
- }
-}
diff --git a/examples/studentmgr/test/unittest/src/com/ohos/demo/test/service/EasyMockStudentMgrTest.java b/examples/studentmgr/test/unittest/src/com/ohos/demo/test/service/EasyMockStudentMgrTest.java
deleted file mode 100755
index c806559cbb4069e014c34c7fc3df57ab693fd73b..0000000000000000000000000000000000000000
--- a/examples/studentmgr/test/unittest/src/com/ohos/demo/test/service/EasyMockStudentMgrTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.ohos.demo.test.service;
-
-import com.ohos.demo.application.StudentMgr;
-import com.ohos.demo.service.Istudent;
-
-import ohos.unittest.CaseLevel;
-import ohos.unittest.CaseType;
-import ohos.unittest.Level;
-import ohos.unittest.Type;
-
-import org.easymock.EasyMock;
-
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-
-
-/**
- * Demo EasyMockStudentMgrTest
- */
-public class EasyMockStudentMgrTest {
- /**
- * @tc.name: testGetInfo
- * @tc.desc: Test of obtaining stub information.
- * @tc.type: FUNC
- * @tc.require: AR00000000 SR00000000
- */
- @Test
- @CaseType(type = Type.FUNC)
- @CaseLevel(level = Level.LEVEL_1)
- public void testGetInfo() {
- // 1. use easymock create mock object
- Istudent student = EasyMock.createMock(Istudent.class);
-
- // 2. set expected behavior and output for mock object
- EasyMock.expect(student.getName()).andReturn("ZhangSan").times(1);
- EasyMock.expect(student.getAge()).andReturn("Nine").times(1);
- EasyMock.expect(student.getGrade()).andReturn("Grade3").times(1);
-
- // 3. switch replay status for mock object
- EasyMock.replay(student);
-
- // 4. execute unit test by mock method
- StudentMgr studentMgr = new StudentMgr();
- studentMgr.setStudent(student);
-
- String getStr = studentMgr.getInfo();
-
- // 5. validate action of mock object
- String cstr = "ZhangSan Nine Grade3";
- Assert.assertEquals(getStr, cstr);
- EasyMock.verify(student);
- }
-
- /**
- * @tc.name: testGetInfo1
- * @tc.desc: Test of obtaining stub information.
- * @tc.type: FUNC
- * @tc.require: AR00000000 SR00000000
- */
- @Test
- @CaseType(type = Type.FUNC)
- @CaseLevel(level = Level.LEVEL_1)
- public void testGetInfo1() {
- // 1. use easymock create mock object
- Istudent student = EasyMock.createMock(Istudent.class);
-
- // 2. set expected behavior and output for mock object
- EasyMock.expect(student.getName()).andReturn("Lisi").times(1);
- EasyMock.expect(student.getAge()).andReturn("Nine").times(1);
- EasyMock.expect(student.getGrade()).andReturn("Grade3").times(1);
-
- // 3. switch replay status for mock object
- EasyMock.replay(student);
-
- // 4. execute unit test by mock method
- StudentMgr studentMgr = new StudentMgr();
- studentMgr.setStudent(student);
-
- String getStr = studentMgr.getInfo();
-
- // 5. validate action of mock object
- String cstr = "Lisi Nine Grade3";
- Assert.assertEquals(getStr, cstr);
- EasyMock.verify(student);
- }
-
- /**
- * @tc.name: testGetInfo2
- * @tc.desc: Test of obtaining stub information.
- * @tc.type: FUNC
- * @tc.require: AR00000000 SR00000000
- */
- @Test
- @CaseType(type = Type.FUNC)
- @CaseLevel(level = Level.LEVEL_1)
- public void testGetInfo2() {
- // 1. use easymock create mock object
- Istudent student = EasyMock.createMock(Istudent.class);
-
- // 2. set expected behavior and output for mock object
- EasyMock.expect(student.getName()).andReturn("Lisi").times(1);
- EasyMock.expect(student.getAge()).andReturn("Nine").times(1);
- EasyMock.expect(student.getGrade()).andReturn("Grade3").times(1);
-
- // 3. switch replay status for mock object
- EasyMock.replay(student);
-
- // 4. execute unit test by mock method
- StudentMgr studentMgr = new StudentMgr();
- studentMgr.setStudent(student);
-
- String getStr = studentMgr.getInfo();
-
- // 5. validate action of mock object
- String cstr = "Lisi Nine Grade3 false";
- Assert.assertEquals(getStr, cstr);
- EasyMock.verify(student);
- }
-
- /**
- * @tc.name: testGetInfoIgnore
- * @tc.desc: Test of obtaining stub information.
- * @tc.type: FUNC
- * @tc.require: AR00000000 SR00000000
- */
- @Test
- @Ignore
- @CaseType(type = Type.FUNC)
- @CaseLevel(level = Level.LEVEL_1)
- public void testGetInfoIgnore() {
- // 1. use easymock create mock object
- Istudent student = EasyMock.createMock(Istudent.class);
-
- // 2. set expected behavior and output for mock object
- EasyMock.expect(student.getName()).andReturn("ZhangSan2").times(1);
- EasyMock.expect(student.getAge()).andReturn("Nine").times(1);
- EasyMock.expect(student.getGrade()).andReturn("Grade3").times(1);
-
- // 3. switch replay status for mock object
- EasyMock.replay(student);
-
- // 4. execute unit test by mock method
- StudentMgr studentMgr = new StudentMgr();
- studentMgr.setStudent(student);
-
- String getStr = studentMgr.getInfo();
-
- // 5. validate action of mock object
- String cstr = "ZhangSan2 Nine Grade3";
- Assert.assertEquals(getStr, cstr);
- EasyMock.verify(student);
- }
-}
diff --git a/examples/test/resource/studentmgr/ohos_test.xml b/examples/test/resource/studentmgr/ohos_test.xml
deleted file mode 100755
index 9ea1ae5dd8ed221996b595742a985ecebe7f7422..0000000000000000000000000000000000000000
--- a/examples/test/resource/studentmgr/ohos_test.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/examples/test/resource/studentmgr/perftimetest/perftimetest.xml b/examples/test/resource/studentmgr/perftimetest/perftimetest.xml
deleted file mode 100755
index 4187176f76b145c360346dfc6dc4709556219765..0000000000000000000000000000000000000000
--- a/examples/test/resource/studentmgr/perftimetest/perftimetest.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/examples/test/systemtest/BUILD.gn b/examples/test/systemtest/BUILD.gn
deleted file mode 100755
index 90f177eb1d0ca0450319226ce9752dba3252f852..0000000000000000000000000000000000000000
--- a/examples/test/systemtest/BUILD.gn
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//build/test.gni")
-
-group("systemtest") {
- testonly = true
- deps = [ "common:systemtest" ]
-}
diff --git a/examples/test/systemtest/common/BUILD.gn b/examples/test/systemtest/common/BUILD.gn
deleted file mode 100755
index ca35304ed138e0e0bd30ed82cd146ae7b240ac76..0000000000000000000000000000000000000000
--- a/examples/test/systemtest/common/BUILD.gn
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//build/test.gni")
-
-group("systemtest") {
- testonly = true
- deps = [ "scenes_common:systemtest" ]
-}
diff --git a/examples/test/systemtest/common/scenes_common/BUILD.gn b/examples/test/systemtest/common/scenes_common/BUILD.gn
deleted file mode 100755
index 6b2c573c72046116b39169bb9ba6f9001a1da87b..0000000000000000000000000000000000000000
--- a/examples/test/systemtest/common/scenes_common/BUILD.gn
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("//build/test.gni")
-
-group("systemtest") {
- testonly = true
- deps = [ "//test/developertest/adapter/examples/test/systemtest/common/scenes_common/AbilityDelegatorSt:systemtest" ]
-}
diff --git a/libs/jtr/main/java/BUILD.gn b/libs/jtr/main/java/BUILD.gn
index 3b2b8c41f9f6a05c388607a1c9f9b395c58e4cdb..db55e803fe1202933eb05b1cd4f4b2848892607b 100755
--- a/libs/jtr/main/java/BUILD.gn
+++ b/libs/jtr/main/java/BUILD.gn
@@ -14,8 +14,6 @@
import("//build/config/ohos/rules.gni")
java_library("test_app_executor_java") {
- emma_never_instrument = true
- java_files = [ "//test/developertest/adapter/libs/jtr/main/java/src/ohos/unittest/TestAbility.java" ]
final_jar_path = "$root_out_dir/test_platform/libs/test_app_executor_java.jar"
aosp_deps = [ "maple:framework" ]
deps = [
diff --git a/libs/jtr/shell/java/BUILD.gn b/libs/jtr/shell/java/BUILD.gn
index bea7e942d9de8ad7d8b0bfa41e6bbe8a6297d723..c617fed07e4535567deef269f891f0b06e34c5a3 100755
--- a/libs/jtr/shell/java/BUILD.gn
+++ b/libs/jtr/shell/java/BUILD.gn
@@ -16,7 +16,6 @@ import("//build/config/ohos/rules.gni")
java_library("test_app_shell_context_java") {
emma_never_instrument = true
java_files = [
- "//test/developertest/adapter/libs/jtr/shell/java/src/ohos/unittest/AppContext.java",
"//test/developertest/libs/jtr/shell/java/src/ohos/unittest/log/HiLogUtil.java",
]
final_jar_path =
diff --git a/src/core/driver/drivers.py b/src/core/driver/drivers.py
deleted file mode 100755
index a42f8cab706b95e4748895d1a3603357a7502fd5..0000000000000000000000000000000000000000
--- a/src/core/driver/drivers.py
+++ /dev/null
@@ -1,1096 +0,0 @@
-#!/usr/bin/env python3
-# coding=utf-8
-
-#
-# Copyright (c) 2020 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 os
-import time
-import platform
-import json
-import shutil
-import zipfile
-import tempfile
-from dataclasses import dataclass
-
-
-from xdevice import DeviceTestType
-from xdevice import DeviceLabelType
-from xdevice import ExecuteTerminate
-from xdevice import DeviceError
-
-from xdevice import IDriver
-from xdevice import platform_logger
-from xdevice import Plugin
-from core.utils import get_decode
-from core.config.resource_manager import ResourceManager
-
-
-__all__ = [
- "CppTestDriver",
- "DexTestDriver",
- "HapTestDriver",
- "disable_keyguard",
- "GTestConst"]
-
-LOG = platform_logger("Drivers")
-DEFAULT_TEST_PATH = "/%s/%s/" % ("data", "test")
-
-TIME_OUT = 900 * 1000
-
-
-##############################################################################
-##############################################################################
-
-
-class DisplayOutputReceiver:
- def __init__(self):
- self.output = ""
- self.unfinished_line = ""
-
- def _process_output(self, output, end_mark="\n"):
- content = output
- if self.unfinished_line:
- content = "".join((self.unfinished_line, content))
- self.unfinished_line = ""
- lines = content.split(end_mark)
- if content.endswith(end_mark):
- return lines[:-1]
- else:
- self.unfinished_line = lines[-1]
- return lines[:-1]
-
- def __read__(self, output):
- self.output = "%s%s" % (self.output, output)
- lines = self._process_output(output)
- for line in lines:
- line = line.strip()
- if line:
- LOG.info(get_decode(line))
-
- def __error__(self, message):
- pass
-
- def __done__(self, result_code="", message=""):
- pass
-
-
-@dataclass
-class GTestConst(object):
- exec_para_filter = "--gtest_filter"
- exec_para_level = "--gtest_testsize"
-
-
-@dataclass
-class ZunitConst(object):
- z_unit_app = "ohos.unittest.App"
- output_dir = "OUTPUT_DIR="
- output_file = "OUTPUT_FILE="
- test_class = "TEST_CLASS="
- exec_class = "EXEC_CLASS="
- exec_method = "EXEC_METHOD="
- exec_level = "EXEC_LEVEL="
- coverage_flag = "COVERAGE_FLAG=1"
- jtest_status_filename = "jtest_status.txt"
- remote_command_dir = "commandtmp"
-
-
-def get_device_log_file(report_path, serial=None, log_name="device_log"):
- from xdevice import Variables
- log_path = os.path.join(report_path, Variables.report_vars.log_dir)
- os.makedirs(log_path, exist_ok=True)
-
- serial = serial or time.time_ns()
- device_file_name = "{}_{}.log".format(log_name, serial)
- device_log_file = os.path.join(log_path, device_file_name)
- return device_log_file
-
-
-def get_level_para_string(level_string):
- level_list = list(set(level_string.split(",")))
- level_para_string = ""
- for item in level_list:
- if not item.isdigit():
- continue
- item = item.strip(" ")
- level_para_string += ("Level%s," % item)
- level_para_string = level_para_string.strip(",")
- return level_para_string
-
-
-def get_execute_java_test_files(suite_file):
- java_test_file = ""
- test_info_file = suite_file[:suite_file.rfind(".")] + ".info"
- if not os.path.exists(test_info_file):
- return java_test_file
- try:
- with open(test_info_file, "r") as file_desc:
- lines = file_desc.readlines()
- for line in lines:
- class_name, _ = line.split(',', 1)
- class_name = class_name.strip()
- if not class_name.endswith("Test"):
- continue
- java_test_file += class_name + ","
- except(IOError, ValueError) as err_msg:
- LOG.exception("Error to read info file: ", err_msg)
- if java_test_file != "":
- java_test_file = java_test_file[:-1]
- return java_test_file
-
-
-def get_java_test_para(testcase, testlevel):
- exec_class = "*"
- exec_method = "*"
- exec_level = ""
-
- if "" != testcase and "" == testlevel:
- pos = testcase.rfind(".")
- if pos != -1:
- exec_class = testcase[0:pos]
- exec_method = testcase[pos + 1:]
- exec_level = ""
- else:
- exec_class = "*"
- exec_method = testcase
- exec_level = ""
- elif "" == testcase and "" != testlevel:
- exec_class = "*"
- exec_method = "*"
- exec_level = get_level_para_string(testlevel)
-
- return exec_class, exec_method, exec_level
-
-
-def get_result_savepath(testsuit_path, result_rootpath):
- findkey = os.sep + "tests" + os.sep
- filedir, _ = os.path.split(testsuit_path)
- pos = filedir.find(findkey)
- if -1 != pos:
- subpath = filedir[pos + len(findkey):]
- pos1 = subpath.find(os.sep)
- if -1 != pos1:
- subpath = subpath[pos1 + len(os.sep):]
- result_path = os.path.join(result_rootpath, "result", subpath)
- else:
- result_path = os.path.join(result_rootpath, "result")
- else:
- result_path = os.path.join(result_rootpath, "result")
-
- if not os.path.exists(result_path):
- os.makedirs(result_path)
-
- LOG.info("result_savepath = " + result_path)
- return result_path
-
-
-# all testsuit common Unavailable test result xml
-def _create_empty_result_file(filepath, filename, error_message):
- error_message = str(error_message)
- error_message = error_message.replace("\"", "")
- error_message = error_message.replace("<", "")
- error_message = error_message.replace(">", "")
- error_message = error_message.replace("&", "")
- if filename.endswith(".hap"):
- filename = filename.split(".")[0]
- if not os.path.exists(filepath):
- with open(filepath, "w", encoding='utf-8') as file_desc:
- time_stamp = time.strftime("%Y-%m-%d %H:%M:%S",
- time.localtime())
- file_desc.write('\n')
- file_desc.write(
- '\n' % time_stamp)
- file_desc.write(
- ' \n' %
- (filename, error_message))
- file_desc.write(' \n')
- file_desc.write('\n')
- return
-
-
-def _unlock_screen(device):
- device.execute_shell_command("svc power stayon true")
- time.sleep(1)
-
-
-def _unlock_device(device):
- device.execute_shell_command("input keyevent 82")
- time.sleep(1)
- device.execute_shell_command("wm dismiss-keyguard")
- time.sleep(1)
-
-
-def _lock_screen(device):
- device.execute_shell_command("svc power stayon false")
- time.sleep(1)
-
-
-def disable_keyguard(device):
- _unlock_screen(device)
- _unlock_device(device)
-
-
-def _sleep_according_to_result(result):
- if result:
- time.sleep(1)
-
-
-##############################################################################
-##############################################################################
-
-class ResultManager(object):
- def __init__(self, testsuit_path, config):
- self.testsuite_path = testsuit_path
- self.config = config
- self.result_rootpath = self.config.report_path
- self.device = self.config.device
- if testsuit_path.endswith(".hap"):
- self.device_testpath = self.config.test_hap_out_path
- else:
- self.device_testpath = self.config.target_test_path
- self.testsuite_name = os.path.basename(self.testsuite_path)
- self.is_coverage = False
-
- def set_is_coverage(self, is_coverage):
- self.is_coverage = is_coverage
-
- def get_test_results(self, error_message=""):
- # Get test result files
- filepath = self.obtain_test_result_file()
- if not os.path.exists(filepath):
- _create_empty_result_file(filepath, self.testsuite_name,
- error_message)
- if "benchmark" == self.config.testtype[0]:
- if self.device.is_directory(
- os.path.join(self.device_testpath, "benchmark")):
- self._obtain_benchmark_result()
- # Get coverage data files
- if self.is_coverage:
- self.obtain_coverage_data()
-
- return filepath
-
- def _obtain_benchmark_result(self):
- benchmark_root_dir = os.path.abspath(
- os.path.join(self.result_rootpath, "benchmark"))
- benchmark_dir = os.path.abspath(
- os.path.join(benchmark_root_dir,
- self.get_result_sub_save_path(),
- self.testsuite_name))
-
- if not os.path.exists(benchmark_dir):
- os.makedirs(benchmark_dir)
-
- print("benchmark_dir =%s", benchmark_dir)
- if not self.device.pull_file(
- os.path.join(self.device_testpath, "benchmark"),
- benchmark_dir):
- os.rmdir(benchmark_dir)
- return benchmark_dir
-
- def get_result_sub_save_path(self):
- find_key = os.sep + "tests" + os.sep
- file_dir, _ = os.path.split(self.testsuite_path)
- pos = file_dir.find(find_key)
- subpath = ""
- if -1 != pos:
- subpath = file_dir[pos + len(find_key):]
- pos1 = subpath.find(os.sep)
- if -1 != pos1:
- subpath = subpath[pos1 + len(os.sep):]
- print("subpath = " + subpath)
- return subpath
-
- def obtain_test_result_file(self):
- result_save_path = get_result_savepath(self.testsuite_path,
- self.result_rootpath)
- result_file_path = os.path.join(result_save_path,
- "%s.xml" % self.testsuite_name)
-
- result_josn_file_path = os.path.join(result_save_path,
- "%s.json" % self.testsuite_name)
-
- if self.testsuite_path.endswith('.hap'):
- remote_result_file = os.path.join(self.device_testpath,
- "testcase_result.xml")
- remote_json_result_file = os.path.join(self.device_testpath,
- "%s.json" % self.testsuite_name)
- else:
- remote_result_file = os.path.join(self.device_testpath,
- "%s.xml" % self.testsuite_name)
- remote_json_result_file = os.path.join(self.device_testpath,
- "%s.json" % self.testsuite_name)
-
- if self.device.is_file_exist(remote_result_file):
- self.device.pull_file(remote_result_file, result_file_path)
- elif self.device.is_file_exist(remote_json_result_file):
- self.device.pull_file(remote_json_result_file,
- result_josn_file_path)
- result_file_path = result_josn_file_path
- else:
- LOG.error("%s not exist", remote_result_file)
-
- return result_file_path
-
- def make_empty_result_file(self, error_message=""):
- result_savepath = get_result_savepath(self.testsuite_path,
- self.result_rootpath)
- result_filepath = os.path.join(result_savepath, "%s.xml" %
- self.testsuite_name)
- if not os.path.exists(result_filepath):
- _create_empty_result_file(result_filepath,
- self.testsuite_name, error_message)
-
- def is_exist_target_in_device(self, path, target):
- if platform.system() == "Windows":
- command = '\"ls -l %s | grep %s\"' % (path, target)
- else:
- command = "ls -l %s | grep %s" % (path, target)
-
- check_result = False
- stdout_info = self.device.execute_shell_command(command)
- if stdout_info != "" and stdout_info.find(target) != -1:
- check_result = True
- return check_result
-
- def obtain_coverage_data(self):
- cov_root_dir = os.path.abspath(os.path.join(
- self.result_rootpath,
- "..",
- "coverage",
- "data",
- "exec"))
- java_cov_path = get_result_savepath(
- self.testsuite_path,
- cov_root_dir)
-
- dst_target_name = "%s.exec" % self.testsuite_name
- src_target_name = "jacoco.exec"
- if self.is_exist_target_in_device(self.device_testpath,
- src_target_name):
- if not os.path.exists(java_cov_path):
- os.makedirs(java_cov_path)
- self.device.pull_file(
- os.path.join(self.device_testpath, src_target_name),
- os.path.join(java_cov_path, dst_target_name))
-
- target_name = "obj"
- cxx_cov_path = os.path.abspath(os.path.join(
- self.result_rootpath,
- "..",
- "coverage",
- "data",
- "cxx",
- self.testsuite_name))
-
- if self.is_exist_target_in_device(DEFAULT_TEST_PATH, target_name):
- if not os.path.exists(cxx_cov_path):
- os.makedirs(cxx_cov_path)
- src_file = os.path.join(DEFAULT_TEST_PATH, target_name)
- self.device.pull_file(src_file, cxx_cov_path, is_create=True)
-
-
-##############################################################################
-##############################################################################
-
-@Plugin(type=Plugin.DRIVER, id=DeviceTestType.cpp_test)
-class CppTestDriver(IDriver):
- """
- CppTest is a Test that runs a native test package on given device.
- """
- # test driver config
- config = None
- result = ""
-
- def __check_environment__(self, device_options):
- if len(device_options) == 1 and device_options[0].label is None:
- return True
- if len(device_options) != 1 or \
- device_options[0].label != DeviceLabelType.phone:
- return False
- return True
-
- def __check_config__(self, config):
- pass
-
- def __result__(self):
- return self.result if os.path.exists(self.result) else ""
-
- def __execute__(self, request):
- try:
- self.config = request.config
- self.config.target_test_path = DEFAULT_TEST_PATH
- self.config.device = request.config.environment.devices[0]
-
- suite_file = request.root.source.source_file
- LOG.debug("Testsuite FilePath: %s" % suite_file)
-
- if not suite_file:
- LOG.error("test source '%s' not exists" %
- request.root.source.source_string)
- return
-
- if not self.config.device:
- result = ResultManager(suite_file, self.config)
- result.set_is_coverage(False)
- result.make_empty_result_file(
- "No test device is found. ")
- return
-
- serial = request.config.device.__get_serial__()
- device_log_file = get_device_log_file(
- request.config.report_path,
- serial)
-
- with open(device_log_file, "a", encoding="UTF-8") as file_pipe:
- self.config.device.start_catch_device_log(file_pipe)
- self._init_gtest()
- self._run_gtest(suite_file)
- finally:
- self.config.device.stop_catch_device_log()
-
- def _init_gtest(self):
- self.config.device.hdc_command("remount")
- self.config.device.execute_shell_command(
- "rm -rf %s" % self.config.target_test_path)
- self.config.device.execute_shell_command(
- "mkdir -p %s" % self.config.target_test_path)
-
- def _run_gtest(self, suite_file):
- from xdevice import Variables
- filename = os.path.basename(suite_file)
- test_para = self._get_test_para(self.config.testcase,
- self.config.testlevel,
- self.config.testtype,
- self.config.target_test_path,
- filename)
- is_coverage_test = True if self.config.coverage else False
-
- # push testsuite file
- self.config.device.push_file(suite_file, self.config.target_test_path)
-
- # push resource files
- resource_manager = ResourceManager()
- resource_data_dic, resource_dir = \
- resource_manager.get_resource_data_dic(suite_file)
- resource_manager.process_preparer_data(resource_data_dic, resource_dir,
- self.config.device)
-
- # execute testcase
- if not self.config.coverage:
- command = "cd %s; rm -rf %s.xml; chmod +x *; ./%s %s" % (
- self.config.target_test_path,
- filename,
- filename,
- test_para)
- else:
- coverage_outpath = self.config.coverage_outpath
- strip_num = len(coverage_outpath.split(os.sep)) - 1
- command = "cd %s; rm -rf %s.xml; chmod +x *; GCOV_PREFIX=. " \
- "GCOV_PREFIX_STRIP=%s ./%s %s" % \
- (self.config.target_test_path,
- filename,
- str(strip_num),
- filename,
- test_para)
-
- result = ResultManager(suite_file, self.config)
- result.set_is_coverage(is_coverage_test)
-
- try:
- # get result
- display_receiver = DisplayOutputReceiver()
- self.config.device.execute_shell_command(
- command,
- receiver=display_receiver,
- timeout=TIME_OUT,
- retry=0)
- return_message = display_receiver.output
- except (ExecuteTerminate, DeviceError) as exception:
- return_message = str(exception.args)
-
- self.result = result.get_test_results(return_message)
- resource_manager.process_cleaner_data(resource_data_dic,
- resource_dir,
- self.config.device)
-
- @staticmethod
- def _get_test_para(testcase,
- testlevel,
- testtype,
- target_test_path,
- filename):
- if "benchmark" == testtype[0]:
- test_para = (" --benchmark_out_format=json"
- " --benchmark_out=%s%s.json") % (
- target_test_path, filename)
- return test_para
-
- if "" != testcase and "" == testlevel:
- test_para = "%s=%s" % (GTestConst.exec_para_filter, testcase)
- elif "" == testcase and "" != testlevel:
- level_para = get_level_para_string(testlevel)
- test_para = "%s=%s" % (GTestConst.exec_para_level, level_para)
- else:
- test_para = ""
- return test_para
-
-
-##############################################################################
-##############################################################################
-
-@Plugin(type=Plugin.DRIVER, id=DeviceTestType.dex_test)
-class DexTestDriver(IDriver):
- """
- DexTest is a Test that runs a native test package on given device.
- """
- # test driver config
- config = None
- result = ""
-
- def __check_environment__(self, device_options):
- pass
-
- def __check_config__(self, config):
- pass
-
- def __result__(self):
- return self.result if os.path.exists(self.result) else ""
-
- def __execute__(self, request):
- try:
- self.config = request.config
- self.config.target_test_path = DEFAULT_TEST_PATH
- self.config.device = request.config.environment.devices[0]
-
- suite_file = request.root.source.source_file
- LOG.debug("Testsuite FilePath: %s" % suite_file)
-
- if not suite_file:
- LOG.error("test source '%s' not exists" %
- request.root.source.source_string)
- return
-
- if not self.config.device:
- result = ResultManager(suite_file, self.config)
- result.set_is_coverage(False)
- result.make_empty_result_file(
- "No test device is found. ")
- return
-
- serial = request.config.device.__get_serial__()
- device_log_file = get_device_log_file(
- request.config.report_path,
- serial)
-
- with open(device_log_file, "a", encoding="UTF-8") as file_pipe:
- self.config.device.start_catch_device_log(file_pipe)
- self._init_junit_test()
- self._run_junit_test(suite_file)
- finally:
- self.config.device.stop_catch_device_log()
-
- def _init_junit_test(self):
- self.config.device.hdc_command("remount")
- self.config.device.execute_shell_command(
- "rm -rf %s" % self.config.target_test_path)
- self.config.device.execute_shell_command(
- "mkdir -p %s" % self.config.target_test_path)
- self.config.device.execute_shell_command(
- "mount -o rw,remount,rw /%s" % "system")
-
- def _run_junit_test(self, suite_file):
- filename = os.path.basename(suite_file)
- suitefile_target_test_path = self.config.target_test_path
- junit_test_para = self._get_junit_test_para(filename, suite_file)
- is_coverage_test = True if self.config.coverage else False
-
- # push testsuite file
- self.config.device.push_file(suite_file, self.config.target_test_path)
-
- # push resource files
- resource_manager = ResourceManager()
- resource_data_dic, resource_dir = \
- resource_manager.get_resource_data_dic(suite_file)
- resource_manager.process_preparer_data(resource_data_dic, resource_dir,
- self.config.device)
-
- # execute testcase
- return_message = self._execute_suitefile_junittest(
- filename, junit_test_para, suitefile_target_test_path)
-
- result = ResultManager(suite_file, self.config)
- result.set_is_coverage(is_coverage_test)
- self.result = result.get_test_results(return_message)
-
- resource_manager.process_cleaner_data(resource_data_dic, resource_dir,
- self.config.device)
-
- def _get_junit_test_para(self, filename, suite_file):
- exec_info = get_java_test_para(self.config.testcase,
- self.config.testlevel)
- java_test_file = get_execute_java_test_files(suite_file)
- junit_test_para = self._get_dex_test_para(filename, java_test_file,
- exec_info)
- return junit_test_para
-
- def _get_dex_test_para(self, filename, java_test_file, exec_info):
- if "benchmark" == self.config.testtype[0]:
- main_class = "ohos.hmh.Executor"
- else:
- main_class = ZunitConst.z_unit_app
- exec_class, exec_method, exec_level = exec_info
- dex_test_para = "%s %s%s %s%s %s%s %s%s %s%s %s%s" % (
- main_class, ZunitConst.output_dir,
- self.config.target_test_path,
- ZunitConst.output_file, filename,
- ZunitConst.test_class, java_test_file,
- ZunitConst.exec_class, exec_class,
- ZunitConst.exec_method, exec_method,
- ZunitConst.exec_level, exec_level)
- if self.config.coverage:
- dex_test_para += " %s" % ZunitConst.coverage_flag
- return dex_test_para
-
- def _execute_suitefile_junittest(self, filename, testpara,
- target_test_path):
- return_message = self._execute_dexfile_junittest(filename, testpara,
- target_test_path)
- return return_message
-
- def _execute_dexfile_junittest(self, filename, testpara, target_test_path):
- from xdevice import Variables
- long_command_path = tempfile.mkdtemp(prefix="long_command_",
- dir=self.config.report_path)
- if self.config.coverage:
- coverage_outpath = self.config.coverage_outpath
- strip_num = len(coverage_outpath.split(os.sep)) - 1
-
- command = "cd %s; rm -rf %s.xml; chmod +x *;" \
- " export BOOTCLASSPATH=%s%s:$BOOTCLASSPATH;" \
- " export GCOV_PREFIX=%s; export GCOV_PREFIX_STRIP=%d;" \
- " app_process %s%s %s" % \
- (target_test_path,
- filename,
- target_test_path,
- filename,
- target_test_path,
- strip_num,
- target_test_path,
- filename,
- testpara)
- else:
- command = "cd %s; rm -rf %s.xml; chmod +x *;" \
- " export BOOTCLASSPATH=%s%s:$BOOTCLASSPATH;" \
- " app_process %s%s %s" % \
- (target_test_path,
- filename,
- target_test_path,
- filename,
- target_test_path,
- filename,
- testpara)
-
- LOG.info("command: %s" % command)
- sh_file_name, file_path = \
- self._make_long_command_file(command, long_command_path, filename)
- remote_command_dir = os.path.join(target_test_path,
- ZunitConst.remote_command_dir)
- self.config.device.execute_shell_command(
- "mkdir -p %s" % remote_command_dir)
- self.config.device.push_file(file_path, remote_command_dir)
- try:
- display_receiver = DisplayOutputReceiver()
- self.config.device.execute_shell_command(
- "sh %s/%s" % (remote_command_dir, sh_file_name),
- receiver=display_receiver,
- timeout=TIME_OUT,
- retry=0)
- return_message = display_receiver.output
- if display_receiver.output:
- time.sleep(1)
- except (ExecuteTerminate, DeviceError) as exception:
- return_message = str(exception.args)
- shutil.rmtree(long_command_path)
- return return_message
-
- @staticmethod
- def _make_long_command_file(command, longcommand_path, filename):
- sh_file_name = '%s.sh' % filename
- file_path = os.path.join(longcommand_path, sh_file_name)
- try:
- with open(file_path, "a") as file_desc:
- file_desc.write(command)
- except(IOError, ValueError) as err_msg:
- LOG.exception("Error for make long command file: ", err_msg)
- return sh_file_name, file_path
-
-
-##############################################################################
-##############################################################################
-
-@Plugin(type=Plugin.DRIVER, id=DeviceTestType.hap_test)
-class HapTestDriver(IDriver):
- """
- HapTest is a Test that runs a native test package on given device.
- """
- # test driver config
- config = None
- instrument_hap_file_suffix = '_ad.hap'
- result = ""
-
- def __init__(self):
- self.ability_name = ""
- self.package_name = ""
- self.activity_name = ""
-
- def __check_environment__(self, device_options):
- pass
-
- def __result__(self):
- return self.result if os.path.exists(self.result) else ""
-
- def __check_config__(self, config):
- pass
-
- def __execute__(self, request):
- try:
- self.config = request.config
- self.config.target_test_path = DEFAULT_TEST_PATH
- self.config.device = request.config.environment.devices[0]
-
- suite_file = request.root.source.source_file
- LOG.debug("Testsuite FilePath: %s" % suite_file)
-
- if not suite_file:
- LOG.error("test source '%s' not exists" %
- request.root.source.source_string)
- return
-
- if not self.config.device:
- result = ResultManager(suite_file, self.config)
- result.set_is_coverage(False)
- result.make_empty_result_file(
- "No test device is found. ")
- return
-
- package_name, ability_name = self._get_package_and_ability_name(
- suite_file)
- self.package_name = package_name
- self.ability_name = ability_name
- self.activity_name = "%s.MainAbilityShellActivity" % \
- self.package_name
- self.config.test_hap_out_path = \
- "/data/data/%s/files/test/result/" % self.package_name
- self.config.test_suite_timeout = TIME_OUT
-
- serial = request.config.device.__get_serial__()
- device_log_file = get_device_log_file(
- request.config.report_path,
- serial)
-
- with open(device_log_file, "a", encoding="UTF-8") as file_pipe:
- self.config.device.start_catch_device_log(file_pipe)
- self._init_junit_test()
- self._run_junit_test(suite_file)
- finally:
- self.config.device.stop_catch_device_log()
-
- def _init_junit_test(self):
- self.config.device.hdc_command("remount")
- self.config.device.execute_shell_command(
- "rm -rf %s" % self.config.target_test_path)
- self.config.device.execute_shell_command(
- "mkdir -p %s" % self.config.target_test_path)
- self.config.device.execute_shell_command(
- "mount -o rw,remount,rw /%s" % "system")
-
- def _run_junit_test(self, suite_file):
- filename = os.path.basename(suite_file)
- suitefile_target_test_path = self.config.test_hap_out_path
- junit_test_para = self._get_junit_test_para(filename, suite_file)
- is_coverage_test = True if self.config.coverage else False
-
- # push testsuite file
- self.config.device.push_file(suite_file, self.config.target_test_path)
-
- resource_manager = ResourceManager()
- resource_data_dic, resource_dir = \
- resource_manager.get_resource_data_dic(suite_file)
- resource_manager.process_preparer_data(resource_data_dic, resource_dir,
- self.config.device)
-
- # execute testcase, especially self.config.test_hap_out_path
- install_result = self._install_hap(filename)
- result = ResultManager(suite_file, self.config)
- result.set_is_coverage(is_coverage_test)
-
- if install_result:
- return_message = self._execute_suitefile_junittest(
- filename,
- junit_test_para,
- suitefile_target_test_path)
- try:
- self.result = result.get_test_results(return_message)
- finally:
- self._unistall_hap(self.package_name)
- else:
- self.result = result.get_test_results("Error: install hap failed.")
- LOG.error("Error: install hap failed.")
-
- resource_manager.process_cleaner_data(resource_data_dic, resource_dir,
- self.config.device)
-
- def _get_junit_test_para(self, filename, suite_file):
- if not filename.endswith(self.instrument_hap_file_suffix):
- exec_class, exec_method, exec_level = get_java_test_para(
- self.config.testcase, self.config.testlevel)
- java_test_file = get_execute_java_test_files(suite_file)
- junit_test_para = self._get_hap_test_para(java_test_file,
- exec_class,
- exec_method,
- exec_level)
- else:
- junit_test_para = get_execute_java_test_files(suite_file)
- return junit_test_para
-
- def _get_hap_test_para(self, java_test_file, exec_class, exec_method,
- exec_level):
- hap_test_para = "%s%s#%s%s#%s%s#%s%s" % (
- ZunitConst.test_class, java_test_file,
- ZunitConst.exec_class, exec_class,
- ZunitConst.exec_method, exec_method,
- ZunitConst.exec_level, exec_level)
-
- if self.config.coverage:
- hap_test_para += "#%s" % ZunitConst.coverage_flag
- return hap_test_para
-
- def _execute_suitefile_junittest(self, filename, testpara,
- target_test_path):
- return_message = self._execute_hapfile_junittest(filename, testpara,
- target_test_path)
- return return_message
-
- def _execute_hapfile_junittest(self, filename, testpara, target_test_path):
- _unlock_screen(self.config.device)
- _unlock_device(self.config.device)
-
- try:
- if not filename.endswith(self.instrument_hap_file_suffix):
- return_message = self.start_hap_activity(testpara)
- LOG.info("HAP Testcase is executing, please wait a moment...")
- if "Error" not in return_message:
- self._check_hap_finished(target_test_path)
- else:
- return_message = self.start_instrument_hap_activity(testpara)
- except (ExecuteTerminate, DeviceError) as exception:
- return_message = str(exception.args)
-
- _lock_screen(self.config.device)
- return return_message
-
- def _init_hap_device(self):
- self.config.device.execute_shell_command(
- "rm -rf %s" % self.config.test_hap_out_path)
- self.config.device.execute_shell_command(
- "mkdir -p %s" % self.config.test_hap_out_path)
-
- def _install_hap(self, filename):
- message = self.config.device.execute_shell_command(
- "bm install -p %s" % os.path.join(self.config.target_test_path,
- filename))
- message = str(message).rstrip()
- if message == "" or "Success" in message:
- return_code = True
- if message != "":
- LOG.info(message)
- else:
- return_code = False
- if message != "":
- LOG.warning(message)
-
- _sleep_according_to_result(return_code)
- return return_code
-
- def start_hap_activity(self, testpara):
- try:
- if not self.config.coverage:
- display_receiver = DisplayOutputReceiver()
- self.config.device.execute_shell_command(
- "am start -S -n %s/%s --es param '%s'" %
- (self.package_name,
- self.activity_name,
- testpara),
- receiver=display_receiver,
- timeout=self.config.test_suite_timeout,
- retry=0)
- else:
- coverage_outpath = self.config.coverage_outpath
- strip_num = len(coverage_outpath.split(os.sep)) - 1
- display_receiver = DisplayOutputReceiver()
- self.config.device.execute_shell_command(
- "cd %s; export GCOV_PREFIX=%s;" \
- " export GCOV_PREFIX_STRIP=%d;" \
- " am start -S -n %s/%s --es param %s" %
- (self.config.target_test_path,
- self.config.target_test_path,
- strip_num,
- self.package_name,
- self.activity_name,
- testpara),
- receiver=display_receiver,
- timeout=self.config.test_suite_timeout,
- retry=0)
-
- _sleep_according_to_result(display_receiver.output)
- return_message = display_receiver.output
- except (ExecuteTerminate, DeviceError) as exception:
- return_message = exception.args
- return return_message
-
- def start_instrument_hap_activity(self, testpara):
- from xdevice import Variables
- try:
- display_receiver = DisplayOutputReceiver()
- if not self.config.coverage:
- self.config.device.execute_shell_command(
- "aa start -p %s -n %s -s AbilityTestCase %s -w %s" %
- (self.package_name,
- self.ability_name,
- testpara,
- str(self.config.test_suite_timeout)),
- receiver=display_receiver,
- timeout=self.config.test_suite_timeout,
- retry=0)
- else:
- coverage_outpath = self.config.coverage_outpath
- strip_num = len(coverage_outpath.split(os.sep)) - 1
- self.config.device.execute_shell_command(
- "cd %s; export GCOV_PREFIX=%s;"
- " export GCOV_PREFIX_STRIP=%d;"
- " aa start -p %s -n %s -s AbilityTestCase %s -w %s" %
- (self.config.target_test_path,
- self.config.target_test_path,
- strip_num,
- self.package_name,
- self.ability_name,
- testpara,
- str(self.config.test_suite_timeout)),
- receiver=display_receiver,
- timeout=self.config.test_suite_timeout,
- retry=0)
- _sleep_according_to_result(display_receiver.output)
- return_message = display_receiver.output
- except (ExecuteTerminate, DeviceError) as exception:
- return_message = exception.args
- return return_message
-
- def _check_hap_finished(self, target_test_path):
- run_timeout = True
- sleep_duration = 3
- target_file = os.path.join(target_test_path,
- ZunitConst.jtest_status_filename)
- for _ in range(
- int(self.config.test_suite_timeout / (1000 * sleep_duration))):
- check_value = self.config.device.is_file_exist(target_file)
- LOG.info("%s state: %s", self.config.device.device_sn,
- self.config.device.test_device_state.value)
- if not check_value:
- time.sleep(sleep_duration)
- continue
- run_timeout = False
- break
- if run_timeout:
- return_code = False
- error_message = "HAP Testcase executed timeout or exception, " \
- "please check detail information from system log"
- LOG.error(error_message)
- else:
- return_code = True
- LOG.info("HAP Testcase executed finished")
- return return_code
-
- def _unistall_hap(self, package_name):
- return_message = self.config.device.execute_shell_command(
- "pm uninstall %s" % package_name)
- _sleep_according_to_result(return_message)
- return return_message
-
- @staticmethod
- def _get_package_and_ability_name(hap_filepath):
- package_name = ""
- ability_name = ""
-
- if os.path.exists(hap_filepath):
- filename = os.path.basename(hap_filepath)
-
- # unzip the hap file
- hap_bak_path = os.path.abspath(os.path.join(
- os.path.dirname(hap_filepath),
- "%s.bak" % filename))
- zf_desc = zipfile.ZipFile(hap_filepath)
- try:
- zf_desc.extractall(path=hap_bak_path)
- except RuntimeError as error:
- print(error)
- zf_desc.close()
-
- # verify config.json file
- app_profile_path = os.path.join(hap_bak_path, "config.json")
- if not os.path.exists(app_profile_path):
- print("file %s not exists" % app_profile_path)
- return package_name, ability_name
-
- if os.path.isdir(app_profile_path):
- print("%s is a folder, and not a file" % app_profile_path)
- return package_name, ability_name
-
- # get package_name and ability_name value.
- load_dict = {}
- with open(app_profile_path, 'r') as load_f:
- load_dict = json.load(load_f)
- profile_list = load_dict.values()
- for profile in profile_list:
- package_name = profile.get("package")
- if not package_name:
- continue
-
- abilities = profile.get("abilities")
- for abilitie in abilities:
- abilities_name = abilitie.get("name")
- if abilities_name.startswith("."):
- ability_name = package_name + abilities_name[
- abilities_name.find("."):]
- else:
- ability_name = abilities_name
- break
- break
-
- # delete hap_bak_path
- if os.path.exists(hap_bak_path):
- shutil.rmtree(hap_bak_path)
- else:
- print("file %s not exists" % hap_filepath)
-
- return package_name, ability_name
-
-
-##############################################################################
-##############################################################################
diff --git a/src/main/_init_global_config.py b/src/main/_init_global_config.py
index b0a93164c472d07f6555913f902198d71cd82923..f0f29dc2340029882ed0ea3d29d8c0e55104ffb8 100755
--- a/src/main/_init_global_config.py
+++ b/src/main/_init_global_config.py
@@ -49,13 +49,6 @@ def _init_global_config():
"python"))
sys.path.insert(2, sys.pytest_dir)
- sys.adapter_dir = os.path.abspath(os.path.join(
- sys.framework_root_dir,
- "adapter"
- "aw",
- "python"))
- sys.path.insert(3, sys.adapter_dir)
-
sys.framework_res_dir = sys.framework_root_dir
sys.exec_dir = sys.framework_root_dir