未验证 提交 106f7b66 编写于 作者: O openharmony_ci 提交者: Gitee

!9771 UDMF接口拆分

Merge pull request !9771 from 耿凌霞/cherry-pick-1692255112
......@@ -15,7 +15,7 @@
import dragController from "@ohos.arkui.dragController"
import UDMF from '@ohos.data.UDMF';
import UDMF from '@ohos.data.unifiedDataChannel';
import componentSnapshot from '@ohos.arkui.componentSnapshot';
import image from '@ohos.multimedia.image';
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import dragController from "@ohos.arkui.dragController"
import UDMF from '@ohos.data.UDMF'
import UDMF from '@ohos.data.unifiedDataChannel';
import promptAction from '@ohos.promptAction';
......
......@@ -12,7 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import udmf from '@ohos.data.UDMF';
import udmf from '@ohos.data.unifiedDataChannel';
import udmfType from '@ohos.data.uniformTypeDescriptor';
import promptAction from '@ohos.promptAction';
@Entry
@Component
......@@ -116,7 +117,7 @@ struct Index {
.draggable(true)
.margin({left: 15})
.border({color: Color.Black, width: 1})
.allowDrop([udmf.UnifiedDataType.IMAGE])
.allowDrop([udmfType.UniformDataType.IMAGE])
.onDrop((dragEvent: DragEvent)=> {
this.getDataFromUdmfRetry(dragEvent, (event)=>{
let records: Array<udmf.UnifiedRecord> = event.getData().getRecords();
......@@ -139,7 +140,7 @@ struct Index {
.height(100)
.border({color: Color.Black, width: 1})
.margin(15)
.allowDrop([udmf.UnifiedDataType.TEXT])
.allowDrop([udmfType.UniformDataType.TEXT])
.onDrop((dragEvent: DragEvent)=>{
console.info("the getDisplayX " + dragEvent.getDisplayX());
console.info("the getDisplayY " + dragEvent.getDisplayY());
......@@ -159,13 +160,13 @@ struct Index {
.width('100%')
.height(200)
.controls(true)
.allowDrop([udmf.UnifiedDataType.VIDEO])
.allowDrop([udmfType.UniformDataType.VIDEO])
Column() {
Text(this.abstractContent).fontSize(20).width('100%')
Text(this.textContent).fontSize(15).width('100%')
}.width('100%').height(100).margin(20).border({color: Color.Black, width: 1})
.allowDrop([udmf.UnifiedDataType.PLAIN_TEXT])
.allowDrop([udmfType.UniformDataType.PLAIN_TEXT])
.onDrop((dragEvent)=>{
this.getDataFromUdmfRetry(dragEvent, event=>{
let records: Array<udmf.UnifiedRecord> = event.getData().getRecords();
......
......@@ -14,19 +14,21 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import UDMF from '@ohos.data.UDMF';
import unifiedDataChannel from '@ohos.data.unifiedDataChannel';
import uniformTypeDescriptor from '@ohos.data.uniformTypeDescriptor';
export default function UDMFApiTest() {
describe('UDMFApiTest', function () {
console.info('start################################start');
let text = new UDMF.Text();
console.info('start UDMFApiTest');
let text = new unifiedDataChannel.Text();
text.details = {
title:"标题",
content:"内容"
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.details = {
title:"标题",
content:"内容"
......@@ -34,15 +36,16 @@ export default function UDMFApiTest() {
plainText.textContent = "textContent";
plainText.abstract = "abstract";
let link = new UDMF.Hyperlink();
let link = new unifiedDataChannel.Hyperlink();
link.details = {
title:"标题",
content:"内容"
};
link.url = "url";
link.description = "description";
let html = new UDMF.HTML();
let html = new unifiedDataChannel.HTML();
html.details = {
title:"标题",
content:"内容"
......@@ -50,35 +53,35 @@ export default function UDMFApiTest() {
html.htmlContent = "htmlContent";
html.plainContent = "plainContent";
let file = new UDMF.File();
let file = new unifiedDataChannel.File();
file.details = {
title:"标题",
content:"内容"
};
file.uri = "uri";
let folder = new UDMF.Folder();
let folder = new unifiedDataChannel.Folder();
folder.details = {
title:"标题",
content:"内容"
};
folder.folderUri = "folderUri";
let image = new UDMF.Image();
let image = new unifiedDataChannel.Image();
image.details = {
title:"标题",
content:"内容"
};
image.imageUri = "imageUri";
let video = new UDMF.Video();
let video = new unifiedDataChannel.Video();
video.details = {
title:"标题",
content:"内容"
};
video.videoUri = "videoUri";
let Audio = new UDMF.Audio();
let Audio = new unifiedDataChannel.Audio();
Audio.details = {
title:"标题",
content:"内容"
......@@ -88,14 +91,14 @@ export default function UDMFApiTest() {
let arrayBuf = new ArrayBuffer(2 * 3 * 4);
let u8Array = new Uint8Array(arrayBuf);
let systemDefinedRecord = new UDMF.SystemDefinedRecord();
let systemDefinedRecord = new unifiedDataChannel.SystemDefinedRecord();
systemDefinedRecord.details = {
title:"标题",
version:1,
content:u8Array
};
let systemDefinedForm = new UDMF.SystemDefinedForm();
let systemDefinedForm = new unifiedDataChannel.SystemDefinedForm();
systemDefinedForm.details = {
title:"标题",
version:1,
......@@ -107,7 +110,7 @@ export default function UDMFApiTest() {
systemDefinedForm.abilityName = 'abilityName';
systemDefinedForm.module = 'module';
let systemDefinedAppItem = new UDMF.SystemDefinedAppItem();
let systemDefinedAppItem = new unifiedDataChannel.SystemDefinedAppItem();
systemDefinedAppItem.details = {
title:"标题",
version:1,
......@@ -120,7 +123,7 @@ export default function UDMFApiTest() {
systemDefinedAppItem.bundleName = 'bundleName';
systemDefinedAppItem.abilityName = 'abilityName';
let systemDefinedPixelMap = new UDMF.SystemDefinedPixelMap();
let systemDefinedPixelMap = new unifiedDataChannel.SystemDefinedPixelMap();
systemDefinedPixelMap.details = {
title:"标题",
version:1,
......@@ -128,11 +131,11 @@ export default function UDMFApiTest() {
};
systemDefinedPixelMap.rawData = u8Array;
let applicationDefinedRecord = new UDMF.ApplicationDefinedRecord();
let applicationDefinedRecord = new unifiedDataChannel.ApplicationDefinedRecord();
applicationDefinedRecord.applicationDefinedType = 'applicationDefinedType';
applicationDefinedRecord.rawData = u8Array;
let summary = new UDMF.Summary;
let summary = new unifiedDataChannel.Summary;
let records1 = summary.summary;
console.info("ttt " + records1);
let records2 = summary.totalSize;
......@@ -140,16 +143,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API001
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a text record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a text record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API001',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API001 start');
let unifiedData = new UDMF.UnifiedData(text);
let unifiedData = new unifiedDataChannel.UnifiedData(text);
let records = unifiedData.getRecords();
let record = <UDMF.Text>(records[0]);
let record = <unifiedDataChannel.Text>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
......@@ -160,16 +163,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API002
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a plaintext record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a plaintext record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API002',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API002 start');
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
let records = unifiedData.getRecords();
let record = <UDMF.PlainText>(records[0]);
let record = <unifiedDataChannel.PlainText>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
......@@ -182,16 +185,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API003
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a hyperlink record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a hyperlink record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API003',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API003 start');
let unifiedData = new UDMF.UnifiedData(link);
let unifiedData = new unifiedDataChannel.UnifiedData(link);
let records = unifiedData.getRecords();
let record = <UDMF.Hyperlink>(records[0]);
let record = <unifiedDataChannel.Hyperlink>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
......@@ -204,16 +207,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API004
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a html record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a html record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API004',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API004 start');
let unifiedData = new UDMF.UnifiedData(html);
let unifiedData = new unifiedDataChannel.UnifiedData(html);
let records = unifiedData.getRecords();
let record = <UDMF.HTML>(records[0]);
let record = <unifiedDataChannel.HTML>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
......@@ -226,16 +229,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API005
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a file record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a file record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API005',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API005 start');
let unifiedData = new UDMF.UnifiedData(file);
let unifiedData = new unifiedDataChannel.UnifiedData(file);
let records = unifiedData.getRecords();
let record = <UDMF.File>(records[0]);
let record = <unifiedDataChannel.File>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
......@@ -246,16 +249,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API006
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a folder record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a folder record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API006',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API006 start');
let unifiedData = new UDMF.UnifiedData(folder);
let unifiedData = new unifiedDataChannel.UnifiedData(folder);
let records = unifiedData.getRecords();
let record = <UDMF.Folder>(records[0]);
let record = <unifiedDataChannel.Folder>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
......@@ -266,16 +269,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API007
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a image record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a image record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API007',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API007 start');
let unifiedData = new UDMF.UnifiedData(image);
let unifiedData = new unifiedDataChannel.UnifiedData(image);
let records = unifiedData.getRecords();
let record = <UDMF.Image>(records[0]);
let record = <unifiedDataChannel.Image>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
......@@ -286,16 +289,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API008
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a video record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a video record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API008',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API008 start');
let unifiedData = new UDMF.UnifiedData(video);
let unifiedData = new unifiedDataChannel.UnifiedData(video);
let records = unifiedData.getRecords();
let record = <UDMF.Video>(records[0]);
let record = <unifiedDataChannel.Video>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
......@@ -306,16 +309,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API009
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a systemdefinedrecord record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a systemdefinedrecord record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API009',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API009 start');
let unifiedData = new UDMF.UnifiedData(systemDefinedRecord);
let unifiedData = new unifiedDataChannel.UnifiedData(systemDefinedRecord);
let records = unifiedData.getRecords();
let record = <UDMF.SystemDefinedRecord>(records[0]);
let record = <unifiedDataChannel.SystemDefinedRecord>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.version).assertEqual(1);
......@@ -329,16 +332,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API010
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a systemdefinedform record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a systemdefinedform record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API010',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API010 start');
let unifiedData = new UDMF.UnifiedData(systemDefinedForm);
let unifiedData = new unifiedDataChannel.UnifiedData(systemDefinedForm);
let records = unifiedData.getRecords();
let record = <UDMF.SystemDefinedForm>(records[0]);
let record = <unifiedDataChannel.SystemDefinedForm>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.version).assertEqual(1);
......@@ -357,16 +360,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API011
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a systemdefinedappitem record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a systemdefinedappitem record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API011',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API011 start');
let unifiedData = new UDMF.UnifiedData(systemDefinedAppItem);
let unifiedData = new unifiedDataChannel.UnifiedData(systemDefinedAppItem);
let records = unifiedData.getRecords();
let record = <UDMF.SystemDefinedAppItem>(records[0]);
let record = <unifiedDataChannel.SystemDefinedAppItem>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.version).assertEqual(1);
......@@ -386,16 +389,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API012
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a systemdefinedpixelmap record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a systemdefinedpixelmap record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API012',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API012 start');
let unifiedData = new UDMF.UnifiedData(systemDefinedPixelMap);
let unifiedData = new unifiedDataChannel.UnifiedData(systemDefinedPixelMap);
let records = unifiedData.getRecords();
let record = <UDMF.SystemDefinedPixelMap>(records[0]);
let record = <unifiedDataChannel.SystemDefinedPixelMap>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.version).assertEqual(1);
......@@ -412,16 +415,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API013
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a applicationdefinedrecord record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a applicationdefinedrecord record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API013',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API013 start');
let unifiedData = new UDMF.UnifiedData(applicationDefinedRecord);
let unifiedData = new unifiedDataChannel.UnifiedData(applicationDefinedRecord);
let records = unifiedData.getRecords();
let record = <UDMF.ApplicationDefinedRecord>(records[0]);
let record = <unifiedDataChannel.ApplicationDefinedRecord>(records[0]);
expect(records.length).assertEqual(1);
expect(record.applicationDefinedType).assertEqual('applicationDefinedType');
for(var i = 0; i<u8Array.length; i++){
......@@ -434,14 +437,14 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API014
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a recordgroup.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a recordgroup.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API014',0, async function (done) {
console.info('SUB_DistributedData_Udmf_API014 start');
let unifiedData = new UDMF.UnifiedData(text);
let unifiedData = new unifiedDataChannel.UnifiedData(text);
unifiedData.addRecord(plainText);
unifiedData.addRecord(link);
unifiedData.addRecord(html);
......@@ -455,33 +458,31 @@ export default function UDMFApiTest() {
unifiedData.addRecord(systemDefinedPixelMap);
unifiedData.addRecord(applicationDefinedRecord);
let records = unifiedData.getRecords();
let record1 = <UDMF.Text>(records[0]);
let record2 = <UDMF.PlainText>(records[1]);
let record3 = <UDMF.Hyperlink>(records[2]);
let record4 = <UDMF.HTML>(records[3]);
let record5 = <UDMF.File>(records[4]);
let record6 = <UDMF.Folder>(records[5]);
let record7 = <UDMF.Image>(records[6]);
let record8 = <UDMF.Video>(records[7]);
let record9 = <UDMF.SystemDefinedRecord>(records[8]);
let record10 = <UDMF.SystemDefinedForm>(records[9]);
let record11 = <UDMF.SystemDefinedAppItem>(records[10]);
let record12 = <UDMF.SystemDefinedPixelMap>(records[11]);
let record13 = <UDMF.ApplicationDefinedRecord>(records[12]);
let record1 = <unifiedDataChannel.Text>(records[0]);
let record2 = <unifiedDataChannel.PlainText>(records[1]);
let record3 = <unifiedDataChannel.Hyperlink>(records[2]);
let record4 = <unifiedDataChannel.HTML>(records[3]);
let record5 = <unifiedDataChannel.File>(records[4]);
let record6 = <unifiedDataChannel.Folder>(records[5]);
let record7 = <unifiedDataChannel.Image>(records[6]);
let record8 = <unifiedDataChannel.Video>(records[7]);
let record9 = <unifiedDataChannel.SystemDefinedRecord>(records[8]);
let record10 = <unifiedDataChannel.SystemDefinedForm>(records[9]);
let record11 = <unifiedDataChannel.SystemDefinedAppItem>(records[10]);
let record12 = <unifiedDataChannel.SystemDefinedPixelMap>(records[11]);
let record13 = <unifiedDataChannel.ApplicationDefinedRecord>(records[12]);
expect(records.length).assertEqual(13);
expect(record1.getType()).assertEqual(UDMF.UnifiedDataType.TEXT);
expect(record2.getType()).assertEqual(UDMF.UnifiedDataType.PLAIN_TEXT);
expect(record3.getType()).assertEqual(UDMF.UnifiedDataType.HYPERLINK);
expect(record4.getType()).assertEqual(UDMF.UnifiedDataType.HTML);
expect(record5.getType()).assertEqual(UDMF.UnifiedDataType.FILE);
expect(record6.getType()).assertEqual(UDMF.UnifiedDataType.FOLDER);
expect(record7.getType()).assertEqual(UDMF.UnifiedDataType.IMAGE);
expect(record8.getType()).assertEqual(UDMF.UnifiedDataType.VIDEO);
expect(record9.getType()).assertEqual(UDMF.UnifiedDataType.SYSTEM_DEFINED_RECORD);
expect(record10.getType()).assertEqual(UDMF.UnifiedDataType.SYSTEM_DEFINED_FORM);
expect(record11.getType()).assertEqual(UDMF.UnifiedDataType.SYSTEM_DEFINED_APP_ITEM);
expect(record12.getType()).assertEqual(UDMF.UnifiedDataType.SYSTEM_DEFINED_PIXEL_MAP);
expect(record13.getType()).assertEqual(UDMF.UnifiedDataType.APPLICATION_DEFINED_RECORD);
expect(record1.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.TEXT);
expect(record2.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.PLAIN_TEXT);
expect(record3.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.HYPERLINK);
expect(record4.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.HTML);
expect(record5.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.FILE);
expect(record6.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.FOLDER);
expect(record7.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.IMAGE);
expect(record8.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.VIDEO);
expect(record10.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.OPENHARMONY_FORM);
expect(record11.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.OPENHARMONY_APP_ITEM);
expect(record12.getType()).assertEqual(uniformTypeDescriptor.UniformDataType.OPENHARMONY_PIXEL_MAP);
console.info("SUB_DistributedData_Udmf_API014 end");
done();
})
......@@ -489,16 +490,16 @@ export default function UDMFApiTest() {
/**
* @tc.number SUB_DistributedData_Udmf_API015
* @tc.name CreateData
* @tc.desc Test UDMF creating a unifieddata with a Audio record.
* @tc.desc Test unifiedDataChannel creating a unifieddata with a Audio record.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_DistributedData_Udmf_API015',0, function (done) {
console.info('SUB_DistributedData_Udmf_API008 start');
let unifiedData = new UDMF.UnifiedData(Audio);
let unifiedData = new unifiedDataChannel.UnifiedData(Audio);
let records = unifiedData.getRecords();
let record = <UDMF.Audio>(records[0]);
let record = <unifiedDataChannel.Audio>(records[0]);
expect(records.length).assertEqual(1);
expect(record.details.title).assertEqual('标题');
expect(record.details.content).assertEqual('内容');
......
......@@ -14,7 +14,8 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import UDMF from '@ohos.data.UDMF';
import unifiedDataChannel from '@ohos.data.unifiedDataChannel';
import uniformTypeDescriptor from '@ohos.data.uniformTypeDescriptor';
const TAG = '[ttt]'
......@@ -24,9 +25,9 @@ export default function UDMFApiCallback() {
beforeEach(async function () {
console.info(TAG + "beforeEach")
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
await UDMF.deleteData(options).then((data) => {
await unifiedDataChannel.deleteData(options).then((data) => {
let size = data.length;
console.info(TAG, ` [beforeEach] success to deleteData data.size = ${size}`);
}).catch((err) => {
......@@ -38,16 +39,16 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_InsertData_Callback_0100
* @tc.name UDMF insertData callback interface test
* @tc.desc UDMF insertData callback interface test.
* @tc.name unifiedDataChannel insertData callback interface test
* @tc.desc unifiedDataChannel insertData callback interface test.
*/
it('SUB_DDM_UDMF_InsertData_Callback_0100', 0, function (done) {
let Options = {}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = 'this is textContent';
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(Options, unifiedData, function (err, data) {
unifiedDataChannel.insertData(Options, unifiedData, function (err, data) {
if (err === undefined) {
console.info(TAG + `data = ${data}, options = ${Options}`);
expect(err === undefined).assertFail();
......@@ -68,18 +69,18 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_InsertData_Callback_0200
* @tc.name UDMF insertData callback interface test
* @tc.desc UDMF insertData callback interface test.
* @tc.name unifiedDataChannel insertData callback interface test
* @tc.desc unifiedDataChannel insertData callback interface test.
*/
it('SUB_DDM_UDMF_InsertData_Callback_0200', 0, function (done) {
let Options = {
intention: undefined
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = 'this is textContent';
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(Options, unifiedData, function (err, data) {
unifiedDataChannel.insertData(Options, unifiedData, function (err, data) {
if (err === undefined) {
console.info(TAG + `data = ${data}, options = ${Options}`);
expect(err === undefined).assertFail();
......@@ -100,18 +101,18 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_InsertData_Callback_0300
* @tc.name UDMF insertData callback interface test
* @tc.desc UDMF insertData callback interface test.
* @tc.name unifiedDataChannel insertData callback interface test
* @tc.desc unifiedDataChannel insertData callback interface test.
*/
it('SUB_DDM_UDMF_InsertData_Callback_0300', 0, function (done) {
let Options = {
intention:null
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = 'this is textContent';
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(Options, unifiedData, function (err, data) {
unifiedDataChannel.insertData(Options, unifiedData, function (err, data) {
if (err === undefined) {
console.info(TAG + `data = ${data}, options = ${Options}`);
expect(err === undefined).assertFail();
......@@ -132,19 +133,19 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_InsertData_Callback_0400
* @tc.name UDMF insertData callback interface test
* @tc.desc UDMF insertData callback interface test.
* @tc.name unifiedDataChannel insertData callback interface test
* @tc.desc unifiedDataChannel insertData callback interface test.
*/
it('SUB_DDM_UDMF_InsertData_Callback_0400', 0, function (done) {
let Options = {
intention: undefined,
key: undefined
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = 'this is textContent';
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(Options, unifiedData, function (err, data) {
unifiedDataChannel.insertData(Options, unifiedData, function (err, data) {
if (err === undefined) {
console.info(TAG + `data = ${data}, options = ${Options}`);
expect(err === undefined).assertFail();
......@@ -165,18 +166,18 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_InsertData_Callback_0500
* @tc.name UDMF insertData callback interface test
* @tc.desc UDMF insertData callback interface test.
* @tc.name unifiedDataChannel insertData callback interface test
* @tc.desc unifiedDataChannel insertData callback interface test.
*/
it('SUB_DDM_UDMF_InsertData_Callback_0500', 0, function (done) {
let Options = {
key: null
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = 'this is textContent';
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(Options, unifiedData, function (err, data) {
unifiedDataChannel.insertData(Options, unifiedData, function (err, data) {
if (err === undefined) {
console.info(TAG + `data = ${data}, options = ${Options}`);
expect(err === undefined).assertFail();
......@@ -197,18 +198,18 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_InsertData_Callback_0600
* @tc.name UDMF insertData callback interface test
* @tc.desc UDMF insertData callback interface test.
* @tc.name unifiedDataChannel insertData callback interface test
* @tc.desc unifiedDataChannel insertData callback interface test.
*/
it('SUB_DDM_UDMF_InsertData_Callback_0600', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try{
UDMF.insertData(options, unifiedData, function (err, data) {
unifiedDataChannel.insertData(options, unifiedData, function (err, data) {
if (err === undefined) {
console.info(TAG + `data = ${data}, options = ${options}`);
expect(err === undefined).assertTrue()
......@@ -227,24 +228,24 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_UpdateData_Callback_0100
* @tc.name UDMF updateData callback interface test
* @tc.desc UDMF updateData callback interface test.
* @tc.name unifiedDataChannel updateData callback interface test
* @tc.desc unifiedDataChannel updateData callback interface test.
*/
it('SUB_DDM_UDMF_UpdateData_Callback_0100', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try{
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(TAG, ` Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options}`);
UDMF.updateData({key: data}, unifiedData, function (err, ret) {
unifiedDataChannel.updateData({key: data}, unifiedData, function (err, ret) {
if (err === undefined) {
console.info(TAG + `updateData success; data = ${ret}, options = ${options}`);
expect(err === undefined).assertTrue()
......@@ -265,25 +266,25 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_UpdateData_Callback_0200
* @tc.name UDMF insertData callback interface test
* @tc.desc UDMF insertData callback interface test.
* @tc.name unifiedDataChannel insertData callback interface test
* @tc.desc unifiedDataChannel insertData callback interface test.
*/
it('SUB_DDM_UDMF_UpdateData_Callback_0200', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(TAG, ` Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0200 success; data = ${data}, options = ${options}`);
try{
UDMF.updateData({key: undefined}, unifiedData, function (err, ret) {
unifiedDataChannel.updateData({key: undefined}, unifiedData, function (err, ret) {
if (err === undefined) {
console.info(TAG + `updateData success; data = ${ret}, options = ${options}`);
expect(err !== null).assertFail()
......@@ -309,25 +310,25 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_UpdateData_Callback_0300
* @tc.name UDMF insertData callback interface test
* @tc.desc UDMF insertData callback interface test.
* @tc.name unifiedDataChannel insertData callback interface test
* @tc.desc unifiedDataChannel insertData callback interface test.
*/
it('SUB_DDM_UDMF_UpdateData_Callback_0300', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(TAG, ` Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0300 success; data = ${data}, options = ${options}`);
try{
UDMF.updateData({key: null}, unifiedData, function (err, ret) {
unifiedDataChannel.updateData({key: null}, unifiedData, function (err, ret) {
if (err === undefined) {
console.info(TAG + `updateData success; data = ${ret}, options = ${options}`);
expect(err !== null).assertFail()
......@@ -354,26 +355,26 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_UpdateData_Callback_0400
* @tc.name UDMF insertData callback interface test
* @tc.desc UDMF insertData callback interface test.
* @tc.name unifiedDataChannel insertData callback interface test
* @tc.desc unifiedDataChannel insertData callback interface test.
*/
it('SUB_DDM_UDMF_UpdateData_Callback_0400', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: undefined
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try{
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(TAG, ` Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0500 success; data = ${data}, options = ${options}`);
UDMF.updateData({key: data}, unifiedData, function (err, ret) {
unifiedDataChannel.updateData({key: data}, unifiedData, function (err, ret) {
if (err === undefined) {
console.info(TAG + `updateData success; data = ${ret}, options = ${options}`);
expect(err === undefined).assertTrue()
......@@ -394,24 +395,24 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_QueryData_Callback_0100
* @tc.name UDMF queryData callback interface test
* @tc.desc UDMF queryData callback interface test.
* @tc.name unifiedDataChannel queryData callback interface test
* @tc.desc unifiedDataChannel queryData callback interface test.
*/
it('SUB_DDM_UDMF_QueryData_Callback_0100', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options}`);
UDMF.queryData(options, function (err, ret) {
unifiedDataChannel.queryData(options, function (err, ret) {
if (err === undefined) {
let size = ret.length;
console.info(TAG, ` data.size = ${size}`);
......@@ -419,8 +420,8 @@ export default function UDMFApiCallback() {
let records = ret[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` queryData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -443,24 +444,24 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_QueryData_Callback_0200
* @tc.name UDMF queryData callback interface test
* @tc.desc UDMF queryData callback interface test.
* @tc.name unifiedDataChannel queryData callback interface test
* @tc.desc unifiedDataChannel queryData callback interface test.
*/
it('SUB_DDM_UDMF_QueryData_Callback_0200', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options}`);
UDMF.queryData({key: data}, function (err, ret) {
unifiedDataChannel.queryData({key: data}, function (err, ret) {
if (err === undefined) {
let size = ret.length;
console.info(TAG, ` data.size = ${size}`);
......@@ -468,8 +469,8 @@ export default function UDMFApiCallback() {
let records = ret[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` queryData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -492,28 +493,28 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_QueryData_Callback_0300
* @tc.name UDMF queryData callback interface test
* @tc.desc UDMF queryData callback interface test.
* @tc.name unifiedDataChannel queryData callback interface test
* @tc.desc unifiedDataChannel queryData callback interface test.
*/
it('SUB_DDM_UDMF_QueryData_Callback_0300', 0, function (done) {
let options1 = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options1, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options1, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options1}`);
let options2 = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: data
};
UDMF.queryData(options2, function (err, ret) {
unifiedDataChannel.queryData(options2, function (err, ret) {
if (err === undefined) {
let size = ret.length;
console.info(TAG, ` data.size = ${size}`);
......@@ -521,8 +522,8 @@ export default function UDMFApiCallback() {
let records = ret[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` queryData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -545,29 +546,29 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_QueryData_Callback_0400
* @tc.name UDMF queryData callback interface test
* @tc.desc UDMF queryData callback interface test.
* @tc.name unifiedDataChannel queryData callback interface test
* @tc.desc unifiedDataChannel queryData callback interface test.
*/
it('SUB_DDM_UDMF_QueryData_Callback_0400', 0, function (done) {
let options1 = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options1, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options1, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0400 success; data = ${data}, options = ${options1}`);
let options2 = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: 'data'
};
try{
UDMF.queryData(options2, function (err, ret) {
unifiedDataChannel.queryData(options2, function (err, ret) {
if (err === undefined) {
let size = ret.length;
console.info(TAG, ` data.size = ${size}`);
......@@ -575,8 +576,8 @@ export default function UDMFApiCallback() {
let records = ret[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` queryData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -604,28 +605,28 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_QueryData_Callback_0500
* @tc.name UDMF queryData callback interface test
* @tc.desc UDMF queryData callback interface test.
* @tc.name unifiedDataChannel queryData callback interface test
* @tc.desc unifiedDataChannel queryData callback interface test.
*/
it('SUB_DDM_UDMF_QueryData_Callback_0500', 0, function (done) {
let options1 = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options1, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options1, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0500 success; data = ${data}, options = ${options1}`);
let options2 = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: undefined
};
UDMF.queryData(options2, function (err, ret) {
unifiedDataChannel.queryData(options2, function (err, ret) {
if (err === undefined) {
let size = ret.length;
console.info(TAG, ` data.size = ${size}`);
......@@ -633,8 +634,8 @@ export default function UDMFApiCallback() {
let records = ret[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` queryData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -657,30 +658,30 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_DeleteData_Callback_0100
* @tc.name UDMF deleteData callback interface test
* @tc.desc UDMF deleteData callback interface test.
* @tc.name unifiedDataChannel deleteData callback interface test
* @tc.desc unifiedDataChannel deleteData callback interface test.
*/
it('SUB_DDM_UDMF_DeleteData_Callback_0100', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options}`);
UDMF.queryData(options, function (errInfo, ret) {
unifiedDataChannel.queryData(options, function (errInfo, ret) {
if (errInfo !== undefined) {
console.info(`Failed to queryData. code is ${errInfo.code},message is ${errInfo.message} `);
return;
}
console.info(TAG, ` queryData size = ${ret.length}`);
UDMF.deleteData(options, function (err, row) {
unifiedDataChannel.deleteData(options, function (err, row) {
if (err == undefined) {
let size = row.length;
console.info(TAG, ` deleteData size = ${size}`);
......@@ -688,8 +689,8 @@ export default function UDMFApiCallback() {
let records = row[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` deleteData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -713,30 +714,30 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_DeleteData_Callback_0200
* @tc.name UDMF deleteData callback interface test
* @tc.desc UDMF deleteData callback interface test.
* @tc.name unifiedDataChannel deleteData callback interface test
* @tc.desc unifiedDataChannel deleteData callback interface test.
*/
it('SUB_DDM_UDMF_DeleteData_Callback_0200', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0200 success; data = ${data}, options = ${options}`);
UDMF.queryData(options, function (errInfo, ret) {
unifiedDataChannel.queryData(options, function (errInfo, ret) {
if (errInfo !== undefined) {
console.info(`Failed to queryData. code is ${errInfo.code},message is ${errInfo.message} `);
return;
}
console.info(TAG, ` queryData size = ${ret.length}`);
UDMF.deleteData({key: data}, function (err, row) {
unifiedDataChannel.deleteData({key: data}, function (err, row) {
if (err == undefined) {
let size = row.length;
console.info(TAG, ` deleteData size = ${size}`);
......@@ -744,8 +745,8 @@ export default function UDMFApiCallback() {
let records = row[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` deleteData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -769,34 +770,34 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_DeleteData_Callback_0300
* @tc.name UDMF deleteData callback interface test
* @tc.desc UDMF deleteData callback interface test.
* @tc.name unifiedDataChannel deleteData callback interface test
* @tc.desc unifiedDataChannel deleteData callback interface test.
*/
it('SUB_DDM_UDMF_DeleteData_Callback_0300', 0, function (done) {
let options1 = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options1, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options1, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options1}`);
UDMF.queryData(options1, function (errInfo, ret) {
unifiedDataChannel.queryData(options1, function (errInfo, ret) {
if (errInfo !== undefined) {
console.info(`Failed to queryData. code is ${errInfo.code},message is ${errInfo.message} `);
return;
}
console.info(TAG, ` queryData size = ${ret.length}`);
let options2 = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: data
};
UDMF.deleteData(options2, function (err, row) {
unifiedDataChannel.deleteData(options2, function (err, row) {
if (err == undefined) {
let size = row.length;
console.info(TAG, ` deleteData size = ${size}`);
......@@ -804,8 +805,8 @@ export default function UDMFApiCallback() {
let records = row[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` deleteData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -829,35 +830,35 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_DeleteData_Callback_0400
* @tc.name UDMF deleteData callback interface test
* @tc.desc UDMF deleteData callback interface test.
* @tc.name unifiedDataChannel deleteData callback interface test
* @tc.desc unifiedDataChannel deleteData callback interface test.
*/
it('SUB_DDM_UDMF_DeleteData_Callback_0400', 0, function (done) {
let options1 = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options1, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options1, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options1}`);
UDMF.queryData(options1, function (errInfo, ret) {
unifiedDataChannel.queryData(options1, function (errInfo, ret) {
if (errInfo !== undefined) {
console.info(`Failed to queryData. code is ${errInfo.code},message is ${errInfo.message} `);
return;
}
console.info(TAG, ` queryData size = ${ret.length}`);
let options2 = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: 'data'
};
try{
UDMF.deleteData(options2, function (err, row) {
unifiedDataChannel.deleteData(options2, function (err, row) {
if (err == undefined) {
let size = row.length;
console.info(TAG, ` deleteData size = ${size}`);
......@@ -865,8 +866,8 @@ export default function UDMFApiCallback() {
let records = row[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` deleteData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -896,34 +897,34 @@ export default function UDMFApiCallback() {
/**
* @tc.number SUB_DDM_UDMF_DeleteData_Callback_0500
* @tc.name UDMF deleteData callback interface test
* @tc.desc UDMF deleteData callback interface test.
* @tc.name unifiedDataChannel deleteData callback interface test
* @tc.desc unifiedDataChannel deleteData callback interface test.
*/
it('SUB_DDM_UDMF_DeleteData_Callback_0300', 0, function (done) {
let options1 = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options1, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options1, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options1}`);
UDMF.queryData(options1, function (errInfo, ret) {
unifiedDataChannel.queryData(options1, function (errInfo, ret) {
if (errInfo !== undefined) {
console.info(`Failed to queryData. code is ${errInfo.code},message is ${errInfo.message} `);
return;
}
console.info(TAG, ` queryData size = ${ret.length}`);
let options2 = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: undefined
};
UDMF.deleteData(options2, function (err, row) {
unifiedDataChannel.deleteData(options2, function (err, row) {
if (err == undefined) {
let size = row.length;
console.info(TAG, ` deleteData size = ${size}`);
......@@ -931,8 +932,8 @@ export default function UDMFApiCallback() {
let records = row[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` deleteData.result = ${i + 1}.${text.textContent}`);
}
}
......
......@@ -14,7 +14,8 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import UDMF from '@ohos.data.UDMF';
import unifiedDataChannel from '@ohos.data.unifiedDataChannel';
import uniformTypeDescriptor from '@ohos.data.uniformTypeDescriptor';
const TAG = '[ttt]'
......@@ -24,9 +25,9 @@ export default function UDMFApiPromise() {
beforeEach(async function () {
console.info(TAG + "beforeEach")
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
await UDMF.deleteData(options).then((data) => {
await unifiedDataChannel.deleteData(options).then((data) => {
let size = data.length;
console.info(TAG, ` [beforeEach] success to deleteData data.size = ${size}`);
}).catch((err) => {
......@@ -38,16 +39,16 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_InsertData_Promise_0100
* @tc.name UDMF insertData promise interface test
* @tc.desc UDMF insertData promise interface test.
* @tc.name unifiedDataChannel insertData promise interface test
* @tc.desc unifiedDataChannel insertData promise interface test.
*/
it('SUB_DDM_UDMF_InsertData_Promise_0100', 0, function (done) {
let Options = {}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = 'this is textContent';
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(Options, unifiedData).then((data) => {
unifiedDataChannel.insertData(Options, unifiedData).then((data) => {
console.info(TAG + `data = ${data}, options = ${Options}`);
expect().assertFail();
done();
......@@ -66,18 +67,18 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_InsertData_Promise_0200
* @tc.name UDMF insertData promise interface test
* @tc.desc UDMF insertData promise interface test.
* @tc.name unifiedDataChannel insertData promise interface test
* @tc.desc unifiedDataChannel insertData promise interface test.
*/
it('SUB_DDM_UDMF_InsertData_Promise_0200', 0, function (done) {
let Options = {
intention: undefined
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = 'this is textContent';
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(Options, unifiedData).then((data) => {
unifiedDataChannel.insertData(Options, unifiedData).then((data) => {
console.info(TAG + `data = ${data}, options = ${Options}`);
expect().assertFail();
done();
......@@ -96,18 +97,18 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_InsertData_Promise_0300
* @tc.name UDMF insertData promise interface test
* @tc.desc UDMF insertData promise interface test.
* @tc.name unifiedDataChannel insertData promise interface test
* @tc.desc unifiedDataChannel insertData promise interface test.
*/
it('SUB_DDM_UDMF_InsertData_Promise_0300', 0, function (done) {
let Options = {
intention:null
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = 'this is textContent';
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(Options, unifiedData).then((data) => {
unifiedDataChannel.insertData(Options, unifiedData).then((data) => {
console.info(TAG + `data = ${data}, options = ${Options}`);
expect().assertFail();
done();
......@@ -126,19 +127,19 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_InsertData_Promise_0400
* @tc.name UDMF insertData promise interface test
* @tc.desc UDMF insertData promise interface test.
* @tc.name unifiedDataChannel insertData promise interface test
* @tc.desc unifiedDataChannel insertData promise interface test.
*/
it('SUB_DDM_UDMF_InsertData_Promise_0400', 0, function (done) {
let Options = {
intention: undefined,
key: undefined
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = 'this is textContent';
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(Options, unifiedData).then((data) => {
unifiedDataChannel.insertData(Options, unifiedData).then((data) => {
console.info(TAG + `data = ${data}, options = ${Options}`);
expect().assertFail();
done();
......@@ -157,18 +158,18 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_InsertData_Promise_0500
* @tc.name UDMF insertData promise interface test
* @tc.desc UDMF insertData promise interface test.
* @tc.name unifiedDataChannel insertData promise interface test
* @tc.desc unifiedDataChannel insertData promise interface test.
*/
it('SUB_DDM_UDMF_InsertData_Promise_0500', 0, function (done) {
let Options = {
key: null
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = 'this is textContent';
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(Options, unifiedData).then((data) => {
unifiedDataChannel.insertData(Options, unifiedData).then((data) => {
console.info(TAG + `data = ${data}, options = ${Options}`);
expect().assertFail();
done();
......@@ -187,18 +188,18 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_InsertData_Promise_0600
* @tc.name UDMF insertData promise interface test
* @tc.desc UDMF insertData promise interface test.
* @tc.name unifiedDataChannel insertData promise interface test
* @tc.desc unifiedDataChannel insertData promise interface test.
*/
it('SUB_DDM_UDMF_InsertData_Promise_0600', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try{
UDMF.insertData(options, unifiedData).then((data) => {
unifiedDataChannel.insertData(options, unifiedData).then((data) => {
console.info(TAG + `data = ${data}, options = ${options}`);
expect(data !== null).assertTrue();
done()
......@@ -215,24 +216,24 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_UpdateData_Promise_0100
* @tc.name UDMF updateData promise interface test
* @tc.desc UDMF updateData promise interface test.
* @tc.name unifiedDataChannel updateData promise interface test
* @tc.desc unifiedDataChannel updateData promise interface test.
*/
it('SUB_DDM_UDMF_UpdateData_Promise_0100', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try{
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(TAG, ` Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options}`);
UDMF.updateData({key: data}, unifiedData).then((ret) => {
unifiedDataChannel.updateData({key: data}, unifiedData).then((ret) => {
console.info(TAG + `updateData success; data = ${ret}, options = ${options}`);
expect(ret !== null).assertTrue();
done();
......@@ -252,25 +253,25 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_UpdateData_Promise_0200
* @tc.name UDMF insertData promise interface test
* @tc.desc UDMF insertData promise interface test.
* @tc.name unifiedDataChannel insertData promise interface test
* @tc.desc unifiedDataChannel insertData promise interface test.
*/
it('SUB_DDM_UDMF_UpdateData_Promise_0200', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(TAG, ` Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0200 success; data = ${data}, options = ${options}`);
try{
UDMF.updateData({key: undefined}, unifiedData).then((ret) => {
unifiedDataChannel.updateData({key: undefined}, unifiedData).then((ret) => {
console.info(TAG + `updateData success; data = ${ret}, options = ${options}`);
expect().assertFail()
done();
......@@ -294,25 +295,25 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_UpdateData_Promise_0300
* @tc.name UDMF insertData promise interface test
* @tc.desc UDMF insertData promise interface test.
* @tc.name unifiedDataChannel insertData promise interface test
* @tc.desc unifiedDataChannel insertData promise interface test.
*/
it('SUB_DDM_UDMF_UpdateData_Promise_0300', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(TAG, ` Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0300 success; data = ${data}, options = ${options}`);
try{
UDMF.updateData({key: null}, unifiedData).then((ret) => {
unifiedDataChannel.updateData({key: null}, unifiedData).then((ret) => {
console.info(TAG + `updateData success; data = ${ret}, options = ${options}`);
expect().assertFail()
done();
......@@ -337,26 +338,26 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_UpdateData_Promise_0400
* @tc.name UDMF insertData promise interface test
* @tc.desc UDMF insertData promise interface test.
* @tc.name unifiedDataChannel insertData promise interface test
* @tc.desc unifiedDataChannel insertData promise interface test.
*/
it('SUB_DDM_UDMF_UpdateData_Promise_0400', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: undefined
}
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try{
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(TAG, ` Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options}`);
UDMF.updateData({key: data}, unifiedData).then((ret) => {
unifiedDataChannel.updateData({key: data}, unifiedData).then((ret) => {
console.info(TAG + `updateData success; data = ${ret}, options = ${options}`);
expect(ret !== null).assertTrue();
done();
......@@ -375,32 +376,32 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_QueryData_Promise_0100
* @tc.name UDMF queryData promise interface test
* @tc.desc UDMF queryData promise interface test.
* @tc.name unifiedDataChannel queryData promise interface test
* @tc.desc unifiedDataChannel queryData promise interface test.
*/
it('SUB_DDM_UDMF_QueryData_Promise_0100', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options}`);
UDMF.queryData(options).then((ret) => {
unifiedDataChannel.queryData(options).then((ret) => {
let size = ret.length;
console.info(TAG, ` data.size = ${size}`);
for (var i = 0; i < size; i++) {
let records = ret[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` queryData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -422,32 +423,32 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_QueryData_Promise_0200
* @tc.name UDMF queryData promise interface test
* @tc.desc UDMF queryData promise interface test.
* @tc.name unifiedDataChannel queryData promise interface test
* @tc.desc unifiedDataChannel queryData promise interface test.
*/
it('SUB_DDM_UDMF_QueryData_Promise_0200', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options}`);
UDMF.queryData({key: data}).then((ret) => {
unifiedDataChannel.queryData({key: data}).then((ret) => {
let size = ret.length;
console.info(TAG, ` data.size = ${size}`);
for (var i = 0; i < size; i++) {
let records = ret[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` queryData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -469,36 +470,36 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_QueryData_Promise_0300
* @tc.name UDMF queryData promise interface test
* @tc.desc UDMF queryData promise interface test.
* @tc.name unifiedDataChannel queryData promise interface test
* @tc.desc unifiedDataChannel queryData promise interface test.
*/
it('SUB_DDM_UDMF_QueryData_Promise_0300', 0, function (done) {
let options1 = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options1, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options1, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options1}`);
let options2 = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: data
};
UDMF.queryData(options2).then((ret) => {
unifiedDataChannel.queryData(options2).then((ret) => {
let size = ret.length;
console.info(TAG, ` data.size = ${size}`);
for (var i = 0; i < size; i++) {
let records = ret[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` queryData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -520,37 +521,37 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_QueryData_Promise_0400
* @tc.name UDMF queryData promise interface test
* @tc.desc UDMF queryData promise interface test.
* @tc.name unifiedDataChannel queryData promise interface test
* @tc.desc unifiedDataChannel queryData promise interface test.
*/
it('SUB_DDM_UDMF_QueryData_Promise_0400', 0, function (done) {
let options1 = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options1, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options1, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0400 success; data = ${data}, options = ${options1}`);
let options2 = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: 'data'
};
try{
UDMF.queryData(options2).then((ret) => {
unifiedDataChannel.queryData(options2).then((ret) => {
let size = ret.length;
console.info(TAG, ` data.size = ${size}`);
for (var i = 0; i < size; i++) {
let records = ret[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` queryData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -577,36 +578,36 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_QueryData_Promise_0500
* @tc.name UDMF queryData promise interface test
* @tc.desc UDMF queryData promise interface test.
* @tc.name unifiedDataChannel queryData promise interface test
* @tc.desc unifiedDataChannel queryData promise interface test.
*/
it('SUB_DDM_UDMF_QueryData_Promise_0500', 0, function (done) {
let options1 = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options1, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options1, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0500 success; data = ${data}, options = ${options1}`);
let options2 = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: undefined
};
UDMF.queryData(options2).then((ret) => {
unifiedDataChannel.queryData(options2).then((ret) => {
let size = ret.length;
console.info(TAG, ` data.size = ${size}`);
for (var i = 0; i < size; i++) {
let records = ret[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` queryData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -628,38 +629,38 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_DeleteData_Promise_0100
* @tc.name UDMF deleteData promise interface test
* @tc.desc UDMF deleteData promise interface test.
* @tc.name unifiedDataChannel deleteData promise interface test
* @tc.desc unifiedDataChannel deleteData promise interface test.
*/
it('SUB_DDM_UDMF_DeleteData_Promise_0100', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options}`);
UDMF.queryData(options, function (errInfo, ret) {
unifiedDataChannel.queryData(options, function (errInfo, ret) {
if (errInfo !== undefined) {
console.info(`Failed to queryData. code is ${errInfo.code},message is ${errInfo.message} `);
return;
}
console.info(TAG, ` queryData size = ${ret.length}`);
UDMF.deleteData(options).then((row) => {
unifiedDataChannel.deleteData(options).then((row) => {
let size = row.length;
console.info(TAG, ` deleteData size = ${size}`);
for (var i = 0; i < size; i++) {
let records = row[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` deleteData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -682,38 +683,38 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_DeleteData_Promise_0200
* @tc.name UDMF deleteData promise interface test
* @tc.desc UDMF deleteData promise interface test.
* @tc.name unifiedDataChannel deleteData promise interface test
* @tc.desc unifiedDataChannel deleteData promise interface test.
*/
it('SUB_DDM_UDMF_DeleteData_Promise_0200', 0, function (done) {
let options = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0200 success; data = ${data}, options = ${options}`);
UDMF.queryData(options, function (errInfo, ret) {
unifiedDataChannel.queryData(options, function (errInfo, ret) {
if (errInfo !== undefined) {
console.info(`Failed to queryData. code is ${errInfo.code},message is ${errInfo.message} `);
return;
}
console.info(TAG, ` queryData size = ${ret.length}`);
UDMF.deleteData({key: data}).then((row) => {
unifiedDataChannel.deleteData({key: data}).then((row) => {
let size = row.length;
console.info(TAG, ` deleteData size = ${size}`);
for (var i = 0; i < size; i++) {
let records = row[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` deleteData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -736,42 +737,42 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_DeleteData_Promise_0300
* @tc.name UDMF deleteData promise interface test
* @tc.desc UDMF deleteData promise interface test.
* @tc.name unifiedDataChannel deleteData promise interface test
* @tc.desc unifiedDataChannel deleteData promise interface test.
*/
it('SUB_DDM_UDMF_DeleteData_Promise_0300', 0, function (done) {
let options1 = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options1, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options1, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options1}`);
UDMF.queryData(options1, function (errInfo, ret) {
unifiedDataChannel.queryData(options1, function (errInfo, ret) {
if (errInfo !== undefined) {
console.info(`Failed to queryData. code is ${errInfo.code},message is ${errInfo.message} `);
return;
}
console.info(TAG, ` queryData size = ${ret.length}`);
let options2 = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: data
};
UDMF.deleteData(options2).then((row) => {
unifiedDataChannel.deleteData(options2).then((row) => {
let size = row.length;
console.info(TAG, ` deleteData size = ${size}`);
for (var i = 0; i < size; i++) {
let records = row[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` deleteData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -794,43 +795,43 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_DeleteData_Promise_0400
* @tc.name UDMF deleteData promise interface test
* @tc.desc UDMF deleteData promise interface test.
* @tc.name unifiedDataChannel deleteData promise interface test
* @tc.desc unifiedDataChannel deleteData promise interface test.
*/
it('SUB_DDM_UDMF_DeleteData_Promise_0400', 0, function (done) {
let options1 = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options1, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options1, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options1}`);
UDMF.queryData(options1, function (errInfo, ret) {
unifiedDataChannel.queryData(options1, function (errInfo, ret) {
if (errInfo !== undefined) {
console.info(`Failed to queryData. code is ${errInfo.code},message is ${errInfo.message} `);
return;
}
console.info(TAG, ` queryData size = ${ret.length}`);
let options2 = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: 'data'
};
try{
UDMF.deleteData(options2).then((row) => {
unifiedDataChannel.deleteData(options2).then((row) => {
let size = row.length;
console.info(TAG, ` deleteData size = ${size}`);
for (var i = 0; i < size; i++) {
let records = row[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` deleteData.result = ${i + 1}.${text.textContent}`);
}
}
......@@ -858,42 +859,42 @@ export default function UDMFApiPromise() {
/**
* @tc.number SUB_DDM_UDMF_DeleteData_Promise_0500
* @tc.name UDMF deleteData promise interface test
* @tc.desc UDMF deleteData promise interface test.
* @tc.name unifiedDataChannel deleteData promise interface test
* @tc.desc unifiedDataChannel deleteData promise interface test.
*/
it('SUB_DDM_UDMF_DeleteData_Promise_0500', 0, function (done) {
let options1 = {
intention: UDMF.Intention.DATA_HUB
intention: unifiedDataChannel.Intention.DATA_HUB
};
let plainText = new UDMF.PlainText();
let plainText = new unifiedDataChannel.PlainText();
plainText.textContent = "hello world!";
let unifiedData = new UDMF.UnifiedData(plainText);
let unifiedData = new unifiedDataChannel.UnifiedData(plainText);
try {
UDMF.insertData(options1, unifiedData, function (e, data) {
unifiedDataChannel.insertData(options1, unifiedData, function (e, data) {
if (e !== undefined) {
console.info(`Failed to insertData. code is ${e.code},message is ${e.message} `);
return;
}
console.info(TAG + `insertData0100 success; data = ${data}, options = ${options1}`);
UDMF.queryData(options1, function (errInfo, ret) {
unifiedDataChannel.queryData(options1, function (errInfo, ret) {
if (errInfo !== undefined) {
console.info(`Failed to queryData. code is ${errInfo.code},message is ${errInfo.message} `);
return;
}
console.info(TAG, ` queryData size = ${ret.length}`);
let options2 = {
intention: UDMF.Intention.DATA_HUB,
intention: unifiedDataChannel.Intention.DATA_HUB,
key: undefined
};
UDMF.deleteData(options2).then((row) => {
unifiedDataChannel.deleteData(options2).then((row) => {
let size = row.length;
console.info(TAG, ` deleteData size = ${size}`);
for (var i = 0; i < size; i++) {
let records = row[i].getRecords();
let size = records.length;
for (var j = 0; j < size; j++) {
if (records[j].getType() == UDMF.UnifiedDataType.PLAIN_TEXT) {
let text = <UDMF.PlainText> (records[j]);
if (records[j].getType() == uniformTypeDescriptor.UniformDataType.PLAIN_TEXT) {
let text = <unifiedDataChannel.PlainText> (records[j]);
console.info(TAG, ` deleteData.result = ${i + 1}.${text.textContent}`);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册