diff --git a/README.md b/README.md index ed78c37bb85c0fe54c1039b9263b88c3c524cbea..c1ec2f253f0a52e77416e29b4434412b7c90f047 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,6 @@ ### 约束与限制 1. 本示例仅支持标准系统上运行,支持设备:华为手机。 -2. HarmonyOS系统:HarmonyOS 5.0.0 Release及以上。 -3. DevEco Studio版本:DevEco Studio 5.0.0 Release及以上。 -4. HarmonyOS SDK版本:HarmonyOS 5.0.0 Release SDK及以上。 +2. HarmonyOS系统:HarmonyOS 5.0.5 Release及以上。 +3. DevEco Studio版本:DevEco Studio 5.0.5 Release及以上。 +4. HarmonyOS SDK版本:HarmonyOS 5.0.5 Release SDK及以上。 diff --git a/README_EN.md b/README_EN.md index 60ab11e83742f4ee8e1e96fbc2352d8af237c5bd..d868411b61af4ff0bfc0503c70a0e4201154a87f 100644 --- a/README_EN.md +++ b/README_EN.md @@ -70,6 +70,6 @@ Use the APIs provided by `@hadss/datacache` to read and write data. The overall ### Constraints 1. The sample app is supported only on Huawei phones running the standard system. -2. The HarmonyOS version must be HarmonyOS 5.0.0 Release or later. -3. The DevEco Studio version must be DevEco Studio 5.0.0 Release or later. -4. The HarmonyOS SDK version must be HarmonyOS 5.0.0 Release or later. +2. The HarmonyOS version must be HarmonyOS 5.0.5 Release or later. +3. The DevEco Studio version must be DevEco Studio 5.0.5 Release or later. +4. The HarmonyOS SDK version must be HarmonyOS 5.0.5 Release or later. diff --git a/build-profile.json5 b/build-profile.json5 index c033ce4278fb0641d84107c3c134047ac487368e..b2ca56e35558b0dc7ca91989b68a1ea65b49a7a2 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -5,7 +5,8 @@ { "name": "default", "signingConfig": "default", - "compatibleSdkVersion": "5.0.0(12)", + "compatibleSdkVersion": "5.0.5(17)", + "targetSdkVersion": "5.0.5(17)", "runtimeOS": "HarmonyOS", } ], diff --git a/entry/obfuscation-rules.txt b/entry/obfuscation-rules.txt index 69c4d6a8a5531548e4886fa766090c5c157a87d9..fdbb5b9852d7dd5f39bddaeb21ab5ee1f3346749 100644 --- a/entry/obfuscation-rules.txt +++ b/entry/obfuscation-rules.txt @@ -15,4 +15,8 @@ # Keep options: # -keep-property-name: specifies property names that you want to keep -# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/entry/src/main/ets/common/utils/Refresh.ets b/entry/src/main/ets/common/utils/Refresh.ets index b51973f7576016d0bc4296e1c37471f46880fa91..06a8c35f2f4c3ce2abcc275dea2f22991e53b98b 100644 --- a/entry/src/main/ets/common/utils/Refresh.ets +++ b/entry/src/main/ets/common/utils/Refresh.ets @@ -13,6 +13,7 @@ * limitations under the License. */ +import { BusinessError } from '@kit.BasicServicesKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; import { http } from '@kit.NetworkKit'; import * as Const from '../constant/CommonConstants'; @@ -39,8 +40,14 @@ export function refreshState(that: ListModel, state: number): void { } export function getUrl(context: Context): string { - const FILENAME = context.resourceManager.getStringSync($r('app.string.fileName').id); - return `https://devecostudio-drcn.op.hicloud.com/solution/v1/getSceneMockData?scene=newsData&fileName=${FILENAME}.json&`; + let filename = ''; + try { + filename = context.resourceManager.getStringSync($r('app.string.fileName').id); + } catch (error) { + let err = error as BusinessError; + hilog.error(0x0000, 'refreshing', `getStringSync failed, error code=${err.code}, message=${err.message}`); + } + return `https://devecostudio-drcn.op.hicloud.com/solution/v1/getSceneMockData?scene=newsData&fileName=${filename}.json&`; } export function refreshing(that: ListModel, url: string): Promise { @@ -57,7 +64,7 @@ export function refreshing(that: ListModel, url: string): Promise { } that.newsData = data; }).catch(() => { - hilog.info(0x0000, 'refreshing', 'http request fail'); + hilog.error(0x0000, 'refreshing', 'http request fail'); }); } @@ -79,7 +86,7 @@ export function loadMore(that: ListModel, url: string): void { } that.newsData = that.newsData.concat(data); }).catch(() => { - hilog.info(0x0000, 'loadMore', 'http request fail'); - }); + hilog.error(0x0000, 'loadMore', 'http request fail'); + }); } } \ No newline at end of file diff --git a/entry/src/ohosTest/ets/test/AverageTime.test.ets b/entry/src/ohosTest/ets/test/AverageTime.test.ets deleted file mode 100644 index 51f5f10f43b6cafc5713caede73429a189d6123e..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/test/AverageTime.test.ets +++ /dev/null @@ -1,178 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ - -import { describe, it, expect, beforeEach } from '@ohos/hypium' -import { DataCache } from '@hadss/datacache'; -import { GlobalContext } from '../testability/GlobalContext'; - -export default function AverageTimeTest() { - - describe('AverageTimeTest', () => { - const COUNT = 2000; - const KEY = 'TEST'; - const VAL = '111'; - const TIME = 1; - let dataCache: DataCache; - - beforeEach(async () => { - const CONTEXT: Context = GlobalContext.getContext().getObject("context") as Context; - dataCache = DataCache.getInstance(CONTEXT); - await dataCache.clear(); - }) - - // get method - it('get', 0, async (done: Function) => { - dataCache.putSync(KEY, VAL); - let startTime = new Date().getTime(); - let configTest: (index: number) => void = async (index) => { - dataCache.get(KEY).then(() => { - if (index < COUNT) { - configTest(index + 1); - } else { - let endTime = new Date().getTime(); - let averageTime = (endTime - startTime) / COUNT; - expect(averageTime).assertLess(5); - done(); - } - }) - }; - configTest(0); - }) - - // put method - it('put', 1, async (done: Function) => { - let startTime = new Date().getTime(); - let configTest: (index: number) => void = async (index) => { - dataCache.put(KEY, VAL).then(() => { - if (index < COUNT) { - configTest(index + 1); - } else { - let endTime = new Date().getTime(); - let averageTime = (endTime - startTime) / COUNT; - expect(averageTime).assertLess(5); - done(); - } - }) - }; - configTest(0); - }) - - // put method - it('put has time', 2, async (done: Function) => { - let startTime = new Date().getTime(); - let configTest: (index: number) => void = async (index) => { - dataCache.put(KEY, VAL, TIME).then(() => { - if (index < COUNT) { - configTest(index + 1); - } else { - let endTime = new Date().getTime(); - let averageTime = (endTime - startTime) / COUNT; - expect(averageTime).assertLess(5); - done(); - } - }) - }; - configTest(0); - }) - - // putSync method - it('putSync', 3, () => { - let startTime = new Date().getTime(); - let configTest: (index: number) => void = async (index) => { - dataCache.putSync(KEY, VAL); - if (index < COUNT) { - configTest(index + 1); - } else { - let endTime = new Date().getTime(); - let averageTime = (endTime - startTime) / COUNT; - expect(averageTime).assertLess(5); - } - }; - configTest(0); - }) - - // putSync method - it('putSync has time', 4, () => { - let startTime = new Date().getTime(); - let configTest: (index: number) => void = async (index) => { - dataCache.putSync(KEY, VAL, TIME); - if (index < COUNT) { - configTest(index + 1); - } else { - let endTime = new Date().getTime(); - let averageTime = (endTime - startTime) / COUNT; - expect(averageTime).assertLess(5); - } - }; - configTest(0); - }) - - // getSync method - it('getSync', 5, () => { - dataCache.putSync(KEY, VAL); - let startTime = new Date().getTime(); - let configTest: (index: number) => void = async (index) => { - dataCache.getSync(KEY); - if (index < COUNT) { - configTest(index + 1); - } else { - let endTime = new Date().getTime(); - let averageTime = (endTime - startTime) / COUNT; - expect(averageTime).assertLess(5); - } - }; - configTest(0); - }) - - // delete method - it('delete', 6, async (done: Function) => { - let sum: number = 0; - let configTest = async (index: number): Promise => { - dataCache.putSync(KEY, VAL); - let startTime = new Date().getTime(); - await dataCache.delete(KEY); - let endTime = new Date().getTime(); - sum += endTime - startTime; - if (index < COUNT) { - await configTest(index + 1); - } else { - let averageTime = sum / COUNT; - expect(averageTime).assertLess(5); - done(); - } - }; - await configTest(0); - }) - - // clear method - it('clear', 7, async (done: Function) => { - let sum: number = 0; - let configTest = async (index: number): Promise => { - let startTime = new Date().getTime(); - await dataCache.clear(); - let endTime = new Date().getTime(); - sum += endTime - startTime; - if (index < COUNT) { - await configTest(index + 1); - } else { - let averageTime = sum / COUNT; - expect(averageTime).assertLess(5); - done(); - } - }; - await configTest(0); - }) - }) -} diff --git a/entry/src/ohosTest/ets/test/DataCache.test.ets b/entry/src/ohosTest/ets/test/DataCache.test.ets deleted file mode 100644 index 8f7d54427fc2cffeafd8b0b0691ca484a6e5f43a..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/test/DataCache.test.ets +++ /dev/null @@ -1,82 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ - -import { describe, it, expect, beforeEach } from '@ohos/hypium' -import { DataCache } from '@hadss/datacache'; -import { BusinessError } from '@kit.BasicServicesKit'; -import { GlobalContext } from '../testability/GlobalContext'; - -export default function DataCacheTest() { - const KEY = 'instance'; - - describe('DataCacheTest', () => { - beforeEach(async () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - await dataCache.clear(); - }) - - it('delete', 0, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - dataCache.putSync(KEY, data); - dataCache.delete(KEY).then(() => { - expect(dataCache.getSync('test')).assertUndefined(); - done(); - }) - }) - - it('delete when key is empty', 1, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - dataCache.delete('').catch((error: BusinessError) => { - expect(error.code).assertEqual(15500000); - done(); - }) - }) - - it('delete when key is not exit', 2, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - dataCache.delete(KEY).then(() => { - expect(true).assertTrue(); - done(); - }); - }) - - it('clear', 3, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - dataCache.putSync('test1', data); - dataCache.putSync('test2', data); - dataCache.clear().then(() => { - expect(dataCache.getSync('test1')).assertUndefined(); - expect(dataCache.getSync('test2')).assertUndefined(); - done(); - }) - }) - - it('clear when not cache', 4, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - dataCache.clear().then(() => { - expect(true).assertTrue(); - done(); - }); - }) - }) -} diff --git a/entry/src/ohosTest/ets/test/Get.test.ets b/entry/src/ohosTest/ets/test/Get.test.ets deleted file mode 100644 index a7173794c956dba4fffac39f0533ddb79a4f708d..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/test/Get.test.ets +++ /dev/null @@ -1,61 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ - -import { describe, it, expect, beforeEach } from '@ohos/hypium' -import { DataCache } from '@hadss/datacache'; -import { GlobalContext } from '../testability/GlobalContext'; - -export default function GetTest() { - const KEY = 'GET'; - - describe('GetTest', () => { - beforeEach(async () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - await dataCache.clear(); - }) - - it('get', 0, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - dataCache.putSync(KEY, data); - dataCache.get(KEY).then((val) => { - expect(val).assertEqual(data); - done(); - }) - }) - - it('get when key is empty', 1, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - try { - await dataCache.get(''); - } catch (error) { - expect(error.code).assertEqual(401); - done(); - } - }) - - it('get when key is not exit', 2, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - dataCache.get(KEY).then((val) => { - expect(val).assertUndefined(); - done(); - }) - }) - }) -} diff --git a/entry/src/ohosTest/ets/test/GetInstance.test.ets b/entry/src/ohosTest/ets/test/GetInstance.test.ets deleted file mode 100644 index 298935fc865fc2903ba13624a526047ea8c1962c..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/test/GetInstance.test.ets +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ - -import { describe, it, expect, beforeEach } from '@ohos/hypium' -import { DataCache } from '@hadss/datacache'; -import { GlobalContext } from '../testability/GlobalContext'; - -export default function GetInstanceTest() { - - describe('GetInstanceTest', () => { - beforeEach(async () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - await dataCache.clear(); - }) - - it('getInstance method success', 0, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - expect(dataCache instanceof DataCache).assertTrue(); - }) - - it('getInstance method when param error', 1, () => { - try { - DataCache.getInstance({} as Context); - } catch (error) { - expect(error.code).assertEqual(401); - } - }) - }) -} diff --git a/entry/src/ohosTest/ets/test/GetSync.test.ets b/entry/src/ohosTest/ets/test/GetSync.test.ets deleted file mode 100644 index 45969570fda71732e82f187f32b7832fc36df7d9..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/test/GetSync.test.ets +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ - -import { describe, it, expect, beforeEach } from '@ohos/hypium' -import { DataCache } from '@hadss/datacache'; -import { GlobalContext } from '../testability/GlobalContext'; - -export default function GetSyncTest() { - const KEY = 'GetSyncTest'; - - describe('GetSyncTest', () => { - beforeEach(async () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - await dataCache.clear(); - }) - - it('getSync', 0, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - dataCache.putSync(KEY, data); - expect(dataCache.getSync(KEY)).assertEqual(data); - }) - - it('getSync when key is empty', 1, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - try { - dataCache.getSync(''); - } catch (error) { - expect(error.code).assertEqual(401); - } - }) - - it('getSync when key is not exit', 2, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - expect(dataCache.getSync(KEY)).assertUndefined(); - }) - }) -} diff --git a/entry/src/ohosTest/ets/test/List.test.ets b/entry/src/ohosTest/ets/test/List.test.ets deleted file mode 100644 index e5be7c2089d0950235d6a347a8b8df01bbccaff6..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/test/List.test.ets +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ -import AverageTimeTest from './AverageTime.test'; - -import DataCacheTest from './DataCache.test'; -import GetTest from './Get.test'; -import GetInstanceTest from './GetInstance.test'; -import GetSyncTest from './GetSync.test'; -import PutTest from './Put.test'; -import PutHasSaveTimeTest from './PutHasSaveTime.test'; -import PutSyncTest from './PutSync.test'; -import PutSyncHasSaveTimeTest from './PutSyncHasSaveTime.test'; - -export default function testsuite() { - GetInstanceTest(); - GetTest(); - GetSyncTest(); - PutTest(); - PutHasSaveTimeTest(); - PutSyncTest(); - PutSyncHasSaveTimeTest(); - DataCacheTest(); - AverageTimeTest(); -} - diff --git a/entry/src/ohosTest/ets/test/Put.test.ets b/entry/src/ohosTest/ets/test/Put.test.ets deleted file mode 100644 index 6926cdcab250febb6f42cc6e01a3dca7ef88c57c..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/test/Put.test.ets +++ /dev/null @@ -1,133 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ - -import { describe, it, expect, beforeEach } from '@ohos/hypium' -import { DataCache } from '@hadss/datacache'; -import { GlobalContext, TestObjectData } from '../testability/GlobalContext'; - -export default function PutTest() { - const KEY = 'PutTest'; - - describe('PutTest', () => { - beforeEach(async () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - await dataCache.clear(); - }) - - it('put uint8array', 0, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = new Uint8Array(); - dataCache.put(KEY, data).then(() => { - expect(dataCache.getSync(KEY)).assertInstanceOf('Uint8Array'); - done(); - }); - }) - - it('put string', 1, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - dataCache.put(KEY, data).then(() => { - expect(dataCache.getSync(KEY)).assertEqual(data); - done(); - }); - }) - - it('put boolean', 2, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = true; - dataCache.put(KEY, data).then(() => { - expect(dataCache.getSync(KEY)).assertEqual(data); - done(); - }); - }) - - it('put number', 3, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = 11; - dataCache.put(KEY, data).then(() => { - expect(dataCache.getSync(KEY)).assertEqual(data); - done(); - }); - }) - - it('put object', 4, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data: TestObjectData = { - test: 'test' - }; - await dataCache.put(KEY, data).then(() => { - expect(dataCache.getSync(KEY)?.test).assertEqual(data.test); - done(); - }); - }) - - it('put when key is empty', 5, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - try { - await dataCache.put('', data); - } catch (error) { - expect(error.code).assertEqual(15500000); - done(); - } - }) - - it('put when value is empty', 6, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = ''; - dataCache.put(KEY, data).then(() => { - expect(true).assertTrue(); - done(); - }); - }) - - it('put when cache is empty', 7, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - await dataCache.put(KEY, data); - expect(dataCache.getSync(KEY)).assertEqual(data); - done(); - }) - - it('put when cache is not empty', 8, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - dataCache.putSync('key1', '222'); - const data = '111'; - await dataCache.put(KEY, data); - expect(dataCache.getSync(KEY)).assertEqual(data); - done(); - }) - - it('put when key is repeat', 9, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - await dataCache.put(KEY, '222'); - const data = '111'; - await dataCache.put(KEY, data); - expect(dataCache.getSync(KEY)).assertEqual(data); - done(); - }) - }) -} diff --git a/entry/src/ohosTest/ets/test/PutHasSaveTime.test.ets b/entry/src/ohosTest/ets/test/PutHasSaveTime.test.ets deleted file mode 100644 index 26a62be4f4c8070233a664bb4fbb32ebf3e23cf9..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/test/PutHasSaveTime.test.ets +++ /dev/null @@ -1,148 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ - -import { describe, it, expect, beforeEach } from '@ohos/hypium' -import { DataCache } from '@hadss/datacache'; -import { GlobalContext, TestObjectData } from '../testability/GlobalContext'; - -export default function PutHasSaveTimeTest() { - const KEY = 'PutHasSaveTimeTest'; - - describe('PutHasSaveTimeTest', () => { - beforeEach(async () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - await dataCache.clear(); - }) - - it('put uint8array save 1s', 0, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = new Uint8Array(); - await dataCache.put(KEY, data, 1).then(() => { - expect(dataCache.getSync(KEY)).assertInstanceOf('Uint8Array'); - setTimeout(() => { - expect(dataCache.getSync(KEY)).assertUndefined(); - done(); - }, 2100); - }); - }) - - it('put string save 1s', 1, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - await dataCache.put(KEY, data, 1).then(() => { - expect(dataCache.getSync(KEY)).assertEqual(data); - setTimeout(() => { - expect(dataCache.getSync(KEY)).assertUndefined(); - done(); - }, 2100); - }); - }) - - it('put boolean save 1s', 2, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = true; - await dataCache.put(KEY, data, 1).then(() => { - expect(dataCache.getSync(KEY)).assertEqual(data); - setTimeout(() => { - expect(dataCache.getSync(KEY)).assertUndefined(); - done(); - }, 2100); - }); - }) - - it('put number save 1s', 3, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = 12; - await dataCache.put(KEY, data, 1).then(() => { - expect(dataCache.getSync(KEY)).assertEqual(data); - setTimeout(() => { - expect(dataCache.getSync(KEY)).assertUndefined(); - done(); - }, 2100); - }); - }) - - it('put object save 1s', 4, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data: TestObjectData = { - test: 'test' - }; - dataCache.put(KEY, data, 1).then(() => { - expect(dataCache.getSync(KEY)?.test).assertEqual(data.test); - setTimeout(() => { - expect(dataCache.getSync(KEY)).assertUndefined(); - done(); - }, 2100); - }); - }) - - it('put when key is empty', 5, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - try { - await dataCache.put('', data, 1); - } catch (error) { - expect(error.code).assertEqual(15500000); - done(); - } - }) - - it('put when value is empty', 6, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = ''; - dataCache.put(KEY, data, 1).then(() => { - expect(true).assertTrue(); - done(); - }); - }) - - it('put when cache is empty', 8, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - await dataCache.put(KEY, data, 1); - expect(dataCache.getSync(KEY)).assertEqual(data); - done(); - }) - - it('put when cache is not empty', 9, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - dataCache.putSync('key1', '222'); - const data = '111'; - await dataCache.put(KEY, data, 1); - expect(dataCache.getSync(KEY)).assertEqual(data); - done(); - }) - - it('put when key is repeat', 10, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - await dataCache.put(KEY, '222', 1); - const data = '111'; - await dataCache.put(KEY, data, 1); - expect(dataCache.getSync(KEY)).assertEqual(data); - done(); - }) - }) -} diff --git a/entry/src/ohosTest/ets/test/PutSync.test.ets b/entry/src/ohosTest/ets/test/PutSync.test.ets deleted file mode 100644 index 7de9360c16d2a730c24f2268042f355b43a164b9..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/test/PutSync.test.ets +++ /dev/null @@ -1,120 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ - -import { describe, it, expect, beforeEach } from '@ohos/hypium' -import { DataCache } from '@hadss/datacache'; -import { GlobalContext, TestObjectData } from '../testability/GlobalContext'; - -export default function PutSyncTest() { - const KEY = 'PutSyncTest'; - - describe('PutSyncTest', () => { - beforeEach(async () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - await dataCache.clear(); - }) - - it('putSync uint8array', 0, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = new Uint8Array(); - dataCache.putSync(KEY, data); - expect(dataCache.getSync(KEY)).assertInstanceOf('Uint8Array'); - }) - - it('putSync string', 1, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - dataCache.putSync(KEY, data); - expect(dataCache.getSync(KEY)).assertEqual(data); - }) - - it('putSync boolean', 2, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = true; - dataCache.putSync(KEY, data); - expect(dataCache.getSync(KEY)).assertEqual(data); - }) - - it('putSync number', 3, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = 12; - dataCache.putSync(KEY, data); - expect(dataCache.getSync(KEY)).assertEqual(data); - }) - - it('putSync object', 4, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data: TestObjectData = { - test: 'test' - }; - dataCache.putSync(KEY, data); - expect(dataCache.getSync(KEY)?.test).assertEqual(data.test); - }) - - it('putSync when key is empty', 5, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - try { - dataCache.putSync('', data); - } catch (error) { - expect(error.code).assertEqual(401); - } - }) - - it('putSync when value is empty', 6, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = ''; - try { - dataCache.putSync(KEY, data); - } catch (error) { - expect(error.code).assertEqual(401); - } - }) - - it('putSync when cache is empty', 7, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - dataCache.putSync(KEY, data); - expect(dataCache.getSync(KEY)).assertEqual(data); - }) - - it('putSync when cache is not empty', 8, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - dataCache.putSync('key1', '222'); - const data = '111'; - dataCache.putSync(KEY, data); - expect(dataCache.getSync(KEY)).assertEqual(data); - }) - - it('putSync when key is repeat', 9, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - dataCache.putSync(KEY, '222'); - const data = '111'; - dataCache.putSync(KEY, data); - expect(dataCache.getSync(KEY)).assertEqual(data); - }) - }) -} diff --git a/entry/src/ohosTest/ets/test/PutSyncHasSaveTime.test.ets b/entry/src/ohosTest/ets/test/PutSyncHasSaveTime.test.ets deleted file mode 100644 index d70aaf3e53c507ebf4e5330dbdece5174d2f9e19..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/test/PutSyncHasSaveTime.test.ets +++ /dev/null @@ -1,158 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ - -import { describe, it, expect, beforeEach } from '@ohos/hypium' -import { DataCache } from '@hadss/datacache'; -import { GlobalContext, TestObjectData } from '../testability/GlobalContext'; - -export default function PutSyncHasSaveTimeTest() { - const KEY = 'PutSyncHasSaveTimeTest'; - - describe('PutSyncHasSaveTimeTest', () => { - beforeEach(async () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - await dataCache.clear(); - }) - - it('putSync uint8array save 1s', 0, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = new Uint8Array(); - dataCache.putSync(KEY, data, 1); - expect(dataCache.getSync(KEY)).assertInstanceOf('Uint8Array'); - await new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 2100); - }); - expect(dataCache.getSync(KEY)).assertUndefined(); - done(); - }) - - it('putSync string save 1s', 1, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - dataCache.putSync(KEY, data, 1); - expect(dataCache.getSync(KEY)).assertEqual(data); - await new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 2100); - }); - expect(dataCache.getSync(KEY)).assertUndefined(); - done(); - }) - - it('putSync boolean save 1s', 2, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = false; - dataCache.putSync(KEY, data, 1); - expect(dataCache.getSync(KEY)).assertEqual(data); - await new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 2100); - }).then(() => { - expect(dataCache.getSync(KEY)).assertUndefined(); - done(); - }); - }) - - it('putSync number save 1s', 3, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = 111; - dataCache.putSync(KEY, data, 1); - expect(dataCache.getSync(KEY)).assertEqual(data); - await new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 2100); - }).then(() => { - expect(dataCache.getSync(KEY)).assertUndefined(); - done(); - }); - }) - - it('putSync object save 1s', 4, async (done: Function) => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data: TestObjectData = { - test: 'test' - }; - dataCache.putSync(KEY, data, 1); - expect(dataCache.getSync(KEY)?.test).assertEqual(data.test); - await new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 2100); - }).then(() => { - expect(dataCache.getSync(KEY)).assertUndefined(); - done(); - }); - }) - - it('putSync when key is empty', 5, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - try { - dataCache.putSync('', data, 1); - } catch (error) { - expect(error.code).assertEqual(401); - } - }) - - it('putSync when value is empty', 6, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = ''; - try { - dataCache.putSync(KEY, data, 1); - } catch (error) { - expect(error.code).assertEqual(401); - } - }) - - it('putSync when cache is empty', 8, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - const data = '111'; - dataCache.putSync(KEY, data, 1); - expect(dataCache.getSync(KEY)).assertEqual(data); - }) - - it('putSync when cache is not empty', 9, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - dataCache.putSync('key1', '222'); - const data = '111'; - dataCache.putSync(KEY, data, 1); - expect(dataCache.getSync(KEY)).assertEqual(data); - }) - - it('putSync when key is repeat', 10, () => { - const context: Context = GlobalContext.getContext().getObject("context") as Context; - const dataCache = DataCache.getInstance(context); - dataCache.putSync(KEY, '222', 1); - const data = '111'; - dataCache.putSync(KEY, data, 1); - expect(dataCache.getSync(KEY)).assertEqual(data); - }) - }) -} diff --git a/entry/src/ohosTest/ets/testability/GlobalContext.ets b/entry/src/ohosTest/ets/testability/GlobalContext.ets deleted file mode 100644 index 56f4cadf8c436458670e6d4df76955b9dcd65b1c..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/testability/GlobalContext.ets +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ - -export interface TestObjectData { - test: string; -} - -export class GlobalContext { - private constructor() { - } - - private static instance: GlobalContext; - private _objects = new Map(); - - public static getContext(): GlobalContext { - if (!GlobalContext.instance) { - GlobalContext.instance = new GlobalContext(); - } - return GlobalContext.instance; - } - - getObject(value: string): Object | undefined { - return this._objects.get(value); - } - - setObject(key: string, objectClass: Object): void { - this._objects.set(key, objectClass); - } -} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/testability/TestAbility.ets b/entry/src/ohosTest/ets/testability/TestAbility.ets deleted file mode 100644 index 8014ea66c5a2cdf6a77147800a18fa15d786c10f..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/testability/TestAbility.ets +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ - -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import window from '@ohos.window'; -import { GlobalContext } from './GlobalContext'; -import testsuite from '../test/List.test'; - -export default class TestAbility extends UIAbility { - onCreate() { - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(AbilityDelegatorRegistry.getAbilityDelegator(), AbilityDelegatorRegistry.getArguments(), testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - GlobalContext.getContext().setObject("context", this.context); - windowStage.loadContent('testability/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } -} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/testability/pages/Index.ets b/entry/src/ohosTest/ets/testability/pages/Index.ets deleted file mode 100644 index 5e4e98f35e5fa2475d8ced54e0fee7c9dc15c84f..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/testability/pages/Index.ets +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ - -@Entry -@Component -struct Index { - @State message: string = 'Hello World' - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - } - .type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(() => { - }) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index eb5e22cab429979d61c5de18433a138bad0e28b4..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (C) 2024 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - */ - -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -var abilityDelegator:AbilityDelegatorRegistry.AbilityDelegator -var abilityDelegatorArguments:AbilityDelegatorRegistry.AbilityDelegatorArgs - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/entry/src/ohosTest/module.json5 b/entry/src/ohosTest/module.json5 deleted file mode 100644 index 87a6ee4004d88bf617b3eb5a6aa50d0ea23288ab..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/module.json5 +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/testability/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "visible": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/entry/src/ohosTest/resources/base/element/color.json b/entry/src/ohosTest/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/entry/src/ohosTest/resources/base/element/string.json b/entry/src/ohosTest/resources/base/element/string.json deleted file mode 100644 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/entry/src/ohosTest/resources/base/media/icon.png b/entry/src/ohosTest/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/entry/src/ohosTest/resources/base/media/icon.png and /dev/null differ diff --git a/entry/src/ohosTest/resources/base/profile/test_pages.json b/entry/src/ohosTest/resources/base/profile/test_pages.json deleted file mode 100644 index b7e7343cacb32ce982a45e76daad86e435e054fe..0000000000000000000000000000000000000000 --- a/entry/src/ohosTest/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "testability/pages/Index" - ] -} diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 index 06b2783670a348f95533b352c1ceda909a842bbc..5bebc9755447385d82ce4138f54d991b1f85f348 100644 --- a/hvigor/hvigor-config.json5 +++ b/hvigor/hvigor-config.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "dependencies": { }, "execution": { diff --git a/oh-package.json5 b/oh-package.json5 index 6ab749ef18643cdf2a600061515b914aedc13d2d..2d9c74ff34f1383ec920815a40399dd0fe46a6c5 100644 --- a/oh-package.json5 +++ b/oh-package.json5 @@ -1,9 +1,8 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "description": "Please describe the basic information.", "dependencies": { }, "devDependencies": { - "@ohos/hypium": "1.0.18" } }