diff options
author | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-13 01:51:58 +0900 |
---|---|---|
committer | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-13 01:51:58 +0900 |
commit | e39bb48298c5ebcdeddc846cb25ab27c8f193465 (patch) | |
tree | 99d312237335bf7eb2bffeaa73334124e1e296de /TC | |
parent | 16c0e855d5d0cdd31886fe57e867732625aa17f8 (diff) | |
download | sync-agent-e39bb48298c5ebcdeddc846cb25ab27c8f193465.tar.gz sync-agent-e39bb48298c5ebcdeddc846cb25ab27c8f193465.tar.bz2 sync-agent-e39bb48298c5ebcdeddc846cb25ab27c8f193465.zip |
Tizen 2.1 base
Diffstat (limited to 'TC')
48 files changed, 17939 insertions, 0 deletions
diff --git a/TC/.gitignore b/TC/.gitignore new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/TC/.gitignore diff --git a/TC/_export_env.sh b/TC/_export_env.sh new file mode 100644 index 0000000..72a11ec --- /dev/null +++ b/TC/_export_env.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +. ./config +export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh new file mode 100644 index 0000000..5ddaa53 --- /dev/null +++ b/TC/_export_target_env.sh @@ -0,0 +1,7 @@ +#!/bin/sh +. ./config +export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/build.sh b/TC/build.sh new file mode 100755 index 0000000..6be8d56 --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +. ./_export_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -c -p ./ +tcc -b -j $JOURNAL_RESULT -p ./ +grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
\ No newline at end of file diff --git a/TC/clean.sh b/TC/clean.sh new file mode 100755 index 0000000..3eec83a --- /dev/null +++ b/TC/clean.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +. ./_export_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +RESULT_DIR=results + +tcc -c -p ./ # executing tcc, with clean option (-c) +rm -r $RESULT_DIR +rm -r tet_tmp_dir +rm testcase/tet_captured + +cd testcase +make clean
\ No newline at end of file diff --git a/TC/config b/TC/config new file mode 100644 index 0000000..d0fff6b --- /dev/null +++ b/TC/config @@ -0,0 +1,2 @@ +TET_INSTALL_HOST_PATH=/home/abuild/test/tetware/TETware +TET_INSTALL_TARGET_PATH=/mnt/nfs/tetware/TETware diff --git a/TC/config.default b/TC/config.default new file mode 100644 index 0000000..48acda6 --- /dev/null +++ b/TC/config.default @@ -0,0 +1,2 @@ +TET_INSTALL_HOST_PATH=/tetware/TETware +TET_INSTALL_TARGET_PATH=/mnt/nfs/obs/srcs/tetware/TETware diff --git a/TC/execute.sh b/TC/execute.sh new file mode 100755 index 0000000..215ad6c --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +. ./_export_target_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ +#grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT +grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT + diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile new file mode 100644 index 0000000..f9bee34 --- /dev/null +++ b/TC/testcase/Makefile @@ -0,0 +1,25 @@ +CC ?= gcc + +C_FILES = $(shell ls *.c) + +PKGS = libwbxml2 sync-agent dlog glib-2.0 + +LDFLAGS = `pkg-config --libs $(PKGS)` +LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s + +CFLAGS = -I. `pkg-config --cflags $(PKGS)` +CFLAGS += -I$(TET_ROOT)/inc/tet3 +CFLAGS += -Wall + +#TARGETS = $(C_FILES:%.c=tc-%) +TCS := $(shell ls -1 *.c | cut -d. -f1) + +all: $(TCS) + +%: %.c + $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) + +clean: + rm -f $(TCS) diff --git a/TC/testcase/fw-test-cfg/eventconfig_fw_test b/TC/testcase/fw-test-cfg/eventconfig_fw_test new file mode 100644 index 0000000..a09df94 --- /dev/null +++ b/TC/testcase/fw-test-cfg/eventconfig_fw_test @@ -0,0 +1 @@ +1, 1, 0, 30, FW_TEST_EVENT
\ No newline at end of file diff --git a/TC/testcase/fw-test-cfg/eventconfig_fw_test_omadm b/TC/testcase/fw-test-cfg/eventconfig_fw_test_omadm new file mode 100644 index 0000000..17284ff --- /dev/null +++ b/TC/testcase/fw-test-cfg/eventconfig_fw_test_omadm @@ -0,0 +1,15 @@ +1, 1, 0, 30, EVENT_SOFTWARE_UPDATE +2, 1, 0, 30, EVENT_CANCEL +3, 1, 0, 30, EVENT_DOWNLOAD +4, 1, 0, 30, EVENT_INSTALL +5, 1, 0, 30, EVENT_SET_INTERVAL +6, 1, 0, 30, EVENT_ACCOUNT_REGISTRATION +7, 1, 0, 30, EVENT_GET_FUMO_CONFIG +8, 1, 0, 30, EVENT_SET_FUMO_CONFIG +9, 1, 0, 30, EVENT_GET_PROFILE +10, 1, 0, 30, EVENT_SET_PROFILE +11, 1, 0, 30, EVENT_RESET_PROFILE +12, 1, 0, 30, EVENT_UIC_ALERT +13, 1, 0, 30, EVENT_CHECK_PIN_CODE +14, 1, 0, 30, EVENT_ADD_DMACC +15, 1, 0, 30, EVENT_REMOVE_DMACC diff --git a/TC/testcase/fw-test-cfg/eventconfig_fw_test_omads b/TC/testcase/fw-test-cfg/eventconfig_fw_test_omads new file mode 100644 index 0000000..f8988c5 --- /dev/null +++ b/TC/testcase/fw-test-cfg/eventconfig_fw_test_omads @@ -0,0 +1,12 @@ +1, 1, 0, 30, addprofile +2, 1, 0, 30, editprofile +3, 1, 0, 30, deleteprofile +4, 1, 0, 30, requestsync +5, 1, 0, 30, cancelsync +6, 1, 0, 30, getprofiledata +7, 1, 0, 30, getprofilesynccategory +8, 1, 0, 30, getprofilestatistics +9, 1, 0, 30, getprofilesdata +10, 1, 0, 30, addprofilecp +11, 1, 0, 30, requestcalllogsync +12, 1, 0, 30, resetalldata
\ No newline at end of file diff --git a/TC/testcase/fw-test-cfg/noticonfig_fw_test b/TC/testcase/fw-test-cfg/noticonfig_fw_test new file mode 100644 index 0000000..d53fc20 --- /dev/null +++ b/TC/testcase/fw-test-cfg/noticonfig_fw_test @@ -0,0 +1 @@ +1, 0, 0, 30, FW_TEST_NOTI
\ No newline at end of file diff --git a/TC/testcase/fw-test-cfg/noticonfig_fw_test_omadm b/TC/testcase/fw-test-cfg/noticonfig_fw_test_omadm new file mode 100644 index 0000000..e18abf2 --- /dev/null +++ b/TC/testcase/fw-test-cfg/noticonfig_fw_test_omadm @@ -0,0 +1,14 @@ +1, 0, 3, 30, NOTI_DOWNLOAD +2, 0, 3, 30, NOTI_INSTALL +3, 0, 0, 30, NOTI_DOWNLOAD_INFO +4, 0, 3, 30, NOTI_ENGINE_START +5, 0, 0, 30, NOTI_ENGINE_FAIL +6, 0, 0, 30, NOTI_WIFI_ONLY_DOWNLOAD_FAIL +7, 0, 0, 30, NOTI_MEMORY_FULL +8, 0, 3, 30, NOTI_OVER_BIG_SIZE +9, 0, 0, 30, NOTI_LOW_BATTERY +10, 0, 3, 30, NOTI_ALERT_DISPLAY +11, 0, 3, 30, NOTI_ALERT_CONFIRMATION +12, 0, 3, 30, NOTI_ALERT_INPUTEXT +13, 0, 3, 30, NOTI_ALERT_SINGLE_CHOICE +14, 0, 3, 30, NOTI_ALERT_MULTIPLE_CHOICE
\ No newline at end of file diff --git a/TC/testcase/fw-test-cfg/noticonfig_fw_test_omads b/TC/testcase/fw-test-cfg/noticonfig_fw_test_omads new file mode 100644 index 0000000..389f69f --- /dev/null +++ b/TC/testcase/fw-test-cfg/noticonfig_fw_test_omads @@ -0,0 +1,2 @@ +1, 0, 0, 30, sessionprocess +2, 0, 0, 30, processupdate
\ No newline at end of file diff --git a/TC/testcase/fw-test-cfg/test_fw_config.xml b/TC/testcase/fw-test-cfg/test_fw_config.xml new file mode 100644 index 0000000..1045bad --- /dev/null +++ b/TC/testcase/fw-test-cfg/test_fw_config.xml @@ -0,0 +1,175 @@ +<?xml version="1.0" encoding="UTF-8" ?>
+<INIT>
+ <Agent-Key>fw_test</Agent-Key>
+ <MainLoop>1</MainLoop>
+ <Event>
+ <Event-Key>fw_test_event</Event-Key>
+ <Event-Config>../../../testcase/fw-test-cfg/eventconfig_fw_test</Event-Config>
+ <RunEventHandler>1</RunEventHandler>
+ </Event>
+ <Noti>
+ <Noti-Key>fw_test_noti</Noti-Key>
+ <Noti-Config>../../../testcase/fw-test-cfg/noticonfig_fw_test</Noti-Config>
+ </Noti>
+ <EngineController>
+ <Max-Thread>5</Max-Thread>
+ </EngineController>
+ <FrameworkDB use="1">
+ <Path>/opt/dbspace/.fw_test.db</Path>
+ </FrameworkDB>
+ <ID-Provider>
+ <Code>1</Code>
+ <MaxID>4000000000</MaxID>
+ <PageSize>5</PageSize>
+ </ID-Provider>
+ <PlugIn-Mgr>
+ <Domain name="Account" count="1">
+ <Plug-In>
+ <ID>1</ID>
+ <Path>/usr/lib/sync-agent/common-public/libplugin-account.so</Path>
+ <Description>SLP Account Accessor</Description>
+ </Plug-In>
+ </Domain>
+ <Domain name="DataConnector" count="1">
+ <Plug-In>
+ <ID>0</ID>
+ <Path>/usr/lib/sync-agent/common-public/libplugin-da-calendar.so</Path>
+ <Description>SLP Calendar Access PlugIn</Description>
+ <DataConverter-PlugIn>1</DataConverter-PlugIn>
+ <Handle-ChangeNoti>1</Handle-ChangeNoti>
+ <Use-MainLoop>1</Use-MainLoop>
+ </Plug-In>
+ <Plug-In>
+ <ID>1</ID>
+ <Path>/usr/lib/sync-agent/kies-private/libplugin-da-sms.so</Path>
+ <Description>SLP SMS Access PlugIn</Description>
+ <DataConverter-PlugIn>2</DataConverter-PlugIn>
+ <Handle-ChangeNoti>1</Handle-ChangeNoti>
+ <Use-MainLoop>1</Use-MainLoop>
+ </Plug-In>
+ <Plug-In>
+ <ID>2</ID>
+ <Path>/usr/lib/sync-agent/kies-private/libplugin-da-bookmark.so</Path>
+ <Description>SLP Bookmark Access PlugIn</Description>
+ <DataConverter-PlugIn>0</DataConverter-PlugIn>
+ <Handle-ChangeNoti>0</Handle-ChangeNoti>
+ <Use-MainLoop>0</Use-MainLoop>
+ </Plug-In>
+ </Domain>
+ <Domain name="DataConverter" count="1">
+ <Plug-In>
+ <ID>1</ID>
+ <Path>/usr/lib/sync-agent/common-public/libplugin-dc-vcalendar.so</Path>
+ <Description>SLP Calendar Converter</Description>
+ </Plug-In>
+ <Plug-In>
+ <ID>2</ID>
+ <Path>/usr/lib/sync-agent/kies-private/libplugin-dc-msg.so</Path>
+ <Description>SLP SMS Converter</Description>
+ </Plug-In>
+ </Domain>
+ <Domain name="NetworkAccess" count="1">
+ <Plug-In>
+ <ID>1</ID>
+ <Path>/usr/lib/sync-agent/common-public/libplugin-na-http.so</Path>
+ <Description>Http Protocol</Description>
+ <UseNetwork>1</UseNetwork>
+ </Plug-In>
+ </Domain>
+ <Domain name="DeviceInfo" count="2">
+ <Plug-In>
+ <ID>1</ID>
+ <Path>/usr/lib/sync-agent/common-public/libplugin-di-slp-device.so</Path>
+ <Description>SLP Device Accessor</Description>
+ </Plug-In>
+ <Plug-In>
+ <ID>2</ID>
+ <Path>/usr/lib/sync-agent/dm-private/libplugin-di-slp-device-dm.so</Path>
+ <Description>SLP Device Accessor for DM</Description>
+ <DependsOn>1</DependsOn>
+ </Plug-In>
+ </Domain>
+ <Domain name="MO">
+ <Plug-In>
+ <ID>1</ID>
+ <Path>/usr/lib/sync-agent/dm-public/libplugin-mo-devdetail.so</Path>
+ <Description>about device detail information</Description>
+ <Type>DEVDETAIL</Type>
+ </Plug-In>
+ <Plug-In>
+ <ID>2</ID>
+ <Path>/usr/lib/sync-agent/dm-public/libplugin-mo-devinfo.so</Path>
+ <Description>about device information</Description>
+ <Type>DEVINFO</Type>
+ </Plug-In>
+ <Plug-In>
+ <ID>3</ID>
+ <Path>/usr/lib/sync-agent/dm-private/libplugin-mo-fumo.so</Path>
+ <Description>Firmware Update</Description>
+ <Type>FUMO</Type>
+ </Plug-In>
+ <Plug-In>
+ <ID>4</ID>
+ <Path>/usr/lib/sync-agent/dm-private/libplugin-mo-dmacc-gcf.so</Path>
+ <Description>gcf Server</Description>
+ <Type>DMACC</Type>
+ </Plug-In>
+ <Plug-In>
+ <ID>5</ID>
+ <Path>/usr/lib/sync-agent/dm-private/libplugin-mo-dmacc-mscserver.so</Path>
+ <Description>MSCServer</Description>
+ <Type>DMACC</Type>
+ </Plug-In>
+ <Plug-In>
+ <ID>6</ID>
+ <Path>/usr/lib/sync-agent/dm-private/libplugin-mo-dmacc-msctestserver.so</Path>
+ <Description>MSCTestServer</Description>
+ <Type>DMACC</Type>
+ </Plug-In>
+ <Plug-In>
+ <ID>7</ID>
+ <Path>/usr/lib/sync-agent/dm-private/libplugin-mo-lawmo.so</Path>
+ <Description>Lock and Wipe</Description>
+ <Type>LAWMO</Type>
+ </Plug-In>
+ <Plug-In>
+ <ID>8</ID>
+ <Path>/usr/lib/sync-agent/dm-private/libplugin-mo-multiapps.so</Path>
+ <Description>Multiple Applications</Description>
+ <Type>MULTIAPPS</Type>
+ </Plug-In>
+ </Domain>
+ <Domain name="PlatformMonitor" count="1">
+ <Plug-In>
+ <ID>1</ID>
+ <Path>/usr/lib/sync-agent/common-public/libplugin-pm-slp-sysnoti-alarm.so</Path>
+ <Description>monitoring Alarm Event from SLP Platform</Description>
+ <Use-MainLoop>0</Use-MainLoop>
+ <Register-Data count="1">
+ <Data>
+ <Pkg-Name>fw-test-agent</Pkg-Name>
+ <Additional-Data>-</Additional-Data>
+ </Data>
+ </Register-Data>
+ </Plug-In>
+ <Plug-In>
+ <ID>2</ID>
+ <Path>/usr/lib/sync-agent/common-public/libplugin-pm-slp-sysnoti-network-connection.so</Path>
+ <Description>monitoring Network Connection Event from SLP Platform</Description>
+ <Use-MainLoop>0</Use-MainLoop>
+ <Register-Data count="0">-</Register-Data>
+ </Plug-In>
+ </Domain>
+ <Domain name="DeviceManager" count="1">
+ <Plug-In>
+ <ID>1</ID>
+ <Path>/usr/lib/sync-agent/common-private/libplugin-mdm-slp-device.so</Path>
+ <Description>SLP Mobile Device Manager</Description>
+ </Plug-In>
+ </Domain>
+ </PlugIn-Mgr>
+ <DeviceManage>
+ <MO-DB-Path>/opt/dbspace/.mo_test.db</MO-DB-Path>
+ <DependentDevInfoID>2</DependentDevInfoID>
+ </DeviceManage>
+</INIT>
diff --git a/TC/testcase/fw-test-cfg/test_fw_config_omadm.xml b/TC/testcase/fw-test-cfg/test_fw_config_omadm.xml new file mode 100644 index 0000000..525fb37 --- /dev/null +++ b/TC/testcase/fw-test-cfg/test_fw_config_omadm.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<INIT> + <Agent-Key>fw_test_omadm</Agent-Key> + <Event> + <Event-Key>omadm</Event-Key> + <Event-Config>../../../testcase/fw-test-cfg/eventconfig_fw_test_omadm</Event-Config> + <RunEventHandler>1</RunEventHandler> + </Event> + <Noti> + <Noti-Key>omadm_fota_ui</Noti-Key> + <Noti-Config>../../../testcase/fw-test-cfg/noticonfig_fw_test_omadm</Noti-Config> + </Noti> + <Noti> + <Noti-Key>omadm_noti_ui</Noti-Key> + <Noti-Config>../../../testcase/fw-test-cfg/noticonfig_fw_test_omadm</Noti-Config> + </Noti> + <Noti> + <Noti-Key>omadm_alert_ui</Noti-Key> + <Noti-Config>../../../testcase/fw-test-cfg/noticonfig_fw_test_omadm</Noti-Config> + </Noti> +</INIT>
\ No newline at end of file diff --git a/TC/testcase/fw-test-cfg/test_fw_config_omads.xml b/TC/testcase/fw-test-cfg/test_fw_config_omads.xml new file mode 100644 index 0000000..ad1f54f --- /dev/null +++ b/TC/testcase/fw-test-cfg/test_fw_config_omads.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<INIT> + <Agent-Key>fw_test_omads</Agent-Key> + <MainLoop>1</MainLoop> + <Event> + <Event-Key>omads</Event-Key> + <Event-Config>../../../testcase/fw-test-cfg/eventconfig_fw_test_omads</Event-Config> + <RunEventHandler>1</RunEventHandler> + </Event> + <Noti> + <Noti-Key>omads</Noti-Key> + <Noti-Config>../../../testcase/fw-test-cfg/noticonfig_fw_test_omads</Noti-Config> + </Noti> +</INIT>
\ No newline at end of file diff --git a/TC/testcase/fw-test-file/sample_xml b/TC/testcase/fw-test-file/sample_xml new file mode 100644 index 0000000..edba9d3 --- /dev/null +++ b/TC/testcase/fw-test-file/sample_xml @@ -0,0 +1,492 @@ +<?xml version="1.0"?> +<!DOCTYPE SyncML PUBLIC "-//SYNCML//DTD SyncML 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/OMA-TS-SyncML_RepPro_DTD-V1_2.dtd"> +<SyncML xmlns="SYNCML:SYNCML1.2"> + <SyncHdr> + <VerDTD>1.2</VerDTD> + <VerProto>SyncML/1.2</VerProto> + <SessionID>0000000000</SessionID> + <MsgID>1</MsgID> + <Target> + <LocURI>IMEI:123456789012345</LocURI> + </Target> + <Source> + <LocURI>http://my.funambol.com/sync</LocURI> + </Source> + <RespURI>http://my.funambol.com/sync;jsessionid=00000000000000000000000000000000.DS00</RespURI> + </SyncHdr> + <SyncBody> + <Status> + <CmdID>1</CmdID> + <MsgRef>1</MsgRef> + <CmdRef>0</CmdRef> + <Cmd>SyncHdr</Cmd> + <TargetRef>http://my.funambol.com/sync</TargetRef> + <SourceRef>IMEI:123456789012345</SourceRef> + <Data>212</Data> + </Status> + <Status> + <CmdID>2</CmdID> + <MsgRef>1</MsgRef> + <CmdRef>1</CmdRef> + <Cmd>Put</Cmd> + <SourceRef>./devinf12</SourceRef> + <Data>200</Data> + </Status> + <Status> + <CmdID>3</CmdID> + <MsgRef>1</MsgRef> + <CmdRef>2</CmdRef> + <Cmd>Get</Cmd> + <TargetRef>./devinf12</TargetRef> + <Data>200</Data> + </Status> + <Status> + <CmdID>4</CmdID> + <MsgRef>1</MsgRef> + <CmdRef>3</CmdRef> + <Cmd>Alert</Cmd> + <TargetRef>card</TargetRef> + <SourceRef>Contacts</SourceRef> + <Data>200</Data> + <Item> + <Data> + <Anchor xmlns="syncml:metinf"> + <Next>1355548820</Next> + </Anchor> + </Data> + </Item> + </Status> + <Results> + <CmdID>5</CmdID> + <MsgRef>1</MsgRef> + <CmdRef>2</CmdRef> + <Meta> + <Type xmlns="syncml:metinf">application/vnd.syncml-devinf+xml</Type> + </Meta> + <Item> + <Source> + <LocURI>./devinf12</LocURI> + </Source> + <Data> <DevInf xmlns="syncml:devinf"> + <VerDTD>1.2</VerDTD> + <Man>Funambol</Man> + <Mod>DS Server CarEd</Mod> + <OEM>-</OEM> + <FwV>-</FwV> + <SwV>11.2.4-p104</SwV> + <HwV>-</HwV> + <DevID>funambol</DevID> + <DevTyp>server</DevTyp> + <UTC/> + <SupportLargeObjs/> + <SupportNumberOfChanges/> + <DataStore> + <SourceRef>cal</SourceRef> + <DisplayName>cal</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>text/x-vcalendar</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Rx> + <CTType>text/calendar</CTType> + <VerCT>2.0</VerCT> + </Rx> + <Tx-Pref> + <CTType>text/x-vcalendar</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <Tx> + <CTType>text/calendar</CTType> + <VerCT>2.0</VerCT> + </Tx> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>calllog</SourceRef> + <DisplayName>calllog</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>text/x-vCallLog</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Tx-Pref> + <CTType>text/x-vCallLog</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>card</SourceRef> + <DisplayName>card</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>text/x-vcard</CTType> + <VerCT>2.1</VerCT> + </Rx-Pref> + <Tx-Pref> + <CTType>text/x-vcard</CTType> + <VerCT>2.1</VerCT> + </Tx-Pref> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>configuration</SourceRef> + <DisplayName>configuration</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>text/plain</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Tx-Pref> + <CTType>text/plain</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>event</SourceRef> + <DisplayName>event</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>text/x-vcalendar</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Rx> + <CTType>text/calendar</CTType> + <VerCT>2.0</VerCT> + </Rx> + <Tx-Pref> + <CTType>text/x-vcalendar</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <Tx> + <CTType>text/calendar</CTType> + <VerCT>2.0</VerCT> + </Tx> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>file</SourceRef> + <DisplayName>file</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>application/vnd.omads-file+xml</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Tx-Pref> + <CTType>application/vnd.omads-file+xml</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>group</SourceRef> + <DisplayName>group</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>text/x-vcard</CTType> + <VerCT>2.1</VerCT> + </Rx-Pref> + <Tx-Pref> + <CTType>text/x-vcard</CTType> + <VerCT>2.1</VerCT> + </Tx-Pref> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>note</SourceRef> + <DisplayName>note</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>text/plain</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Tx-Pref> + <CTType>text/plain</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>picture</SourceRef> + <DisplayName>picture</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>application/vnd.omads-file+xml</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Tx-Pref> + <CTType>application/vnd.omads-file+xml</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>sapi</SourceRef> + <DisplayName>sapi</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>text/plain</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Tx-Pref> + <CTType>text/plain</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>scal</SourceRef> + <DisplayName>scal</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>text/x-s4j-sife</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Tx-Pref> + <CTType>text/x-s4j-sife</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>scard</SourceRef> + <DisplayName>scard</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>text/x-s4j-sifc</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Tx-Pref> + <CTType>text/x-s4j-sifc</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>snote</SourceRef> + <DisplayName>snote</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>text/x-s4j-sifn</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Tx-Pref> + <CTType>text/x-s4j-sifn</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>stask</SourceRef> + <DisplayName>stask</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>text/x-s4j-sift</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Tx-Pref> + <CTType>text/x-s4j-sift</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>task</SourceRef> + <DisplayName>task</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>text/x-vcalendar</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Rx> + <CTType>text/calendar</CTType> + <VerCT>2.0</VerCT> + </Rx> + <Tx-Pref> + <CTType>text/x-vcalendar</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <Tx> + <CTType>text/calendar</CTType> + <VerCT>2.0</VerCT> + </Tx> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <DataStore> + <SourceRef>video</SourceRef> + <DisplayName>video</DisplayName> + <MaxGUIDSize>32</MaxGUIDSize> + <Rx-Pref> + <CTType>application/vnd.omads-file+xml</CTType> + <VerCT>1.0</VerCT> + </Rx-Pref> + <Tx-Pref> + <CTType>application/vnd.omads-file+xml</CTType> + <VerCT>1.0</VerCT> + </Tx-Pref> + <SyncCap> + <SyncType>1</SyncType> + <SyncType>2</SyncType> + <SyncType>3</SyncType> + <SyncType>4</SyncType> + <SyncType>5</SyncType> + <SyncType>6</SyncType> + <SyncType>7</SyncType> + </SyncCap> + </DataStore> + <Ext> + <XNam>X-funambol-smartslow</XNam> + </Ext> + <Ext> + <XNam>X-funambol-media-http-upload</XNam> + </Ext> + <Ext> + <XNam>X-funambol-msu</XNam> + </Ext> + </DevInf> +</Data> + </Item> + </Results> + <Alert> + <CmdID>6</CmdID> + <Data>205</Data> + <Item> + <Target> + <LocURI>Contacts</LocURI> + </Target> + <Source> + <LocURI>card</LocURI> + </Source> + <Meta> + <Anchor xmlns="syncml:metinf"> + <Last>1355317910462</Last> + <Next>1355548846186</Next> + </Anchor> + </Meta> + </Item> + </Alert> + <Final/> + </SyncBody> +</SyncML> diff --git a/TC/testcase/fw-test-file/target_compress b/TC/testcase/fw-test-file/target_compress new file mode 100755 index 0000000..a8d5f28 --- /dev/null +++ b/TC/testcase/fw-test-file/target_compress @@ -0,0 +1,57 @@ +SCCS: @(#)Licence 1.7 (2006/03/10) TET Release 3.7 + + + ++++++++++++++TET END USER LICENCE+++++++++++ + + +BY RETRIEVING THIS DISTRIBUTION OF TET, YOU ARE CONSENTING TO BE BOUND BY +THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, +DO NOT INSTALL THE PRODUCT, AND DESTROY YOUR COPY. + + + +TET RELEASE 3.7 END USER LICENCE +_________________________________ + +Copyright (c) 1996-2006 X/Open Company Ltd trading as The Open Group +All rights reserved. + + +This program is free software; you can redistribute it and/or modify +it under the terms of the "Artistic License" which comes with this +Kit. + + +THE OPEN GROUP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO +EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + + +You should have received a copy of the Artistic License with this +Kit, in the file named "Artistic". If not, we'll be glad to provide one. + +Portions of this work contain code derived from other versions +of the Test Environment Toolkit, which contain the following +copyrights: + +Copyright 1990,1992 Open Software Foundation +Copyright 1990,1992 Unix International +Copyright 1990,1992 X/Open Company Ltd. +Copyright 1991 Hewlett-Packard Co. +Copyright 1993 Information-Technology Promotion Agency, Japan +Copyright 1993 Sunsoft, Inc. +Copyright 1993 UNIX System Laboratories, Inc., a subsidiary of Novell Inc. +Copyright 1994,1995 UniSoft Ltd. + +The unmodified source code of those works is freely available from +ftp.xopen.org. The modified code contained in this work +restricts the usage of that code as per this licence. + +The contrib distribution is now bundled within the "contrib" directory. +This is subject to the individual copyrights contained within +those files. diff --git a/TC/testcase/fw-test-file/target_uncompress.tar b/TC/testcase/fw-test-file/target_uncompress.tar Binary files differnew file mode 100644 index 0000000..beed206 --- /dev/null +++ b/TC/testcase/fw-test-file/target_uncompress.tar diff --git a/TC/testcase/fw-test-file/tnds_sample.txt b/TC/testcase/fw-test-file/tnds_sample.txt new file mode 100644 index 0000000..8eb822c --- /dev/null +++ b/TC/testcase/fw-test-file/tnds_sample.txt @@ -0,0 +1,478 @@ +<MgmtTree xmlns="syncml:dmddf1.2"> + <VerDTD>1.2</VerDTD> + <Node> + <NodeName>DMAcc</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <node/> + </Format> + <Title>A collection of all SyncML DM accounts</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <DDFName></DDFName> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Node> + <NodeName>gcf</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <node/> + </Format> + <Title>The "name" node for a management account sub tree</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <DDFName></DDFName> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Node> + <NodeName>AppID</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Application ID for DM Account MO.</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>w7</Value> + </Node> + <Node> + <NodeName>ServerID</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Server Identifier.</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>RSate</Value> + </Node> + <Node> + <NodeName>Name</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Displayable name for the Management Server.</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>gcf</Value> + </Node> + <Node> + <NodeName>PrefConRef</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Reference to preferred connectivity</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value></Value> + </Node> + <Node> + <NodeName>ToConRef</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <node/> + </Format> + <Title>A collection of references to connectivity definitions</Title> + <TStamp>20121217T192705Z</TStamp> + <Type/> + <VerNo>0</VerNo> + </RTProperties> + <Node> + <NodeName>gcf_ConRef</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <node/> + </Format> + <Title>The "name" node for a management account sub tree</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <DDFName></DDFName> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Node> + <NodeName>ConRef</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>>Linkage to connectivity parameters</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value></Value> + </Node> + </Node> + </Node> + <Node> + <NodeName>AppAddr</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <node/> + </Format> + <Title>A collection of all references to AppAddr objects</Title> + <TStamp>20121217T192705Z</TStamp> + <Type/> + <VerNo>0</VerNo> + </RTProperties> + <Node> + <NodeName>gcf_AppAddr</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <node/> + </Format> + <Title>The "name" node for a management account sub tree</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <DDFName></DDFName> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Node> + <NodeName>Addr</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Management Server Address</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>http://mfiop12.gcf.com/oma/iop</Value> + </Node> + <Node> + <NodeName>AddrType</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Management Server Address Type</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>IPv4</Value> + </Node> + <Node> + <NodeName>Port</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <node/> + </Format> + <Title>A collection of all Port objects</Title> + <TStamp>20121217T192705Z</TStamp> + <Type/> + <VerNo>0</VerNo> + </RTProperties> + <Node> + <NodeName>gcf_Port</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <node/> + </Format> + <Title></Title> + <TStamp>20121217T192705Z</TStamp> + <Type/> + <VerNo>0</VerNo> + </RTProperties> + <Node> + <NodeName>PortNbr</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Port.</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>80</Value> + </Node> + </Node> + </Node> + </Node> + </Node> + <Node> + <NodeName>AAuthPref</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>AApplication Authentication Type preference</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value></Value> + </Node> + <Node> + <NodeName>AppAuth</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <node/> + </Format> + <Title>A collection of all references to multiple Application Authentication objects.</Title> + <TStamp>20121217T192705Z</TStamp> + <Type/> + <VerNo>0</VerNo> + </RTProperties> + <Node> + <NodeName>ServerAppAuth</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <node/> + </Format> + <Title></Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <DDFName></DDFName> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Node> + <NodeName>AAuthLevel</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Application Authentication level</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>SRVCRED</Value> + </Node> + <Node> + <NodeName>AAuthType</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Application Authentication Type</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>DIGEST</Value> + </Node> + <Node> + <NodeName>AAuthName</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Application Authentication Name</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>RSate</Value> + </Node> + <Node> + <NodeName>AAuthSecret</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Application Authentication Secret</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>xxxx</Value> + </Node> + <Node> + <NodeName>AAuthData</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <bin/> + </Format> + <Title>Application Authentication Data</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>11111</Value> + </Node> + </Node> + <Node> + <NodeName>ClientAppAuth</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <node/> + </Format> + <Title></Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <DDFName></DDFName> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Node> + <NodeName>AAuthLevel</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Application Authentication level</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>CLCRED</Value> + </Node> + <Node> + <NodeName>AAuthType</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Application Authentication Type</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>DIGEST</Value> + </Node> + <Node> + <NodeName>AAuthName</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Application Authentication Name</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>xxxxx</Value> + </Node> + <Node> + <NodeName>AAuthSecret</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <chr/> + </Format> + <Title>Application Authentication Secret</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>xxxxx</Value> + </Node> + <Node> + <NodeName>AAuthData</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <bin/> + </Format> + <Title>Application Authentication Data</Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <MIME>text/plain</MIME> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value>11111</Value> + </Node> + </Node> + </Node> + <Node> + <NodeName>Ext</NodeName> + <RTProperties> + <ACL>Add=RSate&Delete=RSate&Get=RSate&Replace=RSate</ACL> + <Format> + <node/> + </Format> + <Title></Title> + <TStamp>20121217T192705Z</TStamp> + <Type> + <DDFName></DDFName> + </Type> + <VerNo>0</VerNo> + </RTProperties> + <Value></Value> + </Node> + </Node> + </Node> +</MgmtTree>
\ No newline at end of file diff --git a/TC/testcase/tslist b/TC/testcase/tslist new file mode 100644 index 0000000..17e3db7 --- /dev/null +++ b/TC/testcase/tslist @@ -0,0 +1,21 @@ +/testcase/utc_sync_agent_framework_account +/testcase/utc_sync_agent_framework_data_adapter +/testcase/utc_sync_agent_framework_device +/testcase/utc_sync_agent_framework_device_manager +/testcase/utc_sync_agent_framework_engine_controller +/testcase/utc_sync_agent_framework_event +/testcase/utc_sync_agent_framework_event_omadm_account_reg +/testcase/utc_sync_agent_framework_event_omadm_admin +/testcase/utc_sync_agent_framework_event_omadm_alert +/testcase/utc_sync_agent_framework_event_omadm_cp +/testcase/utc_sync_agent_framework_event_omadm_dmacc +/testcase/utc_sync_agent_framework_event_omadm_fota +/testcase/utc_sync_agent_framework_event_omadm_noti +/testcase/utc_sync_agent_framework_event_omads +/testcase/utc_sync_agent_framework_fsapi +/testcase/utc_sync_agent_framework_initialization +/testcase/utc_sync_agent_framework_network_access +/testcase/utc_sync_agent_framework_platform_monitor +/testcase/utc_sync_agent_framework_protocol_binder +/testcase/utc_sync_agent_framework_security_assistant +/testcase/utc_sync_agent_framework_utility
\ No newline at end of file diff --git a/TC/testcase/utc_sync_agent_framework_account.c b/TC/testcase/utc_sync_agent_framework_account.c new file mode 100755 index 0000000..4501125 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_account.c @@ -0,0 +1,609 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_FILE "../../../testcase/fw-test-cfg/test_fw_config.xml" + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_CLEAN_UP "cleanup" +#define API_NAME_SYNC_AGENT_CREATE_FW_ACCOUNT "sync_agent_create_fw_account" +#define API_NAME_SYNC_AGENT_ADD_FW_ACCOUNT "sync_agent_add_fw_account" +#define API_NAME_SYNC_AGENT_UPDATE_FW_ACCOUNT "sync_agent_update_fw_account" +#define API_NAME_SYNC_AGENT_GET_FW_ACCOUNT "sync_agent_get_fw_account" +#define API_NAME_SYNC_AGENT_DELETE_FW_ACCOUNT "sync_agent_delete_fw_account" +#define API_NAME_SYNC_AGENT_QUERY_FW_ACCOUNT "sync_agent_query_fw_account" +//#define API_NAME_SYNC_AGENT_FREE_FW_ACCOUNT "sync_agent_free_fw_account" +//#define API_NAME_SYNC_AGENT_FREE_FW_ACCOUNT_LIST "sync_agent_free_fw_account_list" + +#define API_NAME_SYNC_AGENT_CONSTRUCT_ACCOUNT_TBL_FROM_SERVICE "sync_agent_construct_account_tbl_from_service" +#define API_NAME_SYNC_AGENT_CREATE_SERVICE_ACCOUNT_INFO "sync_agent_create_service_account_info" +#define API_NAME_SYNC_AGENT_GET_SERVICE_ACCOUNT "sync_agent_get_service_account" +//#define API_NAME_SYNC_AGENT_FREE_SERVICE_ACCOUNT_INFO "sync_agent_free_service_account_info" + +static void utc_sync_agent_framework_sync_agent_create_fw_account_p(void); +static void utc_sync_agent_framework_sync_agent_add_fw_account_p(void); +static void utc_sync_agent_framework_sync_agent_add_fw_account_n(void); +static void utc_sync_agent_framework_sync_agent_update_fw_account_p(void); +static void utc_sync_agent_framework_sync_agent_update_fw_account_n(void); +static void utc_sync_agent_framework_sync_agent_delete_fw_account_p(void); +static void utc_sync_agent_framework_sync_agent_delete_fw_account_n(void); +static void utc_sync_agent_framework_sync_agent_get_fw_account_p(void); +static void utc_sync_agent_framework_sync_agent_query_fw_account_p(void); +static void utc_sync_agent_framework_sync_agent_query_fw_account_n(void); +//static void utc_sync_agent_framework_sync_agent_free_fw_account_p(void); +//static void utc_sync_agent_framework_sync_agent_free_fw_account_list_p(void); +static void utc_sync_agent_framework_sync_agent_construct_account_tbl_from_service_p(void); +static void utc_sync_agent_framework_sync_agent_create_service_account_info_p(void); +static void utc_sync_agent_framework_sync_agent_get_service_account_p(void); +static void utc_sync_agent_framework_sync_agent_get_service_account_n(void); +//static void utc_sync_agent_framework_sync_agent_free_service_account_info_p(void); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_create_fw_account_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_fw_account_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_fw_account_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_fw_account_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_fw_account_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_fw_account_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_fw_account_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_fw_account_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_query_fw_account_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_query_fw_account_n, NEGATIVE_TC_IDX}, +// { utc_sync_agent_framework_sync_agent_free_fw_account_p, POSITIVE_TC_IDX }, +// { utc_sync_agent_framework_sync_agent_free_fw_account_list_p, POSITIVE_TC_IDX }, + {utc_sync_agent_framework_sync_agent_construct_account_tbl_from_service_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_service_account_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_service_account_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_service_account_n, NEGATIVE_TC_IDX}, +// { utc_sync_agent_framework_sync_agent_free_service_account_info_p, POSITIVE_TC_IDX }, + {NULL, 0} +}; + +static void startup(void) +{ + /* start of TC */ + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_FILE); + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(API_NAME_SYNC_START_UP, "sync_agent_init : %d", init_error); + dts_fail(API_NAME_SYNC_START_UP); + } + + da_err = sync_agent_empty_all_agent_default_table(); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_message(API_NAME_SYNC_START_UP, "sync_agent_empty_all_agent_default_table : %d", da_err); + dts_fail(API_NAME_SYNC_START_UP); + } + + da_err = sync_agent_open_agent(); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_message(API_NAME_SYNC_START_UP, "sync_agent_open_agent : %d", da_err); + dts_fail(API_NAME_SYNC_START_UP); + } +} + +static void cleanup(void) +{ + /* clean of TC */ + sync_agent_close_agent(); +} + +static void utc_sync_agent_framework_sync_agent_create_fw_account_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_FW_ACCOUNT; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + sync_agent_fw_account_s *fw_account = NULL; + + account_err = sync_agent_create_fw_account(&fw_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_fw_account : %d", account_err); + dts_fail(api_name); + } else { + sync_agent_free_fw_account(fw_account); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_fw_account_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UPDATE_FW_ACCOUNT; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + + sync_agent_fw_account_s *fw_account = NULL; + int account_id = 0; + + account_err = sync_agent_create_fw_account(&fw_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_fw_account : %d", account_err); + dts_fail(api_name); + } + + fw_account->email = strdup("add_account@email.com"); + fw_account->password = strdup("1234"); + fw_account->enable = 0; + fw_account->access_name = strdup("TC"); + + account_err = sync_agent_add_fw_account(fw_account, &account_id); + sync_agent_free_fw_account(fw_account); + + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_add_fw_account : %d", account_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_fw_account_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UPDATE_FW_ACCOUNT; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + + sync_agent_fw_account_s *fw_account = NULL; + int account_id = 0; + + account_err = sync_agent_create_fw_account(&fw_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_fw_account : %d", account_err); + dts_fail(api_name); + } + + fw_account->email = strdup("add_account@email.com"); + fw_account->password = strdup("1234"); + fw_account->enable = 0; + fw_account->access_name = strdup("TC"); + + account_err = sync_agent_add_fw_account(NULL, &account_id); + sync_agent_free_fw_account(fw_account); + + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_add_fw_account : %d", account_err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_update_fw_account_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_FW_ACCOUNT; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + sync_agent_fw_account_s *fw_account = NULL; + sync_agent_fw_account_s *fw_update_account = NULL; + int account_id = 0; + + account_err = sync_agent_create_fw_account(&fw_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_fw_account : %d", account_err); + dts_fail(api_name); + } + + fw_account->email = strdup("update_account@email.com"); + fw_account->password = strdup("1234"); + fw_account->enable = 0; + fw_account->access_name = strdup("TC"); + + account_err = sync_agent_add_fw_account(fw_account, &account_id); + sync_agent_free_fw_account(fw_account); + + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_add_fw_account : %d", account_err); + dts_fail(api_name); + } + + account_err = sync_agent_create_fw_account(&fw_update_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_fw_account : %d", account_err); + dts_fail(api_name); + } + + fw_update_account->account_id = account_id; + fw_update_account->email = strdup("update_account1@email.com"); + fw_update_account->password = strdup("123456"); + fw_update_account->enable = 1; + fw_update_account->access_name = strdup("TC"); + + account_err = sync_agent_update_fw_account(fw_update_account); + sync_agent_free_fw_account(fw_update_account); + + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_update_fw_account : %d", account_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_update_fw_account_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_FW_ACCOUNT; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + sync_agent_fw_account_s *fw_account = NULL; + sync_agent_fw_account_s *fw_update_account = NULL; + int account_id = 0; + + account_err = sync_agent_create_fw_account(&fw_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_fw_account : %d", account_err); + dts_pass(api_name); + } + + fw_account->email = strdup("update_account@email.com"); + fw_account->password = strdup("1234"); + fw_account->enable = 0; + fw_account->access_name = strdup("TC"); + + account_err = sync_agent_add_fw_account(fw_account, &account_id); + sync_agent_free_fw_account(fw_account); + + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_add_fw_account : %d", account_err); + dts_pass(api_name); + } + + account_err = sync_agent_create_fw_account(&fw_update_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_fw_account : %d", account_err); + dts_pass(api_name); + } + + fw_update_account->account_id = account_id; + fw_update_account->email = strdup("update_account1@email.com"); + fw_update_account->password = strdup("123456"); + fw_update_account->enable = 1; + fw_update_account->access_name = strdup("TC"); + + account_err = sync_agent_update_fw_account(NULL); + sync_agent_free_fw_account(fw_update_account); + + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_update_fw_account : %d", account_err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_fw_account_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_FW_ACCOUNT; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + sync_agent_fw_account_s *fw_account = NULL; + int account_id = 0; + + account_err = sync_agent_create_fw_account(&fw_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_fw_account : %d", account_err); + dts_fail(api_name); + } + + fw_account->email = strdup("delete_account@email.com"); + fw_account->password = strdup("1234"); + fw_account->enable = 0; + fw_account->access_name = strdup("TC"); + + account_err = sync_agent_add_fw_account(fw_account, &account_id); + sync_agent_free_fw_account(fw_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_add_fw_account : %d", account_err); + dts_fail(api_name); + } + + account_err = sync_agent_delete_fw_account(account_id); + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_delete_fw_account : %d", account_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_fw_account_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_FW_ACCOUNT; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + sync_agent_fw_account_s *fw_account = NULL; + int account_id = 0; + + account_err = sync_agent_create_fw_account(&fw_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_fw_account : %d", account_err); + dts_pass(api_name); + } + + fw_account->email = strdup("delete_account@email.com"); + fw_account->password = strdup("1234"); + fw_account->enable = 0; + fw_account->access_name = strdup("TC"); + + account_err = sync_agent_add_fw_account(fw_account, &account_id); + sync_agent_free_fw_account(fw_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_add_fw_account : %d", account_err); + dts_pass(api_name); + } + + account_err = sync_agent_delete_fw_account(-100); + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_delete_fw_account : %d", account_err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_fw_account_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FW_ACCOUNT; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + sync_agent_fw_account_s *fw_account = NULL; + sync_agent_fw_account_s *fw_get_account = NULL; + int account_id = 0; + + account_err = sync_agent_create_fw_account(&fw_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_fw_account : %d", account_err); + dts_fail(api_name); + } + + fw_account->email = strdup("get_account@email.com"); + fw_account->password = strdup("1234"); + fw_account->enable = 0; + fw_account->access_name = strdup("TC"); + + account_err = sync_agent_add_fw_account(fw_account, &account_id); + sync_agent_free_fw_account(fw_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_add_fw_account : %d", account_err); + dts_fail(api_name); + } + + account_err = sync_agent_create_fw_account(&fw_get_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_fw_account : %d", account_err); + dts_fail(api_name); + } + + account_err = sync_agent_get_fw_account(account_id, &fw_get_account); + sync_agent_free_fw_account(fw_get_account); + + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_fw_account : %d", account_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_query_fw_account_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_QUERY_FW_ACCOUNT; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + sync_agent_fw_account_query_s query; + GList *account_info_list = NULL; + + query.query = ACCOUNT_QUERY_BY_ACCESS_NAME; + query.access_name = strdup("TC"); + + account_err = sync_agent_query_fw_account(&query, &account_info_list); + + if (query.access_name != NULL) + free(query.access_name); + sync_agent_free_fw_account_list(account_info_list); + + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_query_fw_account : %d", account_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_query_fw_account_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_QUERY_FW_ACCOUNT; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + sync_agent_fw_account_query_s query; + GList *account_info_list = NULL; + + query.query = ACCOUNT_QUERY_BY_ACCESS_NAME; + query.access_name = strdup("TC"); + + account_err = sync_agent_query_fw_account(NULL, &account_info_list); + + if (query.access_name != NULL) + free(query.access_name); + sync_agent_free_fw_account_list(account_info_list); + + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_query_fw_account : %d", account_err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +//static void utc_sync_agent_framework_sync_agent_free_fw_account_p(void) +//{ +// sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; +// char* api_name = API_NAME_SYNC_AGENT_FREE_FW_ACCOUNT; +// sync_agent_fw_account_s *fw_account = NULL; +// +// account_err = sync_agent_create_fw_account(&fw_account); +// if (account_err == SYNC_AGENT_ACC_SUCCESS) { +// dts_pass(api_name); +// } else { +// dts_message(api_name, "sync_agent_create_fw_account : %d", account_err); +// dts_fail(api_name); +// } +// +// sync_agent_free_fw_account(fw_account); +//} +// +//static void utc_sync_agent_framework_sync_agent_free_fw_account_list_p(void) +//{ +// sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; +// char* api_name = API_NAME_SYNC_AGENT_FREE_FW_ACCOUNT_LIST; +// sync_agent_fw_account_query_s query; +// GList *account_info_list = NULL; +// +// query.query = ACCOUNT_QUERY_BY_ACCESS_NAME; +// query.access_name = strdup("TC"); +// +// account_err = sync_agent_query_fw_account(&query, &account_info_list); +// if (account_err == SYNC_AGENT_ACC_SUCCESS) { +// dts_pass(api_name); +// } else { +// dts_message(api_name, "sync_agent_query_fw_account : %d", account_err); +// dts_fail(api_name); +// } +// +// if (query.access_name != NULL) +// free(query.access_name); +// +// sync_agent_free_fw_account_list(account_info_list); +//} + +static void utc_sync_agent_framework_sync_agent_construct_account_tbl_from_service_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CONSTRUCT_ACCOUNT_TBL_FROM_SERVICE; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + + account_err = sync_agent_construct_account_tbl_from_service(); + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_construct_account_tbl_from_service : %d", account_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_service_account_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_SERVICE_ACCOUNT_INFO; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + sync_agent_service_account_info_s *account_info = NULL; + + account_err = sync_agent_create_service_account_info(&account_info); + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + sync_agent_free_service_account_info(account_info); + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_create_service_account_info : %d", account_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_service_account_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_SERVICE_ACCOUNT; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + sync_agent_service_account_info_s *account_info = NULL; + + account_err = sync_agent_construct_account_tbl_from_service(); + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_construct_account_tbl_from_service : %d", account_err); + dts_fail(api_name); + } + + account_err = sync_agent_create_service_account_info(&account_info); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_service_account_info : %d", account_err); + dts_fail(api_name); + } + + account_err = sync_agent_get_service_account(1, 1, &account_info); + sync_agent_free_service_account_info(account_info); + + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_service_account : %d", account_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_service_account_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_SERVICE_ACCOUNT; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + sync_agent_service_account_info_s *account_info = NULL; + + account_err = sync_agent_construct_account_tbl_from_service(); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_construct_account_tbl_from_service : %d", account_err); + dts_pass(api_name); + } + + account_err = sync_agent_create_service_account_info(&account_info); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_service_account_info : %d", account_err); + dts_pass(api_name); + } + + account_err = sync_agent_get_service_account(-100, 1, &account_info); + sync_agent_free_service_account_info(account_info); + + if (account_err == SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_get_service_account : %d", account_err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +//static void utc_sync_agent_framework_sync_agent_free_service_account_info_p(void) +//{ +// sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; +// char* api_name = API_NAME_SYNC_AGENT_FREE_SERVICE_ACCOUNT_INFO; +// sync_agent_service_account_info_s *account_info = NULL; +// +// +// account_err = sync_agent_create_service_account_info(&account_info); +// if (account_err == SYNC_AGENT_ACC_SUCCESS) { +// dts_pass(api_name); +// } else { +// dts_message(api_name, "sync_agent_create_service_account_info : %d", account_err); +// dts_fail(api_name); +// } +// +// account_err = sync_agent_get_service_account(account_id, 1, &account_info); +// if (account_err == SYNC_AGENT_ACC_SUCCESS) { +// dts_pass(api_name); +// } else { +// dts_message(api_name, "sync_agent_get_service_account : %d", account_err); +// dts_fail(api_name); +// } +// +// sync_agent_free_service_account_info(account_info); +//} diff --git a/TC/testcase/utc_sync_agent_framework_data_adapter.c b/TC/testcase/utc_sync_agent_framework_data_adapter.c new file mode 100755 index 0000000..f461fe3 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_data_adapter.c @@ -0,0 +1,3902 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_FILE "../../../testcase/fw-test-cfg/test_fw_config.xml" + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_AGENT_OPEN_AGENT "sync_agent_open_agent" +#define API_NAME_SYNC_AGENT_CLOSE_AGENT "sync_agent_close_agent" +#define API_NAME_SYNC_AGENT_EMPTY_AGENT_DEFAULT_TABLE "sync_agent_empty_agent_default_table" +#define API_NAME_SYNC_AGENT_EMPTY_ALL_AGENT_DEFAULT_TABLE "sync_agent_empty_all_agent_default_table" +#define API_NAME_SYNC_AGENT_BEGIN_TRANSACTION "sync_agent_begin_transaction" +#define API_NAME_SYNC_AGENT_END_TRANSACTION "sync_agent_end_transaction" + +#define API_NAME_SYNC_AGENT_CONSTRUCT_ITEM_TBL_FROM_SERVICE "sync_agent_construct_item_tbl_from_service" +#define API_NAME_SYNC_AGENT_CONSTRUCT_FOLDER_TBL_FROM_SERVICE "sync_agent_construct_folder_tbl_from_service" +#define API_NAME_SYNC_AGENT_REFRESH_ITEM_TBL_FROM_SERVICE "sync_agent_refresh_item_tbl_from_service" +#define API_NAME_SYNC_AGENT_SET_SERVICE_CHANGE_POINT "sync_agent_set_service_change_point" + +#define API_NAME_SYNC_AGENT_ALLOC_OBJ "sync_agent_alloc_obj" +#define API_NAME_SYNC_AGENT_FREE_OBJ "sync_agent_free_obj" +#define API_NAME_SYNC_AGENT_SET_VALUE_TO_OBJ "sync_agent_set_value_to_obj" +#define API_NAME_SYNC_AGENT_GET_VALUE_TO_OBJ "sync_agent_get_value_to_obj" +#define API_NAME_SYNC_AGENT_GET_OBJ_INFO "sync_agent_get_obj_info" +#define API_NAME_SYNC_AGENT_FREE_OBJ_INFO "sync_agent_free_obj_info" + +#define API_NAME_SYNC_AGENT_CREATE_CHANGELOG "sync_agent_create_changelog" +#define API_NAME_SYNC_AGENT_UPDATE_CHANGELOG "sync_agent_update_changelog" +#define API_NAME_SYNC_AGENT_DELETE_CHANGELOG "sync_agent_delete_changelog" +#define API_NAME_SYNC_AGENT_GET_CHANGELOG "sync_agent_get_changelog" +#define API_NAME_SYNC_AGENT_GET_CHANGELOG_LIST "sync_agent_get_changelog_list" +#define API_NAME_SYNC_AGENT_FREE_CHANGELOG "sync_agent_free_changelog" +#define API_NAME_SYNC_AGENT_FREE_CHANGELOG_LIST "sync_agent_free_changelog_list" + +#define API_NAME_SYNC_AGENT_CREATE_CONFIG "sync_agent_create_config" +#define API_NAME_SYNC_AGENT_ADD_CONFIG "sync_agent_add_config" +#define API_NAME_SYNC_AGENT_ADD_CONFIG_LIST "sync_agent_add_config_list" +#define API_NAME_SYNC_AGENT_UPDATE_CONFIG "sync_agent_update_config" +#define API_NAME_SYNC_AGENT_DELETE_CONFIG "sync_agent_delete_config" +#define API_NAME_SYNC_AGENT_IS_EXIST_CONFIG "sync_agent_is_exist_config" +#define API_NAME_SYNC_AGENT_GET_CONFIG "sync_agent_get_config" +#define API_NAME_SYNC_AGENT_GET_CONFIG_LIST "sync_agent_get_config_list" + +#define API_NAME_SYNC_AGENT_CREATE_FOLDER "sync_agent_create_folder" +#define API_NAME_SYNC_AGENT_ADD_FOLDER "sync_agent_add_folder" +#define API_NAME_SYNC_AGENT_GET_FOLDER "sync_agent_get_folder" +#define API_NAME_SYNC_AGENT_GET_FOLDER_LIST "sync_agent_get_folder_list" +#define API_NAME_SYNC_AGENT_GET_FOLDER_ID_LIST "sync_agent_get_folder_id_list" +#define API_NAME_SYNC_AGENT_FREE_FOLDER "sync_agent_free_folder" +#define API_NAME_SYNC_AGENT_FREE_FOLDER_LIST "sync_agent_free_folder_list" +#define API_NAME_SYNC_AGENT_FREE_FOLDER_ID "sync_agent_free_folder_id" +#define API_NAME_SYNC_AGENT_FREE_FOLDER_ID_LIST "sync_agent_free_folder_id_list" + +#define API_SYNC_AGENT_CREATE_ITEM "sync_agent_create_item" +#define API_SYNC_AGENT_ADD_ITEM "sync_agent_add_item" +#define API_SYNC_AGENT_UPDATE_ITEM "sync_agent_update_item" +#define API_SYNC_AGENT_DELETE_ITEM "sync_agent_delete_item" +#define API_SYNC_AGENT_QUERY_DELETE_ITEM "sync_agent_query_delete_item" +#define API_SYNC_AGENT_GET_ITEM "sync_agent_get_item" +#define API_SYNC_AGENT_GET_ITEM_LIST "sync_agent_get_item_list" +#define API_SYNC_AGENT_GET_ITEM_ID "sync_agent_get_item_id" +#define API_SYNC_AGENT_GET_ITEM_ID_LIST "sync_agent_get_item_id_list" +#define API_SYNC_AGENT_FREE_ITEM "sync_agent_free_item" +#define API_SYNC_AGENT_FREE_ITEM_LIST "sync_agent_free_item_list" +#define API_SYNC_AGENT_FREE_ITEM_ID "sync_agent_free_item_id" +#define API_SYNC_AGENT_FREE_ITEM_ID_LIST "sync_agent_free_item_id_list" +#define API_SYNC_AGENT_GET_ITEM_COUNT "sync_agent_get_item_count" + +#define API_NAME_SYNC_AGENT_CREATE_LAST_ANCHOR "sync_agent_create_last_anchor" +#define API_NAME_SYNC_AGENT_ADD_LAST_ANCHOR "sync_agent_add_last_anchor" +#define API_NAME_SYNC_AGENT_UPDATE_LAST_ANCHOR "sync_agent_update_last_anchor" +#define API_NAME_SYNC_AGENT_GET_LAST_ANCHOR_LIST "sync_agent_get_last_anchor_list" +#define API_NAME_SYNC_AGENT_FREE_LAST_ANCHOR "sync_agent_free_last_anchor" + +#define API_NAME_SYNC_AGENT_CREATE_MAPPING "sync_agent_create_mapping" +#define API_NAME_SYNC_AGENT_ADD_MAPPING "sync_agent_add_mapping" +#define API_NAME_SYNC_AGENT_DELETE_MAPPING "sync_agent_delete_mapping" +#define API_NAME_SYNC_AGENT_GET_MAPPING "sync_agent_get_mapping" +#define API_NAME_SYNC_AGENT_GET_MAPPING_LIST "sync_agent_get_mapping_list" +#define API_NAME_SYNC_AGENT_FREE_MAPPING "sync_agent_free_mapping" +#define API_NAME_SYNC_AGENT_FREE_MAPPING_LIST "sync_agent_free_mapping_list" +#define API_NAME_SYNC_AGENT_IS_EXIST_MAPPING_BY_ACCOUNT_ID "sync_agent_is_exist_mapping_by_account_id" + +#define API_NAME_SYNC_AGENT_OPEN_SERVICE "sync_agent_open_service" +#define API_NAME_SYNC_AGENT_CLOSE_SERVICE "sync_agent_close_service" +#define API_NAME_SYNC_AGENT_BEGIN_SERVICE "sync_agent_begin_service" +#define API_NAME_SYNC_AGENT_END_SERVICE "sync_agent_end_service" +#define API_NAME_SYNC_AGENT_CREATE_SERVICE_ITEM "sync_agent_create_service_item" +#define API_NAME_SYNC_AGENT_CREATE_SERVICE_FOLDER "sync_agent_create_service_folder" +#define API_NAME_SYNC_AGENT_FREE_SERVICE_ITEM "sync_agent_free_service_item" +#define API_NAME_SYNC_AGENT_FREE_SERVICE_FOLDER "sync_agent_free_service_folder" +#define API_NAME_SYNC_AGENT_ADD_SERVICE_ITEM "sync_agent_add_service_item" +#define API_NAME_SYNC_AGENT_UPDATE_SERVICE_ITEM "sync_agent_update_service_item" +#define API_NAME_SYNC_AGENT_DELETE_SERVICE_ITEM "sync_agent_delete_service_item" +#define API_NAME_SYNC_AGENT_QUERY_DELETE_SERVICE_ITEMS "sync_agent_query_delete_service_items" +#define API_NAME_SYNC_AGENT_GET_SERVICE_ITEM "sync_agent_get_service_item" +#define API_NAME_SYNC_AGENT_GET_SERVICE_FOLDER "sync_agent_get_service_folder" +#define API_NAME_SYNC_AGENT_EXECUTE_SERVICE "sync_agent_execute_service" +#define API_NAME_SYNC_AGENT_GET_USED_SERVICE_ITEM_COUNT "sync_agent_get_used_service_item_count" +#define API_NAME_SYNC_AGENT_GET_USED_SERVICE_ITEM_COUNT_FOR_FOLDER "sync_agent_get_used_service_item_count_for_folder" +#define API_NAME_SYNC_AGENT_BACKUP_SERVICE_ITEMS_TO_FILE "sync_agent_backup_service_items_to_file" +#define API_NAME_SYNC_AGENT_RESTORE_SERVICE_ITEMS_FROM_FILE "sync_agent_restore_service_items_from_file" +#define API_NAME_SYNC_AGENT_GET_SERVICE_ITEM_ID "sync_agent_get_service_item_id" +#define API_NAME_SYNC_AGENT_GET_SERVICE_FOLDER_ID "sync_agent_get_service_folder_id" + +#define API_NAME_SYNC_AGENT_GENERATE_ITEM_LUID "sync_agent_generate_item_luid" +#define API_NAME_SYNC_AGENT_GENERATE_FOLDER_LUID "sync_agent_generate_folder_luid" + +static void utc_sync_agent_framework_sync_agent_open_agent_p(void); +static void utc_sync_agent_framework_sync_agent_open_agent(void); +static void utc_sync_agent_framework_sync_agent_close_agent_p(void); +static void utc_sync_agent_framework_sync_agent_close_agent(void); +static void utc_sync_agent_framework_sync_agent_begin_transaction_p(void); +static void utc_sync_agent_framework_sync_agent_end_transaction_p(void); + +static void utc_sync_agent_framework_sync_agent_empty_agent_default_table_p(void); +static void utc_sync_agent_framework_sync_agent_empty_agent_default_table_n(void); +static void utc_sync_agent_framework_sync_agent_empty_all_agent_default_table_p(void); +static void utc_sync_agent_framework_sync_agent_construct_item_tbl_from_service_p(void); +static void utc_sync_agent_framework_sync_agent_construct_item_tbl_from_service_n(void); +static void utc_sync_agent_framework_sync_agent_construct_folder_tbl_from_service_p(void); +static void utc_sync_agent_framework_sync_agent_construct_folder_tbl_from_service_n(void); +static void utc_sync_agent_framework_sync_agent_refresh_item_tbl_from_service_p(void); +static void utc_sync_agent_framework_sync_agent_refresh_item_tbl_from_service_n(void); +static void utc_sync_agent_framework_sync_agent_set_service_change_point_p(void); + +static void utc_sync_agent_framework_sync_agent_alloc_obj_p(void); +static void utc_sync_agent_framework_sync_agent_free_obj_p(void); +static void utc_sync_agent_framework_sync_agent_free_obj_n(void); +static void utc_sync_agent_framework_sync_agent_set_value_to_obj_p(void); +static void utc_sync_agent_framework_sync_agent_set_value_to_obj_n(void); +static void utc_sync_agent_framework_sync_agent_get_value_to_obj_p(void); +static void utc_sync_agent_framework_sync_agent_get_value_to_obj_n(void); +static void utc_sync_agent_framework_sync_agent_get_obj_info_p(void); +static void utc_sync_agent_framework_sync_agent_get_obj_info_n(void); +static void utc_sync_agent_framework_sync_agent_free_obj_info_p(void); +static void utc_sync_agent_framework_sync_agent_free_obj_info_n(void); + +static void utc_sync_agent_framework_sync_agent_create_changelog_p(void); +static void utc_sync_agent_framework_sync_agent_update_changelog_p(void); +static void utc_sync_agent_framework_sync_agent_update_changelog_n(void); +static void utc_sync_agent_framework_sync_agent_delete_changelog_p(void); +static void utc_sync_agent_framework_sync_agent_delete_changelog_n(void); +static void utc_sync_agent_framework_sync_agent_get_changelog_n(void); +static void utc_sync_agent_framework_sync_agent_get_changelog_list_p(void); +static void utc_sync_agent_framework_sync_agent_get_changelog_list_n(void); +static void utc_sync_agent_framework_sync_agent_free_changelog_p(void); +static void utc_sync_agent_framework_sync_agent_free_changelog_list_p(void); + +static void utc_sync_agent_framework_sync_agent_create_config_p(void); +static void utc_sync_agent_framework_sync_agent_add_config_p(void); +static void utc_sync_agent_framework_sync_agent_add_config_n(void); +static void utc_sync_agent_framework_sync_agent_add_config_list_p(void); +static void utc_sync_agent_framework_sync_agent_add_config_list_n(void); +static void utc_sync_agent_framework_sync_agent_update_config_p(void); +static void utc_sync_agent_framework_sync_agent_update_config_n(void); +static void utc_sync_agent_framework_sync_agent_delete_config_p(void); +static void utc_sync_agent_framework_sync_agent_delete_config_n(void); +static void utc_sync_agent_framework_sync_agent_is_exist_config_p(void); +static void utc_sync_agent_framework_sync_agent_is_exist_config_n(void); +static void utc_sync_agent_framework_sync_agent_get_config_p(void); +static void utc_sync_agent_framework_sync_agent_get_config_n(void); +static void utc_sync_agent_framework_sync_agent_get_config_list_p(void); + +static void utc_sync_agent_framework_sync_agent_create_folder_p(void); +static void utc_sync_agent_framework_sync_agent_add_folder_p(void); +static void utc_sync_agent_framework_sync_agent_add_folder_n(void); +static void utc_sync_agent_framework_sync_agent_get_folder_p(void); +static void utc_sync_agent_framework_sync_agent_get_folder_n(void); +static void utc_sync_agent_framework_sync_agent_get_folder_list_p(void); +static void utc_sync_agent_framework_sync_agent_get_folder_list_n(void); +static void utc_sync_agent_framework_sync_agent_get_folder_id_list_p(void); +static void utc_sync_agent_framework_sync_agent_get_folder_id_list_n(void); +static void utc_sync_agent_framework_sync_agent_free_folder_p(void); +static void utc_sync_agent_framework_sync_agent_free_folder_n(void); +static void utc_sync_agent_framework_sync_agent_free_folder_list_p(void); +static void utc_sync_agent_framework_sync_agent_free_folder_list_n(void); +static void utc_sync_agent_framework_sync_agent_free_folder_id_p(void); +static void utc_sync_agent_framework_sync_agent_free_folder_id_n(void); +static void utc_sync_agent_framework_sync_agent_free_folder_id_list_p(void); +static void utc_sync_agent_framework_sync_agent_free_folder_id_list_n(void); + +static void utc_sync_agent_framework_sync_agent_create_item_p(void); +static void utc_sync_agent_framework_sync_agent_add_item_p(void); +static void utc_sync_agent_framework_sync_agent_add_item_n(void); +static void utc_sync_agent_framework_sync_agent_update_item_p(void); +static void utc_sync_agent_framework_sync_agent_update_item_n(void); +static void utc_sync_agent_framework_sync_agent_delete_item_p(void); +static void utc_sync_agent_framework_sync_agent_delete_item_n(void); +static void utc_sync_agent_framework_sync_agent_query_delete_item_p(void); +static void utc_sync_agent_framework_sync_agent_query_delete_item_n(void); +static void utc_sync_agent_framework_sync_agent_get_item_p(void); +static void utc_sync_agent_framework_sync_agent_get_item_n(void); +static void utc_sync_agent_framework_sync_agent_get_item_list_p(void); +static void utc_sync_agent_framework_sync_agent_get_item_list_n(void); +static void utc_sync_agent_framework_sync_agent_get_item_id_p(void); +static void utc_sync_agent_framework_sync_agent_get_item_id_n(void); +static void utc_sync_agent_framework_sync_agent_get_item_id_list_p(void); +static void utc_sync_agent_framework_sync_agent_get_item_id_list_n(void); +static void utc_sync_agent_framework_sync_agent_free_item_p(void); +static void utc_sync_agent_framework_sync_agent_free_item_n(void); +static void utc_sync_agent_framework_sync_agent_free_item_list_p(void); +static void utc_sync_agent_framework_sync_agent_free_item_list_n(void); +static void utc_sync_agent_framework_sync_agent_free_item_id_p(void); +static void utc_sync_agent_framework_sync_agent_free_item_id_n(void); +static void utc_sync_agent_framework_sync_agent_free_item_id_list_p(void); +static void utc_sync_agent_framework_sync_agent_free_item_id_list_n(void); +static void utc_sync_agent_framework_sync_agent_get_item_count_p(void); + +static void utc_sync_agent_framework_sync_agent_create_last_anchor_p(void); +static void utc_sync_agent_framework_sync_agent_add_last_anchor_p(void); +static void utc_sync_agent_framework_sync_agent_add_last_anchor_n(void); +static void utc_sync_agent_framework_sync_agent_update_last_anchor_p(void); +static void utc_sync_agent_framework_sync_agent_update_last_anchor_n(void); +static void utc_sync_agent_framework_sync_agent_get_last_anchor_list_p(void); +static void utc_sync_agent_framework_sync_agent_get_last_anchor_list_n(void); +static void utc_sync_agent_framework_sync_agent_free_last_anchor_p(void); +static void utc_sync_agent_framework_sync_agent_free_last_anchor_n(void); + +static void utc_sync_agent_framework_sync_agent_create_mapping_p(void); +static void utc_sync_agent_framework_sync_agent_add_mapping_p(void); +static void utc_sync_agent_framework_sync_agent_add_mapping_n(void); +static void utc_sync_agent_framework_sync_agent_delete_mapping_p(void); +static void utc_sync_agent_framework_sync_agent_delete_mapping_n(void); +static void utc_sync_agent_framework_sync_agent_get_mapping_p(void); +static void utc_sync_agent_framework_sync_agent_get_mapping_n(void); +static void utc_sync_agent_framework_sync_agent_get_mapping_list_p(void); +static void utc_sync_agent_framework_sync_agent_get_mapping_list_n(void); +static void utc_sync_agent_framework_sync_agent_free_mapping_p(void); +static void utc_sync_agent_framework_sync_agent_free_mapping_n(void); +static void utc_sync_agent_framework_sync_agent_free_mapping_list_p(void); +static void utc_sync_agent_framework_sync_agent_free_mapping_list_n(void); +static void utc_sync_agent_framework_sync_agent_is_exist_mapping_by_account_id_p(void); + +static void utc_sync_agent_framework_sync_agent_open_service_p(void); +static void utc_sync_agent_framework_sync_agent_open_service_n(void); +static void utc_sync_agent_framework_sync_agent_close_service_p(void); +static void utc_sync_agent_framework_sync_agent_close_service_n(void); +static void utc_sync_agent_framework_sync_agent_begin_service_p(void); +static void utc_sync_agent_framework_sync_agent_begin_service_n(void); +static void utc_sync_agent_framework_sync_agent_end_service_p(void); +static void utc_sync_agent_framework_sync_agent_end_service_n(void); +static void utc_sync_agent_framework_sync_agent_create_service_item_p(void); +static void utc_sync_agent_framework_sync_agent_create_service_folder_p(void); +static void utc_sync_agent_framework_sync_agent_free_service_item_p(void); +static void utc_sync_agent_framework_sync_agent_free_service_item_n(void); +static void utc_sync_agent_framework_sync_agent_free_service_folder_p(void); +static void utc_sync_agent_framework_sync_agent_free_service_folder_n(void); +static void utc_sync_agent_framework_sync_agent_add_service_item_p(void); +static void utc_sync_agent_framework_sync_agent_add_service_item_n(void); +static void utc_sync_agent_framework_sync_agent_update_service_item_p(void); +static void utc_sync_agent_framework_sync_agent_update_service_item_n(void); +static void utc_sync_agent_framework_sync_agent_delete_service_item_p(void); +static void utc_sync_agent_framework_sync_agent_delete_service_item_n(void); +static void utc_sync_agent_framework_sync_agent_query_delete_service_items_p(void); +static void utc_sync_agent_framework_sync_agent_query_delete_service_items_n(void); +static void utc_sync_agent_framework_sync_agent_get_service_item_p(void); +static void utc_sync_agent_framework_sync_agent_get_service_item_n(void); +static void utc_sync_agent_framework_sync_agent_get_service_folder_p(void); +static void utc_sync_agent_framework_sync_agent_get_service_folder_n(void); +static void utc_sync_agent_framework_sync_agent_execute_service_n(void); +static void utc_sync_agent_framework_sync_agent_get_used_service_item_count_p(void); +static void utc_sync_agent_framework_sync_agent_get_used_service_item_count_n(void); +static void utc_sync_agent_framework_sync_agent_get_used_service_item_count_for_folder_p(void); +static void utc_sync_agent_framework_sync_agent_get_used_service_item_count_for_folder_n(void); +static void utc_sync_agent_framework_sync_agent_backup_service_items_to_file_p(void); +static void utc_sync_agent_framework_sync_agent_backup_service_items_to_file_n(void); +static void utc_sync_agent_framework_sync_agent_restore_service_items_from_file_p(void); +static void utc_sync_agent_framework_sync_agent_restore_service_items_from_file_n(void); +static void utc_sync_agent_framework_sync_agent_get_service_item_id_p(void); +static void utc_sync_agent_framework_sync_agent_get_service_item_id_n(void); +static void utc_sync_agent_framework_sync_agent_get_service_folder_id_p(void); +static void utc_sync_agent_framework_sync_agent_get_service_folder_id_n(void); + +static void utc_sync_agent_framework_sync_agent_generate_item_luid_p(void); +static void utc_sync_agent_framework_sync_agent_generate_item_luid_n(void); +static void utc_sync_agent_framework_sync_agent_generate_folder_luid_p(void); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_open_agent_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_open_agent, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_begin_transaction_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_end_transaction_p, POSITIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_empty_agent_default_table_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_empty_agent_default_table_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_empty_all_agent_default_table_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_construct_item_tbl_from_service_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_construct_item_tbl_from_service_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_construct_folder_tbl_from_service_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_construct_folder_tbl_from_service_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_refresh_item_tbl_from_service_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_refresh_item_tbl_from_service_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_set_service_change_point_p, POSITIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_alloc_obj_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_obj_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_obj_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_set_value_to_obj_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_set_value_to_obj_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_value_to_obj_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_value_to_obj_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_obj_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_obj_info_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_obj_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_obj_info_n, NEGATIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_create_changelog_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_changelog_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_changelog_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_changelog_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_changelog_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_changelog_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_changelog_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_changelog_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_changelog_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_changelog_list_p, POSITIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_create_config_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_config_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_config_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_config_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_config_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_config_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_config_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_config_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_config_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_is_exist_config_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_is_exist_config_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_config_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_config_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_config_list_p, POSITIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_create_folder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_folder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_folder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_folder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_folder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_folder_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_folder_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_folder_id_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_folder_id_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_folder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_folder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_folder_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_folder_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_folder_id_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_folder_id_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_folder_id_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_folder_id_list_n, NEGATIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_create_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_query_delete_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_query_delete_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_item_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_item_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_item_id_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_item_id_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_item_id_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_item_id_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_item_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_item_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_item_id_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_item_id_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_item_id_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_item_id_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_item_count_p, POSITIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_create_last_anchor_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_last_anchor_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_last_anchor_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_last_anchor_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_last_anchor_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_last_anchor_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_last_anchor_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_last_anchor_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_last_anchor_n, NEGATIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_create_mapping_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_mapping_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_mapping_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_mapping_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_mapping_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mapping_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mapping_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mapping_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mapping_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_mapping_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_mapping_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_mapping_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_mapping_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_is_exist_mapping_by_account_id_p, POSITIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_create_service_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_service_folder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_service_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_service_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_service_folder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_service_folder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_service_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_service_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_service_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_service_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_service_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_service_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_query_delete_service_items_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_query_delete_service_items_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_service_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_service_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_service_folder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_service_folder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_execute_service_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_used_service_item_count_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_used_service_item_count_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_used_service_item_count_for_folder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_used_service_item_count_for_folder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_backup_service_items_to_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_backup_service_items_to_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_restore_service_items_from_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_restore_service_items_from_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_service_item_id_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_service_item_id_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_service_folder_id_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_service_folder_id_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_close_service_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_close_service_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_open_service_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_open_service_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_begin_service_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_begin_service_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_end_service_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_end_service_n, NEGATIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_generate_item_luid_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_generate_item_luid_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_generate_folder_luid_p, POSITIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_close_agent_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_close_agent, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static int account_id; +static char *item_id; +static char *service_id; +static char *saved_file_path; + +typedef enum { + TYPE_CALENDAR = 0, + TYPE_SMS = 1, + TYPE_BOOKMARK = 2 +} service_type_e; + +static void startup(void) +{ + /* start of TC */ + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(API_NAME_SYNC_START_UP, "sync_agent_init : %d", init_error); + dts_fail(API_NAME_SYNC_START_UP); + } + + sync_agent_da_return_e da_err = sync_agent_empty_all_agent_default_table(); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(API_NAME_SYNC_START_UP); + dts_message(API_NAME_SYNC_START_UP, "sync_agent_empty_agent_default_table : %d", da_err); + } +} + +static void cleanup(void) +{ + /* start of TC */ +} + +static void utc_sync_agent_framework_sync_agent_open_agent_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_OPEN_AGENT; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_open_agent(); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_open_agent : %d", da_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_open_agent(void) +{ + char *api_name = API_NAME_SYNC_AGENT_OPEN_AGENT; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_open_agent(); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_open_agent : %d", da_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_close_agent_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CLOSE_AGENT; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_close_agent(); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_framework : %d", da_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_close_agent(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CLOSE_AGENT; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_close_agent(); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_framework : %d", da_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_begin_transaction_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_BEGIN_TRANSACTION; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_transaction_e transaction = SYNC_AGENT_DA_TRANSACTION_COMMIT; + + da_err = sync_agent_begin_transaction(); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_begin_transaction : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_end_transaction_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_END_TRANSACTION; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_transaction_e transaction = SYNC_AGENT_DA_TRANSACTION_COMMIT; + + da_err = sync_agent_end_transaction(transaction); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_end_transaction : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_empty_agent_default_table_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_EMPTY_AGENT_DEFAULT_TABLE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_table_name_e table = SYNC_AGENT_DA_TABLE_NAME_LAST_ANCHOR; + + da_err = sync_agent_empty_agent_default_table(table); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_empty_agent_default_table : %d", da_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_empty_agent_default_table_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_EMPTY_AGENT_DEFAULT_TABLE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_table_name_e table = SYNC_AGENT_DA_TABLE_NAME_MAX; + + da_err = sync_agent_empty_agent_default_table(table); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + dts_message(api_name, "sync_agent_empty_agent_default_table : %d", da_err); + } else { + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_empty_all_agent_default_table_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_EMPTY_ALL_AGENT_DEFAULT_TABLE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_empty_all_agent_default_table(); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_empty_all_agent_default_table : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_construct_item_tbl_from_service_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CONSTRUCT_ITEM_TBL_FROM_SERVICE; + sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + sync_agent_fw_account_s *fw_account = NULL; + sync_agent_da_folder_s *folder = NULL; + int new_account_id = 0; + char *folder_id = NULL; + char *new_folder_id = NULL; + + account_err = sync_agent_create_fw_account(&fw_account); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_create_fw_account : %d", account_err); + dts_fail(api_name); + } + + fw_account->email = strdup("1234@gmail.com"); + fw_account->password = strdup("1234"); + fw_account->enable = 0; + fw_account->access_name = strdup("TC"); + + account_err = sync_agent_add_fw_account(fw_account, &new_account_id); + if (account_err != SYNC_AGENT_ACC_SUCCESS) { + dts_message(api_name, "sync_agent_add_fw_account : %d", account_err); + dts_fail(api_name); + } + + account_id = new_account_id; + + folder_id = sync_agent_generate_folder_luid(); + if (folder_id == NULL) { + dts_message(api_name, "sync_agent_generate_folder_luid"); + dts_fail(api_name); + } + + da_err = sync_agent_create_folder(&folder); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_message(api_name, "sync_agent_create_folder : %d", da_err); + dts_fail(api_name); + } + + folder->account_id = new_account_id; + folder->folder_id = strdup(folder_id); + folder->data_store_id = TYPE_CALENDAR; + folder->folder_type_id = 0; + folder->parent_folder_id = NULL; + folder->service_id = strdup("0"); + folder->access_name = strdup("EventHandler"); + + da_err = sync_agent_add_folder(folder, &new_folder_id); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_message(api_name, "sync_agent_add_folder : %d", da_err); + dts_fail(api_name); + } + + da_err = sync_agent_construct_item_tbl_from_service(new_account_id, TYPE_CALENDAR); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_construct_item_tbl_from_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_construct_item_tbl_from_service_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CONSTRUCT_ITEM_TBL_FROM_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + int wrong_account_id = -1; + + da_err = sync_agent_construct_item_tbl_from_service(wrong_account_id, TYPE_CALENDAR); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_construct_item_tbl_from_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_construct_folder_tbl_from_service_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CONSTRUCT_FOLDER_TBL_FROM_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_construct_folder_tbl_from_service(TYPE_CALENDAR); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_construct_folder_tbl_from_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_construct_folder_tbl_from_service_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CONSTRUCT_FOLDER_TBL_FROM_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + int wrong_service_type = 2; + + da_err = sync_agent_construct_folder_tbl_from_service(wrong_service_type); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_construct_folder_tbl_from_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_refresh_item_tbl_from_service_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_REFRESH_ITEM_TBL_FROM_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_refresh_item_tbl_from_service(account_id, TYPE_CALENDAR); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_refresh_item_tbl_from_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_refresh_item_tbl_from_service_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_REFRESH_ITEM_TBL_FROM_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + int wrong_account_id = -1; + + da_err = sync_agent_refresh_item_tbl_from_service(wrong_account_id, TYPE_CALENDAR); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_refresh_item_tbl_from_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_set_service_change_point_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SET_SERVICE_CHANGE_POINT; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_set_service_change_point(account_id, TYPE_CALENDAR); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_set_service_change_point : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_alloc_obj_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ALLOC_OBJ; + void *result = NULL; + + result = sync_agent_alloc_obj(TYPE_SMS); + if (result != NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_alloc_obj"); + } +} + +static void utc_sync_agent_framework_sync_agent_free_obj_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_OBJ; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + void *result = NULL; + + result = sync_agent_alloc_obj(TYPE_SMS); + if (result == NULL) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_alloc_obj"); + } + + da_err = sync_agent_free_obj(TYPE_SMS, result); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_obj : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_obj_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_OBJ; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + void *result = NULL; + + da_err = sync_agent_free_obj(TYPE_SMS, result); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_obj : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_set_value_to_obj_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SET_VALUE_TO_OBJ; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + void *result = NULL; + + result = sync_agent_alloc_obj(TYPE_SMS); + if (result == NULL) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_alloc_obj"); + } + + result = sync_agent_set_value_to_obj(TYPE_SMS, result, 1, 0, (void *)(1)); + if (result != NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_set_value_to_obj"); + } +} + +static void utc_sync_agent_framework_sync_agent_set_value_to_obj_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SET_VALUE_TO_OBJ; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + void *result = NULL; + + result = sync_agent_set_value_to_obj(TYPE_SMS, result, 1, 0, (void *)(1)); + if (result == NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_set_value_to_obj"); + } +} + +static void utc_sync_agent_framework_sync_agent_get_value_to_obj_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_VALUE_TO_OBJ; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + void *result = NULL; + char *body = strdup("abc"); + char *return_body = NULL; + + result = sync_agent_alloc_obj(TYPE_SMS); + if (result == NULL) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_alloc_obj"); + } + + result = sync_agent_set_value_to_obj(TYPE_SMS, result, 9, 0, (void *)body); + if (result == NULL) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_set_value_to_obj"); + } + + return_body = sync_agent_get_value_to_obj(TYPE_SMS, result, 9, 0); + if (return_body != NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_value_to_obj"); + } +} + +static void utc_sync_agent_framework_sync_agent_get_value_to_obj_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_VALUE_TO_OBJ; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + void *result = NULL; + char *return_body = NULL; + + return_body = sync_agent_get_value_to_obj(TYPE_SMS, result, 9, 0); + if (return_body == NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_value_to_obj"); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_obj_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_OBJ_INFO; + + sync_agent_plugin_object_info_s *datastore = sync_agent_get_obj_info(TYPE_CALENDAR); + if (datastore != NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_obj_info"); + } +} + +static void utc_sync_agent_framework_sync_agent_get_obj_info_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_OBJ_INFO; + int wrong_service_type = 4; + + sync_agent_plugin_object_info_s *datastore = sync_agent_get_obj_info(wrong_service_type); + if (datastore == NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_obj_info"); + } +} + +static void utc_sync_agent_framework_sync_agent_free_obj_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_OBJ_INFO; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + sync_agent_plugin_object_info_s *datastore = sync_agent_get_obj_info(TYPE_CALENDAR); + if (datastore == NULL) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_obj_info"); + } + + da_err = sync_agent_free_obj_info(TYPE_CALENDAR, datastore); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_obj : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_obj_info_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_OBJ_INFO; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + int wrong_service_type = 4; + + sync_agent_plugin_object_info_s *datastore = sync_agent_get_obj_info(TYPE_CALENDAR); + if (datastore == NULL) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_obj_info"); + } + + da_err = sync_agent_free_obj_info(wrong_service_type, datastore); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_obj : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_create_changelog_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_CHANGELOG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_item_changelog_s *sync_agent_changelog = NULL; + + da_err = sync_agent_create_changelog(&sync_agent_changelog); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_changelog : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_update_changelog_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UPDATE_CHANGELOG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_update_changelog_query_s query; + + int *item_type_id_list = (int *)calloc(1, sizeof(int)); + if (item_type_id_list == NULL) { + dts_fail(api_name); + dts_message(api_name, "itemTypeIdList is NULL"); + } + + item_type_id_list[0] = TYPE_CALENDAR; + + query.option = SYNC_AGENT_DA_UPDATE_CHANGELOG_OPTION_WAIT_STATUS; + query.folder_id_list = NULL; + query.folder_id_count = 0; + query.item_type_id_list = item_type_id_list; + query.item_type_id_count = 1; + + da_err = sync_agent_update_changelog(account_id, &query); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_update_changelog : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_update_changelog_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UPDATE_CHANGELOG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_update_changelog_query_s query; + + int wrong_account_id = -1; + + int *item_type_id_list = (int *)calloc(1, sizeof(int)); + if (item_type_id_list == NULL) { + dts_fail(api_name); + dts_message(api_name, "itemTypeIdList is NULL"); + } + + item_type_id_list[0] = TYPE_CALENDAR; + + query.option = SYNC_AGENT_DA_UPDATE_CHANGELOG_OPTION_WAIT_STATUS; + query.folder_id_list = NULL; + query.folder_id_count = 0; + query.item_type_id_list = item_type_id_list; + query.item_type_id_count = 1; + + da_err = sync_agent_update_changelog(wrong_account_id, &query); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_update_changelog : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_changelog_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_CHANGELOG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_delete_changelog_query_s query; + + query.option = SYNC_AGENT_DA_DELETE_CHANGELOG_OPTION_ITEM_TYPE_ID; + query.item_type_id = TYPE_CALENDAR; + + da_err = sync_agent_delete_changelog(account_id, &query); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_delete_changelog : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_changelog_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_CHANGELOG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_delete_changelog_query_s query; + + int wrong_account_id = -1; + + query.option = SYNC_AGENT_DA_DELETE_CHANGELOG_OPTION_ITEM_TYPE_ID; + query.item_type_id = TYPE_CALENDAR; + + da_err = sync_agent_delete_changelog(wrong_account_id, &query); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_delete_changelog : %d", da_err); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_changelog_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_CHANGELOG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_item_changelog_s *sync_agent_changelog = NULL; + + da_err = sync_agent_create_changelog(&sync_agent_changelog); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_changelog : %d", da_err); + } + + da_err = sync_agent_get_changelog(account_id, NULL, &sync_agent_changelog); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_changelog : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_changelog_list_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_CHANGELOG_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *changelog_list = NULL; + + sync_agent_da_get_changelog_list_query_s get_ch_query; + get_ch_query.option = SYNC_AGENT_DA_GET_CHANGELOG_LIST_OPTION_ITEM_TYPE_ID; + get_ch_query.account_id = account_id; + get_ch_query.item_type_id = TYPE_CALENDAR; + + da_err = sync_agent_get_changelog_list(&get_ch_query, &changelog_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_changelog_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_changelog_list_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_CHANGELOG_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *changelog_list = NULL; + + int wrong_account_id = -1; + + sync_agent_da_get_changelog_list_query_s get_ch_query; + get_ch_query.option = SYNC_AGENT_DA_GET_CHANGELOG_LIST_OPTION_ITEM_TYPE_ID; + get_ch_query.account_id = wrong_account_id; + get_ch_query.item_type_id = TYPE_CALENDAR; + + da_err = sync_agent_get_changelog_list(&get_ch_query, &changelog_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_changelog_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_changelog_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_CHANGELOG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_item_changelog_s *sync_agent_changelog = NULL; + + da_err = sync_agent_create_changelog(&sync_agent_changelog); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_changelog : %d", da_err); + } + + da_err = sync_agent_free_changelog(sync_agent_changelog); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_changelog : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_changelog_list_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_CHANGELOG_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *changelog_list = NULL; + + sync_agent_da_get_changelog_list_query_s get_ch_query; + get_ch_query.option = SYNC_AGENT_DA_GET_CHANGELOG_LIST_OPTION_ITEM_TYPE_ID; + get_ch_query.account_id = account_id;; + get_ch_query.item_type_id = TYPE_CALENDAR; + + da_err = sync_agent_get_changelog_list(&get_ch_query, &changelog_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_changelog_list : %d", da_err); + } + + da_err = sync_agent_free_changelog_list(changelog_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_changelog_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_create_config_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_CONFIG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_config_s *config = NULL; + + da_err = sync_agent_create_config(&config); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_config : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_config_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CONFIG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_config_s *config = NULL; + + da_err = sync_agent_create_config(&config); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_config : %d", da_err); + } + + config->access_name = "access_name"; + config->config_id = account_id; + config->key = "key"; + config->value = "config"; + config->type = "string"; + + da_err = sync_agent_add_config(config); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_config : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_config_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CONFIG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_config_s *config = NULL; + + da_err = sync_agent_create_config(&config); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_config : %d", da_err); + } + + da_err = sync_agent_add_config(config); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_config : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_config_list_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CONFIG_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_config_s *config = NULL; + GList *config_list = NULL; + + da_err = sync_agent_create_config(&config); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_config : %d", da_err); + } + + config->access_name = "access_name"; + config->config_id = account_id; + config->key = "key1"; + config->value = "config1"; + config->type = "string"; + + config_list = g_list_append(config_list, config); + + da_err = sync_agent_create_config(&config); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_config : %d", da_err); + } + + config->access_name = "access_name"; + config->config_id = account_id; + config->key = "key2"; + config->value = "config2"; + config->type = "string"; + + config_list = g_list_append(config_list, config); + + da_err = sync_agent_add_config_list(config_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_config_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_config_list_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CONFIG_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_config_s *config = NULL; + GList *config_list = NULL; + + da_err = sync_agent_add_config_list(config_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_config_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_update_config_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UPDATE_CONFIG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_config_s *config = NULL; + + da_err = sync_agent_create_config(&config); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_config : %d", da_err); + } + + config->access_name = "access_name"; + config->config_id = account_id; + config->key = "key"; + config->value = "update config"; + config->type = "string"; + + da_err = sync_agent_update_config(config); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_update_config : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_update_config_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UPDATE_CONFIG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_config_s *config = NULL; + + da_err = sync_agent_update_config(config); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_update_config : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_config_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_CONFIG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *key = "key"; + + da_err = sync_agent_delete_config(account_id, key); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_delete_config : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_config_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_CONFIG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *key = NULL; + + da_err = sync_agent_delete_config(account_id, key); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_delete_config : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_is_exist_config_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_IS_EXIST_CONFIG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *key = "key"; + int exist; + + da_err = sync_agent_is_exist_config(account_id, key, &exist); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_is_exist_config : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_is_exist_config_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_IS_EXIST_CONFIG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *key = NULL; + int exist; + + da_err = sync_agent_is_exist_config(account_id, key, &exist); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_is_exist_config : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_config_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_CONFIG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_config_s *config = NULL; + char *key = "key2"; + + da_err = sync_agent_create_config(&config); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_config : %d", da_err); + } + + da_err = sync_agent_get_config(account_id, key, &config); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_config : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_config_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_CONFIG; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_config_s *config = NULL; + char *key = NULL; + + da_err = sync_agent_create_config(&config); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_config : %d", da_err); + } + + da_err = sync_agent_get_config(account_id, key, &config); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_config : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_config_list_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_CONFIG_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *config_list = NULL; + + da_err = sync_agent_get_config_list(account_id, &config_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_config_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_create_folder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_FOLDER; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_folder_s *folder = NULL; + + da_err = sync_agent_create_folder(&folder); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_folder : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_folder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_FOLDER; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_folder_s *folder = NULL; + char *folder_id = NULL; + char *new_folder_id = NULL; + + folder_id = sync_agent_generate_folder_luid(); + if (folder_id == NULL) { + dts_message(api_name, "sync_agent_generate_folder_luid"); + dts_fail(api_name); + } + + da_err = sync_agent_create_folder(&folder); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_message(api_name, "sync_agent_create_folder : %d", da_err); + dts_fail(api_name); + } + + folder->account_id = account_id; + folder->folder_id = strdup(folder_id); + folder->data_store_id = TYPE_CALENDAR; + folder->folder_type_id = 0; + folder->parent_folder_id = NULL; + folder->service_id = strdup("0"); + folder->access_name = strdup("EventHandler"); + + da_err = sync_agent_add_folder(folder, &new_folder_id); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_folder : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_folder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_FOLDER; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_folder_s *folder = NULL; + char *new_folder_id = NULL; + + da_err = sync_agent_add_folder(folder, &new_folder_id); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_folder : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_folder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FOLDER; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_folder_s *folder = NULL; + sync_agent_da_folder_s *get_folder = NULL; + char *folder_id = NULL; + char *new_folder_id = NULL; + + folder_id = sync_agent_generate_folder_luid(); + if (folder_id == NULL) { + dts_message(api_name, "sync_agent_generate_folder_luid"); + dts_fail(api_name); + } + + da_err = sync_agent_create_folder(&folder); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_message(api_name, "sync_agent_create_folder : %d", da_err); + dts_fail(api_name); + } + + folder->account_id = account_id; + folder->folder_id = strdup(folder_id); + folder->data_store_id = TYPE_CALENDAR; + folder->folder_type_id = 0; + folder->parent_folder_id = NULL; + folder->service_id = strdup("0"); + folder->access_name = strdup("EventHandler"); + + da_err = sync_agent_add_folder(folder, &new_folder_id); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_folder : %d", da_err); + } + + da_err = sync_agent_create_folder(&get_folder); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_message(api_name, "sync_agent_create_folder : %d", da_err); + dts_fail(api_name); + } + + da_err = sync_agent_get_folder(folder_id, &get_folder); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_folder : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_folder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FOLDER; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_folder_s *get_folder = NULL; + char *folder_id = NULL; + + da_err = sync_agent_get_folder(folder_id, &get_folder); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_folder : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_folder_list_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FOLDER_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *folder_list = NULL; + GList *folder_id_list = NULL; + char *folder_id = NULL; + + sync_agent_da_get_folder_id_list_query_s folder_id_list_query; + folder_id_list_query.option = SYNC_AGENT_DA_GET_FOLDER_ID_OPTION_FOLDER_TYPE_ID; + folder_id_list_query.account_id = account_id; + folder_id_list_query.item_type_id = TYPE_CALENDAR; + folder_id_list_query.folder_type_id = 0; + + da_err = sync_agent_get_folder_id_list(&folder_id_list_query, &folder_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_id_list : %d", da_err); + } + + if (g_list_length(folder_id_list) > 0) { + GList *iter = g_list_nth(folder_id_list, 0); + folder_id = (char *)(iter->data); + } + + sync_agent_da_get_folder_list_query_s foler_list_query; + foler_list_query.option = SYNC_AGENT_DA_GET_FOLDER_LIST_OPTION_SERVICE_ID_MAPPING; + foler_list_query.account_id = account_id; + foler_list_query.folder_id = folder_id; + + da_err = sync_agent_get_folder_list(&foler_list_query, &folder_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_folder_list_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FOLDER_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *folder_list = NULL; + + sync_agent_da_get_folder_list_query_s foler_list_query; + foler_list_query.option = SYNC_AGENT_DA_GET_FOLDER_LIST_OPTION_SERVICE_ID_MAPPING; + foler_list_query.account_id = account_id; + foler_list_query.folder_id = NULL; + + da_err = sync_agent_get_folder_list(&foler_list_query, &folder_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_folder_id_list_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FOLDER_ID_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *folder_id_list = NULL; + + sync_agent_da_get_folder_id_list_query_s folder_id_list_query; + folder_id_list_query.option = SYNC_AGENT_DA_GET_FOLDER_ID_OPTION_FOLDER_TYPE_ID; + folder_id_list_query.account_id = account_id; + folder_id_list_query.item_type_id = 0; + folder_id_list_query.folder_type_id = 0; + + da_err = sync_agent_get_folder_id_list(&folder_id_list_query, &folder_id_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_id_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_folder_id_list_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FOLDER_ID_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *folder_id_list = NULL; + + sync_agent_da_get_folder_id_list_query_s *folder_id_list_query = NULL; + + da_err = sync_agent_get_folder_id_list(folder_id_list_query, &folder_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_id_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_folder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_FOLDER; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_folder_s *folder = NULL; + + da_err = sync_agent_create_folder(&folder); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_folder : %d", da_err); + } + + da_err = sync_agent_free_folder(folder); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_folder : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_folder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_FOLDER; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_folder_s *folder = NULL; + + da_err = sync_agent_free_folder(folder); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_folder : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_folder_list_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_FOLDER_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *folder_list = NULL; + char *folder_id = NULL; + + sync_agent_da_folder_s *folder = NULL; + char *new_folder_id = NULL; + + folder_id = sync_agent_generate_folder_luid(); + if (folder_id == NULL) { + dts_message(api_name, "sync_agent_generate_folder_luid"); + dts_fail(api_name); + } + + da_err = sync_agent_create_folder(&folder); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_message(api_name, "sync_agent_create_folder : %d", da_err); + dts_fail(api_name); + } + + folder->account_id = account_id; + folder->folder_id = strdup(folder_id); + folder->data_store_id = TYPE_CALENDAR; + folder->folder_type_id = 0; + folder->parent_folder_id = NULL; + folder->service_id = strdup("0"); + folder->access_name = strdup("EventHandler"); + + da_err = sync_agent_add_folder(folder, &new_folder_id); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_folder : %d", da_err); + } + + sync_agent_da_get_folder_list_query_s foler_list_query; + foler_list_query.option = SYNC_AGENT_DA_GET_FOLDER_LIST_OPTION_SERVICE_ID_MAPPING; + foler_list_query.account_id = account_id; + foler_list_query.folder_id = new_folder_id; + + da_err = sync_agent_get_folder_list(&foler_list_query, &folder_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_list : %d", da_err); + } + + da_err = sync_agent_free_folder_list(folder_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_folder_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_folder_list_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_FOLDER_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *folder_list = NULL; + + da_err = sync_agent_free_folder_list(folder_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_folder_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_folder_id_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_FOLDER_ID; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + GList *folder_id_list = NULL; + char *folder_id = NULL; + + sync_agent_da_get_folder_id_list_query_s folder_id_list_query; + folder_id_list_query.option = SYNC_AGENT_DA_GET_FOLDER_ID_OPTION_FOLDER_TYPE_ID; + folder_id_list_query.account_id = account_id; + folder_id_list_query.item_type_id = 0; + folder_id_list_query.folder_type_id = 0; + + da_err = sync_agent_get_folder_id_list(&folder_id_list_query, &folder_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_id_list : %d", da_err); + } + + if (g_list_length(folder_id_list) > 0) { + GList *iter = g_list_nth(folder_id_list, 0); + folder_id = (char *)(iter->data); + } + + da_err = sync_agent_free_folder_id(folder_id); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_folder_id : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_folder_id_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_FOLDER_ID; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *folder_id = NULL; + + da_err = sync_agent_free_folder_id(folder_id); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_folder_id : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_folder_id_list_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_FOLDER_ID_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *folder_list = NULL; + GList *folder_id_list = NULL; + char *folder_id = NULL; + + sync_agent_da_get_folder_id_list_query_s folder_id_list_query; + folder_id_list_query.option = SYNC_AGENT_DA_GET_FOLDER_ID_OPTION_FOLDER_TYPE_ID; + folder_id_list_query.account_id = account_id; + folder_id_list_query.item_type_id = 0; + folder_id_list_query.folder_type_id = 0; + + da_err = sync_agent_get_folder_id_list(&folder_id_list_query, &folder_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_id_list : %d", da_err); + } + + if (g_list_length(folder_id_list) > 0) { + GList *iter = g_list_nth(folder_id_list, 0); + folder_id = (char *)(iter->data); + } + + da_err = sync_agent_free_folder_id_list(folder_id_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_folder_id_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_folder_id_list_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_FOLDER_ID_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *folder_id_list = NULL; + + da_err = sync_agent_free_folder_id_list(folder_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_folder_id_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_create_item_p(void) +{ + char *api_name = API_SYNC_AGENT_CREATE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_item_s *sync_agent_item = NULL; + + da_err = sync_agent_create_item(&sync_agent_item); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_item_p(void) +{ + char *api_name = API_SYNC_AGENT_ADD_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_item_s *sync_agent_item = NULL; + char **item_luid_list = NULL; + int item_count = 2; + + item_luid_list = sync_agent_generate_item_luid(1, item_count); + if (item_luid_list == NULL) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_generate_item_luid : %d", da_err); + } + + da_err = sync_agent_create_item(&sync_agent_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_item : %d", da_err); + } + + sync_agent_item->item_id = item_luid_list[0]; + sync_agent_item->data_store_id = TYPE_CALENDAR; + sync_agent_item->account_id = account_id; + sync_agent_item->folder_id = g_strdup("0"); + sync_agent_item->service_id = item_luid_list[1]; + sync_agent_item->access_name = g_strdup("DACI_ChangeLog"); + + da_err = sync_agent_add_item(sync_agent_item, &item_id, true); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_item_n(void) +{ + char *api_name = API_SYNC_AGENT_ADD_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_item_s *sync_agent_item = NULL; + char *item_id = NULL; + + da_err = sync_agent_add_item(sync_agent_item, &item_id, true); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_update_item_p(void) +{ + char *api_name = API_SYNC_AGENT_UPDATE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_update_item(item_id, true); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_update_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_update_item_n(void) +{ + char *api_name = API_SYNC_AGENT_UPDATE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *item_id = NULL; + + da_err = sync_agent_update_item(item_id, true); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_update_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_item_p(void) +{ + char *api_name = API_SYNC_AGENT_DELETE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_item_s *sync_agent_item = NULL; + char *item_id = NULL; + char **item_luid_list = NULL; + int item_count = 2; + + item_luid_list = sync_agent_generate_item_luid(1, item_count); + if (item_luid_list == NULL) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_generate_item_luid : %d", da_err); + } + + da_err = sync_agent_create_item(&sync_agent_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_item : %d", da_err); + } + + sync_agent_item->item_id = item_luid_list[0]; + sync_agent_item->data_store_id = TYPE_CALENDAR; + sync_agent_item->account_id = account_id; + sync_agent_item->folder_id = g_strdup("0"); + sync_agent_item->service_id = item_luid_list[1]; + sync_agent_item->access_name = g_strdup("DACI_ChangeLog"); + + da_err = sync_agent_add_item(sync_agent_item, &item_id, true); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_item : %d", da_err); + } + + da_err = sync_agent_delete_item(item_id, true); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_delete_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_item_n(void) +{ + char *api_name = API_SYNC_AGENT_DELETE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *item_id = NULL; + + da_err = sync_agent_delete_item(item_id, true); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_delete_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_query_delete_item_p(void) +{ + char *api_name = API_SYNC_AGENT_QUERY_DELETE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_item_s *sync_agent_item = NULL; + char *item_id = NULL; + char **item_luid_list = NULL; + int item_count = 2; + + item_luid_list = sync_agent_generate_item_luid(1, item_count); + if (item_luid_list == NULL) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_generate_item_luid : %d", da_err); + } + + da_err = sync_agent_create_item(&sync_agent_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_item : %d", da_err); + } + + sync_agent_item->item_id = item_luid_list[0]; + sync_agent_item->data_store_id = TYPE_CALENDAR; + sync_agent_item->account_id = account_id; + sync_agent_item->folder_id = g_strdup("0"); + sync_agent_item->service_id = item_luid_list[1]; + sync_agent_item->access_name = g_strdup("DACI_ChangeLog"); + + da_err = sync_agent_add_item(sync_agent_item, &item_id, true); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_item : %d", da_err); + } + + sync_agent_da_delete_item_query_s query_item; + query_item.option = SYNC_AGENT_DA_DELETE_ITEM_OPTION_ITEM_TYPE_ID; + query_item.item_type_id = TYPE_CALENDAR; + query_item.account_id = account_id; + + da_err = sync_agent_query_delete_item(&query_item); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_query_delete_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_query_delete_item_n(void) +{ + char *api_name = API_SYNC_AGENT_QUERY_DELETE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_delete_item_query_s *query_item = NULL; + + da_err = sync_agent_query_delete_item(query_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_query_delete_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_item_p(void) +{ + char *api_name = API_SYNC_AGENT_GET_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_item_s *sync_agent_item = NULL; + sync_agent_da_item_s *get_sync_agent_item = NULL; + char *item_id = NULL; + char **item_luid_list = NULL; + int item_count = 2; + + item_luid_list = sync_agent_generate_item_luid(1, item_count); + if (item_luid_list == NULL) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_generate_item_luid : %d", da_err); + } + + da_err = sync_agent_create_item(&sync_agent_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_item : %d", da_err); + } + service_id = item_luid_list[1]; + + sync_agent_item->item_id = item_luid_list[0]; + sync_agent_item->data_store_id = TYPE_CALENDAR; + sync_agent_item->account_id = account_id; + sync_agent_item->folder_id = g_strdup("0"); + sync_agent_item->service_id = item_luid_list[1]; + sync_agent_item->access_name = g_strdup("DACI_ChangeLog"); + + da_err = sync_agent_add_item(sync_agent_item, &item_id, true); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_item : %d", da_err); + } + + da_err = sync_agent_create_item(&get_sync_agent_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_item : %d", da_err); + } + + da_err = sync_agent_get_item(item_id, &get_sync_agent_item); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_item_n(void) +{ + char *api_name = API_SYNC_AGENT_GET_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_item_s *sync_agent_item = NULL; + char *item_id = NULL; + + da_err = sync_agent_get_item(item_id, &sync_agent_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_item_list_p(void) +{ + char *api_name = API_SYNC_AGENT_GET_ITEM_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *item_list = NULL; + + sync_agent_da_get_item_list_query_s query; + query.option = SYNC_AGENT_DA_GET_ITEM_LIST_OPTION_ACCOUNT_ID; + query.item_type_id = TYPE_CALENDAR; + + da_err = sync_agent_get_item_list(account_id, &query, &item_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_item_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_item_list_n(void) +{ + char *api_name = API_SYNC_AGENT_GET_ITEM_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *item_list = NULL; + + sync_agent_da_get_item_list_query_s *query = NULL; + + da_err = sync_agent_get_item_list(account_id, query, &item_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_item_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_item_id_p(void) +{ + char *api_name = API_SYNC_AGENT_GET_ITEM_ID; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *guid = NULL; + + sync_agent_da_get_item_id_query_s query; + query.service_id = service_id; + query.account_id = 1; + query.item_type_id = TYPE_CALENDAR; + + da_err = sync_agent_get_item_id(&query, &guid); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_item_id : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_item_id_n(void) +{ + char *api_name = API_SYNC_AGENT_GET_ITEM_ID; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *guid = NULL; + + sync_agent_da_get_item_id_query_s *query = NULL; + + da_err = sync_agent_get_item_id(query, &guid); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_item_id : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_item_id_list_p(void) +{ + char *api_name = API_SYNC_AGENT_GET_ITEM_ID_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *item_id_list = NULL; + + sync_agent_da_get_item_id_list_query_s query; + query.option = SYNC_AGENT_DA_GET_ITEM_ID_LIST_OPTION_ITEM_TYPE_ID; + query.account_id = account_id; + query.item_type_id = TYPE_CALENDAR; + + da_err = sync_agent_get_item_id_list(&query, &item_id_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_item_id_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_item_id_list_n(void) +{ + char *api_name = API_SYNC_AGENT_GET_ITEM_ID_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *item_id_list = NULL; + + sync_agent_da_get_item_id_list_query_s *query = NULL; + + da_err = sync_agent_get_item_id_list(query, &item_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_item_id_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_item_p(void) +{ + char *api_name = API_SYNC_AGENT_FREE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_item_s *sync_agent_item = NULL; + + da_err = sync_agent_create_item(&sync_agent_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_item : %d", da_err); + } + + da_err = sync_agent_free_item(sync_agent_item); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_item_n(void) +{ + char *api_name = API_SYNC_AGENT_FREE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_item_s *sync_agent_item = NULL; + + da_err = sync_agent_free_item(sync_agent_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_item_list_p(void) +{ + char *api_name = API_SYNC_AGENT_FREE_ITEM_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *item_list = NULL; + + sync_agent_da_get_item_list_query_s query; + query.option = SYNC_AGENT_DA_GET_ITEM_LIST_OPTION_ACCOUNT_ID; + query.item_type_id = TYPE_CALENDAR; + + da_err = sync_agent_get_item_list(account_id, &query, &item_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_item_list : %d", da_err); + } + + da_err = sync_agent_free_item_list(item_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_item_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_item_list_n(void) +{ + char *api_name = API_SYNC_AGENT_FREE_ITEM_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *item_list = NULL; + + da_err = sync_agent_free_item_list(item_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_item_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_item_id_p(void) +{ + char *api_name = API_SYNC_AGENT_FREE_ITEM_ID; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *item_id = NULL; + + sync_agent_da_get_item_id_query_s query; + query.service_id = service_id; + query.account_id = 1; + query.item_type_id = TYPE_CALENDAR; + + da_err = sync_agent_get_item_id(&query, &item_id); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_item_id : %d", da_err); + } + + da_err = sync_agent_free_item_id(item_id); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_item_id : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_item_id_n(void) +{ + char *api_name = API_SYNC_AGENT_FREE_ITEM_ID; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *item_id = NULL; + + da_err = sync_agent_free_item_id(item_id); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_item_id : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_item_id_list_p(void) +{ + char *api_name = API_SYNC_AGENT_FREE_ITEM_ID_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *item_id_list = NULL; + + sync_agent_da_get_item_id_list_query_s query; + query.option = SYNC_AGENT_DA_GET_ITEM_ID_LIST_OPTION_ITEM_TYPE_ID; + query.account_id = account_id; + query.item_type_id = TYPE_CALENDAR; + + da_err = sync_agent_get_item_id_list(&query, &item_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_item_id_list : %d", da_err); + } + + da_err = sync_agent_free_item_id_list(item_id_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_item_id_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_item_id_list_n(void) +{ + char *api_name = API_SYNC_AGENT_FREE_ITEM_ID_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *item_id_list = NULL; + + da_err = sync_agent_free_item_id_list(item_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_item_id_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_item_count_p(void) +{ + char *api_name = API_SYNC_AGENT_GET_ITEM_COUNT; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + int item_count; + + da_err = sync_agent_get_item_count(TYPE_CALENDAR, &item_count); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_item_count : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_create_last_anchor_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_LAST_ANCHOR; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_last_anchor_s *sync_agent_last_anchor = NULL; + + da_err = sync_agent_create_last_anchor(&sync_agent_last_anchor); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_last_anchor : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_last_anchor_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_LAST_ANCHOR; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_last_anchor_s lastAnchor_daci; + + lastAnchor_daci.account_id = account_id; + lastAnchor_daci.data_store_id = TYPE_CALENDAR; + lastAnchor_daci.last_anchor_server = NULL; + lastAnchor_daci.last_anchor_client = NULL; + lastAnchor_daci.access_name = "Engine"; + + da_err = sync_agent_add_last_anchor(&lastAnchor_daci); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_last_anchor : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_last_anchor_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_LAST_ANCHOR; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_last_anchor_s *lastAnchor_daci = NULL; + + da_err = sync_agent_add_last_anchor(lastAnchor_daci); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_last_anchor : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_update_last_anchor_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UPDATE_LAST_ANCHOR; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_last_anchor_s lastAnchor_daci; + + lastAnchor_daci.account_id = account_id; + lastAnchor_daci.data_store_id = TYPE_CALENDAR; + lastAnchor_daci.last_anchor_server = "1234"; + lastAnchor_daci.last_anchor_client = "4567"; + lastAnchor_daci.access_name = "Engine"; + + da_err = sync_agent_update_last_anchor(&lastAnchor_daci); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_update_last_anchor : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_update_last_anchor_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UPDATE_LAST_ANCHOR; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_last_anchor_s *lastAnchor_daci = NULL; + + da_err = sync_agent_update_last_anchor(lastAnchor_daci); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_update_last_anchor : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_last_anchor_list_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_LAST_ANCHOR_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *anchor_list = NULL; + + sync_agent_da_get_last_anchor_list_query_s query; + query.option = SYNC_AGENT_DA_GET_LAST_ANCHOR_LIST_OPTION_ITEM_TYPE_ID; + query.account_id = account_id; + query.item_type_id = TYPE_CALENDAR; + + da_err = sync_agent_get_last_anchor_list(&query, &anchor_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_last_anchor_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_last_anchor_list_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_LAST_ANCHOR_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *anchor_list = NULL; + sync_agent_da_get_last_anchor_list_query_s *query = NULL; + + da_err = sync_agent_get_last_anchor_list(&query, &anchor_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_last_anchor_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_last_anchor_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_LAST_ANCHOR; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_last_anchor_s *sync_agent_last_anchor = NULL; + + da_err = sync_agent_create_last_anchor(&sync_agent_last_anchor); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_last_anchor : %d", da_err); + } + + da_err = sync_agent_free_last_anchor(sync_agent_last_anchor); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_last_anchor : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_last_anchor_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_LAST_ANCHOR; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_last_anchor_s *sync_agent_last_anchor = NULL; + + da_err = sync_agent_free_last_anchor(sync_agent_last_anchor); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_last_anchor : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_create_mapping_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_MAPPING; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_mapping_s *sync_agent_mapping = NULL; + + da_err = sync_agent_create_mapping(&sync_agent_mapping); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_mapping : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_mapping_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_MAPPING; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_mapping_s *sync_agent_mapping = NULL; + + da_err = sync_agent_create_mapping(&sync_agent_mapping); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_last_anchor : %d", da_err); + } + + sync_agent_mapping->account_id = account_id; + sync_agent_mapping->data_store_id = TYPE_CALENDAR; + sync_agent_mapping->luid = "1234"; + sync_agent_mapping->guid = "5678"; + sync_agent_mapping->access_name = strdup("SA"); + + da_err = sync_agent_add_mapping(sync_agent_mapping); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_mapping : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_mapping_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_MAPPING; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_mapping_s *sync_agent_mapping = NULL; + + da_err = sync_agent_add_mapping(sync_agent_mapping); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_mapping : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_mapping_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_MAPPING; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + sync_agent_da_delete_mapping_query_s query; + query.option = SYNC_AGENT_DA_DELETE_MAPPING_OPTION_LUID; + query.account_id = account_id; + query.luid = "1234"; + + da_err = sync_agent_delete_mapping(&query); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_delete_mapping : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_mapping_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_MAPPING; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + sync_agent_da_delete_mapping_query_s *query = NULL; + + da_err = sync_agent_delete_mapping(query); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_delete_mapping : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_mapping_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_MAPPING; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_mapping_s *sync_agent_mapping = NULL; + sync_agent_da_mapping_s *get_sync_agent_mapping = NULL; + + da_err = sync_agent_create_mapping(&sync_agent_mapping); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_last_anchor : %d", da_err); + } + + sync_agent_mapping->account_id = account_id; + sync_agent_mapping->data_store_id = TYPE_CALENDAR; + sync_agent_mapping->luid = "1234"; + sync_agent_mapping->guid = "5678"; + sync_agent_mapping->access_name = strdup("SA"); + + da_err = sync_agent_add_mapping(sync_agent_mapping); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_mapping : %d", da_err); + } + + da_err = sync_agent_create_mapping(&get_sync_agent_mapping); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_last_anchor : %d", da_err); + } + + sync_agent_da_get_mapping_query_s query; + query.account_id = account_id; + query.luid = "1234"; + + da_err = sync_agent_get_mapping(&query, &get_sync_agent_mapping); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_mapping : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_mapping_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_MAPPING; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_mapping_s *sync_agent_mapping = NULL; + + sync_agent_da_get_mapping_query_s *query = NULL; + + da_err = sync_agent_get_mapping(&query, &sync_agent_mapping); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_mapping : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_mapping_list_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_MAPPING_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *mapping_list = NULL; + + sync_agent_da_get_mapping_list_query_s query; + query.option = SYNC_AGENT_DA_GET_MAPPING_LIST_OPTION_ACCOUNT_ID; + query.account_id = account_id; + + da_err = sync_agent_get_mapping_list(&query, &mapping_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_mapping_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_mapping_list_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_MAPPING_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *mapping_list = NULL; + + sync_agent_da_get_mapping_list_query_s *query = NULL; + + da_err = sync_agent_get_mapping_list(query, &mapping_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_mapping_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_mapping_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_MAPPING; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_mapping_s *sync_agent_mapping = NULL; + + da_err = sync_agent_create_mapping(&sync_agent_mapping); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_last_anchor : %d", da_err); + } + + da_err = sync_agent_free_mapping(sync_agent_mapping); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_mapping : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_mapping_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_MAPPING; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_mapping_s *sync_agent_mapping = NULL; + + da_err = sync_agent_free_mapping(sync_agent_mapping); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_mapping : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_mapping_list_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_MAPPING_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *mapping_list = NULL; + + sync_agent_da_get_mapping_list_query_s query; + query.option = SYNC_AGENT_DA_GET_MAPPING_LIST_OPTION_ACCOUNT_ID; + query.account_id = account_id; + + da_err = sync_agent_get_mapping_list(&query, &mapping_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_mapping_list : %d", da_err); + } + + da_err = sync_agent_free_mapping_list(mapping_list); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_mapping_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_mapping_list_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_MAPPING_LIST; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *mapping_list = NULL; + + da_err = sync_agent_free_mapping_list(mapping_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_mapping_list : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_is_exist_mapping_by_account_id_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_IS_EXIST_MAPPING_BY_ACCOUNT_ID; + int exist = 0; + + exist = sync_agent_is_exist_mapping_by_account_id(account_id); + if (exist >= 0) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_mapping_list"); + } +} + +static void utc_sync_agent_framework_sync_agent_open_service_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_OPEN_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_open_service(TYPE_CALENDAR); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_open_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_open_service_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_OPEN_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + int wrong_service_type = 5; + + da_err = sync_agent_open_service(wrong_service_type); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_open_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_close_service_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CLOSE_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_close_service(TYPE_CALENDAR); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_close_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_close_service_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CLOSE_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + int wrong_service_type = 5; + + da_err = sync_agent_close_service(wrong_service_type); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_close_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_begin_service_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_BEGIN_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_begin_service(TYPE_CALENDAR); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_begin_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_begin_service_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_BEGIN_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + int wrong_service_type = 5; + + da_err = sync_agent_begin_service(wrong_service_type); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_begin_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_end_service_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_END_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_end_service(TYPE_CALENDAR, true); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_end_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_end_service_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_END_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + int wrong_service_type = 5; + + da_err = sync_agent_end_service(wrong_service_type, true); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_end_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_create_service_item_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_SERVICE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_service_item_s *service_item = NULL; + + da_err = sync_agent_create_service_item(&service_item); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_service_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_create_service_folder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_SERVICE_FOLDER; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_service_folder_s *service_folder = NULL; + + da_err = sync_agent_create_service_folder(&service_folder); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_service_folder : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_service_item_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_SERVICE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_service_item_s *service_item = NULL; + + da_err = sync_agent_create_service_item(&service_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_service_item : %d", da_err); + } + + da_err = sync_agent_free_service_item(service_item); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_service_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_service_item_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_SERVICE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_service_item_s *service_item = NULL; + + da_err = sync_agent_free_service_item(service_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_service_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_service_folder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_SERVICE_FOLDER; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_service_folder_s *service_folder = NULL; + + da_err = sync_agent_create_service_folder(&service_folder); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_service_folder : %d", da_err); + } + + da_err = sync_agent_free_service_folder(service_folder); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_service_folder : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_free_service_folder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_SERVICE_FOLDER; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_service_folder_s *service_folder = NULL; + + da_err = sync_agent_free_service_folder(service_folder); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_free_service_folder : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_service_item_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_SERVICE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *folder_id_list = NULL; + sync_agent_da_service_item_s *service_item = NULL; + char *folder_id = NULL; + char *data = "BEGIN:VCALENDAR\r\n\ +VERSION:1.0\r\n\ +TZ:+0900\r\n\ +DAYLIGHT:FALSE\r\n\ +BEGIN:VEVENT\r\n\ +SUMMARY;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:=EC=A0=90=EC=8B=AC\r\n\ +LOCATION:123\r\n\ +CLASS:PUBLIC\r\n\ +DTSTART:20121210T020000Z\r\n\ +DTEND:20121210T030000Z\r\n\ +AALARM:20121210T015500Z;;0;\r\n\ +X-FUNAMBOL-ALLDAY:0\r\n\ +END:VEVENT\r\n\ +END:VCALENDAR"; + + char **item_luid_list = NULL; + int item_count = 1; + + sync_agent_da_get_folder_id_list_query_s query; + query.option = SYNC_AGENT_DA_GET_FOLDER_ID_OPTION_FOLDER_TYPE_ID; + query.account_id = account_id; + query.item_type_id = TYPE_CALENDAR; + query.folder_type_id = 0; + + da_err = sync_agent_get_folder_id_list(&query, &folder_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_id_list : %d", da_err); + } + + if (g_list_length(folder_id_list) > 0) { + GList *iter = g_list_nth(folder_id_list, 0); + folder_id = (char *)(iter->data); + } + + item_luid_list = sync_agent_generate_item_luid(1, item_count); + if (item_luid_list == NULL) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_generate_item_luid : %d", da_err); + } + + da_err = sync_agent_create_service_item(&service_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_service_item : %d", da_err); + } + + service_item->item_id = item_luid_list[0]; + service_item->content_type = TYPE_CALENDAR; + service_item->account_id = account_id; + service_item->folder_id = g_strdup(folder_id); + service_item->access_name = g_strdup("Engine"); + service_item->data = g_strdup(data); + + sync_agent_begin_service(TYPE_CALENDAR); + da_err = sync_agent_add_service_item(service_item, &item_id, false); + sync_agent_end_service(TYPE_CALENDAR, true); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_service_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_add_service_item_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_SERVICE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_service_item_s *service_item = NULL; + char *item_id = NULL; + + da_err = sync_agent_add_service_item(service_item, &item_id, false); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_service_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_update_service_item_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UPDATE_SERVICE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *folder_id_list = NULL; + sync_agent_da_service_item_s *service_item = NULL; + char *folder_id = NULL; + char *data = "BEGIN:VCALENDAR\r\n\ +VERSION:1.0\r\n\ +TZ:+0900\r\n\ +DAYLIGHT:FALSE\r\n\ +BEGIN:VEVENT\r\n\ +SUMMARY;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:=EC=A0=90=EC=8B=AC\r\n\ +LOCATION:123\r\n\ +CLASS:PUBLIC\r\n\ +DTSTART:20121210T020000Z\r\n\ +DTEND:20121210T030000Z\r\n\ +AALARM:20121210T015500Z;;0;\r\n\ +X-FUNAMBOL-ALLDAY:0\r\n\ +END:VEVENT\r\n\ +END:VCALENDAR"; + + sync_agent_da_get_folder_id_list_query_s query; + query.option = SYNC_AGENT_DA_GET_FOLDER_ID_OPTION_FOLDER_TYPE_ID; + query.account_id = account_id; + query.item_type_id = TYPE_CALENDAR; + query.folder_type_id = 0; + + da_err = sync_agent_get_folder_id_list(&query, &folder_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_id_list : %d", da_err); + } + + if (g_list_length(folder_id_list) > 0) { + GList *iter = g_list_nth(folder_id_list, 0); + folder_id = (char *)(iter->data); + } + + da_err = sync_agent_create_service_item(&service_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_service_item : %d", da_err); + } + + service_item->item_id = item_id; + service_item->content_type = TYPE_CALENDAR; + service_item->account_id = account_id; + service_item->folder_id = g_strdup(folder_id); + service_item->access_name = g_strdup("Engine"); + service_item->data = g_strdup(data); + + da_err = sync_agent_update_service_item(service_item, item_id, false); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_update_service_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_update_service_item_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UPDATE_SERVICE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_service_item_s *service_item = NULL; + char *item_id = NULL; + + da_err = sync_agent_update_service_item(service_item, item_id, false); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_update_service_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_service_item_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_SERVICE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_delete_service_item(item_id, false); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_delete_service_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_service_item_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_SERVICE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *item_id = NULL; + + da_err = sync_agent_delete_service_item(item_id, false); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_delete_service_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_query_delete_service_items_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_QUERY_DELETE_SERVICE_ITEMS; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + sync_agent_da_delete_service_item_query_s query; + query.content_type = TYPE_CALENDAR; + query.account_id = account_id; + + da_err = sync_agent_query_delete_service_items(&query); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_query_delete_service_items : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_query_delete_service_items_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_QUERY_DELETE_SERVICE_ITEMS; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_delete_service_item_query_s *query = NULL; + + da_err = sync_agent_query_delete_service_items(query); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_query_delete_service_items : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_service_item_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_SERVICE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_service_item_s *service_item = NULL; + sync_agent_da_service_item_s *get_service_item = NULL; + GList *folder_id_list = NULL; + char *folder_id = NULL; + char *data = "BEGIN:VCALENDAR\r\n\ +VERSION:1.0\r\n\ +TZ:+0900\r\n\ +DAYLIGHT:FALSE\r\n\ +BEGIN:VEVENT\r\n\ +SUMMARY;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:=EC=A0=90=EC=8B=AC\r\n\ +LOCATION:123\r\n\ +CLASS:PUBLIC\r\n\ +DTSTART:20121210T020000Z\r\n\ +DTEND:20121210T030000Z\r\n\ +AALARM:20121210T015500Z;;0;\r\n\ +X-FUNAMBOL-ALLDAY:0\r\n\ +END:VEVENT\r\n\ +END:VCALENDAR"; + + char **item_luid_list = NULL; + int item_count = 1; + char *item_id = NULL; + + sync_agent_da_get_folder_id_list_query_s query; + query.option = SYNC_AGENT_DA_GET_FOLDER_ID_OPTION_FOLDER_TYPE_ID; + query.account_id = account_id; + query.item_type_id = TYPE_CALENDAR; + query.folder_type_id = 0; + + da_err = sync_agent_get_folder_id_list(&query, &folder_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_id_list : %d", da_err); + } + + if (g_list_length(folder_id_list) > 0) { + GList *iter = g_list_nth(folder_id_list, 0); + folder_id = (char *)(iter->data); + } + + item_luid_list = sync_agent_generate_item_luid(1, item_count); + if (item_luid_list == NULL) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_generate_item_luid : %d", da_err); + } + + da_err = sync_agent_create_service_item(&service_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_service_item : %d", da_err); + } + + service_item->item_id = item_luid_list[0]; + service_item->content_type = TYPE_CALENDAR; + service_item->account_id = account_id; + service_item->folder_id = g_strdup(folder_id); + service_item->access_name = g_strdup("Engine"); + service_item->data = g_strdup(data); + + sync_agent_begin_service(TYPE_CALENDAR); + da_err = sync_agent_add_service_item(service_item, &item_id, false); + sync_agent_end_service(TYPE_CALENDAR, true); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_service_item : %d", da_err); + } + + da_err = sync_agent_create_service_item(&get_service_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_service_item : %d", da_err); + } + + da_err = sync_agent_get_service_item(item_id, &get_service_item); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_service_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_service_item_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_SERVICE_ITEM; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_service_item_s *service_item = NULL; + char *item_id = NULL; + + da_err = sync_agent_get_service_item(item_id, &service_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_service_item : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_service_folder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_SERVICE_FOLDER; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + sync_agent_da_service_folder_s *service_folder = NULL; + GList *folder_id_list = NULL; + char *folder_id = NULL; + + sync_agent_da_get_folder_id_list_query_s query; + query.option = SYNC_AGENT_DA_GET_FOLDER_ID_OPTION_ITEM_TYPE_ID; + query.account_id = account_id; + query.item_type_id = TYPE_CALENDAR; + + da_err = sync_agent_get_folder_id_list(&query, &folder_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_id_list : %d", da_err); + } + + if (g_list_length(folder_id_list) > 0) { + GList *iter = g_list_nth(folder_id_list, 0); + folder_id = (char *)(iter->data); + } + + da_err = sync_agent_create_service_folder(&service_folder); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_service_folder : %d", da_err); + } + + da_err = sync_agent_get_service_folder(folder_id, service_folder); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_service_folder : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_service_folder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_SERVICE_FOLDER; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *folder_id = NULL; + sync_agent_da_service_folder_s *service_folder = NULL; + + da_err = sync_agent_create_service_folder(&service_folder); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_service_folder : %d", da_err); + } + + da_err = sync_agent_get_service_folder(folder_id, service_folder); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_service_folder : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_execute_service_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_EXECUTE_SERVICE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + void *result = NULL;; + void *values = NULL; + + da_err = sync_agent_execute_service(TYPE_SMS, 1, "send_msg", values, &result); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_execute_service : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_used_service_item_count_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_USED_SERVICE_ITEM_COUNT; + int count = 0; + + count = sync_agent_get_used_service_item_count(TYPE_CALENDAR); + if (count >= 0) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_used_service_item_count"); + } +} + +static void utc_sync_agent_framework_sync_agent_get_used_service_item_count_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_USED_SERVICE_ITEM_COUNT; + int wrong_service_type = 5; + int count = 0; + + count = sync_agent_get_used_service_item_count(wrong_service_type); + if (count < 0) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_used_service_item_count"); + } +} + +static void utc_sync_agent_framework_sync_agent_get_used_service_item_count_for_folder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_USED_SERVICE_ITEM_COUNT_FOR_FOLDER; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *folder_id_list = NULL; + char *folder_id = NULL; + int item_count = 0; + + sync_agent_da_get_folder_id_list_query_s folder_id_list_query; + folder_id_list_query.option = SYNC_AGENT_DA_GET_FOLDER_ID_OPTION_FOLDER_TYPE_ID; + folder_id_list_query.account_id = account_id; + folder_id_list_query.item_type_id = TYPE_CALENDAR; + folder_id_list_query.folder_type_id = 0; + + da_err = sync_agent_get_folder_id_list(&folder_id_list_query, &folder_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_id_list : %d", da_err); + } + + if (g_list_length(folder_id_list) > 0) { + GList *iter = g_list_nth(folder_id_list, 0); + folder_id = (char *)(iter->data); + } + + item_count = sync_agent_get_used_service_item_count_for_folder(TYPE_CALENDAR, account_id, folder_id); + if (item_count >= 0) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_used_service_item_count_for_folder"); + } +} + +static void utc_sync_agent_framework_sync_agent_get_used_service_item_count_for_folder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_USED_SERVICE_ITEM_COUNT_FOR_FOLDER; + char *folder_id = NULL; + int item_count = 0; + + item_count = sync_agent_get_used_service_item_count_for_folder(TYPE_CALENDAR, account_id, folder_id); + if (item_count < 0) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_used_service_item_count_for_folder"); + } + +} + +static void utc_sync_agent_framework_sync_agent_backup_service_items_to_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_BACKUP_SERVICE_ITEMS_TO_FILE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_backup_service_items_to_file(TYPE_BOOKMARK, 0, &saved_file_path); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_backup_service_items_to_file : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_backup_service_items_to_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_BACKUP_SERVICE_ITEMS_TO_FILE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *saved_file_path = NULL; + int wrong_service_type = 5; + + da_err = sync_agent_backup_service_items_to_file(wrong_service_type, 0, &saved_file_path); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_backup_service_items_to_file : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_restore_service_items_from_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_RESTORE_SERVICE_ITEMS_FROM_FILE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + + da_err = sync_agent_restore_service_items_from_file(TYPE_BOOKMARK, 0, saved_file_path); + if (da_err == SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_restore_service_items_from_file : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_restore_service_items_from_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_RESTORE_SERVICE_ITEMS_FROM_FILE; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + int wrong_service_type = 5; + + da_err = sync_agent_restore_service_items_from_file(wrong_service_type, 0, saved_file_path); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_restore_service_items_from_file : %d", da_err); + } +} + +static void utc_sync_agent_framework_sync_agent_get_service_item_id_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_SERVICE_ITEM_ID; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + char *service_item_id = NULL; + sync_agent_da_service_item_s *service_item = NULL; + GList *folder_id_list = NULL; + char *folder_id = NULL; + char *data = "BEGIN:VCALENDAR\r\n\ +VERSION:1.0\r\n\ +TZ:+0900\r\n\ +DAYLIGHT:FALSE\r\n\ +BEGIN:VEVENT\r\n\ +SUMMARY;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:=EC=A0=90=EC=8B=AC\r\n\ +LOCATION:123\r\n\ +CLASS:PUBLIC\r\n\ +DTSTART:20121210T020000Z\r\n\ +DTEND:20121210T030000Z\r\n\ +AALARM:20121210T015500Z;;0;\r\n\ +X-FUNAMBOL-ALLDAY:0\r\n\ +END:VEVENT\r\n\ +END:VCALENDAR"; + + char **item_luid_list = NULL; + int item_count = 1; + char *item_id = NULL; + + sync_agent_da_get_folder_id_list_query_s query; + query.option = SYNC_AGENT_DA_GET_FOLDER_ID_OPTION_FOLDER_TYPE_ID; + query.account_id = account_id; + query.item_type_id = TYPE_CALENDAR; + query.folder_type_id = 0; + + da_err = sync_agent_get_folder_id_list(&query, &folder_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_id_list : %d", da_err); + } + + if (g_list_length(folder_id_list) > 0) { + GList *iter = g_list_nth(folder_id_list, 0); + folder_id = (char *)(iter->data); + } + + item_luid_list = sync_agent_generate_item_luid(1, item_count); + if (item_luid_list == NULL) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_generate_item_luid : %d", da_err); + } + + da_err = sync_agent_create_service_item(&service_item); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_create_service_item : %d", da_err); + } + + service_item->item_id = item_luid_list[0]; + service_item->content_type = TYPE_CALENDAR; + service_item->account_id = account_id; + service_item->folder_id = g_strdup(folder_id); + service_item->access_name = g_strdup("Engine"); + service_item->data = g_strdup(data); + + sync_agent_begin_service(TYPE_CALENDAR); + da_err = sync_agent_add_service_item(service_item, &item_id, false); + sync_agent_end_service(TYPE_CALENDAR, true); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_add_service_item : %d", da_err); + } + + service_item_id = sync_agent_get_service_item_id(item_id); + if (service_item_id != NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_service_item_id"); + } +} + +static void utc_sync_agent_framework_sync_agent_get_service_item_id_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_SERVICE_ITEM_ID; + char *service_item_id = NULL; + char *item_id = NULL; + + service_item_id = sync_agent_get_service_item_id(item_id); + if (service_item_id == NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_service_item_id"); + } +} + +static void utc_sync_agent_framework_sync_agent_get_service_folder_id_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_SERVICE_FOLDER_ID; + sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS; + GList *folder_id_list = NULL; + char *folder_id = NULL; + char *service_folder_id = NULL; + + sync_agent_da_get_folder_id_list_query_s folder_id_list_query; + folder_id_list_query.option = SYNC_AGENT_DA_GET_FOLDER_ID_OPTION_FOLDER_TYPE_ID; + folder_id_list_query.account_id = account_id; + folder_id_list_query.item_type_id = TYPE_CALENDAR; + folder_id_list_query.folder_type_id = 0; + + da_err = sync_agent_get_folder_id_list(&folder_id_list_query, &folder_id_list); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_folder_id_list : %d", da_err); + } + + if (g_list_length(folder_id_list) > 0) { + GList *iter = g_list_nth(folder_id_list, 0); + folder_id = (char *)(iter->data); + } + + service_folder_id = sync_agent_get_service_folder_id(folder_id); + if (service_folder_id != NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_service_folder_id"); + } +} + +static void utc_sync_agent_framework_sync_agent_get_service_folder_id_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_SERVICE_FOLDER_ID; + char *folder_id = NULL; + char *service_folder_id = NULL; + + service_folder_id = sync_agent_get_service_folder_id(folder_id); + if (service_folder_id == NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_get_service_folder_id"); + } +} + +static void utc_sync_agent_framework_sync_agent_generate_item_luid_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GENERATE_ITEM_LUID; + char **item_luid_list = NULL; + int item_count = 10; + + item_luid_list = sync_agent_generate_item_luid(1, item_count); + if (item_luid_list != NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_generate_item_luid"); + } +} + +static void utc_sync_agent_framework_sync_agent_generate_item_luid_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GENERATE_ITEM_LUID; + char **item_luid_list = NULL; + int item_count = 0; + + item_luid_list = sync_agent_generate_item_luid(1, item_count); + if (item_luid_list == NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_generate_item_luid"); + } +} + +static void utc_sync_agent_framework_sync_agent_generate_folder_luid_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GENERATE_FOLDER_LUID; + char *folder_id = NULL; + + folder_id = sync_agent_generate_folder_luid(); + if (folder_id != NULL) { + dts_pass(api_name); + } else { + dts_fail(api_name); + dts_message(api_name, "sync_agent_generate_folder_luid"); + } +} diff --git a/TC/testcase/utc_sync_agent_framework_device.c b/TC/testcase/utc_sync_agent_framework_device.c new file mode 100755 index 0000000..b59bc9d --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_device.c @@ -0,0 +1,148 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_FILE "../../../testcase/fw-test-cfg/test_fw_config.xml" + +#define API_NAME_SYNC_START_UP "startup" + +#define API_NAME_SYNC_AGENT_EXECUTE_DEV_FUNCTION "sync_agent_execute_dev_function" +#define API_NAME_SYNC_AGENT_GET_DEVINFO "sync_agent_get_devinfo" + +////////////////////////////////////////executor.h////////////////////////////////////////////// + +static void utc_sync_agent_framework_sync_agent_execute_dev_function_p(void); +static void utc_sync_agent_framework_sync_agent_execute_dev_function_n(void); + +////////////////////////////////////////information.h////////////////////////////////////////////// + +static void utc_sync_agent_framework_sync_agent_get_devinfo_p(void); +static void utc_sync_agent_framework_sync_agent_get_devinfo_n(void); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_execute_dev_function_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_execute_dev_function_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_devinfo_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_devinfo_n, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + /* start of TC */ + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(API_NAME_SYNC_START_UP, "sync_agent_init : %d", init_error); + dts_fail(API_NAME_SYNC_START_UP); + } else { + dts_pass(API_NAME_SYNC_START_UP); + } +} + +static void cleanup(void) +{ + /* start of TC */ +} + +static void utc_sync_agent_framework_sync_agent_execute_dev_function_p(void) +{ + sync_agent_dev_return_e err = SYNC_AGENT_DEV_RETURN_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_EXECUTE_DEV_FUNCTION; + int memory_type = 0; + char *function_name = NULL; + + function_name = "fota_flag"; + + err = sync_agent_execute_dev_function(2, function_name, 1, memory_type); + if (err != SYNC_AGENT_DEV_RETURN_SUCCESS) { + dts_message(api_name, "sync_agent_execute_dev_function : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_execute_dev_function_n(void) +{ + sync_agent_dev_return_e err = SYNC_AGENT_DEV_RETURN_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_EXECUTE_DEV_FUNCTION; + int memory_type = 0; + char *function_name = NULL; + + err = sync_agent_execute_dev_function(2, function_name, 1, memory_type); + if (err != SYNC_AGENT_DEV_RETURN_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_execute_dev_function : %d", err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_devinfo_p(void) +{ + sync_agent_dev_return_e err = SYNC_AGENT_DEV_RETURN_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_DEVINFO; + + int device_plugin_id = 0; + char *info_name = NULL; + char *value = NULL; + + device_plugin_id = 2; + info_name = "FOTADownDir"; + + err = sync_agent_get_devinfo(device_plugin_id, info_name, &value); + if (err != SYNC_AGENT_DEV_RETURN_SUCCESS) { + dts_message(api_name, "sync_agent_get_devinfo : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_devinfo_n(void) +{ + sync_agent_dev_return_e err = SYNC_AGENT_ACC_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_DEVINFO; + + int device_plugin_id = 0; + char *info_name = NULL; + char *value = NULL; + + device_plugin_id = 2; + + err = sync_agent_get_devinfo(device_plugin_id, info_name, &value); + if (err != SYNC_AGENT_DEV_RETURN_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_devinfo : %d", err); + dts_fail(api_name); + } +} diff --git a/TC/testcase/utc_sync_agent_framework_device_manager.c b/TC/testcase/utc_sync_agent_framework_device_manager.c new file mode 100755 index 0000000..7efa207 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_device_manager.c @@ -0,0 +1,1966 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_FILE "../../../testcase/fw-test-cfg/test_fw_config.xml" + +#define API_NAME_SYNC_START_UP "startup" + +///////////////////////////////////mo_accessor.h////////////////////////////////////////// +#define API_NAME_SYNC_AGENT_CREATE_MO_ITEM "sync_agent_create_mo_item" +#define API_NAME_SYNC_AGENT_ADD_MO_ITEM "sync_agent_add_mo_item" +#define API_NAME_SYNC_AGENT_UPDATE_MO_ITEM "sync_agent_update_mo_item" +#define API_NAME_SYNC_AGENT_DELETE_MO_ITEM "sync_agent_delete_mo_item" +#define API_NAME_SYNC_AGENT_DELETE_MO_TREE_ITEM "sync_agent_delete_mo_tree_item" +#define API_NAME_SYNC_AGENT_GET_MO_ITEM "sync_agent_get_mo_item" +#define API_NAME_SYNC_AGENT_GET_MO_ITEMS "sync_agent_get_mo_items" +#define API_NAME_SYNC_AGENT_QUERY_MO_ITEM "sync_agent_query_mo_item" +#define API_NAME_SYNC_AGENT_FREE_MO_ITEM "sync_agent_free_mo_item" +#define API_NAME_SYNC_AGENT_CREATE_MO_ACC_ITEM "sync_agent_create_mo_acc_item" +#define API_NAME_SYNC_AGENT_UPDATE_MO_ACC_ITEM "sync_agent_update_mo_acc_item" +#define API_NAME_SYNC_AGENT_GET_MO_ACC_ITEM "sync_agent_get_mo_acc_item" +#define API_NAME_SYNC_AGENT_FREE_MO_ACC_ITEM "sync_agent_free_mo_acc_item" +#define API_NAME_SYNC_AGENT_INITIALIZE "sync_agent_initialize" +#define API_NAME_SYNC_AGENT_OPEN "sync_agent_open" +#define API_NAME_SYNC_AGENT_CLOSE "sync_agent_close" +#define API_NAME_SYNC_AGENT_BEGIN_TRANSACTION_MO "sync_agent_begin_transaction_mo" +#define API_NAME_SYNC_AGENT_END_TRANSACTION_MO "sync_agent_end_transaction_mo" +#define API_NAME_SYNC_AGENT_CONSTRUCT_MO_TABLE "sync_agent_construct_mo_table" +#define API_NAME_SYNC_AGENT_UPTODATE_MO_TABLE "sync_agent_uptodate_mo_table" +#define API_NAME_SYNC_AGENT_DELETE_ALL_MO_TABLE "sync_agent_delete_all_mo_table" +#define API_NAME_SYNC_AGENT_GET_SERVERINFO "sync_agent_get_serverinfo" +#define API_NAME_SYNC_AGENT_FREE_SERVERINFO "sync_agent_free_serverinfo" +#define API_NAME_SYNC_AGENT_GET_SERVERID "sync_agent_get_serverid" +#define API_NAME_SYNC_AGENT_GET_ROOT_PATH "sync_agent_get_root_path" +#define API_NAME_SYNC_AGENT_GET_SERVER_TYPE "sync_agent_get_server_type" +#define API_NAME_SYNC_AGENT_IS_EXIST_MO "sync_agent_is_exist_mo" +#define API_NAME_SYNC_AGENT_GET_MO_TYPE "sync_agent_get_mo_type" +#define API_NAME_SYNC_AGENT_CHECK_ACL_VALUE "sync_agent_check_acl_value" +#define API_NAME_SYNC_AGENT_DESCENDANT_MO_TREE "sync_agent_descendant_mo_tree" +#define API_NAME_SYNC_AGENT_TRAVERSE_MO_TREE_PREORDER "sync_agent_traverse_mo_tree_preorder" + +#define API_NAME_SYNC_AGENT_EXPORT_TNDS_STREAM "sync_agent_export_tnds_stream" +#define API_NAME_SYNC_AGENT_IMPORT_TNDS_STREAM "sync_agent_import_tnds_stream" + +///////////////////////////////////mo_executor.h////////////////////////////////////////// +#define API_NAME_SYNC_AGENT_EXECUTE_MO_EXT "sync_agent_execute_mo_ext" + +///////////////////////////////////interface.h////////////////////////////////////////// +#define API_NAME_SYNC_AGENT_START_MDM_SERVICE "sync_agent_start_mdm_service" +#define API_NAME_SYNC_AGENT_STOP_MDM_SERVICE "sync_agent_stop_mdm_service" +#define API_NAME_SYNC_AGENT_GET_MDM_SERVICE "sync_agent_get_mdm_service" +#define API_NAME_SYNC_AGENT_SET_MDM_SERVICE "sync_agent_set_mdm_service" +#define API_NAME_SYNC_AGENT_EXECUTE_MDM_SERVICE "sync_agent_execute_mdm_service" + +#define TNDS_SAMPLE_FILE "../../../testcase/fw-test-file/tnds_sample.txt" + +static void utc_sync_agent_framework_sync_agent_create_mo_item_p(void); +static void utc_sync_agent_framework_sync_agent_add_mo_item_p(void); +static void utc_sync_agent_framework_sync_agent_add_mo_item_n(void); +static void utc_sync_agent_framework_sync_agent_update_mo_item_p(void); +static void utc_sync_agent_framework_sync_agent_update_mo_item_n(void); +static void utc_sync_agent_framework_sync_agent_delete_mo_item_p(void); +static void utc_sync_agent_framework_sync_agent_delete_mo_item_n(void); +static void utc_sync_agent_framework_sync_agent_delete_mo_tree_item_p(void); +static void utc_sync_agent_framework_sync_agent_delete_mo_tree_item_n(void); +static void utc_sync_agent_framework_sync_agent_get_mo_item_p(void); +static void utc_sync_agent_framework_sync_agent_get_mo_item_n(void); +static void utc_sync_agent_framework_sync_agent_get_mo_items_p(void); +static void utc_sync_agent_framework_sync_agent_get_mo_items_n(void); +static void utc_sync_agent_framework_sync_agent_query_mo_item_p(void); +static void utc_sync_agent_framework_sync_agent_qyery_mo_item_n(void); +static void utc_sync_agent_framework_sync_agent_free_mo_item_p(void); +static void utc_sync_agent_framework_sync_agent_free_mo_item_list_p(void); +static void utc_sync_agent_framework_sync_agent_create_mo_acc_item_p(void); +static void utc_sync_agent_framework_sync_agent_update_mo_acc_item_p(void); +static void utc_sync_agent_framework_sync_agent_update_mo_acc_item_n(void); +static void utc_sync_agent_framework_sync_agent_get_mo_acc_item_p(void); +static void utc_sync_agent_framework_sync_agent_get_mo_acc_item_n(void); +static void utc_sync_agent_framework_sync_agent_free_mo_acc_item_p(void); + +static void utc_sync_agent_framework_sync_agent_initialize_p(void); +static void utc_sync_agent_framework_sync_agent_initialize_n(void); + +static void utc_sync_agent_framework_sync_agent_construct_mo_table_p(void); +static void utc_sync_agent_framework_sync_agent_construct_mo_table_n(void); + +static void utc_sync_agent_framework_sync_agent_uptodate_mo_table_p(void); +static void utc_sync_agent_framework_sync_agent_uptodate_mo_table_n(void); +static void utc_sync_agent_framework_sync_agent_delete_all_mo_table_p(void); + +static void utc_sync_agent_framework_sync_agent_get_serverinfo_p(void); +static void utc_sync_agent_framework_sync_agent_free_serverinfo_p(void); + +static void utc_sync_agent_framework_sync_agent_get_serverid_p(void); +static void utc_sync_agent_framework_sync_agent_get_serverid_n(void); +static void utc_sync_agent_framework_sync_agent_get_root_path_p(void); +static void utc_sync_agent_framework_sync_agent_get_root_path_n(void); + +static void utc_sync_agent_framework_sync_agent_get_server_type_p(void); +static void utc_sync_agent_framework_sync_agent_get_server_type_n(void); + +static void utc_sync_agent_framework_sync_agent_is_exist_mo_p(void); +static void utc_sync_agent_framework_sync_agent_is_exist_mo_n(void); +static void utc_sync_agent_framework_sync_agent_get_mo_type_p(void); +static void utc_sync_agent_framework_sync_agent_get_mo_type_n(void); + +static void utc_sync_agent_framework_sync_agent_check_acl_value_p(void); +static void utc_sync_agent_framework_sync_agent_check_acl_value_n(void); +static void utc_sync_agent_framework_sync_agent_get_descendant_mo_tree_p(void); +static void utc_sync_agent_framework_sync_agent_get_descendant_mo_tree_n(void); +static void utc_sync_agent_framework_sync_agent_traverse_mo_tree_preorder_p(void); +static void utc_sync_agent_framework_sync_agent_traverse_mo_tree_preorder_n(void); + +static void utc_sync_agent_framework_sync_agent_export_tnds_stream_p(void); +static void utc_sync_agent_framework_sync_agent_export_tnds_stream_n(void); +static void utc_sync_agent_framework_sync_agent_import_tnds_stream_p(void); +static void utc_sync_agent_framework_sync_agent_import_tnds_stream_n(void); + +static void utc_sync_agent_framework_sync_agent_open_p(void); +static void utc_sync_agent_framework_sync_agent_begin_transaction_mo_p(void); +static void utc_sync_agent_framework_sync_agent_end_transaction_mo_p(void); +static void utc_sync_agent_framework_sync_agent_close_p(void); + +///////////////////////////////////mo_executor.h////////////////////////////////////////// + +static void utc_sync_agent_framework_sync_agent_execute_mo_ext_n(void); + +///////////////////////////////////mdm_control_code.h////////////////////////////////////////// + +static void utc_sync_agent_framework_sync_agent_start_mdm_service_p(void); +static void utc_sync_agent_framework_sync_agent_start_mdm_service_n(void); +static void utc_sync_agent_framework_sync_agent_stop_mdm_service_p(void); +static void utc_sync_agent_framework_sync_agent_stop_mdm_service_n(void); +static void utc_sync_agent_framework_sync_agent_set_mdm_value_p(void); +static void utc_sync_agent_framework_sync_agent_set_mdm_value_n(void); +static void utc_sync_agent_framework_sync_agent_get_mdm_value_p(void); +static void utc_sync_agent_framework_sync_agent_get_mdm_value_n(void); +static void utc_sync_agent_framework_sync_agent_execute_mdm_p(void); +static void utc_sync_agent_framework_sync_agent_execute_mdm_n(void); + +struct tet_testlist tet_testlist[] = { + + {utc_sync_agent_framework_sync_agent_create_mo_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_mo_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_mo_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_mo_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_mo_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_mo_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_mo_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_mo_tree_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_mo_tree_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mo_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mo_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mo_items_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mo_items_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_query_mo_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_qyery_mo_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_mo_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_mo_item_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_mo_acc_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_mo_acc_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_update_mo_acc_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mo_acc_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mo_acc_item_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_mo_acc_item_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_initialize_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_initialize_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_construct_mo_table_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_construct_mo_table_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_uptodate_mo_table_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_uptodate_mo_table_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_all_mo_table_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_serverinfo_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_serverinfo_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_serverid_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_serverid_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_root_path_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_root_path_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_server_type_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_server_type_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_is_exist_mo_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_is_exist_mo_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mo_type_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mo_type_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_check_acl_value_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_check_acl_value_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_descendant_mo_tree_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_descendant_mo_tree_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_traverse_mo_tree_preorder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_traverse_mo_tree_preorder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_export_tnds_stream_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_export_tnds_stream_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_import_tnds_stream_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_import_tnds_stream_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_open_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_begin_transaction_mo_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_end_transaction_mo_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_close_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_execute_mo_ext_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_start_mdm_service_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_start_mdm_service_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_set_mdm_value_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_set_mdm_value_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mdm_value_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_mdm_value_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_execute_mdm_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_execute_mdm_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_stop_mdm_service_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_stop_mdm_service_n, NEGATIVE_TC_IDX}, + + {NULL, 0} + +}; + +static void startup(void) +{ + /* start of TC */ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(API_NAME_SYNC_START_UP, "sync_agent_init : %d", init_error); + + err = sync_agent_open_mo(); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + } + + err = sync_agent_delete_all_mo_table(); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + } else { + } + + dts_fail(API_NAME_SYNC_START_UP); + } else { + + err = sync_agent_open_mo(); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + } + + err = sync_agent_delete_all_mo_table(); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + } else { + } + + dts_pass(API_NAME_SYNC_START_UP); + } + +} + +static void cleanup(void) +{ + /* start of TC */ +} + +static void utc_sync_agent_framework_sync_agent_create_mo_item_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s *sync_agent_mo_item = NULL; + char *api_name = API_NAME_SYNC_AGENT_CREATE_MO_ITEM; + + err = sync_agent_create_mo_item(&sync_agent_mo_item); + + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } + + sync_agent_free_mo_item(sync_agent_mo_item); +} + +static void utc_sync_agent_framework_sync_agent_add_mo_item_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s sync_agent_mo_item; + char *api_name = API_NAME_SYNC_AGENT_ADD_MO_ITEM; + + sync_agent_mo_item.mo_type = 1; + sync_agent_mo_item.full_path = "./dmacc/test1"; + sync_agent_mo_item.value = "aa"; + sync_agent_mo_item.type = SYNC_AGENT_DM_MO_NODE_LEAF; + + err = sync_agent_add_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_add_mo_item_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s *sync_agent_mo_item = NULL; + char *api_name = API_NAME_SYNC_AGENT_ADD_MO_ITEM; + + err = sync_agent_add_mo_item(sync_agent_mo_item); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_update_mo_item_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s sync_agent_mo_item; + char *api_name = API_NAME_SYNC_AGENT_UPDATE_MO_ITEM; + + sync_agent_mo_item.mo_type = 1; + sync_agent_mo_item.full_path = "./dmacc/test2"; + sync_agent_mo_item.value = "aa"; + sync_agent_mo_item.type = SYNC_AGENT_DM_MO_NODE_LEAF; + + err = sync_agent_add_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + sync_agent_mo_item.value = "aaaa"; + + err = sync_agent_update_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_update_mo_item_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s *sync_agent_mo_item = NULL; + char *api_name = API_NAME_SYNC_AGENT_UPDATE_MO_ITEM; + + err = sync_agent_update_mo_item(sync_agent_mo_item); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_delete_mo_item_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s sync_agent_mo_item; + char *api_name = API_NAME_SYNC_AGENT_DELETE_MO_ITEM; + + sync_agent_mo_item.mo_type = 1; + sync_agent_mo_item.full_path = "./dmacc/test3"; + sync_agent_mo_item.value = "aa"; + sync_agent_mo_item.type = SYNC_AGENT_DM_MO_NODE_LEAF; + + err = sync_agent_add_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + err = sync_agent_delete_mo_item("./dmacc/test3"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_mo_item_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_DELETE_MO_ITEM; + + err = sync_agent_delete_mo_item(NULL); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_delete_mo_tree_item_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s sync_agent_mo_item; + char *api_name = API_NAME_SYNC_AGENT_DELETE_MO_TREE_ITEM; + + sync_agent_mo_item.mo_type = 1; + sync_agent_mo_item.full_path = "./dmacc/test4"; + sync_agent_mo_item.value = "aa"; + sync_agent_mo_item.type = SYNC_AGENT_DM_MO_NODE_LEAF; + + err = sync_agent_add_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + err = sync_agent_delete_mo_tree_item("./dmacc/test4"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_delete_mo_tree_item_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_DELETE_MO_ITEM; + + err = sync_agent_delete_mo_tree_item(NULL); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_mo_item_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s sync_agent_mo_item; + sync_agent_dm_mo_node_s *sync_agent_mo_items = NULL; + char *api_name = API_NAME_SYNC_AGENT_GET_MO_ITEM; + + sync_agent_mo_item.mo_type = 1; + sync_agent_mo_item.full_path = "./dmacc/test5"; + sync_agent_mo_item.value = "aa"; + sync_agent_mo_item.type = SYNC_AGENT_DM_MO_NODE_LEAF; + + err = sync_agent_add_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + err = sync_agent_get_mo_item("./dmacc/test5", &sync_agent_mo_items); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_mo_item_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s *sync_agent_mo_items = NULL; + char *api_name = API_NAME_SYNC_AGENT_GET_MO_ITEM; + + err = sync_agent_get_mo_item(NULL, &sync_agent_mo_items); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_mo_items_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s sync_agent_mo_item; + sync_agent_dm_mo_node_s *sync_agent_mo_items = NULL; + char *api_name = API_NAME_SYNC_AGENT_GET_MO_ITEMS; + + sync_agent_mo_item.mo_type = 1; + sync_agent_mo_item.full_path = "./dmacc/test6"; + sync_agent_mo_item.value = "aa"; + sync_agent_mo_item.type = SYNC_AGENT_DM_MO_NODE_LEAF; + + err = sync_agent_add_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + err = sync_agent_get_mo_items("./dmacc/test6", &sync_agent_mo_items); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_mo_items_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s *sync_agent_mo_items = NULL; + char *api_name = API_NAME_SYNC_AGENT_GET_MO_ITEMS; + + err = sync_agent_get_mo_items(NULL, &sync_agent_mo_items); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_query_mo_item_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s sync_agent_mo_item; + char *api_name = API_NAME_SYNC_AGENT_QUERY_MO_ITEM; + sync_agent_dm_mo_item_s sync_agent_mo_query; + GList *list = NULL; + + sync_agent_mo_item.mo_type = 1; + sync_agent_mo_item.full_path = "./dmacc/test7"; + sync_agent_mo_item.value = "aa"; + sync_agent_mo_item.type = SYNC_AGENT_DM_MO_NODE_LEAF; + + err = sync_agent_add_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + sync_agent_mo_query.mo_path = "./dmacc/test7"; + sync_agent_mo_query.interface_type = MO_ONLY_DATA_VALUE; + sync_agent_mo_query.mo_type = 1; + sync_agent_mo_query.option = SYNC_AGENT_DM_MO_GET_OPTION_NODE; + + err = sync_agent_query_mo_item(&sync_agent_mo_query, &list); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_qyery_mo_item_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s *sync_agent_mo_items = NULL; + char *api_name = API_NAME_SYNC_AGENT_QUERY_MO_ITEM; + sync_agent_dm_mo_item_s *sync_agent_mo_query = NULL; + GList *list = NULL; + + err = sync_agent_query_mo_item(sync_agent_mo_query, &list); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_free_mo_item_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s *sync_agent_mo_item = NULL; + char *api_name = API_NAME_SYNC_AGENT_FREE_MO_ITEM; + + err = sync_agent_create_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + sync_agent_free_mo_item(sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_free_mo_item_list_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_node_s *sync_agent_mo_item = NULL; + char *api_name = API_NAME_SYNC_AGENT_FREE_MO_ITEM; + GList *list = NULL; + + err = sync_agent_create_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + list = g_list_append(list, sync_agent_mo_item); + + sync_agent_free_mo_item_list(list); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_create_mo_acc_item_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_CREATE_MO_ACC_ITEM; + sync_agent_dm_acc_info_s *acc_info = NULL; + + err = sync_agent_create_mo_acc_item(&acc_info); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } + + sync_agent_free_mo_acc_item(&acc_info); + +} + +static void utc_sync_agent_framework_sync_agent_update_mo_acc_item_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_UPDATE_MO_ACC_ITEM; + sync_agent_dm_acc_info_s acc_info; + sync_agent_dm_mo_acc_item_info_s sync_agent_mo_acc_info_item; + + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + const char *vendar_file = "/usr/share/oma-dm-cfg/ddf/slp/slp_gcf_dmacc_ddf_1.2.xml"; + int mo_plugin_id = 4; + int server_type = 16; + + err = sync_agent_construct_mo_table(mo_type, vendar_file, mo_plugin_id, server_type); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + sync_agent_mo_acc_info_item.serverid = "RSate"; + sync_agent_mo_acc_info_item.acc_type = DEVICE_MANAGE_ACC_TYPE_SERVER; + + acc_info.auth_type = "xxx"; + acc_info.auth_secret = "xxx"; + acc_info.auth_name = "xxxx"; + acc_info.auth_level = "xxx"; + acc_info.auth_data = "xxx"; + acc_info.addr = "xxxxx"; + + err = sync_agent_update_mo_acc_item(&sync_agent_mo_acc_info_item, &acc_info); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_fail(api_name); + } else { + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_update_mo_acc_item_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_UPDATE_MO_ACC_ITEM; + sync_agent_dm_acc_info_s acc_info; + sync_agent_dm_mo_acc_item_info_s *sync_agent_mo_acc_info_item = NULL; + + err = sync_agent_update_mo_acc_item(sync_agent_mo_acc_info_item, &acc_info); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_mo_acc_item_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_MO_ACC_ITEM; + + sync_agent_dm_acc_info_s *acc_info = NULL; + sync_agent_dm_mo_acc_item_info_s sync_agent_mo_acc_info_item; + + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + const char *vendar_file = "/usr/share/oma-dm-cfg/ddf/slp/slp_gcf_dmacc_ddf_1.2.xml"; + int mo_plugin_id = 4; + int server_type = 16; + + err = sync_agent_construct_mo_table(mo_type, vendar_file, mo_plugin_id, server_type); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + sync_agent_mo_acc_info_item.serverid = "RSate"; + sync_agent_mo_acc_info_item.acc_type = DEVICE_MANAGE_ACC_TYPE_SERVER; + + err = sync_agent_get_mo_acc_item(&sync_agent_mo_acc_info_item, &acc_info); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_fail(api_name); + } else { + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_mo_acc_item_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_MO_ACC_ITEM; + sync_agent_dm_acc_info_s *acc_info = NULL; + sync_agent_dm_mo_acc_item_info_s *sync_agent_mo_acc_info_item = NULL; + + err = sync_agent_get_mo_acc_item(sync_agent_mo_acc_info_item, &acc_info); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } + + err = sync_agent_close_mo(); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_free_mo_acc_item_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_FREE_MO_ACC_ITEM; + sync_agent_dm_acc_info_s *acc_info = NULL; + + err = sync_agent_create_mo_acc_item(&acc_info); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + err = sync_agent_free_mo_acc_item(&acc_info); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } + + err = sync_agent_close_mo(); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_initialize_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_INITIALIZE; + int mo_plugin_id = 8; + + err = sync_agent_initialize_mo(mo_plugin_id); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_initialize_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_INITIALIZE; + int mo_plugin_id = 100; + + err = sync_agent_initialize_mo(mo_plugin_id); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_begin_transaction_mo_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_CLOSE; + + err = sync_agent_begin_transaction_mo(); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + err = sync_agent_end_transaction_mo(SYNC_AGENT_DM_MO_TRANSACTION_COMMIT); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_end_transaction_mo_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_CLOSE; + + err = sync_agent_begin_transaction_mo(); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } + + //db control + + err = sync_agent_end_transaction_mo(SYNC_AGENT_DM_MO_TRANSACTION_COMMIT); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_construct_mo_table_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_CONSTRUCT_MO_TABLE; + + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + const char *vendar_file = "/usr/share/oma-dm-cfg/ddf/slp/slp_gcf_dmacc_ddf_1.2.xml"; + int mo_plugin_id = 4; + int server_type = 16; + + err = sync_agent_construct_mo_table(mo_type, vendar_file, mo_plugin_id, server_type); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_fail(api_name); + } else { + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_construct_mo_table_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_CONSTRUCT_MO_TABLE; + + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + const char *vendar_file = NULL; + int mo_plugin_id = 4; + int server_type = 16; + + err = sync_agent_construct_mo_table(mo_type, vendar_file, mo_plugin_id, server_type); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_uptodate_mo_table_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_UPTODATE_MO_TABLE; + + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + const char *vendar_file = "/usr/share/oma-dm-cfg/ddf/slp/slp_gcf_dmacc_ddf_1.2.xml"; + int mo_plugin_id = 4; + int server_type = 16; + + err = sync_agent_construct_mo_table(mo_type, vendar_file, mo_plugin_id, server_type); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + err = sync_agent_uptodate_mo_table(mo_type, mo_plugin_id, "./DMAcc/gcf"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + dts_fail(api_name); + } else { + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_uptodate_mo_table_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_UPTODATE_MO_TABLE; + + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + int mo_plugin_id = 4; + + err = sync_agent_uptodate_mo_table(mo_type, mo_plugin_id, NULL); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_delete_all_mo_table_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_DELETE_ALL_MO_TABLE; + + err = sync_agent_delete_all_mo_table(); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_serverinfo_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_SERVERINFO; + sync_agent_dm_server_info_s *server_info = NULL; + + err = sync_agent_get_serverinfo(&server_info); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + err = sync_agent_free_serverinfo(server_info); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_free_serverinfo_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_FREE_SERVERINFO; + sync_agent_dm_server_info_s *server_info = NULL; + + err = sync_agent_get_serverinfo(&server_info); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + err = sync_agent_free_serverinfo(server_info); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_serverid_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_SERVERID; + char *server_id = NULL; + + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + const char *vendar_file = "/usr/share/oma-dm-cfg/ddf/slp/slp_gcf_dmacc_ddf_1.2.xml"; + int mo_plugin_id = 4; + int server_type = 16; + + err = sync_agent_construct_mo_table(mo_type, vendar_file, mo_plugin_id, server_type); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + err = sync_agent_get_serverid(mo_type, &server_id); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_fail(api_name); + } else { + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_serverid_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_SERVERID; + sync_agent_dm_mo_type_e mo_type = 16; + char *server_id = NULL; + + err = sync_agent_get_serverid(mo_type, &server_id); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_root_path_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_ROOT_PATH; + char *mo_full_path = NULL; + char *root_path = NULL; + + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + const char *vendar_file = "/usr/share/oma-dm-cfg/ddf/slp/slp_gcf_dmacc_ddf_1.2.xml"; + int mo_plugin_id = 4; + int server_type = 16; + + err = sync_agent_construct_mo_table(mo_type, vendar_file, mo_plugin_id, server_type); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + mo_full_path = "./DMAcc/gcf/Name"; + + err = sync_agent_get_root_path(mo_full_path, &root_path); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_fail(api_name); + } else { + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_root_path_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_ROOT_PATH; + char *mo_full_path = NULL; + char *root_path = NULL; + + err = sync_agent_get_root_path(mo_full_path, &root_path); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_server_type_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_SERVER_TYPE; + char *server_id = NULL; + + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + const char *vendar_file = "/usr/share/oma-dm-cfg/ddf/slp/slp_gcf_dmacc_ddf_1.2.xml"; + int mo_plugin_id = 4; + int server_type = 16; + + err = sync_agent_construct_mo_table(mo_type, vendar_file, mo_plugin_id, server_type); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + server_id = "RSate"; + + err = sync_agent_get_server_type(server_id, &server_type); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_fail(api_name); + } else { + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_server_type_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_SERVER_TYPE; + char *server_id = NULL; + int server_type = 0; + + err = sync_agent_get_server_type(server_id, &server_type); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_is_exist_mo_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_SERVER_TYPE; + char *mo_path = NULL; + int is_exist = 0; + + sync_agent_dm_mo_node_s sync_agent_mo_item; + + sync_agent_mo_item.mo_type = 1; + sync_agent_mo_item.full_path = "./dmacc/test8"; + sync_agent_mo_item.value = "aa"; + sync_agent_mo_item.type = SYNC_AGENT_DM_MO_NODE_LEAF; + + err = sync_agent_add_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + mo_path = "./dmacc/test8"; + + err = sync_agent_is_exist_mo(mo_path, &is_exist); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_is_exist_mo_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_SERVER_TYPE; + char *mo_path = NULL; + int is_exist = 0; + + err = sync_agent_is_exist_mo(mo_path, &is_exist); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_mo_type_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_MO_TYPE; + char *mo_full_path = NULL; + sync_agent_dm_mo_type_e mo_type = 0; + sync_agent_dm_mo_node_s sync_agent_mo_item; + + sync_agent_mo_item.mo_type = 1; + sync_agent_mo_item.full_path = "./dmacc/test9"; + sync_agent_mo_item.value = "aa"; + sync_agent_mo_item.type = SYNC_AGENT_DM_MO_NODE_LEAF; + + err = sync_agent_add_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + mo_full_path = "./dmacc/test9"; + + err = sync_agent_get_mo_type(mo_full_path, &mo_type); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_mo_type_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_GET_MO_TYPE; + char *mo_full_path = NULL; + sync_agent_dm_mo_type_e mo_type = 0; + + err = sync_agent_get_mo_type(mo_full_path, &mo_type); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_check_acl_value_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_CHECK_ACL_VALUE; + + sync_agent_dm_mo_node_s sync_agent_mo_item; + sync_agent_dm_mo_runtime_property_s *runtime_property = NULL; + sync_agent_dm_mo_access_type_e access_type = SYNC_AGENT_DM_MO_ACCESSTYPE_GET; + char *mo_full_path = NULL; + char *server_id = NULL; + int check_acl = 0; + + runtime_property = (sync_agent_dm_mo_runtime_property_s *) calloc(1, sizeof(sync_agent_dm_mo_runtime_property_s) + 1); + if (runtime_property == NULL) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + runtime_property->acl = "Get=RSate&Replace=RSate"; + + sync_agent_mo_item.mo_type = 1; + sync_agent_mo_item.full_path = "./dmacc/test10"; + sync_agent_mo_item.value = "aa"; + sync_agent_mo_item.type = SYNC_AGENT_DM_MO_NODE_LEAF; + sync_agent_mo_item.runtime_property = runtime_property; + + err = sync_agent_add_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + free(runtime_property); + dts_fail(api_name); + } + + mo_full_path = "./dmacc/test10"; + server_id = "RSate"; + + err = sync_agent_check_acl_value(mo_full_path, access_type, server_id, &check_acl); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + free(runtime_property); + dts_fail(api_name); + } else { + + free(runtime_property); + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_check_acl_value_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_CHECK_ACL_VALUE; + + sync_agent_dm_mo_access_type_e access_type = SYNC_AGENT_DM_MO_ACCESSTYPE_GET; + char *mo_full_path = NULL; + char *server_id = NULL; + int check_acl = 0; + + server_id = "RSate"; + + err = sync_agent_check_acl_value(mo_full_path, access_type, server_id, &check_acl); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_descendant_mo_tree_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_DESCENDANT_MO_TREE; + + char *mo_full_path = NULL; + sync_agent_dm_mo_node_s *root_node = NULL; + int count = 0; + + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + const char *vendar_file = "/usr/share/oma-dm-cfg/ddf/slp/slp_gcf_dmacc_ddf_1.2.xml"; + int mo_plugin_id = 4; + int server_type = 16; + + err = sync_agent_construct_mo_table(mo_type, vendar_file, mo_plugin_id, server_type); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + mo_full_path = "./DMAcc/gcf/Name"; + + err = sync_agent_get_descendant_mo_tree(mo_type, mo_full_path, &root_node, &count, SYNC_AGENT_DM_MO_GET_OPTION_NODE); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + } else { + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_descendant_mo_tree_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_DESCENDANT_MO_TREE; + + char *mo_full_path = NULL; + sync_agent_dm_mo_node_s *root_node = NULL; + int count = 0; + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + + err = sync_agent_get_descendant_mo_tree(mo_type, mo_full_path, &root_node, &count, SYNC_AGENT_DM_MO_GET_OPTION_NODE); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void *print_Node(sync_agent_dm_mo_node_s * mo_node, int depth, void **data) +{ + _EXTERN_FUNC_ENTER; + + _EXTERN_FUNC_EXIT; + return 0; +} + +static void utc_sync_agent_framework_sync_agent_traverse_mo_tree_preorder_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_TRAVERSE_MO_TREE_PREORDER; + + char *mo_full_path = NULL; + sync_agent_dm_mo_node_s sync_agent_mo_item; + sync_agent_dm_mo_node_s *root_node = NULL; + int v_err = 0; + int count = 0; + int depth = 1; + void *arg = NULL; + + sync_agent_mo_item.mo_type = 0; + sync_agent_mo_item.full_path = "./dmacc/test11"; + sync_agent_mo_item.value = "aa"; + sync_agent_mo_item.type = SYNC_AGENT_DM_MO_NODE_LEAF; + + err = sync_agent_add_mo_item(&sync_agent_mo_item); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + mo_full_path = "./dmacc"; + + err = sync_agent_get_descendant_mo_tree(0, mo_full_path, &root_node, &count, SYNC_AGENT_DM_MO_GET_OPTION_NODE); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + v_err = sync_agent_traverse_mo_tree_preorder(root_node, print_Node, depth, 0, &arg); + if (v_err != 0) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_traverse_mo_tree_preorder_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_TRAVERSE_MO_TREE_PREORDER; + char *mo_full_path = NULL; + sync_agent_dm_mo_type_e mo_type = 0; + sync_agent_dm_mo_node_s sync_agent_mo_item; + sync_agent_dm_mo_node_s *root_node = NULL; + int v_err = NULL; + int count = 0; + int depth = 0; + void *arg = NULL; + + v_err = sync_agent_traverse_mo_tree_preorder(root_node, NULL, depth, 0, &arg); + if (v_err == 0) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_export_tnds_stream_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_EXPORT_TNDS_STREAM; + + char *mo_path = NULL; + char *output_stream = NULL; + unsigned int byte_size = 0; + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + const char *vendar_file = "/usr/share/oma-dm-cfg/ddf/slp/slp_gcf_dmacc_ddf_1.2.xml"; + int mo_plugin_id = 4; + int server_type = 16; + + err = sync_agent_construct_mo_table(mo_type, vendar_file, mo_plugin_id, server_type); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + mo_path = "./DMAcc"; + + err = sync_agent_export_tnds_stream(SYNC_AGENT_DM_MO_TNDS_TYPE_WBXML, mo_type, mo_path, &output_stream, &byte_size); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_fail(api_name); + } else { + + err = sync_agent_delete_mo_tree_item("./DMAcc"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_export_tnds_stream_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_EXPORT_TNDS_STREAM; + + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + char *mo_path = NULL; + char *output_stream = NULL; + unsigned int byte_size = 0; + + err = sync_agent_export_tnds_stream(SYNC_AGENT_DM_MO_TNDS_TYPE_WBXML, mo_type, mo_path, &output_stream, &byte_size); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_import_tnds_stream_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_EXPORT_TNDS_STREAM; + + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + char *mo_path = NULL; + char *input_stream = NULL; + unsigned int byte_size = 0; + + sync_agent_fsapi_return_e f_err = SYNC_AGENT_FSAPI_TRUE; + + f_err = sync_agent_is_existing_fs(TNDS_SAMPLE_FILE); + if (f_err != SYNC_AGENT_FSAPI_TRUE) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + f_err = sync_agent_read_whole_file(TNDS_SAMPLE_FILE, &input_stream, &byte_size); + if (f_err != SYNC_AGENT_FSAPI_TRUE) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + mo_path = "./test"; + + err = sync_agent_import_tnds_stream(SYNC_AGENT_DM_MO_TNDS_ACTION_ADD, SYNC_AGENT_DM_MO_TNDS_TYPE_XML, mo_type, mo_path, input_stream, byte_size); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + err = sync_agent_delete_mo_tree_item("./test"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_fail(api_name); + } else { + + err = sync_agent_delete_mo_tree_item("./test"); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } + + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_import_tnds_stream_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_EXPORT_TNDS_STREAM; + sync_agent_dm_mo_type_e mo_type = SYNC_AGENT_DM_MO_TYPE_DMACC; + char *mo_path = NULL; + char *input_stream = NULL; + unsigned int byte_size = 0; + + mo_path = NULL; + + err = sync_agent_import_tnds_stream(SYNC_AGENT_DM_MO_TNDS_ACTION_ADD, SYNC_AGENT_DM_MO_TNDS_TYPE_XML, mo_type, mo_path, input_stream, byte_size); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_open_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_OPEN; + + err = sync_agent_open_mo(); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_close_p(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_CLOSE; + + err = sync_agent_close_mo(); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static void utc_sync_agent_framework_sync_agent_execute_mo_ext_n(void) +{ + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + char *api_name = API_NAME_SYNC_AGENT_EXECUTE_MO_EXT; + const char *mo_path = NULL; + int err_num = 0; + int check_operation = 1; + + err = sync_agent_execute_mo_ext(mo_path, &err_num, check_operation); + if (err == SYNC_AGENT_DM_MO_SUCCESS) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_start_mdm_service_p(void) +{ + + sync_agent_dm_mdm_return_e err = SYNC_AGENT_DM_MDM_SUCCEEDED; + char *api_name = API_NAME_SYNC_AGENT_START_MDM_SERVICE; + + err = sync_agent_start_mdm_service(1, "syncagent-service"); + if (err != SYNC_AGENT_DM_MDM_SUCCEEDED) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_start_mdm_service_n(void) +{ + sync_agent_dm_mdm_return_e err = SYNC_AGENT_DM_MDM_SUCCEEDED; + char *api_name = API_NAME_SYNC_AGENT_START_MDM_SERVICE; + + err = sync_agent_start_mdm_service(1, NULL); + if (err == SYNC_AGENT_DM_MDM_SUCCEEDED) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_stop_mdm_service_p(void) +{ + + sync_agent_dm_mdm_return_e err = SYNC_AGENT_DM_MDM_SUCCEEDED; + char *api_name = API_NAME_SYNC_AGENT_STOP_MDM_SERVICE; + + err = sync_agent_stop_mdm_service(1, "syncagent-service"); + if (err != SYNC_AGENT_DM_MDM_SUCCEEDED) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_stop_mdm_service_n(void) +{ + sync_agent_dm_mdm_return_e err = SYNC_AGENT_DM_MDM_SUCCEEDED; + char *api_name = API_NAME_SYNC_AGENT_STOP_MDM_SERVICE; + + err = sync_agent_stop_mdm_service(1, NULL); + if (err == SYNC_AGENT_DM_MDM_SUCCEEDED) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_set_mdm_value_p(void) +{ + sync_agent_dm_mdm_return_e err = SYNC_AGENT_DM_MDM_SUCCEEDED; + char *api_name = API_NAME_SYNC_AGENT_GET_MDM_SERVICE; + + err = sync_agent_set_mdm_value(1, SYNC_AGENT_DM_MDM_ALLOW_WIFI, SYNC_AGENT_DM_MDM_ALLOWED); + if (err != SYNC_AGENT_DM_MDM_SUCCEEDED) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_set_mdm_value_n(void) +{ + sync_agent_dm_mdm_return_e err = SYNC_AGENT_DM_MDM_SUCCEEDED; + char *api_name = API_NAME_SYNC_AGENT_GET_MDM_SERVICE; + + err = sync_agent_set_mdm_value(1, 102, 3); + if (err == SYNC_AGENT_DM_MDM_SUCCEEDED) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_mdm_value_p(void) +{ + sync_agent_dm_mdm_return_e err = SYNC_AGENT_DM_MDM_SUCCEEDED; + char *api_name = API_NAME_SYNC_AGENT_SET_MDM_SERVICE; + + sync_agent_dm_mdm_password_policy_s old_policy = { 0 }; + + err = sync_agent_get_mdm_value(1, SYNC_AGENT_DM_MDM_PWD_POLICY, &old_policy); + if (err != SYNC_AGENT_DM_MDM_SUCCEEDED) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_get_mdm_value_n(void) +{ + sync_agent_dm_mdm_return_e err = SYNC_AGENT_DM_MDM_SUCCEEDED; + char *api_name = API_NAME_SYNC_AGENT_SET_MDM_SERVICE; + + sync_agent_dm_mdm_password_policy_s old_policy = { 0 }; + + err = sync_agent_get_mdm_value(1, 102, &old_policy); + if (err == SYNC_AGENT_DM_MDM_SUCCEEDED) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_execute_mdm_p(void) +{ + sync_agent_dm_mdm_return_e err = SYNC_AGENT_DM_MDM_SUCCEEDED; + char *api_name = API_NAME_SYNC_AGENT_EXECUTE_MDM_SERVICE; + + err = sync_agent_execute_mdm(1, SYNC_AGENT_DM_MDM_EXE_ENFORCE_PWD_CHANGE); + if (err != SYNC_AGENT_DM_MDM_SUCCEEDED) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} + +static void utc_sync_agent_framework_sync_agent_execute_mdm_n(void) +{ + sync_agent_dm_mdm_return_e err = SYNC_AGENT_DM_MDM_SUCCEEDED; + char *api_name = API_NAME_SYNC_AGENT_EXECUTE_MDM_SERVICE; + + err = sync_agent_execute_mdm(1, 102); + if (err == SYNC_AGENT_DM_MDM_SUCCEEDED) { + dts_message(api_name, "sync_agent_framework : %d", err); + + dts_fail(api_name); + } else { + dts_pass(api_name); + } + +} diff --git a/TC/testcase/utc_sync_agent_framework_engine_controller.c b/TC/testcase/utc_sync_agent_framework_engine_controller.c new file mode 100755 index 0000000..76665a4 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_engine_controller.c @@ -0,0 +1,271 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_FILE "../../../testcase/fw-test-cfg/test_fw_config.xml" + +#define API_NAME_SYNC_START_UP "startup" + +#define API_NAME_SYNC_AGENT_ALLOC_PARAM_SPEC_INT "sync_agent_alloc_param_spec_int" +#define API_NAME_SYNC_AGENT_ALLOC_PARAM_SPEC_STRUCTURE "sync_agent_alloc_param_spec_structure" + +#define API_NAME_SYNC_AGENT_CREATE_QUEUING_RULE_SPEC_OUTLINE "sync_agent_create_queuing_rule_spec_outline" +#define API_NAME_SYNC_AGENT_ADD_PROGRESS_BLOCKING_ELEMENT "sync_agent_add_progress_blocking_element" + +#define API_NAME_SYNC_AGENT_ALLOC_SIMPLE_TASK_SPEC "sync_agent_alloc_simple_task_spec" + +static void utc_sync_agent_framework_sync_agent_alloc_param_spec_int_p(void); +static void utc_sync_agent_framework_sync_agent_alloc_param_spec_int_n(void); +static void utc_sync_agent_framework_sync_agent_alloc_param_spec_structure_p(void); +static void utc_sync_agent_framework_sync_agent_alloc_param_spec_structure_n(void); +static void utc_sync_agent_framework_sync_agent_create_queuing_rule_spec_outline_p(void); +static void utc_sync_agent_framework_sync_agent_create_queuing_rule_spec_outline_n(void); +static void utc_sync_agent_framework_sync_agent_add_progress_blocking_element_p(void); +static void utc_sync_agent_framework_sync_agent_add_progress_blocking_element_n(void); +static void utc_sync_agent_framework_sync_agent_alloc_simple_task_spec_p(void); +static void utc_sync_agent_framework_sync_agent_alloc_simple_task_spec_n(void); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_alloc_param_spec_int_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_alloc_param_spec_int_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_alloc_param_spec_structure_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_alloc_param_spec_structure_n, NEGATIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_create_queuing_rule_spec_outline_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_queuing_rule_spec_outline_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_progress_blocking_element_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_progress_blocking_element_n, NEGATIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_alloc_simple_task_spec_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_alloc_simple_task_spec_n, NEGATIVE_TC_IDX}, + + {NULL, 0} +}; + +#define EC_MSG_TYPE_SIMPLE_TASK 1 +#define EC_MSG_TYPE_NAME_SIMPLE_TASK "simple_task" + +sync_agent_ec_task_error_e simple_task(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array) +{ + + return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS; +} + +static void startup(void) +{ + /* start of TC */ + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(API_NAME_SYNC_START_UP, "sync_agent_init : %d", init_error); + dts_fail(API_NAME_SYNC_START_UP); + } else { + dts_pass(API_NAME_SYNC_START_UP); + } +} + +static void cleanup(void) +{ + /* start of TC */ +} + +static void utc_sync_agent_framework_sync_agent_alloc_param_spec_int_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ALLOC_PARAM_SPEC_INT; + sync_agent_ec_param_spec_s *param_spec = NULL; + + param_spec = sync_agent_alloc_param_spec_int("param_int", true, false, false, 0, 0, false, 0, false, 0, 0); + if (param_spec != NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_alloc_param_spec_int"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_alloc_param_spec_int_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ALLOC_PARAM_SPEC_INT; + sync_agent_ec_param_spec_s *param_spec = NULL; + + param_spec = sync_agent_alloc_param_spec_int(NULL, true, false, false, 0, 0, false, 0, false, 0, 0); + if (param_spec == NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_alloc_param_spec_int"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_alloc_param_spec_structure_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ALLOC_PARAM_SPEC_STRUCTURE; + sync_agent_ec_param_spec_s *param_spec = NULL; + + param_spec = sync_agent_alloc_param_spec_structure("param_struct", NULL, NULL, true, false, false, NULL, false, NULL, false, NULL); + if (param_spec != NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_alloc_param_spec_structure"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_alloc_param_spec_structure_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ALLOC_PARAM_SPEC_STRUCTURE; + sync_agent_ec_param_spec_s *param_spec = NULL; + + param_spec = sync_agent_alloc_param_spec_structure(NULL, NULL, NULL, true, false, false, NULL, false, NULL, false, NULL); + if (param_spec == NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_alloc_param_spec_structure"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_queuing_rule_spec_outline_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_QUEUING_RULE_SPEC_OUTLINE; + sync_agent_ec_queuing_rule_spec_s *queuing_rule = NULL; + + queuing_rule = sync_agent_create_queuing_rule_spec_outline("queuing_rule_name"); + if (queuing_rule != NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_create_queuing_rule_spec_outline"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_queuing_rule_spec_outline_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_QUEUING_RULE_SPEC_OUTLINE; + sync_agent_ec_queuing_rule_spec_s *queuing_rule = NULL; + + queuing_rule = sync_agent_create_queuing_rule_spec_outline(NULL); + if (queuing_rule == NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_create_queuing_rule_spec_outline"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_progress_blocking_element_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_PROGRESS_BLOCKING_ELEMENT; + sync_agent_ec_error_e ec_err = SYNC_AGENT_EC_OK; + sync_agent_ec_queuing_rule_spec_s *queuing_rule = NULL; + sync_agent_ec_task_spec_s *task_spec = NULL; + + sync_agent_ec_param_spec_s *param_spec = sync_agent_alloc_param_spec_int("param", true, false, false, 0, 0, false, 0, false, 0, 0); + if (param_spec == NULL) { + dts_message(api_name, "sync_agent_alloc_param_spec_int"); + dts_fail(api_name); + } + + sync_agent_ec_param_spec_s *param_spec_array[1] = { param_spec }; + + task_spec = sync_agent_alloc_simple_task_spec("simple_task", simple_task, NULL, NULL, 1, param_spec_array); + if (task_spec == NULL) { + dts_message(api_name, "sync_agent_alloc_simple_task_spec"); + dts_fail(api_name); + } + + sync_agent_unref_param_spec(param_spec); + + queuing_rule = sync_agent_create_queuing_rule_spec_outline("queuing_rule_name"); + if (queuing_rule == NULL) { + dts_message(api_name, "sync_agent_create_queuing_rule_spec_outline"); + dts_fail(api_name); + } + + ec_err = sync_agent_add_progress_blocking_element(queuing_rule, EC_MSG_TYPE_SIMPLE_TASK, task_spec, 0); + if (ec_err == SYNC_AGENT_EC_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_add_progress_blocking_element"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_progress_blocking_element_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_PROGRESS_BLOCKING_ELEMENT; + sync_agent_ec_error_e ec_err = SYNC_AGENT_EC_OK; + sync_agent_ec_queuing_rule_spec_s *queuing_rule = NULL; + sync_agent_ec_task_spec_s *task_spec = NULL; + + ec_err = sync_agent_add_progress_blocking_element(queuing_rule, EC_MSG_TYPE_SIMPLE_TASK, task_spec, 0); + if (ec_err != SYNC_AGENT_EC_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_add_progress_blocking_element"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_alloc_simple_task_spec_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ALLOC_SIMPLE_TASK_SPEC; + sync_agent_ec_task_spec_s *task_spec = NULL; + + sync_agent_ec_param_spec_s *param_spec = sync_agent_alloc_param_spec_int("param", true, false, false, 0, 0, false, 0, false, 0, 0); + if (param_spec == NULL) { + dts_message(api_name, "sync_agent_alloc_param_spec_int"); + dts_fail(api_name); + } + + sync_agent_ec_param_spec_s *param_spec_array[1] = { param_spec }; + + task_spec = sync_agent_alloc_simple_task_spec("simple_task", simple_task, NULL, NULL, 1, param_spec_array); + if (task_spec != NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_alloc_simple_task_spec"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_alloc_simple_task_spec_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ALLOC_SIMPLE_TASK_SPEC; + sync_agent_ec_task_spec_s *task_spec = NULL; + + task_spec = sync_agent_alloc_simple_task_spec(NULL, NULL, NULL, NULL, 1, NULL); + if (task_spec == NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_alloc_simple_task_spec"); + dts_fail(api_name); + } +} diff --git a/TC/testcase/utc_sync_agent_framework_event.c b/TC/testcase/utc_sync_agent_framework_event.c new file mode 100755 index 0000000..6c65411 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_event.c @@ -0,0 +1,566 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_FILE "../../../testcase/fw-test-cfg/test_fw_config.xml" + +#define EVENT_NUM 1 +#define NOTI_NUM 1 +#define NOTI_KEY "fw_test_noti" + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_CLEAN_UP "cleanup" +#define API_NAME_EVENT_CB "_event_cb" +#define API_NAME_CANCEL_CB "_cancel_cb" +#define API_NAME_NOTI_CB "_noti_cb" + +#define API_NAME_SYNC_AGENT_APPEND_EVENT_DATA_PARAM "sync_agent_append_event_data_param" +#define API_NAME_SYNC_AGENT_GET_EVENT_DATA_PARAM "sync_agent_get_event_data_param" +#define API_NAME_SYNC_AGENT_RUN_EVENT_HANDLER "sync_agent_run_event_handler" +#define API_NAME_SYNC_AGENT_SET_EVENT_CALLBACK "sync_agent_set_event_callback" +#define API_NAME_SYNC_AGENT_CREATE_NOTI "sync_agent_create_noti" +#define API_NAME_SYNC_AGENT_SEND_NOTI "sync_agent_send_noti" +#define API_NAME_SYNC_AGENT_CREATE_EVENT "sync_agent_create_event" +#define API_NAME_SYNC_AGENT_SEND_EVENT "sync_agent_send_event" +#define API_NAME_SYNC_AGENT_RUN_NOTI_LISTENER "sync_agent_run_noti_listener" +#define API_NAME_SYNC_AGENT_STOP_NOTI_LISTENER "sync_agent_stop_noti_listener" +#define API_NAME_SYNC_AGENT_SET_NOTI_CALLBACK "sync_agent_set_noti_callback" +#define API_NAME_SYNC_AGENT_CLEAN_EVENT_HANDLER "sync_agent_clean_event_handler" + +static void utc_sync_agent_framework_sync_agent_append_event_data_param_p(void); +static void utc_sync_agent_framework_sync_agent_get_event_data_param_p(void); +static void utc_sync_agent_framework_sync_agent_run_event_handler_p(void); +static void utc_sync_agent_framework_sync_agent_set_event_callback_p(void); +static void utc_sync_agent_framework_sync_agent_set_event_callback_n(void); +static void utc_sync_agent_framework_sync_agent_create_noti_p(void); +static void utc_sync_agent_framework_sync_agent_send_noti_p(void); +static void utc_sync_agent_framework_sync_agent_send_noti_n(void); +static void utc_sync_agent_framework_sync_agent_create_event_p(void); +static void utc_sync_agent_framework_sync_agent_send_event_p(void); +static void utc_sync_agent_framework_sync_agent_send_event_n(void); +static void utc_sync_agent_framework_sync_agent_run_noti_listener_p(void); +static void utc_sync_agent_framework_sync_agent_run_noti_listener_n(void); +static void utc_sync_agent_framework_sync_agent_stop_noti_listener_p(void); +static void utc_sync_agent_framework_sync_agent_set_noti_callback_p(void); +static void utc_sync_agent_framework_sync_agent_clean_event_handler_p(void); + +static int _event_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static sync_agent_event_ipc_cancel_e _cancel_cb(void *user_data); +static int _noti_cb(sync_agent_event_data_s * noti, void *user_data); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_append_event_data_param_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_event_data_param_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_run_event_handler_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_set_event_callback_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_set_event_callback_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_noti_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_send_noti_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_send_noti_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_event_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_send_event_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_send_event_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_run_noti_listener_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_run_noti_listener_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_stop_noti_listener_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_set_noti_callback_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_clean_event_handler_p, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + /* start of TC */ + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(API_NAME_SYNC_START_UP, "sync_agent_init : %d", init_error); + dts_fail(API_NAME_SYNC_START_UP); + } + + sync_agent_event_error_e event_err = sync_agent_set_event_callback(EVENT_NUM, _event_cb); + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(API_NAME_SYNC_START_UP, "sync_agent_set_event_callback : %d", event_err); + dts_fail(API_NAME_SYNC_START_UP); + } + + event_err = sync_agent_set_noti_callback(NOTI_NUM, _noti_cb, NULL); + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(API_NAME_SYNC_START_UP, "sync_agent_set_noti_callback : %d", event_err); + dts_fail(API_NAME_SYNC_START_UP); + } + + /* todo : register event callback x */ + + /* create noti listener x */ +} + +static void cleanup(void) +{ + /* clean of TC */ + sync_agent_event_error_e event_err = sync_agent_clean_event_handler(); +} + +static void utc_sync_agent_framework_sync_agent_append_event_data_param_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_APPEND_EVENT_DATA_PARAM; + sync_agent_event_data_s *request_event = NULL; + int event_int_data = 1; + + request_event = sync_agent_create_event(EVENT_NUM); + if (request_event != NULL) { + sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_int_data); + sync_agent_free_event_data(request_event); + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_create_event"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_event_data_param_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_EVENT_DATA_PARAM; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_event_data_s *request_event = NULL; + sync_agent_event_data_s *response_event = NULL; + int event_int_data = 1; + char *event_char_data = strdup("event data"); + int result_int = 0; + + request_event = sync_agent_create_event(EVENT_NUM); + if (request_event == NULL) { + dts_message(api_name, "sync_agent_create_event"); + dts_fail(api_name); + } + + sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_int_data); + sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, event_char_data); + + response_event = sync_agent_send_event(request_event, &event_err); + + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_send_event : %d", event_err); + sync_agent_free_event_data(response_event); + sync_agent_free_event_data(request_event); + dts_fail(api_name); + } + + if (response_event != NULL) { + sync_agent_get_event_data_param(response_event, &result_int); + dts_message(api_name, "sync_agent_get_event_data_param (event result) : %d", result_int); + sync_agent_free_event_data(request_event); + sync_agent_free_event_data(response_event); + dts_pass(api_name); + } else { + sync_agent_free_event_data(request_event); + dts_message(api_name, "sync_agent_send_event : %d", event_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_run_event_handler_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_RUN_EVENT_HANDLER; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + unsigned long int thread_id = 0; + + event_err = sync_agent_run_event_handler(&thread_id); + if (event_err == SYNC_AGENT_EVENT_SUCCESS) { + pthread_cancel(thread_id); + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_run_event_handler : %d", event_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_set_event_callback_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SET_EVENT_CALLBACK; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + + event_err = sync_agent_set_event_callback(EVENT_NUM, _event_cb); + if (event_err == SYNC_AGENT_EVENT_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_set_event_callback : %d", event_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_set_event_callback_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SET_EVENT_CALLBACK; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + + int event_num = 3; /* not defined event */ + + event_err = sync_agent_set_event_callback(event_num, _event_cb); + if (event_err == SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_set_event_callback : %d", event_err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_noti_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_NOTI; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_event_data_s *noti = NULL; + + noti = sync_agent_create_noti(NOTI_NUM); + if (noti != NULL) { + sync_agent_free_noti(noti); + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_create_noti : %d", event_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_send_noti_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SEND_NOTI; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_event_data_s *noti = NULL; + sync_agent_event_data_s *response = NULL; + int noti_int_data = 0; + char *noti_char_data = strdup("noti data"); + void *user_data = NULL; + + event_err = sync_agent_run_noti_listener(NOTI_KEY); + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_run_noti_listener : %d", event_err); + dts_fail(api_name); + } + + sync_agent_run_main_loop(1); + + noti = sync_agent_create_noti(NOTI_NUM); + if (noti == NULL) { + dts_message(api_name, "sync_agent_create_noti : %d", event_err); + dts_fail(api_name); + } + + sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, ¬i_int_data); + sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, noti_char_data); + + sync_agent_send_noti(NOTI_KEY, noti, _cancel_cb, user_data, &event_err); + + if (event_err == SYNC_AGENT_EVENT_SUCCESS) { + sync_agent_free_noti(noti); + dts_pass(api_name); + } else { + sync_agent_free_noti(noti); + dts_message(api_name, "sync_agent_send_noti : %d", event_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_send_noti_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SEND_NOTI; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_event_data_s *noti = NULL; + sync_agent_event_data_s *response = NULL; + int noti_int_data = 0; + char *noti_char_data = strdup("noti data"); + void *user_data = NULL; + + event_err = sync_agent_run_noti_listener(NULL); + if (event_err == SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_run_noti_listener : %d", event_err); + dts_fail(api_name); + } + + sync_agent_run_main_loop(1); + + noti = sync_agent_create_noti(NOTI_NUM); + if (noti == NULL) { + dts_message(api_name, "sync_agent_create_noti : %d", event_err); + dts_fail(api_name); + } + + sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, ¬i_int_data); + sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, noti_char_data); + + sync_agent_send_noti(NULL, noti, _cancel_cb, user_data, &event_err); + + if (event_err == SYNC_AGENT_EVENT_SUCCESS) { + sync_agent_free_noti(noti); + dts_message(api_name, "sync_agent_send_noti : %d", event_err); + dts_fail(api_name); + } else { + sync_agent_free_noti(noti); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_event_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_EVENT; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_event_data_s *event = NULL; + + event = sync_agent_create_event(EVENT_NUM); + if (event != NULL) { + sync_agent_free_noti(event); + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_create_noti : %d", event_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_send_event_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SEND_EVENT; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_event_data_s *request = NULL; + sync_agent_event_data_s *response = NULL; + int event_int_data = 0; + char *event_char_data = strdup("event data"); + int event_result = 0; + + request = sync_agent_create_event(EVENT_NUM); + if (request == NULL) { + dts_message(api_name, "sync_agent_create_event : %d", event_err); + dts_fail(api_name); + } + + sync_agent_append_event_data_param(request, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_int_data); + sync_agent_append_event_data_param(request, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, event_char_data); + + response = sync_agent_send_event(request, &event_err); + + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_send_event : %d", event_err); + sync_agent_free_event(request); + sync_agent_free_event(response); + dts_fail(api_name); + } + + if (response != NULL) { + sync_agent_get_event_data_param(response, &event_result); + dts_message(api_name, "sync_agent_get_event_data_param (event result) : %d", event_result); + sync_agent_free_event(request); + sync_agent_free_event(response); + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_send_event : %d", event_err); + sync_agent_free_event(request); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_send_event_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SEND_EVENT; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_event_data_s *request = NULL; + sync_agent_event_data_s *response = NULL; + int event_int_data = 0; + char *event_char_data = strdup("event data"); + int event_result = 0; + + request = sync_agent_create_event(EVENT_NUM); + if (request == NULL) { + dts_message(api_name, "sync_agent_create_event : %d", event_err); + dts_fail(api_name); + } + + sync_agent_append_event_data_param(request, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_int_data); + sync_agent_append_event_data_param(request, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, event_char_data); + + response = sync_agent_send_event(NULL, &event_err); + + if (event_err == SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_send_event : %d", event_err); + sync_agent_free_event(request); + sync_agent_free_event(response); + dts_fail(api_name); + } + + if (response != NULL) { + dts_message(api_name, "sync_agent_send_event : %d", event_err); + sync_agent_free_event(request); + dts_fail(api_name); + } else { + sync_agent_get_event_data_param(response, &event_result); + dts_message(api_name, "sync_agent_get_event_data_param (event result) : %d", event_result); + sync_agent_free_event(request); + sync_agent_free_event(response); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_run_noti_listener_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_RUN_NOTI_LISTENER; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + + event_err = sync_agent_run_noti_listener(NOTI_KEY); + if (event_err == SYNC_AGENT_EVENT_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_run_noti_listener : %d", event_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_run_noti_listener_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_RUN_NOTI_LISTENER; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + + event_err = sync_agent_run_noti_listener(NULL); + if (event_err == SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_run_noti_listener : %d", event_err); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_stop_noti_listener_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_STOP_NOTI_LISTENER; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + + event_err = sync_agent_stop_noti_listener(); + if (event_err == SYNC_AGENT_EVENT_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_stop_noti_listener : %d", event_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_set_noti_callback_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SET_NOTI_CALLBACK; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + + event_err = sync_agent_set_noti_callback(NOTI_NUM, _noti_cb, NULL); + if (event_err == SYNC_AGENT_EVENT_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_set_noti_callback : %d", event_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_clean_event_handler_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CLEAN_EVENT_HANDLER; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + + event_err = sync_agent_clean_event_handler(); + if (event_err == SYNC_AGENT_EVENT_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_clean_event_handler : %d", event_err); + dts_fail(api_name); + } +} + +static int _event_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("start event callback \n"); + + char *api_name = API_NAME_EVENT_CB; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + int event_int_data = 0; + char *event_char_data = NULL; + int event_result = 1; + + sync_agent_get_event_data_param(request, &event_int_data); + sync_agent_get_event_data_param(request, &event_char_data); + + g_print("%s : received event data\n", __func__); + dts_message(api_name, "sync_agent_get_event_data_param (int) : %d", event_int_data); + dts_message(api_name, "sync_agent_get_event_data_param (char) : %s", event_char_data); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s : event response\n", __func__); + dts_message(api_name, "sync_agent_append_event_data_param (int) : %d", event_result); + + return 1; +} + +static sync_agent_event_ipc_cancel_e _cancel_cb(void *user_data) +{ + g_print("start cancel callback \n"); + + char *api_name = API_NAME_CANCEL_CB; + + sync_agent_ec_boolean cancel_flag = sync_agent_check_cancel_flag(); + sync_agent_event_ipc_cancel_e result_cancel; + + if (cancel_flag == 0) + result_cancel = SYNC_AGENT_EVENT_IPC_CANCEL_UN_NEED_CANCEL; + else + result_cancel = SYNC_AGENT_EVENT_IPC_CANCEL_NEED_CANCEL; + + dts_message(api_name, "cancel result : %d", result_cancel); + + return result_cancel; +} + +static int _noti_cb(sync_agent_event_data_s * noti, void *user_data) +{ + g_print("start noti callback \n"); + + char *api_name = API_NAME_NOTI_CB; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + int noti_int_data = 0; + char *noti_char_data = NULL; + + sync_agent_get_event_data_param(noti, ¬i_int_data); + sync_agent_get_event_data_param(noti, ¬i_char_data); + + g_print("%s : received event data\n", __func__); + dts_message(api_name, "sync_agent_get_event_data_param (int) : %d", noti_int_data); + dts_message(api_name, "sync_agent_get_event_data_param (char) : %s", noti_char_data); + + event_err = sync_agent_stop_noti_listener(); + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_run_noti_listener : %d", event_err); +// dts_fail(api_name); + } + + sync_agent_stop_main_loop(1); + + return 1; +} diff --git a/TC/testcase/utc_sync_agent_framework_event_omadm_account_reg.c b/TC/testcase/utc_sync_agent_framework_event_omadm_account_reg.c new file mode 100755 index 0000000..bffbe0c --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_event_omadm_account_reg.c @@ -0,0 +1,152 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> +#include "../../src/framework/event/oma_dm_api_common_internal.h" + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_OMADM_FILE "../../../testcase/fw-test-cfg/test_fw_config_omadm.xml" + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_CLEAN_UP "cleanup" + +#define API_NAME_SYNC_AGENT_DM_REG_INIT "sync_agent_dm_reg_init" +#define API_NAME_SYNC_AGENT_DM_REG_ACCOUNT_REGISTRATION "sync_agent_dm_reg_account_registration" +#define API_NAME_SYNC_AGENT_DM_REG_DEINIT "sync_agent_dm_reg_deinit" + +#define API_NAME_START_TEST_DM_AGENT "_start_test_dm_agent" + +static void utc_sync_agent_framework_sync_agent_dm_reg_init_p(void); +static void utc_sync_agent_framework_sync_agent_dm_reg_account_registration_p(void); +static void utc_sync_agent_framework_sync_agent_dm_reg_deinit_p(void); + +static void *_start_test_dm_agent(void *arg); +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_dm_reg_init_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_reg_account_registration_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_reg_deinit_p, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static pthread_t test_dm_agent_thread_id; + +static void startup(void) +{ + /* start of TC */ + pthread_create(&test_dm_agent_thread_id, 0, _start_test_dm_agent, 0); + + sleep(3); +} + +static void cleanup(void) +{ + /* clean of TC */ + pthread_cancel(test_dm_agent_thread_id); + + sync_agent_stop_main_loop(1); +} + +static void utc_sync_agent_framework_sync_agent_dm_reg_init_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_REG_INIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_reg_init(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_reg_init : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_reg_account_registration_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_REG_ACCOUNT_REGISTRATION; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_reg_account_registration(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_reg_account_registration : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_reg_deinit_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_REG_DEINIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_reg_deinit(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_reg_deinit : %d", dm_err); + dts_fail(api_name); + } +} + +static void *_start_test_dm_agent(void *arg) +{ + char *api_name = API_NAME_START_TEST_DM_AGENT; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_OMADM_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(api_name, "sync_agent_init : %d", init_error); + dts_fail(api_name); + } + + event_err = sync_agent_set_event_callback(EVENT_ACCOUNT_REGISTRATION, ___account_registration_cb); + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_set_event_callback : %d", event_err); + dts_fail(api_name); + } + + sync_agent_run_main_loop(1); +} + +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int response_type = 0; + +// sync_agent_get_event_data_param(request, &response_type); +// +// sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} diff --git a/TC/testcase/utc_sync_agent_framework_event_omadm_admin.c b/TC/testcase/utc_sync_agent_framework_event_omadm_admin.c new file mode 100755 index 0000000..66eb6bb --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_event_omadm_admin.c @@ -0,0 +1,713 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> +#include "../../src/framework/event/oma_dm_api_common_internal.h" + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_OMADM_FILE "../../../testcase/fw-test-cfg/test_fw_config_omadm.xml" + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_CLEAN_UP "cleanup" +#define API_NAME_SYNC_AGENT_DM_ADMIN_INIT "sync_agent_dm_admin_init" +#define API_NAME_SYNC_AGENT_DM_ADMIN_GET_FUMO_CONFIG "sync_agent_dm_admin_get_fumo_config" +#define API_NAME_SYNC_AGENT_DM_ADMIN_SET_FUMO_CONFIG "sync_agent_dm_admin_set_fumo_config" +#define API_NAME_SYNC_AGENT_DM_ADMIN_GET_PROFILE "sync_agent_dm_admin_get_profile" +#define API_NAME_SYNC_AGENT_DM_ADMIN_SET_PROFILE "sync_agent_dm_admin_set_profile" +#define API_NAME_SYNC_AGENT_DM_ADMIN_RESET_PROFILE "sync_agent_dm_admin_reset_profile" +#define API_NAME_SYNC_AGENT_DM_ADMIN_USER_INITIATE "sync_agent_dm_admin_user_initiate" +#define API_NAME_SYNC_AGENT_DM_ADMIN_DEINIT "sync_agent_dm_admin_deinit" + +#define API_NAME_START_TEST_DM_AGENT "_start_test_dm_agent" + +static void utc_sync_agent_framework_sync_agent_dm_admin_init_p(void); +static void utc_sync_agent_framework_sync_agent_dm_admin_get_fumo_config_p(void); +static void utc_sync_agent_framework_sync_agent_dm_admin_set_fumo_config_p(void); +static void utc_sync_agent_framework_sync_agent_dm_admin_get_profile_p(void); +static void utc_sync_agent_framework_sync_agent_dm_admin_set_profile_p(void); +static void utc_sync_agent_framework_sync_agent_dm_admin_reset_profile_p(void); +static void utc_sync_agent_framework_sync_agent_dm_admin_user_initiate_p(void); +static void utc_sync_agent_framework_sync_agent_dm_admin_deinit_p(void); + +static void *_start_test_dm_agent(void *arg); +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___software_update_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___cancel_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___download_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___install_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_interval_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___reset_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___uic_alert_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___check_pin_code_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___add_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___remove_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_dm_admin_init_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_admin_get_fumo_config_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_admin_set_fumo_config_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_admin_get_profile_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_admin_set_profile_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_admin_reset_profile_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_admin_user_initiate_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_admin_deinit_p, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static pthread_t test_dm_agent_thread_id; + +static void startup(void) +{ + /* start of TC */ + pthread_create(&test_dm_agent_thread_id, 0, _start_test_dm_agent, 0); + + sleep(3); + +} + +static void cleanup(void) +{ + /* clean of TC */ + pthread_cancel(test_dm_agent_thread_id); + + sync_agent_stop_main_loop(1); +} + +static void utc_sync_agent_framework_sync_agent_dm_admin_init_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ADMIN_INIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_admin_init(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_admin_init : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_admin_get_fumo_config_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ADMIN_GET_FUMO_CONFIG; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int wifi_only = 0; + + dm_err = sync_agent_dm_admin_get_fumo_config(&wifi_only); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_admin_get_fumo_config : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_admin_set_fumo_config_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ADMIN_SET_FUMO_CONFIG; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int wifi_only = 1; + + dm_err = sync_agent_dm_admin_set_fumo_config(wifi_only); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_admin_set_fumo_config : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_admin_get_profile_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ADMIN_GET_PROFILE; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int profile_type = 1; + sync_agent_dm_setting_data_s *setting_data = (sync_agent_dm_setting_data_s *) calloc(1, sizeof(sync_agent_dm_setting_data_s)); + if (setting_data == NULL) { + _DEBUG_ERROR("calloc failed !!"); + return false; + } + + dm_err = sync_agent_dm_admin_get_profile(profile_type, &setting_data); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_admin_get_profile : %d", dm_err); + dts_fail(api_name); + } + + if (setting_data != NULL) { + if (setting_data->profile_name != NULL) + g_free(setting_data->profile_name); + if (setting_data->imei != NULL) + g_free(setting_data->imei); + if (setting_data->server_url != NULL) + g_free(setting_data->server_url); + if (setting_data->server_pwd != NULL) + g_free(setting_data->server_pwd); + if (setting_data->client_id != NULL) + g_free(setting_data->client_id); + if (setting_data->client_pwd != NULL) + g_free(setting_data->client_pwd); + if (setting_data->client_auth_type != NULL) + g_free(setting_data->client_auth_type); + if (setting_data->server_auth_type != NULL) + g_free(setting_data->server_auth_type); + + g_free(setting_data); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_admin_set_profile_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ADMIN_SET_PROFILE; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int profile_type = 1; + sync_agent_dm_setting_data_s setting_data; + + setting_data.server_url = strdup("server url"); + setting_data.server_id = strdup("server id"); + setting_data.server_pwd = strdup("server pwd"); + setting_data.client_id = strdup("client id"); + setting_data.client_pwd = strdup("client pwd"); + setting_data.client_auth_type = strdup("client auth type"); + setting_data.server_auth_type = strdup("server auth type"); + + dm_err = sync_agent_dm_admin_set_profile(profile_type, &setting_data); + + free(setting_data.server_url); + free(setting_data.server_id); + free(setting_data.server_pwd); + free(setting_data.client_id); + free(setting_data.client_pwd); + free(setting_data.client_auth_type); + free(setting_data.server_auth_type); + + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_admin_set_profile : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_admin_reset_profile_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ADMIN_RESET_PROFILE; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int profile_type = 1; + + dm_err = sync_agent_dm_admin_reset_profile(profile_type); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_admin_reset_profile : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_admin_user_initiate_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ADMIN_USER_INITIATE; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int server_type = 16; + + dm_err = sync_agent_dm_admin_user_initiate(server_type); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_admin_reset_profile : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_admin_deinit_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ADMIN_DEINIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_admin_deinit(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_admin_deinit : %d", dm_err); + dts_fail(api_name); + } +} + +static void *_start_test_dm_agent(void *arg) +{ + char *api_name = API_NAME_START_TEST_DM_AGENT; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_OMADM_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(api_name, "sync_agent_init : %d", init_error); + dts_fail(api_name); + } + + int event_id = 0; + for (event_id = 1; event_id < EVENT_NUM; event_id++) { + event_err = sync_agent_set_event_callback(event_id, __get_event_callback(event_id)); + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_set_event_callback : %d", event_err); + dts_fail(api_name); + } + } + + sync_agent_run_main_loop(1); +} + +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response) { + g_print("%s Start \n", __func__); + + switch (event_id) { + case EVENT_SOFTWARE_UPDATE: + return ___software_update_cb; + break; + case EVENT_CANCEL: + return ___cancel_cb; + break; + case EVENT_DOWNLOAD: + return ___download_cb; + break; + case EVENT_INSTALL: + return ___install_cb; + break; + case EVENT_SET_INTERVAL: + return ___set_interval_cb; + break; + case EVENT_ACCOUNT_REGISTRATION: + return ___account_registration_cb; + break; + case EVENT_GET_FUMO_CONFIG: + return ___get_fumo_config_cb; + break; + case EVENT_SET_FUMO_CONFIG: + return ___set_fumo_config_cb; + break; + case EVENT_GET_PROFILE: + return ___get_profile_cb; + break; + case EVENT_SET_PROFILE: + return ___set_profile_cb; + break; + case EVENT_RESET_PROFILE: + return ___reset_profile_cb; + break; + case EVENT_UIC_ALERT: + return ___uic_alert_cb; + break; + case EVENT_CHECK_PIN_CODE: + return ___check_pin_code_cb; + break; + case EVENT_ADD_DMACC: + return ___add_dmacc_cb; + break; + case EVENT_REMOVE_DMACC: + return ___remove_dmacc_cb; + break; + default: + return ___default_cb; + break; + } + + g_print("%s End \n", __func__); +} + +static int ___software_update_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int ui_type = 0; + char *session_id = NULL; + char *server_id = NULL; + int task_id = 0; + int server_type = 0; + + sync_agent_get_event_data_param(request, &ui_type); + + switch (ui_type) { + case FOTA_COMMON_UI: + g_print("fota common ui \n"); + sync_agent_get_event_data_param(request, &task_id); + sync_agent_get_event_data_param(request, &server_type); + break; + case FOTA_NOTI_UI: + g_print("fota noti ui \n"); + sync_agent_get_event_data_param(request, &session_id); + sync_agent_get_event_data_param(request, &server_id); + break; + case FOTA_BACKGROUND_UI: + g_print("fota background ui \n"); + break; + case ADMIN_UI: + g_print("admin ui \n"); + sync_agent_get_event_data_param(request, &server_type); + break; + case CP_UI: + g_print("cp ui \n"); + break; + default: + break; + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + free(session_id); + free(server_id); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___cancel_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int task_id = 0; + + sync_agent_get_event_data_param(request, &task_id); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___download_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int response_type = 0; + + sync_agent_get_event_data_param(request, &response_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___install_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int response_type = 0; + + sync_agent_get_event_data_param(request, &response_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_interval_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int request_param = 0; + + sync_agent_get_event_data_param(request, &request_param); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int wifi_only = 1; + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &wifi_only); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int wifi_only_param = 0; + + sync_agent_get_event_data_param(request, &wifi_only_param); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + char *profile_name = strdup("profile name"); + char *client_targetUrl = strdup("client target url"); + char *server_url = strdup("server url"); + char *server_pwd = strdup("server pwd"); + char *client_id = strdup("client id"); + char *client_pwd = strdup("client pwd"); + char *client_authType = strdup("client auth type"); + char *server_authType = strdup("server auth type"); + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, profile_name); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_targetUrl); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_url); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_pwd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_id); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_pwd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_authType); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_authType); + + free(profile_name); + free(client_targetUrl); + free(server_url); + free(server_pwd); + free(client_id); + free(client_pwd); + free(client_authType); + free(server_authType); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + char *server_url = NULL; + char *server_id = NULL; + char *server_pw = NULL; + char *user_id = NULL; + char *user_pw = NULL; + char *user_auth_type = NULL; + char *server_auth_type = NULL; + + sync_agent_get_event_data_param(request, &sv_type); + sync_agent_get_event_data_param(request, &server_url); + sync_agent_get_event_data_param(request, &server_id); + sync_agent_get_event_data_param(request, &server_pw); + sync_agent_get_event_data_param(request, &user_id); + sync_agent_get_event_data_param(request, &user_pw); + sync_agent_get_event_data_param(request, &user_auth_type); + sync_agent_get_event_data_param(request, &server_auth_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___reset_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___uic_alert_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + uic_type type = UIC_NONE_TYPE; + int response_ret = 0; + char *input_text = NULL; + int count = 0; + int i = 0; + + sync_agent_get_event_data_param(request, &response_ret); + sync_agent_get_event_data_param(request, &type); + + if (response_ret == 1) { + switch (type) { + case UIC_CONFIRMATION_TYPE: + break; + case UIC_INPUT_TEXT_TYPE: + sync_agent_get_event_data_param(request, &input_text); + break; + case UIC_SINGLE_CHOICE_TYPE: + case UIC_MULTIPLE_CHOICE_TYPE: + { + sync_agent_get_event_data_param(request, &count); + + if (count != 0) { + for (i = 0; i < count; ++i) { + char *input = NULL; + sync_agent_get_event_data_param(request, &input); + } + } + } + break; + case UIC_DISPLAY_TYPE: + default: + break; + } + } else { + g_printf("response failed \n"); + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___check_pin_code_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int ext_id = 0; + char *user_pin = NULL; + int response_type = 0; + int response_value = 1; + + sync_agent_get_event_data_param(request, &ext_id); + sync_agent_get_event_data_param(request, &response_type); + + if (response_type == 1) + sync_agent_get_event_data_param(request, &user_pin); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &response_value); + + if (user_pin != NULL) + free(user_pin); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___add_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___remove_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + g_print("%s End \n", __func__); + + return 1; +} diff --git a/TC/testcase/utc_sync_agent_framework_event_omadm_alert.c b/TC/testcase/utc_sync_agent_framework_event_omadm_alert.c new file mode 100755 index 0000000..75c41c5 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_event_omadm_alert.c @@ -0,0 +1,651 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> +#include "../../src/framework/event/oma_dm_api_common_internal.h" + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_OMADM_FILE "../../../testcase/fw-test-cfg/test_fw_config_omadm.xml" + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_CLEAN_UP "cleanup" + +#define API_NAME_SYNC_AGENT_DM_ALERT_INIT "sync_agent_dm_alert_init" +#define API_NAME_SYNC_AGENT_DM_ALERT_CONFIRMATION "sync_agent_dm_alert_confirmation" +#define API_NAME_SYNC_AGENT_DM_ALERT_INPUTTEXT "sync_agent_dm_alert_inputtext" +#define API_NAME_SYNC_AGENT_DM_ALERT_SINGLE_CHOICE "sync_agent_dm_alert_single_choice" +#define API_NAME_SYNC_AGENT_DM_ALERT_MULTIPLE_CHOICE "sync_agent_dm_alert_multiple_choice" +#define API_NAME_SYNC_AGENT_DM_ALERT_DEINIT "sync_agent_dm_alert_deinit" + +#define API_NAME_START_TEST_DM_AGENT "_start_test_dm_agent" + +static void utc_sync_agent_framework_sync_agent_dm_alert_init_p(void); +static void utc_sync_agent_framework_sync_agent_dm_alert_confirmation_p(void); +static void utc_sync_agent_framework_sync_agent_dm_alert_inputtext_p(void); +static void utc_sync_agent_framework_sync_agent_dm_alert_single_choice_p(void); +static void utc_sync_agent_framework_sync_agent_dm_alert_multiple_choice_p(void); +static void utc_sync_agent_framework_sync_agent_dm_alert_deinit_p(void); + +static void *_start_test_dm_agent(void *arg); +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___software_update_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___cancel_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___download_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___install_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_interval_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___reset_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___uic_alert_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___check_pin_code_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___add_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___remove_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_dm_alert_init_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_alert_confirmation_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_alert_inputtext_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_alert_single_choice_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_alert_multiple_choice_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_alert_deinit_p, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static pthread_t test_dm_agent_thread_id; + +static void startup(void) +{ + /* start of TC */ + pthread_create(&test_dm_agent_thread_id, 0, _start_test_dm_agent, 0); + + sleep(3); +} + +static void cleanup(void) +{ + /* clean of TC */ + pthread_cancel(test_dm_agent_thread_id); + + sync_agent_stop_main_loop(1); +} + +static void utc_sync_agent_framework_sync_agent_dm_alert_init_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ALERT_INIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_alert_init(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_alert_init : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_alert_confirmation_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ALERT_CONFIRMATION; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int response_type = 1; + + dm_err = sync_agent_dm_alert_confirmation(response_type); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_alert_confirmation : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_alert_inputtext_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ALERT_INPUTTEXT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int response_type = 1; + char *text = strdup("test alert input text"); + + dm_err = sync_agent_dm_alert_inputtext(response_type, text); + + free(text); + + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_alert_inputtext : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_alert_single_choice_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ALERT_SINGLE_CHOICE; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int response_type = 1; + int selected_count = 1; + char *selected_number = strdup("1"); + + dm_err = sync_agent_dm_alert_single_choice(response_type, selected_count, selected_number); + + free(selected_number); + + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_alert_single_choice : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_alert_multiple_choice_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ALERT_SINGLE_CHOICE; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int response_type = 1; + char *selected_number1 = strdup("1"); + char *selected_number2 = strdup("2"); + + GList *out_data_list = NULL; + out_data_list = g_list_append(out_data_list, selected_number1); + out_data_list = g_list_append(out_data_list, selected_number2); + + dm_err = sync_agent_dm_alert_multiple_choice(response_type, out_data_list); + + free(selected_number1); + free(selected_number2); + + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_alert_multiple_choice : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_alert_deinit_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ALERT_DEINIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_alert_deinit(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_alert_deinit : %d", dm_err); + dts_fail(api_name); + } +} + +static void *_start_test_dm_agent(void *arg) +{ + char *api_name = API_NAME_START_TEST_DM_AGENT; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_OMADM_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(api_name, "sync_agent_init : %d", init_error); + dts_fail(api_name); + } + + int event_id = 0; + for (event_id = 1; event_id < EVENT_NUM; event_id++) { + event_err = sync_agent_set_event_callback(event_id, __get_event_callback(event_id)); + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_set_event_callback : %d", event_err); + dts_fail(api_name); + } + } + + sync_agent_run_main_loop(1); +} + +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response) { + g_print("%s Start \n", __func__); + + switch (event_id) { + case EVENT_SOFTWARE_UPDATE: + return ___software_update_cb; + break; + case EVENT_CANCEL: + return ___cancel_cb; + break; + case EVENT_DOWNLOAD: + return ___download_cb; + break; + case EVENT_INSTALL: + return ___install_cb; + break; + case EVENT_SET_INTERVAL: + return ___set_interval_cb; + break; + case EVENT_ACCOUNT_REGISTRATION: + return ___account_registration_cb; + break; + case EVENT_GET_FUMO_CONFIG: + return ___get_fumo_config_cb; + break; + case EVENT_SET_FUMO_CONFIG: + return ___set_fumo_config_cb; + break; + case EVENT_GET_PROFILE: + return ___get_profile_cb; + break; + case EVENT_SET_PROFILE: + return ___set_profile_cb; + break; + case EVENT_RESET_PROFILE: + return ___reset_profile_cb; + break; + case EVENT_UIC_ALERT: + return ___uic_alert_cb; + break; + case EVENT_CHECK_PIN_CODE: + return ___check_pin_code_cb; + break; + case EVENT_ADD_DMACC: + return ___add_dmacc_cb; + break; + case EVENT_REMOVE_DMACC: + return ___remove_dmacc_cb; + break; + default: + return ___default_cb; + break; + } + + g_print("%s End \n", __func__); +} + +static int ___software_update_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int ui_type = 0; + char *session_id = NULL; + char *server_id = NULL; + int task_id = 0; + int server_type = 0; + + sync_agent_get_event_data_param(request, &ui_type); + + switch (ui_type) { + case FOTA_COMMON_UI: + g_print("fota common ui \n"); + sync_agent_get_event_data_param(request, &task_id); + sync_agent_get_event_data_param(request, &server_type); + break; + case FOTA_NOTI_UI: + g_print("fota noti ui \n"); + sync_agent_get_event_data_param(request, &session_id); + sync_agent_get_event_data_param(request, &server_id); + break; + case FOTA_BACKGROUND_UI: + g_print("fota background ui \n"); + break; + case ADMIN_UI: + g_print("admin ui \n"); + sync_agent_get_event_data_param(request, &task_id); + sync_agent_get_event_data_param(request, &server_type); + break; + case CP_UI: + g_print("cp ui \n"); + break; + default: + break; + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + free(session_id); + free(server_id); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___cancel_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int task_id = 0; + + sync_agent_get_event_data_param(request, &task_id); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___download_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int response_type = 0; + + sync_agent_get_event_data_param(request, &response_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___install_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int response_type = 0; + + sync_agent_get_event_data_param(request, &response_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_interval_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int request_param = 0; + + sync_agent_get_event_data_param(request, &request_param); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int wifi_only = 1; + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &wifi_only); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int wifi_only_param = 0; + + sync_agent_get_event_data_param(request, &wifi_only_param); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + char *profile_name = strdup("profile name"); + char *client_targetUrl = strdup("client target url"); + char *server_url = strdup("server url"); + char *server_pwd = strdup("server pwd"); + char *client_id = strdup("client id"); + char *client_pwd = strdup("client pwd"); + char *client_authType = strdup("client auth type"); + char *server_authType = strdup("server auth type"); + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, profile_name); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_targetUrl); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_url); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_pwd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_id); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_pwd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_authType); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_authType); + + free(profile_name); + free(client_targetUrl); + free(server_url); + free(server_pwd); + free(client_id); + free(client_pwd); + free(client_authType); + free(server_authType); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + char *server_url = NULL; + char *server_id = NULL; + char *server_pw = NULL; + char *user_id = NULL; + char *user_pw = NULL; + char *user_auth_type = NULL; + char *server_auth_type = NULL; + + sync_agent_get_event_data_param(request, &sv_type); + sync_agent_get_event_data_param(request, &server_url); + sync_agent_get_event_data_param(request, &server_id); + sync_agent_get_event_data_param(request, &server_pw); + sync_agent_get_event_data_param(request, &user_id); + sync_agent_get_event_data_param(request, &user_pw); + sync_agent_get_event_data_param(request, &user_auth_type); + sync_agent_get_event_data_param(request, &server_auth_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___reset_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___uic_alert_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + uic_type type = UIC_NONE_TYPE; + int response_ret = 0; + char *input_text = NULL; + int count = 0; + int i = 0; + + sync_agent_get_event_data_param(request, &response_ret); + sync_agent_get_event_data_param(request, &type); + + if (response_ret == 1) { + switch (type) { + case UIC_CONFIRMATION_TYPE: + break; + case UIC_INPUT_TEXT_TYPE: + sync_agent_get_event_data_param(request, &input_text); + break; + case UIC_SINGLE_CHOICE_TYPE: + case UIC_MULTIPLE_CHOICE_TYPE: + { + sync_agent_get_event_data_param(request, &count); + + if (count != 0) { + for (i = 0; i < count; ++i) { + char *input = NULL; + sync_agent_get_event_data_param(request, &input); + } + } + } + break; + case UIC_DISPLAY_TYPE: + default: + break; + } + } else { + g_printf("response failed \n"); + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___check_pin_code_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int ext_id = 0; + char *user_pin = NULL; + int response_type = 0; + int response_value = 1; + + sync_agent_get_event_data_param(request, &ext_id); + sync_agent_get_event_data_param(request, &response_type); + + if (response_type == 1) + sync_agent_get_event_data_param(request, &user_pin); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &response_value); + + if (user_pin != NULL) + free(user_pin); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___add_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___remove_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + g_print("%s End \n", __func__); + + return 1; +} diff --git a/TC/testcase/utc_sync_agent_framework_event_omadm_cp.c b/TC/testcase/utc_sync_agent_framework_event_omadm_cp.c new file mode 100755 index 0000000..cf7b1d0 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_event_omadm_cp.c @@ -0,0 +1,581 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> +#include "../../src/framework/event/oma_dm_api_common_internal.h" + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_OMADM_FILE "../../../testcase/fw-test-cfg/test_fw_config_omadm.xml" + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_CLEAN_UP "cleanup" + +#define API_NAME_SYNC_AGENT_DM_CP_INIT "sync_agent_dm_cp_init" +#define API_NAME_SYNC_AGENT_DM_CP_CHECK_PIN_CODE "sync_agent_dm_cp_check_pin_code" +#define API_NAME_SYNC_AGENT_DM_CP_DEINIT "sync_agent_dm_cp_deinit" + +#define API_NAME_START_TEST_DM_AGENT "_start_test_dm_agent" + +static void utc_sync_agent_framework_sync_agent_dm_cp_init_p(void); +static void utc_sync_agent_framework_sync_agent_dm_cp_check_pin_code_p(void); +static void utc_sync_agent_framework_sync_agent_dm_cp_deinit_p(void); + +static void *_start_test_dm_agent(void *arg); +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___software_update_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___cancel_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___download_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___install_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_interval_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___reset_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___uic_alert_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___check_pin_code_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___add_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___remove_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_dm_cp_init_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_cp_check_pin_code_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_cp_deinit_p, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static pthread_t test_dm_agent_thread_id; + +static void startup(void) +{ + /* start of TC */ + pthread_create(&test_dm_agent_thread_id, 0, _start_test_dm_agent, 0); + + sleep(3); +} + +static void cleanup(void) +{ + /* clean of TC */ + pthread_cancel(test_dm_agent_thread_id); + + sync_agent_stop_main_loop(1); +} + +static void utc_sync_agent_framework_sync_agent_dm_cp_init_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_CP_INIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_cp_init(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_cp_init : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_cp_check_pin_code_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_CP_CHECK_PIN_CODE; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int ext_id = 1; + int response_type = 1; + char *user_pin = strdup("1234"); + int pin_check_response = 0; + + dm_err = sync_agent_dm_cp_check_pin_code(ext_id, response_type, user_pin, &pin_check_response); + + free(user_pin); + + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_cp_check_pin_code : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_cp_deinit_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_CP_DEINIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_cp_deinit(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_cp_deinit : %d", dm_err); + dts_fail(api_name); + } +} + +static void *_start_test_dm_agent(void *arg) +{ + char *api_name = API_NAME_START_TEST_DM_AGENT; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_OMADM_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(api_name, "sync_agent_init : %d", init_error); + dts_fail(api_name); + } + + int event_id = 0; + for (event_id = 1; event_id < EVENT_NUM; event_id++) { + event_err = sync_agent_set_event_callback(event_id, __get_event_callback(event_id)); + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_set_event_callback : %d", event_err); + dts_fail(api_name); + } + } + + sync_agent_run_main_loop(1); +} + +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response) { + g_print("%s Start \n", __func__); + + switch (event_id) { + case EVENT_SOFTWARE_UPDATE: + return ___software_update_cb; + break; + case EVENT_CANCEL: + return ___cancel_cb; + break; + case EVENT_DOWNLOAD: + return ___download_cb; + break; + case EVENT_INSTALL: + return ___install_cb; + break; + case EVENT_SET_INTERVAL: + return ___set_interval_cb; + break; + case EVENT_ACCOUNT_REGISTRATION: + return ___account_registration_cb; + break; + case EVENT_GET_FUMO_CONFIG: + return ___get_fumo_config_cb; + break; + case EVENT_SET_FUMO_CONFIG: + return ___set_fumo_config_cb; + break; + case EVENT_GET_PROFILE: + return ___get_profile_cb; + break; + case EVENT_SET_PROFILE: + return ___set_profile_cb; + break; + case EVENT_RESET_PROFILE: + return ___reset_profile_cb; + break; + case EVENT_UIC_ALERT: + return ___uic_alert_cb; + break; + case EVENT_CHECK_PIN_CODE: + return ___check_pin_code_cb; + break; + case EVENT_ADD_DMACC: + return ___add_dmacc_cb; + break; + case EVENT_REMOVE_DMACC: + return ___remove_dmacc_cb; + break; + default: + return ___default_cb; + break; + } + + g_print("%s End \n", __func__); +} + +static int ___software_update_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int ui_type = 0; + char *session_id = NULL; + char *server_id = NULL; + int task_id = 0; + int server_type = 0; + + sync_agent_get_event_data_param(request, &ui_type); + + switch (ui_type) { + case FOTA_COMMON_UI: + g_print("fota common ui \n"); + sync_agent_get_event_data_param(request, &task_id); + sync_agent_get_event_data_param(request, &server_type); + break; + case FOTA_NOTI_UI: + g_print("fota noti ui \n"); + sync_agent_get_event_data_param(request, &session_id); + sync_agent_get_event_data_param(request, &server_id); + break; + case FOTA_BACKGROUND_UI: + g_print("fota background ui \n"); + break; + case ADMIN_UI: + g_print("admin ui \n"); + sync_agent_get_event_data_param(request, &task_id); + sync_agent_get_event_data_param(request, &server_type); + break; + case CP_UI: + g_print("cp ui \n"); + break; + default: + break; + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + free(session_id); + free(server_id); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___cancel_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int task_id = 0; + + sync_agent_get_event_data_param(request, &task_id); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___download_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int response_type = 0; + + sync_agent_get_event_data_param(request, &response_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___install_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int response_type = 0; + + sync_agent_get_event_data_param(request, &response_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_interval_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int request_param = 0; + + sync_agent_get_event_data_param(request, &request_param); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int wifi_only = 1; + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &wifi_only); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int wifi_only_param = 0; + + sync_agent_get_event_data_param(request, &wifi_only_param); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + char *profile_name = strdup("profile name"); + char *client_targetUrl = strdup("client target url"); + char *server_url = strdup("server url"); + char *server_pwd = strdup("server pwd"); + char *client_id = strdup("client id"); + char *client_pwd = strdup("client pwd"); + char *client_authType = strdup("client auth type"); + char *server_authType = strdup("server auth type"); + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, profile_name); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_targetUrl); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_url); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_pwd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_id); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_pwd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_authType); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_authType); + + free(profile_name); + free(client_targetUrl); + free(server_url); + free(server_pwd); + free(client_id); + free(client_pwd); + free(client_authType); + free(server_authType); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + char *server_url = NULL; + char *server_id = NULL; + char *server_pw = NULL; + char *user_id = NULL; + char *user_pw = NULL; + char *user_auth_type = NULL; + char *server_auth_type = NULL; + + sync_agent_get_event_data_param(request, &sv_type); + sync_agent_get_event_data_param(request, &server_url); + sync_agent_get_event_data_param(request, &server_id); + sync_agent_get_event_data_param(request, &server_pw); + sync_agent_get_event_data_param(request, &user_id); + sync_agent_get_event_data_param(request, &user_pw); + sync_agent_get_event_data_param(request, &user_auth_type); + sync_agent_get_event_data_param(request, &server_auth_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___reset_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___uic_alert_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + uic_type type = UIC_NONE_TYPE; + int response_ret = 0; + char *input_text = NULL; + int count = 0; + int i = 0; + + sync_agent_get_event_data_param(request, &response_ret); + sync_agent_get_event_data_param(request, &type); + + if (response_ret == 1) { + switch (type) { + case UIC_CONFIRMATION_TYPE: + break; + case UIC_INPUT_TEXT_TYPE: + sync_agent_get_event_data_param(request, &input_text); + break; + case UIC_SINGLE_CHOICE_TYPE: + case UIC_MULTIPLE_CHOICE_TYPE: + { + sync_agent_get_event_data_param(request, &count); + + if (count != 0) { + for (i = 0; i < count; ++i) { + char *input = NULL; + sync_agent_get_event_data_param(request, &input); + } + } + } + break; + case UIC_DISPLAY_TYPE: + default: + break; + } + } else { + g_printf("response failed \n"); + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___check_pin_code_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int ext_id = 0; + char *user_pin = NULL; + int response_type = 0; + int response_value = 1; + + sync_agent_get_event_data_param(request, &ext_id); + sync_agent_get_event_data_param(request, &response_type); + + if (response_type == 1) + sync_agent_get_event_data_param(request, &user_pin); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &response_value); + + if (user_pin != NULL) + free(user_pin); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___add_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___remove_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + g_print("%s End \n", __func__); + + return 1; +} diff --git a/TC/testcase/utc_sync_agent_framework_event_omadm_dmacc.c b/TC/testcase/utc_sync_agent_framework_event_omadm_dmacc.c new file mode 100755 index 0000000..5b971e1 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_event_omadm_dmacc.c @@ -0,0 +1,594 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> +#include "../../src/framework/event/oma_dm_api_common_internal.h" + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_OMADM_FILE "../../../testcase/fw-test-cfg/test_fw_config_omadm.xml" + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_CLEAN_UP "cleanup" + +#define API_NAME_SYNC_AGENT_DM_DMACC_INIT "sync_agent_dm_dmacc_init" +#define API_NAME_SYNC_AGENT_DM_ADD_DMACC "sync_agent_dm_add_dmacc" +#define API_NAME_SYNC_AGENT_DM_REMOVE_DMACC "sync_agent_dm_remove_dmacc" +#define API_NAME_SYNC_AGENT_DM_DMACC_DEINIT "sync_agent_dm_dmacc_deinit" + +#define API_NAME_START_TEST_DM_AGENT "_start_test_dm_agent" + +static void utc_sync_agent_framework_sync_agent_dm_dmacc_init_p(void); +static void utc_sync_agent_framework_sync_agent_dm_add_dmacc_p(void); +static void utc_sync_agent_framework_sync_agent_dm_remove_dmacc_p(void); +static void utc_sync_agent_framework_sync_agent_dm_dmacc_deinit_p(void); + +static void *_start_test_dm_agent(void *arg); +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___software_update_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___cancel_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___download_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___install_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_interval_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___reset_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___uic_alert_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___check_pin_code_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___add_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___remove_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_dm_dmacc_init_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_add_dmacc_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_remove_dmacc_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_dmacc_deinit_p, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static pthread_t test_dm_agent_thread_id; + +static void startup(void) +{ + /* start of TC */ + pthread_create(&test_dm_agent_thread_id, 0, _start_test_dm_agent, 0); + + sleep(3); +} + +static void cleanup(void) +{ + /* clean of TC */ + pthread_cancel(test_dm_agent_thread_id); + + sync_agent_stop_main_loop(1); +} + +static void utc_sync_agent_framework_sync_agent_dm_dmacc_init_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_DMACC_INIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_dmacc_init(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_dmacc_init : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_add_dmacc_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_ADD_DMACC; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + sync_agent_dm_service_server_type_e dmacc_type = UI_SAMSUNG_FUMO_TYPE; + + dm_err = sync_agent_dm_add_dmacc(dmacc_type); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_add_dmacc : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_remove_dmacc_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_REMOVE_DMACC; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + sync_agent_dm_service_server_type_e dmacc_type = UI_SAMSUNG_FUMO_TYPE; + + dm_err = sync_agent_dm_remove_dmacc(dmacc_type); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_remove_dmacc : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_dmacc_deinit_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_DMACC_DEINIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_dmacc_deinit(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_dmacc_deinit : %d", dm_err); + dts_fail(api_name); + } +} + +static void *_start_test_dm_agent(void *arg) +{ + char *api_name = API_NAME_START_TEST_DM_AGENT; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_OMADM_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(api_name, "sync_agent_init : %d", init_error); + dts_fail(api_name); + } + + int event_id = 0; + for (event_id = 1; event_id < EVENT_NUM; event_id++) { + event_err = sync_agent_set_event_callback(event_id, __get_event_callback(event_id)); + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_set_event_callback : %d", event_err); + dts_fail(api_name); + } + } + + sync_agent_run_main_loop(1); +} + +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response) { + g_print("%s Start \n", __func__); + + switch (event_id) { + case EVENT_SOFTWARE_UPDATE: + return ___software_update_cb; + break; + case EVENT_CANCEL: + return ___cancel_cb; + break; + case EVENT_DOWNLOAD: + return ___download_cb; + break; + case EVENT_INSTALL: + return ___install_cb; + break; + case EVENT_SET_INTERVAL: + return ___set_interval_cb; + break; + case EVENT_ACCOUNT_REGISTRATION: + return ___account_registration_cb; + break; + case EVENT_GET_FUMO_CONFIG: + return ___get_fumo_config_cb; + break; + case EVENT_SET_FUMO_CONFIG: + return ___set_fumo_config_cb; + break; + case EVENT_GET_PROFILE: + return ___get_profile_cb; + break; + case EVENT_SET_PROFILE: + return ___set_profile_cb; + break; + case EVENT_RESET_PROFILE: + return ___reset_profile_cb; + break; + case EVENT_UIC_ALERT: + return ___uic_alert_cb; + break; + case EVENT_CHECK_PIN_CODE: + return ___check_pin_code_cb; + break; + case EVENT_ADD_DMACC: + return ___add_dmacc_cb; + break; + case EVENT_REMOVE_DMACC: + return ___remove_dmacc_cb; + break; + default: + return ___default_cb; + break; + } + + g_print("%s End \n", __func__); +} + +static int ___software_update_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int ui_type = 0; + char *session_id = NULL; + char *server_id = NULL; + int task_id = 0; + int server_type = 0; + + sync_agent_get_event_data_param(request, &ui_type); + + switch (ui_type) { + case FOTA_COMMON_UI: + g_print("fota common ui \n"); + sync_agent_get_event_data_param(request, &task_id); + sync_agent_get_event_data_param(request, &server_type); + break; + case FOTA_NOTI_UI: + g_print("fota noti ui \n"); + sync_agent_get_event_data_param(request, &session_id); + sync_agent_get_event_data_param(request, &server_id); + break; + case FOTA_BACKGROUND_UI: + g_print("fota background ui \n"); + break; + case ADMIN_UI: + g_print("admin ui \n"); + sync_agent_get_event_data_param(request, &task_id); + sync_agent_get_event_data_param(request, &server_type); + break; + case CP_UI: + g_print("cp ui \n"); + break; + default: + break; + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + free(session_id); + free(server_id); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___cancel_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int task_id = 0; + + sync_agent_get_event_data_param(request, &task_id); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___download_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int response_type = 0; + + sync_agent_get_event_data_param(request, &response_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___install_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int response_type = 0; + + sync_agent_get_event_data_param(request, &response_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_interval_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int request_param = 0; + + sync_agent_get_event_data_param(request, &request_param); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int wifi_only = 1; + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &wifi_only); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int wifi_only_param = 0; + + sync_agent_get_event_data_param(request, &wifi_only_param); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + char *profile_name = strdup("profile name"); + char *client_targetUrl = strdup("client target url"); + char *server_url = strdup("server url"); + char *server_pwd = strdup("server pwd"); + char *client_id = strdup("client id"); + char *client_pwd = strdup("client pwd"); + char *client_authType = strdup("client auth type"); + char *server_authType = strdup("server auth type"); + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, profile_name); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_targetUrl); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_url); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_pwd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_id); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_pwd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_authType); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_authType); + + free(profile_name); + free(client_targetUrl); + free(server_url); + free(server_pwd); + free(client_id); + free(client_pwd); + free(client_authType); + free(server_authType); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + char *server_url = NULL; + char *server_id = NULL; + char *server_pw = NULL; + char *user_id = NULL; + char *user_pw = NULL; + char *user_auth_type = NULL; + char *server_auth_type = NULL; + + sync_agent_get_event_data_param(request, &sv_type); + sync_agent_get_event_data_param(request, &server_url); + sync_agent_get_event_data_param(request, &server_id); + sync_agent_get_event_data_param(request, &server_pw); + sync_agent_get_event_data_param(request, &user_id); + sync_agent_get_event_data_param(request, &user_pw); + sync_agent_get_event_data_param(request, &user_auth_type); + sync_agent_get_event_data_param(request, &server_auth_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___reset_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___uic_alert_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + uic_type type = UIC_NONE_TYPE; + int response_ret = 0; + char *input_text = NULL; + int count = 0; + int i = 0; + + sync_agent_get_event_data_param(request, &response_ret); + sync_agent_get_event_data_param(request, &type); + + if (response_ret == 1) { + switch (type) { + case UIC_CONFIRMATION_TYPE: + break; + case UIC_INPUT_TEXT_TYPE: + sync_agent_get_event_data_param(request, &input_text); + break; + case UIC_SINGLE_CHOICE_TYPE: + case UIC_MULTIPLE_CHOICE_TYPE: + { + sync_agent_get_event_data_param(request, &count); + + if (count != 0) { + for (i = 0; i < count; ++i) { + char *input = NULL; + sync_agent_get_event_data_param(request, &input); + } + } + } + break; + case UIC_DISPLAY_TYPE: + default: + break; + } + } else { + g_printf("response failed \n"); + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___check_pin_code_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int ext_id = 0; + char *user_pin = NULL; + int response_type = 0; + int response_value = 1; + + sync_agent_get_event_data_param(request, &ext_id); + sync_agent_get_event_data_param(request, &response_type); + + if (response_type == 1) + sync_agent_get_event_data_param(request, &user_pin); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &response_value); + + if (user_pin != NULL) + free(user_pin); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___add_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___remove_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + g_print("%s End \n", __func__); + + return 1; +} diff --git a/TC/testcase/utc_sync_agent_framework_event_omadm_fota.c b/TC/testcase/utc_sync_agent_framework_event_omadm_fota.c new file mode 100755 index 0000000..5565098 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_event_omadm_fota.c @@ -0,0 +1,649 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> +#include "../../src/framework/event/oma_dm_api_common_internal.h" + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_OMADM_FILE "../../../testcase/fw-test-cfg/test_fw_config_omadm.xml" + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_CLEAN_UP "cleanup" + +#define API_NAME_SYNC_AGENT_DM_FOTA_INIT "sync_agent_dm_fota_init" +#define API_NAME_SYNC_AGENT_DM_FOTA_SOFTWARE_UPDATE "sync_agent_dm_fota_software_update" +#define API_NAME_SYNC_AGENT_DM_FOTA_CANCEL "sync_agent_dm_fota_cancel" +#define API_NAME_SYNC_AGENT_DM_FOTA_DOWNLOAD "sync_agent_dm_fota_download" +#define API_NAME_SYNC_AGENT_DM_FOTA_INSTALL "sync_agent_dm_fota_install" +#define API_NAME_SYNC_AGENT_DM_FOTA_SET_INTERVAL "sync_agent_dm_fota_set_interval" +#define API_NAME_SYNC_AGENT_DM_FOTA_DEINIT "sync_agent_dm_fota_deinit" + +#define API_NAME_START_TEST_DM_AGENT "_start_test_dm_agent" + +static void utc_sync_agent_framework_sync_agent_dm_fota_init_p(void); +static void utc_sync_agent_framework_sync_agent_dm_fota_software_update_p(void); +static void utc_sync_agent_framework_sync_agent_dm_fota_cancel_p(void); +static void utc_sync_agent_framework_sync_agent_dm_fota_download_p(void); +static void utc_sync_agent_framework_sync_agent_dm_fota_install_p(void); +static void utc_sync_agent_framework_sync_agent_dm_fota_set_interval_p(void); +static void utc_sync_agent_framework_sync_agent_dm_fota_deinit_p(void); + +static void *_start_test_dm_agent(void *arg); +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___software_update_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___cancel_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___download_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___install_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_interval_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___reset_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___uic_alert_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___check_pin_code_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___add_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___remove_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_dm_fota_init_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_fota_software_update_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_fota_cancel_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_fota_download_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_fota_install_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_fota_set_interval_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_fota_deinit_p, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static pthread_t test_dm_agent_thread_id; + +static void startup(void) +{ + /* start of TC */ + pthread_create(&test_dm_agent_thread_id, 0, _start_test_dm_agent, 0); + + sleep(3); +} + +static void cleanup(void) +{ + /* clean of TC */ + pthread_cancel(test_dm_agent_thread_id); + + sync_agent_stop_main_loop(1); +} + +static void utc_sync_agent_framework_sync_agent_dm_fota_init_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_FOTA_INIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_fota_init(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_fota_init : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_fota_software_update_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_FOTA_SOFTWARE_UPDATE; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + sync_agent_dm_service_server_type_e server_type = UI_SAMSUNG_FUMO_TYPE; + + dm_err = sync_agent_dm_fota_software_update(server_type); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_fota_software_update : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_fota_cancel_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_FOTA_CANCEL; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_fota_cancel(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_fota_cancel : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_fota_download_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_FOTA_DOWNLOAD; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int response_type = 1; + + dm_err = sync_agent_dm_fota_download(response_type); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_fota_download : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_fota_install_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_FOTA_INSTALL; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int response_type = 1; + + dm_err = sync_agent_dm_fota_install(response_type); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_fota_install : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_fota_set_interval_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_FOTA_SET_INTERVAL; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int interval_type = 1; + + dm_err = sync_agent_dm_fota_set_interval(interval_type); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_fota_set_interval : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_fota_deinit_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_FOTA_DEINIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_fota_deinit(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_fota_deinit : %d", dm_err); + dts_fail(api_name); + } +} + +static void *_start_test_dm_agent(void *arg) +{ + char *api_name = API_NAME_START_TEST_DM_AGENT; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_OMADM_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(api_name, "sync_agent_init : %d", init_error); + dts_fail(api_name); + } + + int event_id = 0; + for (event_id = 1; event_id < EVENT_NUM; event_id++) { + event_err = sync_agent_set_event_callback(event_id, __get_event_callback(event_id)); + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_set_event_callback : %d", event_err); + dts_fail(api_name); + } + } + + sync_agent_run_main_loop(1); +} + +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response) { + g_print("%s Start \n", __func__); + + switch (event_id) { + case EVENT_SOFTWARE_UPDATE: + return ___software_update_cb; + break; + case EVENT_CANCEL: + return ___cancel_cb; + break; + case EVENT_DOWNLOAD: + return ___download_cb; + break; + case EVENT_INSTALL: + return ___install_cb; + break; + case EVENT_SET_INTERVAL: + return ___set_interval_cb; + break; + case EVENT_ACCOUNT_REGISTRATION: + return ___account_registration_cb; + break; + case EVENT_GET_FUMO_CONFIG: + return ___get_fumo_config_cb; + break; + case EVENT_SET_FUMO_CONFIG: + return ___set_fumo_config_cb; + break; + case EVENT_GET_PROFILE: + return ___get_profile_cb; + break; + case EVENT_SET_PROFILE: + return ___set_profile_cb; + break; + case EVENT_RESET_PROFILE: + return ___reset_profile_cb; + break; + case EVENT_UIC_ALERT: + return ___uic_alert_cb; + break; + case EVENT_CHECK_PIN_CODE: + return ___check_pin_code_cb; + break; + case EVENT_ADD_DMACC: + return ___add_dmacc_cb; + break; + case EVENT_REMOVE_DMACC: + return ___remove_dmacc_cb; + break; + default: + return ___default_cb; + break; + } + + g_print("%s End \n", __func__); +} + +static int ___software_update_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int ui_type = 0; + char *session_id = NULL; + char *server_id = NULL; + int task_id = 0; + int server_type = 0; + + sync_agent_get_event_data_param(request, &ui_type); + + switch (ui_type) { + case FOTA_COMMON_UI: + g_print("fota common ui \n"); + sync_agent_get_event_data_param(request, &task_id); + sync_agent_get_event_data_param(request, &server_type); + break; + case FOTA_NOTI_UI: + g_print("fota noti ui \n"); + sync_agent_get_event_data_param(request, &session_id); + sync_agent_get_event_data_param(request, &server_id); + break; + case FOTA_BACKGROUND_UI: + g_print("fota background ui \n"); + break; + case ADMIN_UI: + g_print("admin ui \n"); + sync_agent_get_event_data_param(request, &task_id); + sync_agent_get_event_data_param(request, &server_type); + break; + case CP_UI: + g_print("cp ui \n"); + break; + default: + break; + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + free(session_id); + free(server_id); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___cancel_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int task_id = 0; + + sync_agent_get_event_data_param(request, &task_id); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___download_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int response_type = 0; + + sync_agent_get_event_data_param(request, &response_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___install_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int response_type = 0; + + sync_agent_get_event_data_param(request, &response_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_interval_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int request_param = 0; + + sync_agent_get_event_data_param(request, &request_param); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int wifi_only = 1; + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &wifi_only); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int wifi_only_param = 0; + + sync_agent_get_event_data_param(request, &wifi_only_param); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + char *profile_name = strdup("profile name"); + char *client_targetUrl = strdup("client target url"); + char *server_url = strdup("server url"); + char *server_pwd = strdup("server pwd"); + char *client_id = strdup("client id"); + char *client_pwd = strdup("client pwd"); + char *client_authType = strdup("client auth type"); + char *server_authType = strdup("server auth type"); + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, profile_name); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_targetUrl); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_url); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_pwd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_id); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_pwd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_authType); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_authType); + + free(profile_name); + free(client_targetUrl); + free(server_url); + free(server_pwd); + free(client_id); + free(client_pwd); + free(client_authType); + free(server_authType); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + char *server_url = NULL; + char *server_id = NULL; + char *server_pw = NULL; + char *user_id = NULL; + char *user_pw = NULL; + char *user_auth_type = NULL; + char *server_auth_type = NULL; + + sync_agent_get_event_data_param(request, &sv_type); + sync_agent_get_event_data_param(request, &server_url); + sync_agent_get_event_data_param(request, &server_id); + sync_agent_get_event_data_param(request, &server_pw); + sync_agent_get_event_data_param(request, &user_id); + sync_agent_get_event_data_param(request, &user_pw); + sync_agent_get_event_data_param(request, &user_auth_type); + sync_agent_get_event_data_param(request, &server_auth_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___reset_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___uic_alert_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + uic_type type = UIC_NONE_TYPE; + int response_ret = 0; + char *input_text = NULL; + int count = 0; + int i = 0; + + sync_agent_get_event_data_param(request, &response_ret); + sync_agent_get_event_data_param(request, &type); + + if (response_ret == 1) { + switch (type) { + case UIC_CONFIRMATION_TYPE: + break; + case UIC_INPUT_TEXT_TYPE: + sync_agent_get_event_data_param(request, &input_text); + break; + case UIC_SINGLE_CHOICE_TYPE: + case UIC_MULTIPLE_CHOICE_TYPE: + { + sync_agent_get_event_data_param(request, &count); + + if (count != 0) { + for (i = 0; i < count; ++i) { + char *input = NULL; + sync_agent_get_event_data_param(request, &input); + } + } + } + break; + case UIC_DISPLAY_TYPE: + default: + break; + } + } else { + g_printf("response failed \n"); + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___check_pin_code_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int ext_id = 0; + char *user_pin = NULL; + int response_type = 0; + int response_value = 1; + + sync_agent_get_event_data_param(request, &ext_id); + sync_agent_get_event_data_param(request, &response_type); + + if (response_type == 1) + sync_agent_get_event_data_param(request, &user_pin); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &response_value); + + if (user_pin != NULL) + free(user_pin); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___add_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___remove_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + g_print("%s End \n", __func__); + + return 1; +} diff --git a/TC/testcase/utc_sync_agent_framework_event_omadm_noti.c b/TC/testcase/utc_sync_agent_framework_event_omadm_noti.c new file mode 100755 index 0000000..f415fe4 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_event_omadm_noti.c @@ -0,0 +1,654 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> +#include "../../src/framework/event/oma_dm_api_common_internal.h" + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_OMADM_FILE "../../../testcase/fw-test-cfg/test_fw_config_omadm.xml" + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_CLEAN_UP "cleanup" + +#define API_NAME_SYNC_AGENT_DM_PUSH_INIT "sync_agent_dm_push_init" +#define API_NAME_SYNC_AGENT_DM_PUSH_SOFTWARE_UPDATE "sync_agent_dm_push_software_update" +#define API_NAME_SYNC_AGENT_DM_PUSH_CANCEL "sync_agent_dm_push_cancel" +#define API_NAME_SYNC_AGENT_DM_PUSH_DOWNLOAD "sync_agent_dm_push_download" +#define API_NAME_SYNC_AGENT_DM_PUSH_INSTALL "sync_agent_dm_push_install" +#define API_NAME_SYNC_AGENT_DM_PUSH_SET_INTERVAL "sync_agent_dm_fota_set_interval" +#define API_NAME_SYNC_AGENT_DM_PUSH_DEINIT "sync_agent_dm_push_deinit" + +#define API_NAME_START_TEST_DM_AGENT "_start_test_dm_agent" + +static void utc_sync_agent_framework_sync_agent_dm_push_init_p(void); +static void utc_sync_agent_framework_sync_agent_dm_push_software_update_p(void); +static void utc_sync_agent_framework_sync_agent_dm_push_cancel_p(void); +static void utc_sync_agent_framework_sync_agent_dm_push_download_p(void); +static void utc_sync_agent_framework_sync_agent_dm_push_install_p(void); +static void utc_sync_agent_framework_sync_agent_dm_push_set_interval_p(void); +static void utc_sync_agent_framework_sync_agent_dm_push_deinit_p(void); + +static void *_start_test_dm_agent(void *arg); +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___software_update_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___cancel_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___download_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___install_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_interval_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___set_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___reset_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___uic_alert_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___check_pin_code_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___add_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___remove_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_dm_push_init_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_push_software_update_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_push_cancel_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_push_download_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_push_install_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_push_set_interval_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_dm_push_deinit_p, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static pthread_t test_dm_agent_thread_id; + +static void startup(void) +{ + /* start of TC */ + pthread_create(&test_dm_agent_thread_id, 0, _start_test_dm_agent, 0); + + sleep(3); +} + +static void cleanup(void) +{ + /* clean of TC */ + pthread_cancel(test_dm_agent_thread_id); + + sync_agent_stop_main_loop(1); +} + +static void utc_sync_agent_framework_sync_agent_dm_push_init_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_PUSH_INIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_push_init(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_push_init : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_push_software_update_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_PUSH_SOFTWARE_UPDATE; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + char *server_id = strdup("server id"); + char *session_id = strdup("111"); + + dm_err = sync_agent_dm_push_software_update(server_id, session_id); + + free(server_id); + free(session_id); + + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_push_software_update : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_push_cancel_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_PUSH_CANCEL; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_push_cancel(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_push_cancel : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_push_download_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_PUSH_DOWNLOAD; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int response_type = 1; + + dm_err = sync_agent_dm_push_download(response_type); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_push_download : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_push_install_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_PUSH_INSTALL; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int response_type = 1; + + dm_err = sync_agent_dm_push_install(response_type); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_push_install : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_push_set_interval_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_PUSH_SET_INTERVAL; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + int interval_type = 1; + + dm_err = sync_agent_dm_push_set_interval(interval_type); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_push_set_interval : %d", dm_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_dm_push_deinit_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DM_PUSH_DEINIT; + sync_agent_dm_error_e dm_err = UI_SYNC_AGENT_DM_SUCCESS; + + dm_err = sync_agent_dm_push_deinit(); + if (dm_err == UI_SYNC_AGENT_DM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_dm_push_deinit : %d", dm_err); + dts_fail(api_name); + } +} + +static void *_start_test_dm_agent(void *arg) +{ + char *api_name = API_NAME_START_TEST_DM_AGENT; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_OMADM_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(api_name, "sync_agent_init : %d", init_error); + dts_fail(api_name); + } + + int event_id = 0; + for (event_id = 1; event_id < EVENT_NUM; event_id++) { + event_err = sync_agent_set_event_callback(event_id, __get_event_callback(event_id)); + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_set_event_callback : %d", event_err); + dts_fail(api_name); + } + } + + sync_agent_run_main_loop(1); +} + +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response) { + g_print("%s Start \n", __func__); + + switch (event_id) { + case EVENT_SOFTWARE_UPDATE: + return ___software_update_cb; + break; + case EVENT_CANCEL: + return ___cancel_cb; + break; + case EVENT_DOWNLOAD: + return ___download_cb; + break; + case EVENT_INSTALL: + return ___install_cb; + break; + case EVENT_SET_INTERVAL: + return ___set_interval_cb; + break; + case EVENT_ACCOUNT_REGISTRATION: + return ___account_registration_cb; + break; + case EVENT_GET_FUMO_CONFIG: + return ___get_fumo_config_cb; + break; + case EVENT_SET_FUMO_CONFIG: + return ___set_fumo_config_cb; + break; + case EVENT_GET_PROFILE: + return ___get_profile_cb; + break; + case EVENT_SET_PROFILE: + return ___set_profile_cb; + break; + case EVENT_RESET_PROFILE: + return ___reset_profile_cb; + break; + case EVENT_UIC_ALERT: + return ___uic_alert_cb; + break; + case EVENT_CHECK_PIN_CODE: + return ___check_pin_code_cb; + break; + case EVENT_ADD_DMACC: + return ___add_dmacc_cb; + break; + case EVENT_REMOVE_DMACC: + return ___remove_dmacc_cb; + break; + default: + return ___default_cb; + break; + } + + g_print("%s End \n", __func__); +} + +static int ___software_update_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int ui_type = 0; + char *session_id = NULL; + char *server_id = NULL; + int task_id = 0; + int server_type = 0; + + sync_agent_get_event_data_param(request, &ui_type); + + switch (ui_type) { + case FOTA_COMMON_UI: + g_print("fota common ui \n"); + sync_agent_get_event_data_param(request, &task_id); + sync_agent_get_event_data_param(request, &server_type); + break; + case FOTA_NOTI_UI: + g_print("fota noti ui \n"); + sync_agent_get_event_data_param(request, &session_id); + sync_agent_get_event_data_param(request, &server_id); + break; + case FOTA_BACKGROUND_UI: + g_print("fota background ui \n"); + break; + case ADMIN_UI: + g_print("admin ui \n"); + sync_agent_get_event_data_param(request, &task_id); + sync_agent_get_event_data_param(request, &server_type); + break; + case CP_UI: + g_print("cp ui \n"); + break; + default: + break; + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + free(session_id); + free(server_id); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___cancel_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int task_id = 0; + + sync_agent_get_event_data_param(request, &task_id); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___download_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int response_type = 0; + + sync_agent_get_event_data_param(request, &response_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___install_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int response_type = 0; + + sync_agent_get_event_data_param(request, &response_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_interval_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int request_param = 0; + + sync_agent_get_event_data_param(request, &request_param); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___account_registration_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int wifi_only = 1; + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &wifi_only); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_fumo_config_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int wifi_only_param = 0; + + sync_agent_get_event_data_param(request, &wifi_only_param); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + char *profile_name = strdup("profile name"); + char *client_targetUrl = strdup("client target url"); + char *server_url = strdup("server url"); + char *server_pwd = strdup("server pwd"); + char *client_id = strdup("client id"); + char *client_pwd = strdup("client pwd"); + char *client_authType = strdup("client auth type"); + char *server_authType = strdup("server auth type"); + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, profile_name); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_targetUrl); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_url); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_pwd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_id); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_pwd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, client_authType); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, server_authType); + + free(profile_name); + free(client_targetUrl); + free(server_url); + free(server_pwd); + free(client_id); + free(client_pwd); + free(client_authType); + free(server_authType); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___set_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + char *server_url = NULL; + char *server_id = NULL; + char *server_pw = NULL; + char *user_id = NULL; + char *user_pw = NULL; + char *user_auth_type = NULL; + char *server_auth_type = NULL; + + sync_agent_get_event_data_param(request, &sv_type); + sync_agent_get_event_data_param(request, &server_url); + sync_agent_get_event_data_param(request, &server_id); + sync_agent_get_event_data_param(request, &server_pw); + sync_agent_get_event_data_param(request, &user_id); + sync_agent_get_event_data_param(request, &user_pw); + sync_agent_get_event_data_param(request, &user_auth_type); + sync_agent_get_event_data_param(request, &server_auth_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___reset_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___uic_alert_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + uic_type type = UIC_NONE_TYPE; + int response_ret = 0; + char *input_text = NULL; + int count = 0; + int i = 0; + + sync_agent_get_event_data_param(request, &response_ret); + sync_agent_get_event_data_param(request, &type); + + if (response_ret == 1) { + switch (type) { + case UIC_CONFIRMATION_TYPE: + break; + case UIC_INPUT_TEXT_TYPE: + sync_agent_get_event_data_param(request, &input_text); + break; + case UIC_SINGLE_CHOICE_TYPE: + case UIC_MULTIPLE_CHOICE_TYPE: + { + sync_agent_get_event_data_param(request, &count); + + if (count != 0) { + for (i = 0; i < count; ++i) { + char *input = NULL; + sync_agent_get_event_data_param(request, &input); + } + } + } + break; + case UIC_DISPLAY_TYPE: + default: + break; + } + } else { + g_printf("response failed \n"); + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___check_pin_code_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int ext_id = 0; + char *user_pin = NULL; + int response_type = 0; + int response_value = 1; + + sync_agent_get_event_data_param(request, &ext_id); + sync_agent_get_event_data_param(request, &response_type); + + if (response_type == 1) + sync_agent_get_event_data_param(request, &user_pin); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &response_value); + + if (user_pin != NULL) + free(user_pin); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___add_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___remove_dmacc_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int sv_type = 0; + + sync_agent_get_event_data_param(request, &sv_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + g_print("%s End \n", __func__); + + return 1; +} diff --git a/TC/testcase/utc_sync_agent_framework_event_omads.c b/TC/testcase/utc_sync_agent_framework_event_omads.c new file mode 100755 index 0000000..d75dd9e --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_event_omads.c @@ -0,0 +1,1060 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_OMADS_FILE "../../../testcase/fw-test-cfg/test_fw_config_omads.xml" + +#define OMA_DS_EVENT_NUM 10 + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_CLEAN_UP "cleanup" + +#define API_NAME_SYNC_AGENT_DS_INIT "sync_agent_ds_init" +#define API_NAME_SYNC_AGENT_DS_CREATE_PROFILE_INFO "sync_agent_ds_create_profile_info" +#define API_NAME_SYNC_AGENT_DS_SET_PROFILE_NAME "sync_agent_ds_set_profile_name" +#define API_NAME_SYNC_AGENT_DS_SET_SERVER_INFO "sync_agent_ds_set_server_info" +#define API_NAME_SYNC_AGENT_DS_SET_SYNC_INFO "sync_agent_ds_set_sync_info" +#define API_NAME_SYNC_AGENT_DS_SET_SYNC_SERVICE_INFO "sync_agent_ds_set_sync_service_info" +#define API_NAME_SYNC_AGENT_DS_GET_PROFILE_NAME "sync_agent_ds_get_profile_name" +#define API_NAME_SYNC_AGENT_DS_GET_SERVER_INFO "sync_agent_ds_get_server_info" +#define API_NAME_SYNC_AGENT_DS_GET_SYNC_INFO "sync_agent_ds_get_sync_info" +#define API_NAME_SYNC_AGENT_DS_GET_SYNC_SERVICE_INFO "sync_agent_ds_get_sync_service_info" +#define API_NAME_SYNC_AGENT_DS_GET_LAST_SYNC_INFO "sync_agent_ds_get_last_sync_info" +#define API_NAME_SYNC_AGENT_DS_GET_SYNC_STATISTICS "sync_agent_ds_get_sync_statistics" +#define API_NAME_SYNC_AGENT_DS_ADD_PROFILE "sync_agent_ds_add_profile" +#define API_NAME_SYNC_AGENT_DS_GET_PROFILE "sync_agent_ds_get_profile" +#define API_NAME_SYNC_AGENT_DS_GET_ALL_PROFILE "sync_agent_ds_get_all_profile" +#define API_NAME_SYNC_AGENT_DS_UPDATE_PROFILE "sync_agent_ds_update_profile" +#define API_NAME_SYNC_AGENT_DS_DELETE_PROFILE "sync_agent_ds_delete_profile" +#define API_NAME_SYNC_AGENT_DS_START_SYNC "sync_agent_ds_start_sync" +#define API_NAME_SYNC_AGENT_DS_STOP_SYNC "sync_agent_ds_stop_sync" +#define API_NAME_SYNC_AGENT_DS_FREE_PROFILE_INFO "sync_agent_ds_free_profile_info" +#define API_NAME_SYNC_AGENT_DS_DEINIT "sync_agent_ds_deinit" + +#define API_NAME_START_TEST_DS_AGENT "_start_test_ds_agent" + +static void utc_sync_agent_framework_sync_agent_sync_agent_ds_init_p(void); +static void utc_sync_agent_framework_sync_agent_ds_create_profile_info_p(void); +static void utc_sync_agent_framework_sync_agent_ds_set_profile_name_p(void); +static void utc_sync_agent_framework_sync_agent_ds_set_server_info_p(void); +static void utc_sync_agent_framework_sync_agent_ds_set_sync_info_p(void); +static void utc_sync_agent_framework_sync_agent_ds_set_sync_service_info_p(void); +static void utc_sync_agent_framework_sync_agent_ds_get_profile_name_p(void); +static void utc_sync_agent_framework_sync_agent_ds_get_server_info_p(void); +static void utc_sync_agent_framework_sync_agent_ds_get_sync_info_p(void); +static void utc_sync_agent_framework_sync_agent_ds_get_sync_service_info_p(void); +static void utc_sync_agent_framework_sync_agent_ds_get_last_sync_info_p(void); +static void utc_sync_agent_framework_sync_agent_ds_get_sync_statistics_p(void); +static void utc_sync_agent_framework_sync_agent_ds_add_profile_p(void); +static void utc_sync_agent_framework_sync_agent_ds_get_profile_p(void); +static void utc_sync_agent_framework_sync_agent_ds_get_all_profile_p(void); +static void utc_sync_agent_framework_sync_agent_ds_update_profile_p(void); +static void utc_sync_agent_framework_sync_agent_ds_delete_profile_p(void); +static void utc_sync_agent_framework_sync_agent_ds_start_sync_p(void); +static void utc_sync_agent_framework_sync_agent_ds_stop_sync_p(void); +//static void utc_sync_agent_framework_sync_agent_ds_free_profile_info_p(void); +static void utc_sync_agent_framework_sync_agent_ds_deinit_p(void); + +static void *_start_test_ds_agent(void *arg); +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___add_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___update_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___delete_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___start_sync_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___stop_sync_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_sync_category_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_sync_statistics_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___get_all_profiles_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_sync_agent_ds_init_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_create_profile_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_set_profile_name_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_set_server_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_set_sync_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_set_sync_service_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_get_profile_name_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_get_server_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_get_sync_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_get_sync_service_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_get_last_sync_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_get_sync_statistics_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_add_profile_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_get_profile_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_get_all_profile_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_update_profile_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_delete_profile_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_start_sync_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_ds_stop_sync_p, POSITIVE_TC_IDX}, +// { utc_sync_agent_framework_sync_agent_ds_free_profile_info_p, POSITIVE_TC_IDX }, + {utc_sync_agent_framework_sync_agent_ds_deinit_p, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static pthread_t test_ds_agent_thread_id; + +static void startup(void) +{ + /* start of TC */ + pthread_create(&test_ds_agent_thread_id, 0, _start_test_ds_agent, 0); + + sleep(3); +} + +static void cleanup(void) +{ + /* clean of TC */ + pthread_cancel(test_ds_agent_thread_id); + + sync_agent_stop_main_loop(1); +} + +static void utc_sync_agent_framework_sync_agent_sync_agent_ds_init_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_INIT; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_err = sync_agent_ds_init(); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_init : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_create_profile_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_CREATE_PROFILE_INFO; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + + ds_err = sync_agent_ds_create_profile_info(&profile_h); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_create_profile_info : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_set_profile_name_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_SET_PROFILE_NAME; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *profile_dir_name = "Sync1"; + char *profile_name = "profile name"; + + ds_err = sync_agent_ds_create_profile_info(&profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_create_profile_info : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_set_profile_name(profile_h, profile_dir_name, profile_name); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_set_profile_name : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_set_server_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_SET_SERVER_INFO; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *addr = "http://"; + char *id = "id"; + char *password = "password"; + + ds_err = sync_agent_ds_create_profile_info(&profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_create_profile_info : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_set_server_info(profile_h, addr, id, password); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_set_server_info : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_set_sync_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_SET_SYNC_INFO; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *sync_mode = "Periodic"; + char *sync_type = "Update both"; + char *interval = "1 hour"; + + ds_err = sync_agent_ds_create_profile_info(&profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_create_profile_info : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_set_sync_info(profile_h, sync_mode, sync_type, interval); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_set_sync_info : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_set_sync_service_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_SET_SYNC_SERVICE_INFO; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + sync_agent_ds_service_type_e service_type = SYNC_AGENT_CONTACT; + int enabled = 1; + char *src_uri = "Contacts"; + char *tgt_uri = "card"; + char *id = "id"; + char *password = "password"; + + ds_err = sync_agent_ds_create_profile_info(&profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_create_profile_info : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_set_sync_service_info(profile_h, service_type, enabled, src_uri, tgt_uri, id, password); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_set_sync_service_info : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_get_profile_name_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_GET_PROFILE_NAME; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *profile_dir_name = "Sync1"; + char *get_profile_dir_name = NULL; + char *profile_name = NULL; + + ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_get_profile : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_get_profile_name(profile_h, &get_profile_dir_name, &profile_name); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_get_profile_name : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_get_server_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_GET_SERVER_INFO; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *profile_dir_name = "Sync1"; + sync_agent_ds_server_info server_info = { NULL }; + + ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_get_profile : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_get_server_info(profile_h, &server_info); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_get_server_info : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_get_sync_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_GET_SYNC_INFO; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *profile_dir_name = "Sync1"; + sync_agent_ds_sync_info sync_info = { NULL }; + + ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_get_profile : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_get_sync_info(profile_h, &sync_info); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_get_sync_info : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_get_sync_service_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_GET_SYNC_SERVICE_INFO; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *profile_dir_name = "Sync1"; + GList *service_list = NULL; + + ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_get_profile : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_get_sync_service_info(profile_h, &service_list); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_get_sync_service_info : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_get_last_sync_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_GET_LAST_SYNC_INFO; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *profile_dir_name = "Sync1"; + int last_sync_status = 0; + int last_sync_time = 0; + + ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_get_profile : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_get_last_sync_info(profile_h, &last_sync_status, &last_sync_time); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_get_last_sync_info : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_get_sync_statistics_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_GET_SYNC_STATISTICS; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *profile_dir_name = "Sync1"; + GList *statistics_list = NULL; + + ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_get_profile : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_get_sync_statistics(profile_h, &statistics_list); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_get_sync_statistics : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_add_profile_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_ADD_PROFILE; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *profile_dir_name = "Sync1"; + char *profile_name = "profile name"; + + char *addr = "http://"; + char *id = "id"; + char *password = "password"; + + char *sync_mode = "Periodic"; + char *sync_type = "Update both"; + char *interval = "1 hour"; + + sync_agent_ds_service_type_e service_type = SYNC_AGENT_CONTACT; + int enabled = 1; + char *src_uri = "Contacts"; + char *tgt_uri = "card"; + + int profile_id = 0; + + ds_err = sync_agent_ds_create_profile_info(&profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_create_profile_info : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_set_profile_name(profile_h, profile_dir_name, profile_name); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_set_profile_name : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_set_server_info(profile_h, addr, id, password); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_set_server_info : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_set_sync_info(profile_h, sync_mode, sync_type, interval); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_set_sync_info : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_add_profile(profile_h, &profile_id); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_add_profile : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_get_profile_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_GET_PROFILE; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *profile_dir_name = "Sync1"; + + ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_get_profile : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_get_all_profile_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_GET_ALL_PROFILE; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + GList *profile_list = NULL; + + ds_err = sync_agent_ds_get_all_profile(&profile_list); + + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_get_all_profile : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_update_profile_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_UPDATE_PROFILE; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *profile_dir_name = "Sync1"; + char *profile_name = "updated profile name"; + + char *addr = "http://"; + char *id = "id"; + char *password = "password"; + + char *sync_mode = "Periodic"; + char *sync_type = "Update both"; + char *interval = "1 hour"; + + sync_agent_ds_service_type_e service_type = SYNC_AGENT_CONTACT; + int enabled = 1; + char *src_uri = "Contacts"; + char *tgt_uri = "card"; + + ds_err = sync_agent_ds_create_profile_info(&profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_create_profile_info : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_set_profile_name(profile_h, profile_dir_name, profile_name); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_set_profile_name : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_set_server_info(profile_h, addr, id, password); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_set_server_info : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_set_sync_info(profile_h, sync_mode, sync_type, interval); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_set_sync_info : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_update_profile(profile_h); + sync_agent_ds_free_profile_info(profile_h); + + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_update_profile : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_delete_profile_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_DELETE_PROFILE; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *profileDirName = "Sync1"; + + ds_err = sync_agent_ds_create_profile_info(&profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_create_profile_info : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_set_profile_name(profile_h, profileDirName, NULL); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_set_profile_name : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_delete_profile(profile_h); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_delete_profile : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_start_sync_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_START_SYNC; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *profileDirName = "Sync1"; + + ds_err = sync_agent_ds_create_profile_info(&profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_create_profile_info : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_set_profile_name(profile_h, profileDirName, NULL); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_set_profile_name : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_start_sync(profile_h); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_start_sync : %d", ds_err); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_ds_stop_sync_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_STOP_SYNC; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_profile_h profile_h = NULL; + char *profileDirName = "Sync1"; + + ds_err = sync_agent_ds_create_profile_info(&profile_h); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_create_profile_info : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_set_profile_name(profile_h, profileDirName, NULL); + if (ds_err != SYNC_AGENT_DS_SUCCESS) { + dts_message(api_name, "sync_agent_ds_set_profile_name : %d", ds_err); + dts_fail(api_name); + } + + ds_err = sync_agent_ds_stop_sync(profile_h); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_stop_sync : %d", ds_err); + dts_fail(api_name); + } +} + +//static void utc_sync_agent_framework_sync_agent_ds_free_profile_info_p(void) +//{ +// char *api_name = API_NAME_SYNC_AGENT_DS_FREE_PROFILE_INFO; +// sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; +// +// ds_profile_h profile_h = NULL; +// +// ds_err = sync_agent_ds_create_profile_info(&profile_h); +// if (ds_err != SYNC_AGENT_DS_SUCCESS) { +// dts_message(api_name, "sync_agent_ds_create_profile_info : %d", ds_err); +// dts_fail(api_name); +// } +// +// sync_agent_ds_free_profile_info(profile_h); +//} + +static void utc_sync_agent_framework_sync_agent_ds_deinit_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DS_DEINIT; + sync_agent_ds_error_e ds_err = SYNC_AGENT_DS_SUCCESS; + + ds_err = sync_agent_ds_deinit(); + if (ds_err == SYNC_AGENT_DS_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_ds_deinit : %d", ds_err); + dts_fail(api_name); + } +} + +static void *_start_test_ds_agent(void *arg) +{ + char *api_name = API_NAME_START_TEST_DS_AGENT; + sync_agent_event_error_e event_err = SYNC_AGENT_EVENT_SUCCESS; + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_OMADS_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(api_name, "sync_agent_init : %d", init_error); + dts_fail(api_name); + } + + int event_id = 0; + for (event_id = 1; event_id < OMA_DS_EVENT_NUM; event_id++) { + event_err = sync_agent_set_event_callback(event_id, __get_event_callback(event_id)); + if (event_err != SYNC_AGENT_EVENT_SUCCESS) { + dts_message(api_name, "sync_agent_set_event_callback : %d", event_err); + dts_fail(api_name); + } + } + + sync_agent_run_main_loop(1); +} + +static int (*__get_event_callback(int event_id)) (sync_agent_event_data_s * request, sync_agent_event_data_s * response) { + g_print("%s Start \n", __func__); + + switch (event_id) { + case 1: + return ___add_profile_cb; + break; + case 2: + return ___update_profile_cb; + break; + case 3: + return ___delete_profile_cb; + break; + case 4: + return ___start_sync_cb; + break; + case 5: + return ___stop_sync_cb; + break; + case 6: + return ___get_profile_cb; + break; + case 7: + return ___get_sync_category_cb; + break; + case 8: + return ___get_sync_statistics_cb; + break; + case 9: + return ___get_all_profiles_cb; + break; + default: + return ___default_cb; + break; + } + + g_print("%s End \n", __func__); +} + +static int ___add_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + char *profile_dir_name = NULL; + char *profile_name = NULL; + char *addr = NULL; + char *id = NULL; + char *password = NULL; + char *sync_mode = NULL; + char *sync_type = NULL; + char *interval = NULL; + int category_count = 0; + int account_id = 1; + + sync_agent_get_event_data_param(request, &profile_dir_name); + sync_agent_get_event_data_param(request, &profile_name); + sync_agent_get_event_data_param(request, &addr); + sync_agent_get_event_data_param(request, &id); + sync_agent_get_event_data_param(request, &password); + sync_agent_get_event_data_param(request, &sync_mode); + sync_agent_get_event_data_param(request, &sync_type); + sync_agent_get_event_data_param(request, &interval); + sync_agent_get_event_data_param(request, &category_count); + + int i = 0; + for (; i < category_count; i++) { + sync_agent_ds_service_info *category = NULL; + sync_agent_get_event_data_param(request, &(category->service_type)); + sync_agent_get_event_data_param(request, &(category->enabled)); + sync_agent_get_event_data_param(request, &(category->src_uri)); + sync_agent_get_event_data_param(request, &(category->tgt_uri)); + sync_agent_get_event_data_param(request, &(category->id)); + sync_agent_get_event_data_param(request, &(category->password)); + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &account_id); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___update_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + char *profile_dir_name = NULL; + char *profile_name = NULL; + char *addr = NULL; + char *id = NULL; + char *password = NULL; + char *sync_mode = NULL; + char *sync_type = NULL; + char *interval = NULL; + int category_count = 0; + + sync_agent_get_event_data_param(request, &profile_dir_name); + sync_agent_get_event_data_param(request, &profile_name); + sync_agent_get_event_data_param(request, &addr); + sync_agent_get_event_data_param(request, &id); + sync_agent_get_event_data_param(request, &password); + sync_agent_get_event_data_param(request, &sync_mode); + sync_agent_get_event_data_param(request, &sync_type); + sync_agent_get_event_data_param(request, &interval); + sync_agent_get_event_data_param(request, &category_count); + + int i = 0; + for (; i < category_count; i++) { + sync_agent_ds_service_info *category = NULL; + sync_agent_get_event_data_param(request, &(category->service_type)); + sync_agent_get_event_data_param(request, &(category->enabled)); + sync_agent_get_event_data_param(request, &(category->src_uri)); + sync_agent_get_event_data_param(request, &(category->tgt_uri)); + sync_agent_get_event_data_param(request, &(category->id)); + sync_agent_get_event_data_param(request, &(category->password)); + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___delete_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int count = 0; + sync_agent_get_event_data_param(request, &count); + + int i; + char *profile = NULL; + for (i = 0; i < count; i++) { + sync_agent_get_event_data_param(request, &profile); + } + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___start_sync_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + char *profile = NULL; + + sync_agent_get_event_data_param(request, &profile); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + if (profile != NULL) + free(profile); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___stop_sync_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + char *profile = NULL; + + sync_agent_get_event_data_param(request, &profile); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + + if (profile != NULL) + free(profile); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_profile_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + char *profile = NULL; + char *profile_name = strdup("profile name"); + char *addr = strdup("addr"); + char *id = strdup("id"); + char *password = strdup("password"); + char *sync_mode = strdup("sync_mode"); + char *sync_type = strdup("sync_type"); + char *interval = strdup("interval"); + int last_session_status = 0; + int last_session_time = 0; + + sync_agent_get_event_data_param(request, &profile); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)profile_name); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)addr); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)id); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)password); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_mode); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_type); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)interval); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &last_session_status); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &last_session_time); + + if (profile != NULL) + free(profile); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_sync_category_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + char *profile = NULL; + int content_type = 0; + int enabled = 0; + char *srcURI = strdup("srcURI"); + char *tgtURI = strdup("tgtURI"); + char *id = strdup("id"); + char *password = strdup("password"); + + sync_agent_get_event_data_param(request, &profile); + sync_agent_get_event_data_param(request, &content_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &enabled); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)srcURI); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)tgtURI); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)id); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)password); + + if (profile != NULL) + free(profile); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_sync_statistics_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + char *profile = NULL; + int content_type = 0; + char *dbSynced = strdup("NO"); + int last_session_time = 0; + int server2Client_Total = 0; + int server2Client_NrOfAdd = 0; + int server2Client_NrOfDelete = 0; + int server2Client_NrOfReplace = 0; + int client2Server_Total = 0; + int client2Server_NrOfAdd = 0; + int client2Server_NrOrDelete = 0; + int client2Server_NrOfReplace = 0; + + sync_agent_get_event_data_param(request, &profile); + sync_agent_get_event_data_param(request, &content_type); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)dbSynced); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &last_session_time); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &server2Client_Total); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &server2Client_NrOfAdd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &server2Client_NrOfDelete); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &server2Client_NrOfReplace); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &client2Server_Total); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &client2Server_NrOfAdd); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &client2Server_NrOrDelete); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &client2Server_NrOfReplace); + + if (profile != NULL) + free(profile); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___get_all_profiles_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + int event_result = 1; + int profile_count = 1; + int category_count = 1; + sync_agent_ds_service_info *category_info = NULL; + + char *profile_dir_name = strdup("profile_dir_name"); + char *profile_name = strdup("profile_name"); + char *addr = strdup("addr"); + char *id = strdup("id"); + char *password = strdup("password"); + char *sync_mode = strdup("sync_mode"); + char *sync_type = strdup("sync_type"); + char *interval = strdup("interval"); + int last_sync_status = 0; + int last_sync_time = 1; + int service_type = 1; + int enabled = 1; + char *src_uri = strdup("src_uri"); + char *tgt_uri = strdup("tgt_uri"); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &event_result); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &profile_count); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)profile_dir_name); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)profile_name); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)addr); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)id); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)password); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_mode); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_type); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)interval); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &last_sync_status); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &last_sync_time); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &category_count); + + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &service_type); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &enabled); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)src_uri); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)tgt_uri); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)id); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)password); + + g_print("%s End \n", __func__); + + return 1; +} + +static int ___default_cb(sync_agent_event_data_s * request, sync_agent_event_data_s * response) +{ + g_print("%s Start \n", __func__); + + g_print("%s End \n", __func__); + + return 1; +} diff --git a/TC/testcase/utc_sync_agent_framework_fsapi.c b/TC/testcase/utc_sync_agent_framework_fsapi.c new file mode 100755 index 0000000..0b52d36 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_fsapi.c @@ -0,0 +1,964 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define FILE_SRC "../../../testcase/fw-test-file/file_src" +#define FILE_DST "../../../testcase/fw-test-file/file_dst" +#define FILE_DST_DIR "../../../testcase/fw-test-file/dir_src/file_dst" +#define DIR_SRC "../../../testcase/fw-test-file/dir_src" +#define DIR_DST "../../../testcase/fw-test-file/dir_dst" +#define NOT_EXISTING "./not_existing" + +#define API_NAME_SYNC_AGENT_IS_EXISTING_FS "sync_agent_is_existing_fs" +#define API_NAME_SYNC_AGENT_GET_FS_INFO "sync_agent_get_fs_info" +#define API_NAME_SYNC_AGENT_FREE_FS_INFO "sync_agent_free_fs_info" +#define API_NAME_SYNC_AGENT_GET_FS_MEM_SIZE "sync_agent_get_fs_mem_size" +#define API_NAME_SYNC_AGENT_GET_FILE_SIZE "sync_agent_get_file_size" +#define API_NAME_SYNC_AGENT_COPY_FILE "sync_agent_copy_file" +#define API_NAME_SYNC_AGENT_DELETE_FILE "sync_agent_delete_file" +#define API_NAME_SYNC_AGENT_MOVE_FILE "sync_agent_move_file" +#define API_NAME_SYNC_AGENT_RENAME_FILE "sync_agent_rename_file" +#define API_NAME_SYNC_AGENT_GET_FILE_LIST "sync_agent_get_file_list" +#define API_NAME_SYNC_AGENT_READ_FILE "sync_agent_read_file" +#define API_NAME_SYNC_AGENT_READ_WHOLE_FILE "sync_agent_read_whole_file" +#define API_NAME_SYNC_AGENT_FREE_FILE "sync_agent_free_file" +#define API_NAME_SYNC_AGENT_WRITE_FILE "sync_agent_write_file" +#define API_NAME_SYNC_AGENT_WRITE_WHOLE_FILE "sync_agent_write_whole_file" +#define API_NAME_SYNC_AGENT_APPEND_FILE "sync_agent_append_file" +#define API_NAME_SYNC_AGENT_CREATE_DIRECTORY "sync_agent_create_directory" +#define API_NAME_SYNC_AGENT_DELETE_DIRECTORY "sync_agent_delete_directory" +#define API_NAME_SYNC_AGENT_EMPTY_DIRECTORY_CONTENTS "sync_agent_empty_directory_contents" +#define API_NAME_SYNC_AGENT_RENAME_DIRECTORY "sync_agent_rename_directory" +#define API_NAME_SYNC_AGENT_GET_DIRECTORY_LIST "sync_agent_get_directory_list" +#define API_NAME_SYNC_AGENT_FILE_MD5_VALIDATION "sync_agent_file_md5_validation" + +static void utc_sync_agent_framework_sync_agent_is_existing_fs_p(void); +static void utc_sync_agent_framework_sync_agent_is_existing_fs_n(void); +static void utc_sync_agent_framework_sync_agent_get_fs_info_p(void); +static void utc_sync_agent_framework_sync_agent_get_fs_info_n(void); +static void utc_sync_agent_framework_sync_agent_free_fs_info_p(void); +static void utc_sync_agent_framework_sync_agent_free_fs_info_n(void); +static void utc_sync_agent_framework_sync_agent_get_fs_mem_size_p(void); +static void utc_sync_agent_framework_sync_agent_get_fs_mem_size_n(void); +static void utc_sync_agent_framework_sync_agent_get_file_size_p(void); +static void utc_sync_agent_framework_sync_agent_get_file_size_n(void); +static void utc_sync_agent_framework_sync_agent_copy_file_p(void); +static void utc_sync_agent_framework_sync_agent_copy_file_n(void); +static void utc_sync_agent_framework_sync_agent_delete_file_p(void); +static void utc_sync_agent_framework_sync_agent_delete_file_n(void); +static void utc_sync_agent_framework_sync_agent_move_file_p(void); +static void utc_sync_agent_framework_sync_agent_move_file_n(void); +static void utc_sync_agent_framework_sync_agent_rename_file_p(void); +static void utc_sync_agent_framework_sync_agent_rename_file_n(void); +static void utc_sync_agent_framework_sync_agent_get_file_list_p(void); +static void utc_sync_agent_framework_sync_agent_get_file_list_n(void); +static void utc_sync_agent_framework_sync_agent_read_file_p(void); +static void utc_sync_agent_framework_sync_agent_read_file_n(void); +static void utc_sync_agent_framework_sync_agent_read_whole_file_p(void); +static void utc_sync_agent_framework_sync_agent_read_whole_file_n(void); +static void utc_sync_agent_framework_sync_agent_free_file_p(void); +static void utc_sync_agent_framework_sync_agent_free_file_n(void); +static void utc_sync_agent_framework_sync_agent_write_file_p(void); +static void utc_sync_agent_framework_sync_agent_write_file_n(void); +static void utc_sync_agent_framework_sync_agent_write_whole_file_p(void); +static void utc_sync_agent_framework_sync_agent_write_whole_file_n(void); +static void utc_sync_agent_framework_sync_agent_append_file_p(void); +static void utc_sync_agent_framework_sync_agent_append_file_n(void); +static void utc_sync_agent_framework_sync_agent_create_directory_p(void); +static void utc_sync_agent_framework_sync_agent_create_directory_n(void); +static void utc_sync_agent_framework_sync_agent_delete_directory_p(void); +static void utc_sync_agent_framework_sync_agent_delete_directory_n(void); +static void utc_sync_agent_framework_sync_agent_empty_directory_contents_p(void); +static void utc_sync_agent_framework_sync_agent_empty_directory_contents_n(void); +static void utc_sync_agent_framework_sync_agent_rename_directory_p(void); +static void utc_sync_agent_framework_sync_agent_rename_directory_n(void); +static void utc_sync_agent_framework_sync_agent_get_directory_list_p(void); +static void utc_sync_agent_framework_sync_agent_get_directory_list_n(void); +static void utc_sync_agent_framework_sync_agent_file_md5_validation_p(void); +static void utc_sync_agent_framework_sync_agent_file_md5_validation_n(void); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_is_existing_fs_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_is_existing_fs_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_fs_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_fs_info_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_fs_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_fs_info_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_fs_mem_size_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_fs_mem_size_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_file_size_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_file_size_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_copy_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_copy_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_move_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_move_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_rename_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_rename_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_file_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_file_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_read_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_read_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_read_whole_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_read_whole_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_free_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_write_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_write_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_write_whole_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_write_whole_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_append_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_append_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_directory_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_directory_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_directory_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_delete_directory_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_empty_directory_contents_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_empty_directory_contents_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_rename_directory_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_rename_directory_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_directory_list_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_directory_list_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_file_md5_validation_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_file_md5_validation_n, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + /* start of TC */ +} + +static void cleanup(void) +{ + /* start of TC */ +} + +static void utc_sync_agent_framework_sync_agent_is_existing_fs_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_IS_EXISTING_FS; + int ret = 0; + + ret = sync_agent_write_whole_file(FILE_SRC, "tizen sync-agent framework", strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_is_existing_fs(FILE_SRC); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_is_existing_fs returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_file(FILE_SRC); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_is_existing_fs_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_IS_EXISTING_FS; + int ret = 0; + + ret = sync_agent_is_existing_fs(NOT_EXISTING); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_is_existing_fs returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_fs_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FS_INFO; + int ret = 0; + char *fs_info = NULL; + + ret = sync_agent_get_fs_info(&fs_info); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_get_fs_info returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_fs_info_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FS_INFO; + int ret = 0; + char *fs_info = NULL; + + ret = sync_agent_get_fs_info(NULL); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_fs_info returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_free_fs_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_FS_INFO; + int ret = 0; + char *fs_info = NULL; + + ret = sync_agent_get_fs_info(&fs_info); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_get_fs_info returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_free_fs_info(fs_info); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_free_fs_info returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_free_fs_info_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_FS_INFO; + int ret = 0; + + ret = sync_agent_free_fs_info(NULL); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_free_fs_info returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_fs_mem_size_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FS_MEM_SIZE; + int ret = 0; + long double size_free = 0; + long double size_total = 0; + + ret = sync_agent_get_fs_mem_size("/", &size_free, &size_total); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_get_fs_mem_size returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_fs_mem_size_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FS_MEM_SIZE; + int ret = 0; + long double size_free = 0; + long double size_total = 0; + + ret = sync_agent_get_fs_mem_size(NOT_EXISTING, &size_free, &size_total); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_fs_mem_size returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_file_size_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FILE_SIZE; + int ret = 0; + unsigned long size = 0; + + ret = sync_agent_write_whole_file(FILE_SRC, "tizen sync-agent framework", strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_get_file_size(FILE_SRC, &size); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_get_file_size returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_file(FILE_SRC); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_file_size_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FILE_SIZE; + int ret = 0; + unsigned long size = 0; + + ret = sync_agent_get_file_size(NOT_EXISTING, &size); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_file_size returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_copy_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_COPY_FILE; + int ret = 0; + + ret = sync_agent_write_whole_file(FILE_SRC, "tizen sync-agent framework", strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_copy_file(FILE_SRC, FILE_DST); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + sync_agent_delete_file(FILE_SRC); + dts_message(api_name, "sync_agent_copy_file returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_file(FILE_SRC); + sync_agent_delete_file(FILE_DST); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_copy_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_COPY_FILE; + int ret = 0; + + ret = sync_agent_copy_file(NOT_EXISTING, FILE_DST); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_copy_file returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_FILE; + int ret = 0; + + ret = sync_agent_write_whole_file(FILE_SRC, "tizen sync-agent framework", strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_delete_file(FILE_SRC); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_delete_file returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_FILE; + int ret = 0; + + ret = sync_agent_delete_file(NOT_EXISTING); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_delete_file returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_move_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_MOVE_FILE; + int ret = 0; + + ret = sync_agent_write_whole_file(FILE_SRC, "tizen sync-agent framework", strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_move_file(FILE_SRC, FILE_DST); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + sync_agent_delete_file(FILE_SRC); + dts_message(api_name, "sync_agent_move_file returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_file(FILE_DST); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_move_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_MOVE_FILE; + int ret = 0; + + ret = sync_agent_move_file(NOT_EXISTING, FILE_DST); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_move_file returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_rename_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_RENAME_FILE; + int ret = 0; + + ret = sync_agent_write_whole_file(FILE_SRC, "tizen sync-agent framework", strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_rename_file(FILE_SRC, FILE_DST); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + sync_agent_delete_file(FILE_SRC); + dts_message(api_name, "sync_agent_rename_file returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_file(FILE_DST); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_rename_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_RENAME_FILE; + int ret = 0; + + ret = sync_agent_rename_file(NOT_EXISTING, FILE_DST); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_rename_file returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_file_list_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FILE_LIST; + int ret = 0; + GSList *list = NULL; + + ret = sync_agent_get_file_list("./", &list); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_get_file_list returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_file_list_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_FILE_LIST; + int ret = 0; + GSList *list = NULL; + + ret = sync_agent_get_file_list(NOT_EXISTING, &list); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_file_list returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_read_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_READ_FILE; + int ret = 0; + char *contents = NULL; + unsigned long contents_len = 0; + bool final = false; + + ret = sync_agent_write_whole_file(FILE_SRC, "tizen sync-agent framework", strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_read_file(FILE_SRC, &contents, 10, &contents_len, &final); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + sync_agent_delete_file(FILE_SRC); + dts_message(api_name, "sync_agent_read_file returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_file(FILE_SRC); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_read_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_READ_FILE; + int ret = 0; + char *contents = NULL; + unsigned long contents_len = 0; + bool final = false; + + ret = sync_agent_read_file(NOT_EXISTING, &contents, 10, &contents_len, &final); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_read_file returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_read_whole_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_READ_WHOLE_FILE; + int ret = 0; + char *contents = NULL; + unsigned long contents_len = 0; + + ret = sync_agent_write_whole_file(FILE_SRC, "tizen sync-agent framework", strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_read_whole_file(FILE_SRC, &contents, &contents_len); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + sync_agent_delete_file(FILE_SRC); + dts_message(api_name, "sync_agent_read_whole_file returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_file(FILE_SRC); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_read_whole_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_READ_WHOLE_FILE; + int ret = 0; + char *contents = NULL; + unsigned long contents_len = 0; + + ret = sync_agent_read_whole_file(NOT_EXISTING, &contents, &contents_len); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_read_whole_file returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_free_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_FILE; + int ret = 0; + char *contents = NULL; + unsigned long contents_len = 0; + + ret = sync_agent_write_whole_file(FILE_SRC, "tizen sync-agent framework", strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_read_whole_file(FILE_SRC, &contents, &contents_len); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_read_whole_file returned [%d]", ret); + dts_fail(api_name); + } + + sync_agent_delete_file(FILE_SRC); + + ret = sync_agent_free_file(&contents); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_free_file returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_free_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FREE_FILE; + int ret = 0; + + ret = sync_agent_free_file(NULL); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_free_file returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_write_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_WRITE_FILE; + int ret = 0; + + ret = sync_agent_write_file(FILE_SRC, "test writing", strlen("test writing"), true, true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_file returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_file(FILE_SRC); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_write_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_WRITE_FILE; + int ret = 0; + + ret = sync_agent_write_file(FILE_SRC, NULL, strlen("test writing"), true, true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_write_file returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_write_whole_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_WRITE_WHOLE_FILE; + int ret = 0; + + ret = sync_agent_write_whole_file(FILE_SRC, "tizen sync-agent framework", strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_file(FILE_SRC); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_write_whole_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_WRITE_WHOLE_FILE; + int ret = 0; + + ret = sync_agent_write_whole_file(FILE_SRC, NULL, strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_append_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_APPEND_FILE; + int ret = 0; + + ret = sync_agent_append_file(FILE_SRC, "test writing", strlen("test writing"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_append_file returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_file(FILE_SRC); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_append_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_APPEND_FILE; + int ret = 0; + + ret = sync_agent_append_file(FILE_SRC, NULL, strlen("test writing"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_append_file returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_directory_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_DIRECTORY; + int ret = 0; + + ret = sync_agent_create_directory(DIR_SRC); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_create_directory returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_directory(DIR_SRC, true); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_directory_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_DIRECTORY; + int ret = 0; + + ret = sync_agent_create_directory(NULL); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_create_directory returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_directory_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_DIRECTORY; + int ret = 0; + + ret = sync_agent_create_directory(DIR_SRC); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_create_directory returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_delete_directory(DIR_SRC, true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_delete_directory returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_delete_directory_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DELETE_DIRECTORY; + int ret = 0; + + ret = sync_agent_delete_directory(NOT_EXISTING, true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_delete_directory returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_empty_directory_contents_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_EMPTY_DIRECTORY_CONTENTS; + int ret = 0; + + ret = sync_agent_write_whole_file(FILE_SRC, "tizen sync-agent framework", strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_create_directory(DIR_SRC); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_create_directory returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_copy_file(FILE_SRC, FILE_DST_DIR); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + sync_agent_delete_file(FILE_SRC); + sync_agent_delete_directory(DIR_SRC, true); + dts_message(api_name, "sync_agent_copy_file returned [%d]", ret); + dts_fail(api_name); + } + + sync_agent_delete_file(FILE_SRC); + + ret = sync_agent_empty_directory_contents(DIR_SRC); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + sync_agent_delete_directory(DIR_SRC, true); + dts_message(api_name, "sync_agent_empty_directory_contents returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_directory(DIR_SRC, true); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_empty_directory_contents_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_EMPTY_DIRECTORY_CONTENTS; + int ret = 0; + + ret = sync_agent_empty_directory_contents(NOT_EXISTING); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_empty_directory_contents returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_rename_directory_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_RENAME_DIRECTORY; + int ret = 0; + + ret = sync_agent_create_directory(DIR_SRC); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_create_directory returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_rename_directory(DIR_SRC, DIR_DST); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + sync_agent_delete_directory(DIR_SRC, true); + dts_message(api_name, "sync_agent_rename_directory returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_directory(DIR_DST, true); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_rename_directory_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_RENAME_DIRECTORY; + int ret = 0; + + ret = sync_agent_rename_directory(NOT_EXISTING, DIR_DST); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_rename_directory returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_directory_list_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_DIRECTORY_LIST; + int ret = 0; + GSList *list = NULL; + + ret = sync_agent_write_whole_file(FILE_SRC, "tizen sync-agent framework", strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_create_directory(DIR_SRC); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_create_directory returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_copy_file(FILE_SRC, FILE_DST_DIR); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + sync_agent_delete_file(FILE_SRC); + sync_agent_delete_directory(DIR_SRC, true); + dts_message(api_name, "sync_agent_copy_file returned [%d]", ret); + dts_fail(api_name); + } + + sync_agent_delete_file(FILE_SRC); + + ret = sync_agent_get_directory_list(DIR_SRC, &list); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + sync_agent_delete_directory(DIR_SRC, true); + dts_message(api_name, "sync_agent_get_directory_list returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_directory(DIR_SRC, true); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_directory_list_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_DIRECTORY_LIST; + int ret = 0; + GSList *list = NULL; + + ret = sync_agent_get_directory_list(NOT_EXISTING, &list); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_directory_list returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_file_md5_validation_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FILE_MD5_VALIDATION; + int ret = 0; + char *md5hash = strdup("DF8F725F131D55A19742C001AB03DC42"); + bool same = false; + + ret = sync_agent_write_whole_file(FILE_SRC, "tizen sync-agent framework", strlen("tizen sync-agent framework"), true); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_message(api_name, "sync_agent_write_whole_file returned [%d]", ret); + dts_fail(api_name); + } + + ret = sync_agent_file_md5_validation(FILE_SRC, md5hash, &same); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + sync_agent_delete_file(FILE_SRC); + dts_message(api_name, "sync_agent_file_md5_validation returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_delete_file(FILE_SRC); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_file_md5_validation_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_FILE_MD5_VALIDATION; + int ret = 0; + char *md5hash = strdup("c88ad98ef5a3368404ff42926adc4eb0"); + bool same = false; + + ret = sync_agent_file_md5_validation(NOT_EXISTING, md5hash, &same); + if (ret == SYNC_AGENT_FSAPI_FALSE) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_file_md5_validation returned [%d]", ret); + dts_fail(api_name); + } +} diff --git a/TC/testcase/utc_sync_agent_framework_initialization.c b/TC/testcase/utc_sync_agent_framework_initialization.c new file mode 100755 index 0000000..dfc2bcb --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_initialization.c @@ -0,0 +1,113 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define TEST_FW_CONFIG_FILE_P "../../../testcase/fw-test-cfg/test_fw_config.xml" +#define TEST_FW_CONFIG_FILE_N "../../../testcase/fw-test-cfg/test_fw_config_not_existing.xml" + +#define API_NAME_SYNC_AGENT_INIT "sync_agent_init" +#define API_NAME_SYNC_AGENT_DEINIT "sync_agent_deinit" + +static void utc_sync_agent_framework_sync_agent_init_p(void); +static void utc_sync_agent_framework_sync_agent_init_n(void); +static void utc_sync_agent_framework_sync_agent_deinit_p(void); +static void utc_sync_agent_framework_sync_agent_deinit_n(void); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_init_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_init_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_deinit_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_deinit_n, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + /* start of TC */ +} + +static void cleanup(void) +{ + /* start of TC */ +} + +static void utc_sync_agent_framework_sync_agent_init_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_INIT; + + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_FILE_P); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(api_name, "sync_agent_init : %d", init_error); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_init_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_INIT; + + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_FILE_N); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_init : %d", init_error); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_deinit_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DEINIT; + + sync_agent_init_error_e init_error = sync_agent_deinit(); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(api_name, "sync_agent_deinit : %d", init_error); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_deinit_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DEINIT; + +// Trying to deinitialize without initializing.. + sync_agent_init_error_e init_error = sync_agent_deinit(); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_deinit : %d", init_error); + dts_fail(api_name); + } +} diff --git a/TC/testcase/utc_sync_agent_framework_network_access.c b/TC/testcase/utc_sync_agent_framework_network_access.c new file mode 100755 index 0000000..4fde6e8 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_network_access.c @@ -0,0 +1,389 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +unsigned int session_id = 0; + +#define TEST_FW_CONFIG_FILE "../../../testcase/fw-test-cfg/test_fw_config.xml" + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_AGENT_OPEN_CONNECTION "sync_agent_open_connection" +#define API_NAME_SYNC_AGENT_GET_STATUS "sync_agent_get_status" +#define API_NAME_SYNC_AGENT_CHECK_NETWORK_STATUS "sync_agent_check_network_status" +#define API_NAME_SYNC_AGENT_GET_CONNECTION_TYPE "sync_agent_get_connection_type" +#define API_NAME_SYNC_AGENT_GET_CONNECTION_STATE "sync_agent_get_connection_state" +#define API_NAME_SYNC_AGENT_SEND_MSG "sync_agent_send_msg" +#define API_NAME_SYNC_AGENT_GET_HEADER_INFO "sync_agent_get_header_info" +#define API_NAME_SYNC_AGENT_CANCEL_MSG "sync_agent_cancel_msg" +#define API_NAME_SYNC_AGENT_ADD_AUTHENTICATION_INFO "sync_agent_add_authentication_info" +#define API_NAME_SYNC_AGENT_CLOSE_CONNECTION "sync_agent_close_connection" +#define API_NAME_SYNC_AGENT_DESTROY_NETOWK_ACCESS "sync_agent_destroy_netowk_access" + +static void utc_sync_agent_framework_sync_agent_open_connection_p(void); +static void utc_sync_agent_framework_sync_agent_open_connection_n(void); +static void utc_sync_agent_framework_sync_agent_get_status_p(void); +static void utc_sync_agent_framework_sync_agent_get_status_n(void); +static void utc_sync_agent_framework_sync_agent_check_network_status_p(void); +static void utc_sync_agent_framework_sync_agent_check_network_status_n(void); +static void utc_sync_agent_framework_sync_agent_get_connection_type_p(void); +static void utc_sync_agent_framework_sync_agent_get_connection_type_n(void); +static void utc_sync_agent_framework_sync_agent_get_connection_state_p(void); +static void utc_sync_agent_framework_sync_agent_get_connection_state_n(void); +static void utc_sync_agent_framework_sync_agent_send_msg_p(void); +static void utc_sync_agent_framework_sync_agent_send_msg_n(void); +static void utc_sync_agent_framework_sync_agent_get_header_info_p(void); +static void utc_sync_agent_framework_sync_agent_get_header_info_n(void); +static void utc_sync_agent_framework_sync_agent_cancel_msg_p(void); +static void utc_sync_agent_framework_sync_agent_cancel_msg_n(void); +static void utc_sync_agent_framework_sync_agent_add_authentication_info_p(void); +static void utc_sync_agent_framework_sync_agent_add_authentication_info_n(void); +static void utc_sync_agent_framework_sync_agent_close_connection_p(void); +static void utc_sync_agent_framework_sync_agent_close_connection_n(void); +static void utc_sync_agent_framework_sync_agent_destroy_netowk_access_p(void); // actually is "positive" case but given "negative" because of execution order + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_open_connection_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_open_connection_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_status_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_status_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_check_network_status_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_check_network_status_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_connection_type_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_connection_type_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_connection_state_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_connection_state_n, NEGATIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_send_msg_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_send_msg_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_header_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_header_info_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_cancel_msg_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_cancel_msg_n, NEGATIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_add_authentication_info_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_authentication_info_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_close_connection_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_close_connection_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_destroy_netowk_access_p, NEGATIVE_TC_IDX}, // actually is "positive" case but given "negative" because of execution order + {NULL, 0} +}; + +static void startup(void) +{ + /* start of TC */ + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(API_NAME_SYNC_START_UP, "sync_agent_init : %d", init_error); + dts_fail(API_NAME_SYNC_START_UP); + } else { + dts_pass(API_NAME_SYNC_START_UP); + } +} + +static void cleanup(void) +{ + /* start of TC */ +} + +static void utc_sync_agent_framework_sync_agent_open_connection_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_OPEN_CONNECTION; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + + ret = sync_agent_open_connection(1, 30, &session_id); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_message(api_name, "sync_agent_open_connection returned code [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_open_connection_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_OPEN_CONNECTION; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + + ret = sync_agent_open_connection(2, 30, &session_id); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_open_connection returned code [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_status_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_STATUS; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + double status = 0; + + ret = sync_agent_get_status(1, session_id, SYNC_AGENT_NA_STATUS_ELAPSED_TIME, &status); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_message(api_name, "sync_agent_get_status returned code [%ld]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_status_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_STATUS; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + double status = 0; + + ret = sync_agent_get_status(2, session_id, SYNC_AGENT_NA_STATUS_ELAPSED_TIME, &status); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_status returned code [%ld]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_check_network_status_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CHECK_NETWORK_STATUS; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + int interval = 1; + int retry_cnt = 3; + + ret = sync_agent_check_network_status(interval, retry_cnt); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_message(api_name, "sync_agent_check_network_status returned code [%ld]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_check_network_status_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CHECK_NETWORK_STATUS; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + int interval = -1; + int retry_cnt = 3; + + ret = sync_agent_check_network_status(interval, retry_cnt); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_check_network_status returned code [%ld]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_connection_type_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_CONNECTION_TYPE; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + sync_agent_na_network_connection_type_e con_type = SYNC_AGENT_NA_NETWORK_CONNECTION_TYPE_UNKNOWN; + + ret = sync_agent_get_connection_type(&con_type); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_message(api_name, "sync_agent_get_connection_type returned code [%ld]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_connection_type_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_CONNECTION_TYPE; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + + ret = sync_agent_get_connection_type(NULL); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_connection_type returned code [%ld]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_connection_state_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_CONNECTION_STATE; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + sync_agent_na_network_connection_state_e con_state = SYNC_AGENT_NA_NETWORK_CONNECTION_STATE_NONE; + + ret = sync_agent_get_connection_state(&con_state); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_message(api_name, "sync_agent_get_connection_state returned code [%ld]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_connection_state_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_CONNECTION_STATE; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + + ret = sync_agent_get_connection_state(NULL); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_connection_state returned code [%ld]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_send_msg_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SEND_MSG; + + dts_pass(api_name); +} + +static void utc_sync_agent_framework_sync_agent_send_msg_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SEND_MSG; + + dts_pass(api_name); +} + +static void utc_sync_agent_framework_sync_agent_get_header_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_HEADER_INFO; + + dts_pass(api_name); +} + +static void utc_sync_agent_framework_sync_agent_get_header_info_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_HEADER_INFO; + + dts_pass(api_name); +} + +static void utc_sync_agent_framework_sync_agent_cancel_msg_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CANCEL_MSG; + + dts_pass(api_name); +} + +static void utc_sync_agent_framework_sync_agent_cancel_msg_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CANCEL_MSG; + + dts_pass(api_name); +} + +static void utc_sync_agent_framework_sync_agent_add_authentication_info_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_AUTHENTICATION_INFO; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + + ret = sync_agent_add_authentication_info(1, "user", "password", session_id); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_message(api_name, "sync_agent_add_authentication_info returned code [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_authentication_info_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_AUTHENTICATION_INFO; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + + ret = sync_agent_add_authentication_info(2, "user", "password", session_id); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_add_authentication_info returned code [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_close_connection_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CLOSE_CONNECTION; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + + ret = sync_agent_close_connection(1, session_id); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_message(api_name, "sync_agent_close_connection returned code [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_close_connection_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CLOSE_CONNECTION; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + + ret = sync_agent_close_connection(2, session_id); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_close_connection returned code [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_destroy_netowk_access_p(void) // actually is "positive" case but given "negative" because of execution order +{ + char *api_name = API_NAME_SYNC_AGENT_DESTROY_NETOWK_ACCESS; + + sync_agent_na_result_e ret = SYNC_AGENT_NA_SUCCESS; + + ret = sync_agent_destroy_netowk_access(); + if (ret != SYNC_AGENT_NA_SUCCESS) { + dts_message(api_name, "sync_agent_destroy_netowk_access returned code [%ld]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} diff --git a/TC/testcase/utc_sync_agent_framework_platform_monitor.c b/TC/testcase/utc_sync_agent_framework_platform_monitor.c new file mode 100755 index 0000000..a1a881c --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_platform_monitor.c @@ -0,0 +1,237 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> +#include <plugin/plugin_slp_sysnoti_alarm.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static int alarm_id = 0; +static int alarm_id_invalid = 0; + +#define TEST_FW_CONFIG_FILE "../../../testcase/fw-test-cfg/test_fw_config.xml" + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_AGNET_REGISTER_USER_CALLBACK "sync_agnet_register_user_callback" +#define API_NAME_SYNC_AGENT_ADD_SERVICE_DATA "sync_agent_add_service_data" +#define API_NAME_SYNC_AGENT_GET_SERVICE_DATA "sync_agent_get_service_data" +#define API_NAME_SYNC_AGENT_REMOVE_SERVICE_DATA "sync_agent_remove_service_data" +#define API_NAME_SYNC_AGENT_UNREGISTER_SERVICE_NOTI "sync_agent_unregister_service_noti" + +static void utc_sync_agent_framework_sync_agnet_register_user_callback_p(void); +static void utc_sync_agent_framework_sync_agnet_register_user_callback_n(void); +static void utc_sync_agent_framework_sync_agent_add_service_data_p(void); +static void utc_sync_agent_framework_sync_agent_add_service_data_n(void); +static void utc_sync_agent_framework_sync_agent_get_service_data_p(void); +static void utc_sync_agent_framework_sync_agent_get_service_data_n(void); +static void utc_sync_agent_framework_sync_agent_remove_service_data_p(void); +static void utc_sync_agent_framework_sync_agent_remove_service_data_n(void); +static void utc_sync_agent_framework_sync_agent_unregister_service_noti_p(void); +static void utc_sync_agent_framework_sync_agent_unregister_service_noti_n(void); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agnet_register_user_callback_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agnet_register_user_callback_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_service_data_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_service_data_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_service_data_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_service_data_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_remove_service_data_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_remove_service_data_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_unregister_service_noti_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_unregister_service_noti_n, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + /* start of TC */ + sync_agent_init_error_e init_error = sync_agent_init(TEST_FW_CONFIG_FILE); + if (init_error != SYNC_AGENT_INIT_SUCCESS) { + dts_message(API_NAME_SYNC_START_UP, "sync_agent_init : %d", init_error); + dts_fail(API_NAME_SYNC_START_UP); + } else { + dts_pass(API_NAME_SYNC_START_UP); + } +} + +static void cleanup(void) +{ + /* start of TC */ +} + +int alarm_cb(int item_id, void *user_data) +{ + return 0; +} + +static void utc_sync_agent_framework_sync_agnet_register_user_callback_p(void) +{ + char *api_name = API_NAME_SYNC_AGNET_REGISTER_USER_CALLBACK; + + sync_agent_pm_return_e ret = sync_agnet_register_user_callback(1, NULL, 1, alarm_cb); + if (ret != SYNC_AGENT_PM_SUCCESS) { + dts_message(api_name, "sync_agnet_register_user_callback returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agnet_register_user_callback_n(void) +{ + char *api_name = API_NAME_SYNC_AGNET_REGISTER_USER_CALLBACK; + + sync_agent_pm_return_e ret = sync_agnet_register_user_callback(3, NULL, 1, alarm_cb); + if (ret != SYNC_AGENT_PM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agnet_register_user_callback returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_service_data_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_SERVICE_DATA; + + pmci_alarm_s *alarm_info = (pmci_alarm_s *) calloc(1, sizeof(pmci_alarm_s)); + alarm_info->start_alarm_time = g_strdup("2014-12-13T15:32:17Z"); + alarm_info->is_disposable = 0; + alarm_info->repeat_type = REPEAT; + alarm_info->repeat_value = 5 * 60; + + sync_agent_pm_return_e ret = sync_agent_add_service_data(1, alarm_info, &alarm_id); + if (ret != SYNC_AGENT_PM_SUCCESS) { + dts_message(api_name, "sync_agent_add_service_data returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_service_data_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_SERVICE_DATA; + + pmci_alarm_s *alarm_info = (pmci_alarm_s *) calloc(1, sizeof(pmci_alarm_s)); + alarm_info->start_alarm_time = g_strdup("2014-12-13T15:32:17Z"); + alarm_info->is_disposable = 0; + alarm_info->repeat_type = REPEAT; + alarm_info->repeat_value = 5 * 60; + + sync_agent_pm_return_e ret = sync_agent_add_service_data(3, alarm_info, &alarm_id_invalid); + if (ret != SYNC_AGENT_PM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_add_service_data returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_service_data_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_SERVICE_DATA; + + pmci_alarm_s *alarm_info = NULL; + + sync_agent_pm_return_e ret = sync_agent_get_service_data(1, alarm_id, &alarm_info); + if (ret != SYNC_AGENT_PM_SUCCESS) { + dts_message(api_name, "sync_agent_get_service_data returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_service_data_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_SERVICE_DATA; + + pmci_alarm_s *alarm_info = NULL; + + sync_agent_pm_return_e ret = sync_agent_get_service_data(1, alarm_id_invalid, &alarm_info); + if (ret != SYNC_AGENT_PM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_service_data returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_remove_service_data_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_REMOVE_SERVICE_DATA; + + sync_agent_pm_return_e ret = sync_agent_remove_service_data(1, alarm_id); + if (ret != SYNC_AGENT_PM_SUCCESS) { + dts_message(api_name, "sync_agent_remove_service_data returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_remove_service_data_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_REMOVE_SERVICE_DATA; + + sync_agent_pm_return_e ret = sync_agent_remove_service_data(1, alarm_id_invalid); + if (ret != SYNC_AGENT_PM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_remove_service_data returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_unregister_service_noti_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UNREGISTER_SERVICE_NOTI; + + sync_agent_pm_return_e ret = sync_agent_unregister_service_noti(1); + if (ret != SYNC_AGENT_PM_SUCCESS) { + dts_message(api_name, "sync_agent_unregister_service_noti returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_unregister_service_noti_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UNREGISTER_SERVICE_NOTI; + + sync_agent_pm_return_e ret = sync_agent_unregister_service_noti(3); + if (ret != SYNC_AGENT_PM_SUCCESS) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_unregister_service_noti returned [%d]", ret); + dts_fail(api_name); + } +} diff --git a/TC/testcase/utc_sync_agent_framework_protocol_binder.c b/TC/testcase/utc_sync_agent_framework_protocol_binder.c new file mode 100755 index 0000000..6928510 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_protocol_binder.c @@ -0,0 +1,1586 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define API_NAME_SYNC_AGENT_INIT_BINDER_FUNCTION_SET "sync_agent_init_binder_function_set" +#define API_NAME_SYNC_AGENT_INIT_PROTOCOL_BINDER "sync_agent_init_protocol_binder" +#define API_NAME_SYNC_AGENT_INIT_REVERSE_PROTOCOL_BINDER "sync_agent_init_reverse_protocol_binder" +#define API_NAME_SYNC_AGENT_ADD_BINDER_FUNCTION_SET "sync_agent_add_binder_function_set" +#define API_NAME_SYNC_AGENT_APPEND_ELEMENT "sync_agent_append_element" +#define API_NAME_SYNC_AGENT_NEXT_ELEMENT "sync_agent_next_element" +#define API_NAME_SYNC_AGENT_GET_STREAM_FROM_PROTOCOL_BINDER "sync_agent_get_stream_from_protocol_binder" +#define API_NAME_SYNC_AGENT_GET_STREAM_SIZE_FROM_PROTOCOL_BINDER "sync_agent_get_stream_size_from_protocol_binder" +#define API_NAME_SYNC_AGENT_GET_ENCODING_FROM_PROTOCOL_BINDER "sync_agent_get_encoding_from_protocol_binder" +#define API_NAME_SYNC_AGENT_GET_XML_FOR_DEBUGGING_FROM_PROTOCOL_BINDER "sync_agent_get_xml_from_protocol_binder" +#define API_NAME_SYNC_AGENT_GET_XML_FOR_DEBUGGING_FROM_REVERSE_PROTOCOL_BINDER "sync_agent_get_xml_from_reverse_protocol_binder" +#define API_NAME_SYNC_AGENT_GET_USER_DATA_FROM_REVERSE_PROTOCOL_BINDER "sync_agent_get_user_data_from_reverse_protocol_binder" + +#define API_NAME_SYNC_AGENT_SWITCH_PROTOCOL "sync_agent_switch_protocol" +#define API_NAME_SYNC_AGENT_UNDO_SWITCH_PROTOCOL "sync_agent_undo_switch_protocol" +#define API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME "sync_agent_create_node" +#define API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE "sync_agent_create_node_with_namespace" +#define API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME_WITH_TEXT "sync_agent_create_text_node" +#define API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE_WITH_TEXT "sync_agent_create_text_node_with_namespace" +#define API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME_WITH_CDATA "sync_agent_create_cdata_node" +#define API_NAME_SYNC_AGENT_CREATE_WBXML_TREE "sync_agent_create_wbxml_tree" +#define API_NAME_SYNC_AGENT_ADD_WBXML_TREE_TO_WBXML_NODE "sync_agent_add_wbxml_tree_to_wbxml_node" +#define API_NAME_SYNC_AGENT_SET_WBXML_TREE_ROOT "sync_agent_set_wbxml_tree_root" +#define API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME "sync_agent_add_child_node" +#define API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE "sync_agent_add_child_node_with_namespace" +#define API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_WITH_TEXT "sync_agent_add_child_text_node" +#define API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE_WITH_TEXT "sync_agent_add_child_text_node_with_namespace" +#define API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_WITH_CDATA "sync_agent_add_child_cdata_node" +#define API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_WITH_INT "sync_agent_add_child_int_node" +#define API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE_WITH_INT "sync_agent_add_child_int_node_with_namespace" +#define API_NAME_SYNC_AGENT_GET_XML_NAME_FROM_ELEMENT_WBXML_NODE "sync_agent_get_name_from_element_node" +#define API_NAME_SYNC_AGENT_GET_NAMESPACE_FROM_ELEMENT_WBXML_NODE "sync_agent_get_namespace_from_element_node" +#define API_NAME_SYNC_AGENT_GET_TEXT_POINTER_FROM_WBXML_NODE "sync_agent_get_text_from_node" +#define API_NAME_SYNC_AGENT_GET_BINARY_POINTER_FROM_WBXML_NODE "sync_agent_get_binary_from_node" +#define API_NAME_SYNC_AGENT_GET_INT_FROM_WBXML_NODE "sync_agent_get_int_from_node" +#define API_NAME_SYNC_AGENT_GET_TEXT_POINTER_FROM_WBXML_CDATA_NODE "sync_agent_get_text_from_cdata_node" +#define API_NAME_SYNC_AGENT_DESTROY_WBXML_NODE "sync_agent_destroy_wbxml_node" + +sync_agent_pb_protocol_binder_function_set_s *binder_function_set = NULL; +sync_agent_pb_protocol_binder_info_s *binder = NULL; +sync_agent_pb_protocol_binder_reverse_info_s *reverse_binder = NULL; + +WBXMLTreeNode *node = NULL; +WBXMLTreeNode *node_child = NULL; +WBXMLTree *tree = NULL; + +static sync_agent_pb_error_e start_converter_function(sync_agent_pb_protocol_binder_info_s * pBinder, Content_Ptr pContent, WBXMLTreeNode ** ppWbxml_dom_node); +static sync_agent_pb_error_e header_converter_function(sync_agent_pb_protocol_binder_info_s * pBinder, Content_Ptr pContent, WBXMLTreeNode ** ppWbxml_dom_node); +static sync_agent_pb_error_e body_start_converter_function(sync_agent_pb_protocol_binder_info_s * pBinder, Content_Ptr pContent, WBXMLTreeNode ** ppWbxml_dom_node); +static sync_agent_pb_error_e final_converter_function(sync_agent_pb_protocol_binder_info_s * pBinder, Content_Ptr pContent, WBXMLTreeNode ** ppWbxml_dom_node); +static sync_agent_pb_error_e results_command_converter_function(sync_agent_pb_protocol_binder_info_s * pBinder, Content_Ptr pContent, WBXMLTreeNode ** ppWbxml_dom_node); + +static sync_agent_pb_error_e header_reverse_converter_function(sync_agent_pb_protocol_binder_reverse_info_s * reverse_binder, WBXMLTreeNode * wbxml_dom_node, Content_Ptr * content); +static sync_agent_pb_error_e final_reverse_converter_function(sync_agent_pb_protocol_binder_reverse_info_s * reverse_binder, WBXMLTreeNode * wbxml_dom_node, Content_Ptr * content); +static sync_agent_pb_error_e results_command_reverse_converter_function(sync_agent_pb_protocol_binder_reverse_info_s * reverse_binder, WBXMLTreeNode * wbxml_dom_node, Content_Ptr * content); + +typedef enum { + PE_UNDEF = 0, PE_ERROR, PE_ADD, PE_ALERT, PE_ATOMIC_START, PE_ATOMIC_END, PE_COPY, PE_DELETE, PE_EXEC, PE_GET, + PE_MAP, PE_PUT_START, PE_PUT_END, PE_RESULTS_START, PE_RESULTS_END, PE_SEARCH, PE_SEQUENCE_START, PE_SEQUENCE_END, + PE_STATUS, PE_SYNC_START, PE_SYNC_END, PE_REPLACE, PE_HEADER, PE_PUT_GET, PE_CMD_GROUP, PE_GENERIC, PE_FINAL, PE_DEVINF, + PE_SYNCML_START, PE_SYNCML_END, PE_BODY_START, PE_BODY_END +} protocol_element_e; + +const sync_agent_pb_function_info_s binder_function_info[8] = { + {PE_SYNCML_START, "SyncML", start_converter_function, NULL, false}, + {PE_SYNCML_END, "/SyncML", NULL, NULL, false}, + {PE_HEADER, "SyncHdr", header_converter_function, header_reverse_converter_function, true}, + {PE_BODY_START, "SyncBody", body_start_converter_function, NULL, false}, + {PE_BODY_END, "/SyncBody", NULL, NULL, false}, + {PE_FINAL, "Final", final_converter_function, final_reverse_converter_function, true}, + {PE_RESULTS_START, "Results", results_command_converter_function, results_command_reverse_converter_function, false}, + {PE_RESULTS_END, "/Results", NULL, NULL, false} +}; + +const sync_agent_pb_function_info_s binder_function_info_additional[8] = { + {PE_SYNCML_START, "SyncML", start_converter_function, NULL, false}, + {PE_SYNCML_END, "/SyncML", NULL, NULL, false}, + {PE_HEADER, "SyncHdr", header_converter_function, header_reverse_converter_function, true}, + {PE_BODY_START, "SyncBody", body_start_converter_function, NULL, false}, + {PE_BODY_END, "/SyncBody", NULL, NULL, false}, + {PE_FINAL, "Final", final_converter_function, final_reverse_converter_function, true}, + {PE_RESULTS_START, "Results", results_command_converter_function, results_command_reverse_converter_function, false}, + {PE_RESULTS_END, "/Results", NULL, NULL, false} +}; + +static void utc_sync_agent_framework_sync_agent_init_binder_function_set_p(void); +static void utc_sync_agent_framework_sync_agent_init_binder_function_set_n(void); +static void utc_sync_agent_framework_sync_agent_init_protocol_binder_p(void); +static void utc_sync_agent_framework_sync_agent_init_protocol_binder_n(void); +static void utc_sync_agent_framework_sync_agent_init_reverse_protocol_binder_p(void); +static void utc_sync_agent_framework_sync_agent_init_reverse_protocol_binder_n(void); +static void utc_sync_agent_framework_sync_agent_add_binder_function_set_p(void); +static void utc_sync_agent_framework_sync_agent_add_binder_function_set_n(void); +static void utc_sync_agent_framework_sync_agent_append_element_p(void); +static void utc_sync_agent_framework_sync_agent_append_element_n(void); +static void utc_sync_agent_framework_sync_agent_next_element_p(void); +static void utc_sync_agent_framework_sync_agent_next_element_n(void); +static void utc_sync_agent_framework_sync_agent_get_stream_from_protocol_binder_p(void); +static void utc_sync_agent_framework_sync_agent_get_stream_from_protocol_binder_n(void); +static void utc_sync_agent_framework_sync_agent_get_stream_size_from_protocol_binder_p(void); +static void utc_sync_agent_framework_sync_agent_get_stream_size_from_protocol_binder_n(void); +static void utc_sync_agent_framework_sync_agent_get_encoding_from_protocol_binder_p(void); +static void utc_sync_agent_framework_sync_agent_get_encoding_from_protocol_binder_n(void); +static void utc_sync_agent_framework_sync_agent_get_xml_for_debugging_from_protocol_binder_p(void); +static void utc_sync_agent_framework_sync_agent_get_xml_for_debugging_from_protocol_binder_n(void); +static void utc_sync_agent_framework_sync_agent_get_xml_for_debugging_from_reverse_protocol_binder_p(void); +static void utc_sync_agent_framework_sync_agent_get_xml_for_debugging_from_reverse_protocol_binder_n(void); +static void utc_sync_agent_framework_sync_agent_get_user_data_from_reverse_protocol_binder_p(void); +static void utc_sync_agent_framework_sync_agent_get_user_data_from_reverse_protocol_binder_n(void); + +static void utc_sync_agent_framework_sync_agent_switch_protocol_p(void); +static void utc_sync_agent_framework_sync_agent_switch_protocol_n(void); +static void utc_sync_agent_framework_sync_agent_undo_switch_protocol_p(void); +static void utc_sync_agent_framework_sync_agent_undo_switch_protocol_n(void); +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_p(void); +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_n(void); +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_and_namespace_p(void); +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_and_namespace_n(void); +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_with_text_p(void); +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_with_text_n(void); +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_and_namespace_with_text_p(void); +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_and_namespace_with_text_n(void); +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_with_cdata_p(void); +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_with_cdata_n(void); +static void utc_sync_agent_framework_sync_agent_create_wbxml_tree_p(void); +static void utc_sync_agent_framework_sync_agent_create_wbxml_tree_n(void); +static void utc_sync_agent_framework_sync_agent_add_wbxml_tree_to_wbxml_node_p(void); +static void utc_sync_agent_framework_sync_agent_add_wbxml_tree_to_wbxml_node_n(void); +static void utc_sync_agent_framework_sync_agent_set_wbxml_tree_root_p(void); +static void utc_sync_agent_framework_sync_agent_set_wbxml_tree_root_n(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_p(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_n(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_p(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_n(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_text_p(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_text_n(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_with_text_p(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_with_text_n(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_cdata_p(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_cdata_n(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_int_p(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_int_n(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_with_int_p(void); +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_with_int_n(void); +static void utc_sync_agent_framework_sync_agent_get_xml_name_from_element_wbxml_node_p(void); +static void utc_sync_agent_framework_sync_agent_get_xml_name_from_element_wbxml_node_n(void); +static void utc_sync_agent_framework_sync_agent_get_namespace_from_element_wbxml_node_p(void); +static void utc_sync_agent_framework_sync_agent_get_namespace_from_element_wbxml_node_n(void); +static void utc_sync_agent_framework_sync_agent_get_text_pointer_from_wbxml_node_p(void); +static void utc_sync_agent_framework_sync_agent_get_text_pointer_from_wbxml_node_n(void); +static void utc_sync_agent_framework_sync_agent_get_binary_pointer_from_wbxml_node_p(void); +static void utc_sync_agent_framework_sync_agent_get_binary_pointer_from_wbxml_node_n(void); +static void utc_sync_agent_framework_sync_agent_get_int_from_wbxml_node_p(void); +static void utc_sync_agent_framework_sync_agent_get_int_from_wbxml_node_n(void); +static void utc_sync_agent_framework_sync_agent_get_text_pointer_from_wbxml_cdata_node_p(void); +static void utc_sync_agent_framework_sync_agent_get_text_pointer_from_wbxml_cdata_node_n(void); +static void utc_sync_agent_framework_sync_agent_destroy_wbxml_node_p(void); +static void utc_sync_agent_framework_sync_agent_destroy_wbxml_node_n(void); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_init_binder_function_set_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_init_binder_function_set_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_init_protocol_binder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_init_protocol_binder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_init_reverse_protocol_binder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_init_reverse_protocol_binder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_binder_function_set_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_binder_function_set_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_append_element_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_append_element_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_next_element_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_next_element_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_stream_from_protocol_binder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_stream_from_protocol_binder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_stream_size_from_protocol_binder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_stream_size_from_protocol_binder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_encoding_from_protocol_binder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_encoding_from_protocol_binder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_xml_for_debugging_from_protocol_binder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_xml_for_debugging_from_protocol_binder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_xml_for_debugging_from_reverse_protocol_binder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_xml_for_debugging_from_reverse_protocol_binder_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_user_data_from_reverse_protocol_binder_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_user_data_from_reverse_protocol_binder_n, NEGATIVE_TC_IDX}, + + {utc_sync_agent_framework_sync_agent_switch_protocol_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_switch_protocol_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_undo_switch_protocol_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_undo_switch_protocol_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_and_namespace_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_and_namespace_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_with_text_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_with_text_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_and_namespace_with_text_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_and_namespace_with_text_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_with_cdata_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_with_cdata_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_wbxml_tree_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_wbxml_tree_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_wbxml_tree_to_wbxml_node_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_wbxml_tree_to_wbxml_node_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_set_wbxml_tree_root_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_set_wbxml_tree_root_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_text_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_text_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_with_text_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_with_text_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_cdata_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_cdata_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_int_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_int_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_with_int_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_with_int_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_xml_name_from_element_wbxml_node_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_xml_name_from_element_wbxml_node_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_namespace_from_element_wbxml_node_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_namespace_from_element_wbxml_node_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_text_pointer_from_wbxml_node_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_text_pointer_from_wbxml_node_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_binary_pointer_from_wbxml_node_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_binary_pointer_from_wbxml_node_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_int_from_wbxml_node_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_int_from_wbxml_node_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_text_pointer_from_wbxml_cdata_node_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_text_pointer_from_wbxml_cdata_node_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_destroy_wbxml_node_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_destroy_wbxml_node_n, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + /* start of TC */ +} + +static void cleanup(void) +{ + /* start of TC */ +} + +static void utc_sync_agent_framework_sync_agent_init_binder_function_set_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_INIT_BINDER_FUNCTION_SET; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_init_binder_function_set(sizeof(binder_function_info) / sizeof(sync_agent_pb_function_info_s), (sync_agent_pb_function_info_s *) binder_function_info, &binder_function_set); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_message(api_name, "sync_agent_init_binder_function_set returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_init_binder_function_set_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_INIT_BINDER_FUNCTION_SET; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_init_binder_function_set(sizeof(binder_function_info) / sizeof(sync_agent_pb_function_info_s), NULL, &binder_function_set); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_init_binder_function_set returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_init_protocol_binder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_INIT_PROTOCOL_BINDER; + + binder = sync_agent_init_protocol_binder(binder, SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12, NULL, SYNC_AGENT_PB_ENCODING_XML, false, false, false, true, false, NULL, NULL, binder_function_set); + if (binder == NULL) { + dts_message(api_name, "sync_agent_init_protocol_binder returned NULL"); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_init_protocol_binder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_INIT_PROTOCOL_BINDER; + + binder = sync_agent_init_protocol_binder(binder, SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12, NULL, SYNC_AGENT_PB_ENCODING_XML, false, false, false, true, false, NULL, NULL, NULL); + if (binder == NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_init_protocol_binder returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_init_reverse_protocol_binder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_INIT_REVERSE_PROTOCOL_BINDER; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12; + char *xml_stream = NULL; + unsigned long xml_stream_length = 0; + + sync_agent_read_whole_file("../../../testcase/fw-test-file/sample_xml", &xml_stream, &xml_stream_length); + + ret = sync_agent_init_reverse_protocol_binder(xml_stream, xml_stream_length, SYNC_AGENT_PB_DECODING_XML, &protocol, binder_function_set, "user data", &reverse_binder); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_message(api_name, "sync_agent_init_reverse_protocol_binder returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_init_reverse_protocol_binder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_INIT_REVERSE_PROTOCOL_BINDER; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12; + + ret = sync_agent_init_reverse_protocol_binder("wrong xml", strlen("wrong xml"), SYNC_AGENT_PB_DECODING_XML, &protocol, binder_function_set, "user data", &reverse_binder); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_init_reverse_protocol_binder returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_binder_function_set_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_BINDER_FUNCTION_SET; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_add_binder_function_set(binder_function_set, sizeof(binder_function_info_additional) / sizeof(sync_agent_pb_function_info_s), (sync_agent_pb_function_info_s *) binder_function_info_additional); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_message(api_name, "sync_agent_add_binder_function_set returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_binder_function_set_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_BINDER_FUNCTION_SET; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_add_binder_function_set(binder_function_set, sizeof(binder_function_info_additional) / sizeof(sync_agent_pb_function_info_s), NULL); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_add_binder_function_set returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_append_element_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_APPEND_ELEMENT; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_append_element(binder, PE_SYNCML_START, NULL); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_message(api_name, "sync_agent_append_element returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_append_element_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_APPEND_ELEMENT; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_append_element(NULL, PE_SYNCML_START, NULL); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_append_element returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_next_element_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_NEXT_ELEMENT; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + Protocol_Element protocol_element = PE_UNDEF; + char *protocol_element_name = NULL; + Content_Ptr content = NULL; + + ret = sync_agent_next_element(binder, &protocol_element, &protocol_element_name, &content); + if (ret != SYNC_AGENT_PB_RETURN_OK && ret != SYNC_AGENT_PB_RETURN_HAS_NO_MORE_ELEMENT) { + dts_message(api_name, "sync_agent_append_element returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_next_element_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_NEXT_ELEMENT; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + Protocol_Element protocol_element = PE_UNDEF; + char *protocol_element_name = NULL; + Content_Ptr content = NULL; + + ret = sync_agent_next_element(NULL, &protocol_element, &protocol_element_name, &content); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_append_element returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_stream_from_protocol_binder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_STREAM_FROM_PROTOCOL_BINDER; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *stream = NULL; + unsigned int stream_len = 0; + + ret = sync_agent_get_stream_from_protocol_binder(binder, &stream, &stream_len); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_message(api_name, "sync_agent_get_stream_from_protocol_binder returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_stream_from_protocol_binder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_STREAM_FROM_PROTOCOL_BINDER; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *stream = NULL; + unsigned int stream_len = 0; + + ret = sync_agent_get_stream_from_protocol_binder(binder, NULL, &stream_len); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_stream_from_protocol_binder returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_stream_size_from_protocol_binder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_STREAM_SIZE_FROM_PROTOCOL_BINDER; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + unsigned int stream_len = 0; + + ret = sync_agent_get_stream_size_from_protocol_binder(binder, &stream_len); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_message(api_name, "sync_agent_get_stream_size_from_protocol_binder returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_stream_size_from_protocol_binder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_STREAM_SIZE_FROM_PROTOCOL_BINDER; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + unsigned int stream_len = 0; + + ret = sync_agent_get_stream_size_from_protocol_binder(NULL, &stream_len); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_stream_size_from_protocol_binder returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_encoding_from_protocol_binder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_ENCODING_FROM_PROTOCOL_BINDER; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_UNKNOWN; + + ret = sync_agent_get_encoding_from_protocol_binder(binder, &encoding); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_message(api_name, "sync_agent_get_encoding_from_protocol_binder returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_encoding_from_protocol_binder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_ENCODING_FROM_PROTOCOL_BINDER; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + sync_agent_pb_encoding_e encoding = SYNC_AGENT_PB_ENCODING_UNKNOWN; + + ret = sync_agent_get_encoding_from_protocol_binder(NULL, &encoding); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_encoding_from_protocol_binder returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_xml_for_debugging_from_protocol_binder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_XML_FOR_DEBUGGING_FROM_PROTOCOL_BINDER; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *xml = NULL; + unsigned int xml_len = 0; + + ret = sync_agent_get_xml_from_protocol_binder(binder, &xml, &xml_len); + if (ret != SYNC_AGENT_PB_RETURN_OK && ret != SYNC_AGENT_PB_RETURN_NOT_SUPPORT_FOR_XML_ENCODING) { + dts_message(api_name, "sync_agent_get_xml_from_protocol_binder returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_xml_for_debugging_from_protocol_binder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_XML_FOR_DEBUGGING_FROM_PROTOCOL_BINDER; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *xml = NULL; + unsigned int xml_len = 0; + + ret = sync_agent_get_xml_from_protocol_binder(NULL, &xml, &xml_len); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_xml_from_protocol_binder returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_xml_for_debugging_from_reverse_protocol_binder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_XML_FOR_DEBUGGING_FROM_REVERSE_PROTOCOL_BINDER; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *xml = NULL; + unsigned int xml_len = 0; + + ret = sync_agent_get_xml_from_reverse_protocol_binder(reverse_binder, &xml, &xml_len); + if (ret != SYNC_AGENT_PB_RETURN_OK && ret != SYNC_AGENT_PB_RETURN_NOT_SUPPORT_FOR_XML_DECODING) { + dts_message(api_name, "sync_agent_get_xml_from_reverse_protocol_binder returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_xml_for_debugging_from_reverse_protocol_binder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_XML_FOR_DEBUGGING_FROM_REVERSE_PROTOCOL_BINDER; + + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *xml = NULL; + unsigned int xml_len = 0; + + ret = sync_agent_get_xml_from_reverse_protocol_binder(NULL, &xml, &xml_len); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_xml_from_reverse_protocol_binder returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_user_data_from_reverse_protocol_binder_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_USER_DATA_FROM_REVERSE_PROTOCOL_BINDER; + + void *user_data = NULL;; + + user_data = sync_agent_get_user_data_from_reverse_protocol_binder(reverse_binder); + if (user_data != NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_user_data_from_reverse_protocol_binder returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_user_data_from_reverse_protocol_binder_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_USER_DATA_FROM_REVERSE_PROTOCOL_BINDER; + + void *user_data = NULL; + + user_data = sync_agent_get_user_data_from_reverse_protocol_binder(NULL); + if (user_data != NULL) { + dts_message(api_name, "sync_agent_get_user_data_from_reverse_protocol_binder returned non-NULL"); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_switch_protocol_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SWITCH_PROTOCOL; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_switch_protocol(binder, SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_message(api_name, "sync_agent_switch_protocol returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_switch_protocol_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SWITCH_PROTOCOL; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_switch_protocol(binder, SYNC_AGENT_PB_PROTOCOL_UNKNOWN); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_switch_protocol returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_undo_switch_protocol_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UNDO_SWITCH_PROTOCOL; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_undo_switch_protocol(binder); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_message(api_name, "sync_agent_undo_switch_protocol returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_undo_switch_protocol_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UNDO_SWITCH_PROTOCOL; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_undo_switch_protocol(NULL); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_undo_switch_protocol returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME; + + node = sync_agent_create_node(binder, "Item"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node returned NULL"); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME; + + node = sync_agent_create_node(NULL, "Item"); + if (node == NULL) { + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_create_node returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_and_namespace_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE; + + node = sync_agent_create_node_with_namespace(binder, "FolderCreate", "FolderHierarchy:"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node_with_namespace returned NULL"); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_and_namespace_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE; + + node = sync_agent_create_node_with_namespace(NULL, "FolderCreate", "FolderHierarchy:"); + if (node == NULL) { + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_create_node_with_namespace returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_with_text_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME_WITH_TEXT; + + node = sync_agent_create_text_node(binder, "SaveInSentItems", "1", 1); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_text_node returned NULL"); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_with_text_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME_WITH_TEXT; + + node = sync_agent_create_text_node(NULL, "SaveInSentItems", "1", 1); + if (node == NULL) { + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_create_text_node returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_and_namespace_with_text_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE_WITH_TEXT; + char *client_id = "test_account"; + + node = sync_agent_create_text_node_with_namespace(binder, "ClientId", "ComposeMail:", client_id, strlen(client_id)); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_text_node_with_namespace returned NULL"); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_and_namespace_with_text_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE_WITH_TEXT; + char *client_id = "test_account"; + + node = sync_agent_create_text_node_with_namespace(NULL, "ClientId", "ComposeMail:", client_id, strlen(client_id)); + if (node == NULL) { + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_create_text_node_with_namespace returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_with_cdata_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME_WITH_CDATA; + char *mime = "mime"; + + node = sync_agent_create_cdata_node(binder, "MIME", mime, strlen(mime)); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_cdata_node returned NULL"); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_wbxml_node_using_xml_name_with_cdata_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_WBXML_NODE_USING_XML_NAME_WITH_CDATA; + char *mime = "mime"; + + node = sync_agent_create_cdata_node(NULL, "MIME", mime, strlen(mime)); + if (node == NULL) { + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_create_cdata_node returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_wbxml_tree_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_WBXML_TREE; + + tree = sync_agent_create_wbxml_tree(binder); + if (tree == NULL) { + dts_message(api_name, "sync_agent_create_wbxml_tree returned NULL"); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_wbxml_tree_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_WBXML_TREE; + + tree = sync_agent_create_wbxml_tree(NULL); + if (tree == NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_create_wbxml_tree returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_wbxml_tree_to_wbxml_node_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_WBXML_TREE_TO_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_add_wbxml_tree_to_wbxml_node(node, tree); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_message(api_name, "sync_agent_add_wbxml_tree_to_wbxml_node returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_wbxml_tree_to_wbxml_node_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_WBXML_TREE_TO_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_add_wbxml_tree_to_wbxml_node(NULL, tree); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_add_wbxml_tree_to_wbxml_node returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_set_wbxml_tree_root_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SET_WBXML_TREE_ROOT; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + node_child = sync_agent_create_node(binder, "Source"); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_create_node returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_set_wbxml_tree_root(tree, node_child); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + sync_agent_destroy_wbxml_node(node_child); + dts_message(api_name, "sync_agent_set_wbxml_tree_root returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_set_wbxml_tree_root_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SET_WBXML_TREE_ROOT; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_set_wbxml_tree_root(tree, NULL); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_set_wbxml_tree_root returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME; + + node_child = sync_agent_add_child_node(binder, node, "Source"); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_node returned NULL"); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME; + + node_child = sync_agent_add_child_node(binder, node, "Source"); + if (node_child == NULL) { + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_message(api_name, "sync_agent_add_child_node returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE; + + node_child = sync_agent_add_child_node_with_namespace(binder, node, "Options", "ItemOperations:"); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_node returned NULL"); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE; + + node_child = sync_agent_add_child_node_with_namespace(NULL, node, "Options", "ItemOperations:"); + if (node_child == NULL) { + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_message(api_name, "sync_agent_add_child_node returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_text_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_WITH_TEXT; + char *loc_uri = "loc_uri"; + + node_child = sync_agent_add_child_text_node(binder, node, "LocURI", loc_uri, strlen(loc_uri)); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_text_node returned NULL"); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_text_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_WITH_TEXT; + char *loc_uri = "loc_uri"; + + node_child = sync_agent_add_child_text_node(NULL, node, "LocURI", loc_uri, strlen(loc_uri)); + if (node_child == NULL) { + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_message(api_name, "sync_agent_add_child_text_node returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_with_text_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE_WITH_TEXT; + char *sync_key = "sync_key"; + + node_child = sync_agent_add_child_text_node_with_namespace(binder, node, "SyncKey", "FolderHierarchy:", sync_key, strlen(sync_key)); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_text_node_with_namespace returned NULL"); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_with_text_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE_WITH_TEXT; + char *sync_key = "sync_key"; + + node_child = sync_agent_add_child_text_node_with_namespace(NULL, node, "SyncKey", "FolderHierarchy:", sync_key, strlen(sync_key)); + if (node_child == NULL) { + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_message(api_name, "sync_agent_add_child_text_node_with_namespace returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_cdata_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_WITH_CDATA; + char *data = "data"; + + node_child = sync_agent_add_child_cdata_node(binder, node, "Data", data, strlen(data)); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_cdata_node returned NULL"); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_cdata_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_WITH_CDATA; + char *data = "data"; + + node_child = sync_agent_add_child_cdata_node(NULL, node, "Data", data, strlen(data)); + if (node_child == NULL) { + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_message(api_name, "sync_agent_add_child_cdata_node returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_int_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_WITH_INT; + int mime_support = 1; + + node_child = sync_agent_add_child_int_node(binder, node, "MIMESupport", mime_support); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_int_node returned NULL"); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_with_int_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_WITH_INT; + int mime_support = 1; + + node_child = sync_agent_add_child_int_node(NULL, node, "MIMESupport", mime_support); + if (node_child == NULL) { + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_message(api_name, "sync_agent_add_child_int_node returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_with_int_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE_WITH_INT; + int type = 1; + + node_child = sync_agent_add_child_int_node_with_namespace(binder, node, "Type", "FolderHierarchy:", type); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_int_node_with_namespace returned NULL"); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_add_child_wbxml_node_using_xml_name_and_namespace_with_int_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ADD_CHILD_WBXML_NODE_USING_XML_NAME_AND_NAMESPACE_WITH_INT; + int type = 1; + + node_child = sync_agent_add_child_int_node_with_namespace(NULL, node, "Type", "FolderHierarchy:", type); + if (node_child == NULL) { + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node_child); + dts_message(api_name, "sync_agent_add_child_int_node_with_namespace returned non-NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_xml_name_from_element_wbxml_node_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_XML_NAME_FROM_ELEMENT_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *xml_name = NULL; + + node = sync_agent_create_node(binder, "Item"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_get_name_from_element_node(node, &xml_name); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_set_wbxml_tree_root returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_xml_name_from_element_wbxml_node_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_XML_NAME_FROM_ELEMENT_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *xml_name = NULL; + + binder = sync_agent_init_protocol_binder(binder, SYNC_AGENT_PB_PROTOCOL_SYNCML_SYNCML12, NULL, SYNC_AGENT_PB_ENCODING_XML, false, false, false, true, false, NULL, NULL, binder_function_set); + if (binder == NULL) { + dts_message(api_name, "sync_agent_init_protocol_binder returned NULL"); + dts_fail(api_name); + } + + node = sync_agent_create_node(binder, "Item"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_get_name_from_element_node(NULL, &xml_name); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_get_name_from_element_node returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_namespace_from_element_wbxml_node_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_NAMESPACE_FROM_ELEMENT_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *name_space = NULL; + + node = sync_agent_create_node_with_namespace(binder, "FolderCreate", "FolderHierarchy:"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node_with_namespace returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_get_namespace_from_element_node(binder, node, &name_space); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_get_namespace_from_element_node returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_namespace_from_element_wbxml_node_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_NAMESPACE_FROM_ELEMENT_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *name_space = NULL; + + node = sync_agent_create_node_with_namespace(binder, "FolderCreate", "FolderHierarchy:"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node_with_namespace returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_get_namespace_from_element_node(NULL, node, &name_space); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_get_namespace_from_element_node returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_text_pointer_from_wbxml_node_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_TEXT_POINTER_FROM_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *loc_uri = "loc_uri"; + char *text_pointer = NULL; + + node = sync_agent_create_node(binder, "Item"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node returned NULL"); + dts_fail(api_name); + } + + node_child = sync_agent_add_child_text_node(binder, node, "LocURI", loc_uri, strlen(loc_uri)); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_text_node returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_get_text_from_node(node_child, &text_pointer); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_get_text_from_node returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_text_pointer_from_wbxml_node_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_TEXT_POINTER_FROM_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *loc_uri = "loc_uri"; + char *text_pointer = NULL; + + node = sync_agent_create_node(binder, "Item"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node returned NULL"); + dts_fail(api_name); + } + + node_child = sync_agent_add_child_text_node(binder, node, "LocURI", loc_uri, strlen(loc_uri)); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_text_node returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_get_text_from_node(NULL, &text_pointer); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_get_text_from_node returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_binary_pointer_from_wbxml_node_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_BINARY_POINTER_FROM_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *loc_uri = "loc_uri"; + char *binary_pointer = NULL; + unsigned int binary_size = 0; + + node = sync_agent_create_node(binder, "Item"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node returned NULL"); + dts_fail(api_name); + } + + node_child = sync_agent_add_child_text_node(binder, node, "LocURI", loc_uri, strlen(loc_uri)); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_text_node returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_get_binary_from_node(node_child, &binary_pointer, &binary_size); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_get_binary_from_node returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_binary_pointer_from_wbxml_node_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_BINARY_POINTER_FROM_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *loc_uri = "loc_uri"; + char *binary_pointer = NULL; + unsigned int binary_size = 0; + + node = sync_agent_create_node(binder, "Item"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node returned NULL"); + dts_fail(api_name); + } + + node_child = sync_agent_add_child_text_node(binder, node, "LocURI", loc_uri, strlen(loc_uri)); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_text_node returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_get_binary_from_node(NULL, &binary_pointer, &binary_size); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_get_binary_from_node returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_int_from_wbxml_node_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_INT_FROM_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + int value = 0; + + node = sync_agent_create_node(binder, "Item"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node returned NULL"); + dts_fail(api_name); + } + + node_child = sync_agent_add_child_int_node(binder, node, "Node", 777); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_int_node returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_get_int_from_node(node_child, &value); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_get_int_from_node returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_int_from_wbxml_node_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_INT_FROM_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + int value = 0; + + node = sync_agent_create_node(binder, "Item"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node returned NULL"); + dts_fail(api_name); + } + + node_child = sync_agent_add_child_int_node(binder, node, "Node", 777); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_int_node returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_get_int_from_node(NULL, &value); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_get_int_from_node returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_text_pointer_from_wbxml_cdata_node_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_TEXT_POINTER_FROM_WBXML_CDATA_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *data = "data"; + char *text_pointer = NULL; + + node = sync_agent_create_node(binder, "Item"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node returned NULL"); + dts_fail(api_name); + } + + node_child = sync_agent_add_child_cdata_node(binder, node, "Data", data, strlen(data)); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_text_node returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_get_text_from_cdata_node(node_child, &text_pointer); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_get_text_from_cdata_node returned [%d]", ret); + dts_fail(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_text_pointer_from_wbxml_cdata_node_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_TEXT_POINTER_FROM_WBXML_CDATA_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + char *data = "data"; + char *text_pointer = NULL; + + node = sync_agent_create_node(binder, "Item"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node returned NULL"); + dts_fail(api_name); + } + + node_child = sync_agent_add_child_cdata_node(binder, node, "Data", data, strlen(data)); + if (node_child == NULL) { + dts_message(api_name, "sync_agent_add_child_text_node returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_get_text_from_cdata_node(NULL, &text_pointer); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + sync_agent_destroy_wbxml_node(node); + dts_pass(api_name); + } else { + sync_agent_destroy_wbxml_node(node); + dts_message(api_name, "sync_agent_get_text_from_cdata_node returned [%d]", ret); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_destroy_wbxml_node_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DESTROY_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + node = sync_agent_create_node(binder, "Item"); + if (node == NULL) { + dts_message(api_name, "sync_agent_create_node returned NULL"); + dts_fail(api_name); + } + + ret = sync_agent_destroy_wbxml_node(node); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_message(api_name, "sync_agent_destroy_wbxml_node returned [%d]", ret); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_destroy_wbxml_node_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DESTROY_WBXML_NODE; + sync_agent_pb_error_e ret = SYNC_AGENT_PB_RETURN_OK; + + ret = sync_agent_destroy_wbxml_node(NULL); + if (ret != SYNC_AGENT_PB_RETURN_OK) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_destroy_wbxml_node returned [%d]", ret); + dts_fail(api_name); + } +} + +// ================================================= +static sync_agent_pb_error_e start_converter_function(sync_agent_pb_protocol_binder_info_s * pBinder, Content_Ptr pContent, WBXMLTreeNode ** ppWbxml_dom_node) +{ + WBXMLTreeNode *node = sync_agent_create_node(binder, "SyncML"); + *ppWbxml_dom_node = node; + + return SYNC_AGENT_PB_RETURN_OK; +} + +static sync_agent_pb_error_e header_converter_function(sync_agent_pb_protocol_binder_info_s * pBinder, Content_Ptr pContent, WBXMLTreeNode ** ppWbxml_dom_node) +{ + WBXMLTreeNode *node = sync_agent_create_node(binder, "SyncHdr"); + *ppWbxml_dom_node = node; + + return SYNC_AGENT_PB_RETURN_OK; +} + +static sync_agent_pb_error_e body_start_converter_function(sync_agent_pb_protocol_binder_info_s * pBinder, Content_Ptr pContent, WBXMLTreeNode ** ppWbxml_dom_node) +{ + WBXMLTreeNode *node = sync_agent_create_node(binder, "SyncBody"); + *ppWbxml_dom_node = node; + + return SYNC_AGENT_PB_RETURN_OK; +} + +static sync_agent_pb_error_e final_converter_function(sync_agent_pb_protocol_binder_info_s * pBinder, Content_Ptr pContent, WBXMLTreeNode ** ppWbxml_dom_node) +{ + WBXMLTreeNode *node = sync_agent_create_node(binder, "Final"); + *ppWbxml_dom_node = node; + + return SYNC_AGENT_PB_RETURN_OK; +} + +static sync_agent_pb_error_e results_command_converter_function(sync_agent_pb_protocol_binder_info_s * pBinder, Content_Ptr pContent, WBXMLTreeNode ** ppWbxml_dom_node) +{ + WBXMLTreeNode *node = sync_agent_create_node(binder, "Results"); + *ppWbxml_dom_node = node; + + return SYNC_AGENT_PB_RETURN_OK; +} + +// ================================================= +static sync_agent_pb_error_e header_reverse_converter_function(sync_agent_pb_protocol_binder_reverse_info_s * reverse_binder, WBXMLTreeNode * wbxml_dom_node, Content_Ptr * content) +{ + return SYNC_AGENT_PB_RETURN_OK; +} + +static sync_agent_pb_error_e final_reverse_converter_function(sync_agent_pb_protocol_binder_reverse_info_s * reverse_binder, WBXMLTreeNode * wbxml_dom_node, Content_Ptr * content) +{ + return SYNC_AGENT_PB_RETURN_OK; +} + +static sync_agent_pb_error_e results_command_reverse_converter_function(sync_agent_pb_protocol_binder_reverse_info_s * reverse_binder, WBXMLTreeNode * wbxml_dom_node, Content_Ptr * content) +{ + return SYNC_AGENT_PB_RETURN_OK; +} diff --git a/TC/testcase/utc_sync_agent_framework_security_assistant.c b/TC/testcase/utc_sync_agent_framework_security_assistant.c new file mode 100755 index 0000000..01dd9e8 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_security_assistant.c @@ -0,0 +1,153 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +#define API_NAME_SYNC_START_UP "startup" +#define API_NAME_SYNC_AGENT_ENCRYPT_CRYPTOGRAHIC_HASH "sync_agent_encrypt_cryptograhic_hash" +#define API_NAME_SYNC_AGENT_ENCRYPT_CRYPTOGRAHIC_HASH_WITH_FLAGS "sync_agent_encrypt_cryptograhic_hash_with_flags" +#define API_NAME_SYNC_AGENT_GET_ENCRYPTION_VALUE "sync_agent_get_encryption_value" + +static void utc_sync_agent_framework_sync_agent_encrypt_cryptograhic_hash_p(void); +static void utc_sync_agent_framework_sync_agent_encrypt_cryptograhic_hash_n(void); +static void utc_sync_agent_framework_sync_agent_encrypt_cryptograhic_hash_with_flags_p(void); +static void utc_sync_agent_framework_sync_agent_encrypt_cryptograhic_hash_with_flags_n(void); +static void utc_sync_agent_framework_sync_agent_get_encryption_value_p(void); +static void utc_sync_agent_framework_sync_agent_get_encryption_value_n(void); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_encrypt_cryptograhic_hash_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_encrypt_cryptograhic_hash_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_encrypt_cryptograhic_hash_with_flags_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_encrypt_cryptograhic_hash_with_flags_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_encryption_value_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_encryption_value_n, NEGATIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + /* start of TC */ +} + +static void cleanup(void) +{ + /* start of TC */ +} + +static void utc_sync_agent_framework_sync_agent_encrypt_cryptograhic_hash_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ENCRYPT_CRYPTOGRAHIC_HASH; + + unsigned char *digest = NULL; + + digest = sync_agent_encrypt_cryptograhic_hash(SYNC_AGENT_SA_CRYPTOGRAHIC_HASH_FUNTION_MD5, "sync-agent", strlen("sync-agent")); + if (digest != NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agnet_resync_agent_encrypt_cryptograhic_hash returned wrong value"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_encrypt_cryptograhic_hash_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ENCRYPT_CRYPTOGRAHIC_HASH; + + unsigned char *digest = NULL; + + digest = sync_agent_encrypt_cryptograhic_hash(SYNC_AGENT_SA_CRYPTOGRAHIC_HASH_FUNTION_MD5, NULL, strlen("sync-agent")); + if (digest != NULL) { + dts_message(api_name, "sync_agnet_resync_agent_encrypt_cryptograhic_hash returned wrong value"); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_encrypt_cryptograhic_hash_with_flags_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ENCRYPT_CRYPTOGRAHIC_HASH_WITH_FLAGS; + + unsigned char *digest = NULL; + + digest = sync_agent_encrypt_cryptograhic_hash_with_flags(SYNC_AGENT_SA_CRYPTOGRAHIC_HASH_FUNTION_MD5, "sync-agent", strlen("sync-agent"), "tizen", strlen("tizen"), SYNC_AGENT_SA_CRYPTOGRAHIC_HASH_FUN_HMAC); + if (digest != NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_encrypt_cryptograhic_hash_with_flags returned wrong value"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_encrypt_cryptograhic_hash_with_flags_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ENCRYPT_CRYPTOGRAHIC_HASH_WITH_FLAGS; + + unsigned char *digest = NULL; + + digest = sync_agent_encrypt_cryptograhic_hash_with_flags(SYNC_AGENT_SA_CRYPTOGRAHIC_HASH_FUNTION_MD5, NULL, strlen("sync-agent"), "tizen", strlen("tizen"), SYNC_AGENT_SA_CRYPTOGRAHIC_HASH_FUN_HMAC); + if (digest != NULL) { + dts_message(api_name, "sync_agnet_resync_agent_encrypt_cryptograhic_hash returned wrong value"); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_encryption_value_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_ENCRYPTION_VALUE; + + unsigned char *digest = NULL; + + digest = sync_agent_get_encryption_value(SYNC_AGENT_SA_ENCRYPTION_MD5, "sync-agent", strlen("sync-agent")); + if (digest != NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_encryption_value returned wrong value"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_encryption_value_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_ENCRYPTION_VALUE; + + unsigned char *digest = NULL; + + digest = sync_agent_get_encryption_value(SYNC_AGENT_SA_ENCRYPTION_MD5, NULL, strlen("sync-agent")); + if (digest != NULL) { + dts_message(api_name, "sync_agent_get_encryption_value returned wrong value"); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} diff --git a/TC/testcase/utc_sync_agent_framework_utility.c b/TC/testcase/utc_sync_agent_framework_utility.c new file mode 100755 index 0000000..696ace4 --- /dev/null +++ b/TC/testcase/utc_sync_agent_framework_utility.c @@ -0,0 +1,565 @@ +/* + * sync-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <tet_api.h> + +#include <sync_agent.h> + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +sync_agent_util_ref_object_s *ref_object = NULL; + +#define API_NAME_SYNC_AGENT_ALLOC_ASYNC_QUEUE "sync_agent_alloc_async_queue" +#define API_NAME_SYNC_AGENT_RECEIVE_MSG_ASYNC_QUEUE "sync_agent_receive_msg_async_queue" +#define API_NAME_SYNC_AGENT_ASYNC_QUEUE_LENGTH "sync_agent_async_queue_length" +#define API_NAME_SYNC_AGENT_COMPRESS "sync_agent_compress" +#define API_NAME_SYNC_AGENT_UNCOMPRESS "sync_agent_uncompress" +#define API_NAME_SYNC_AGENT_SET_INT_INTO_FILE "sync_agent_set_int_into_file" +#define API_NAME_SYNC_AGENT_GET_INT_INTO_FILE "sync_agent_get_int_into_file" +#define API_NAME_SYNC_AGENT_GET_MAIN_LOOP "sync_agent_get_main_loop" +#define API_NAME_SYNC_AGENT_CONVERT_SECONDS_TO_UTC "sync_agent_convert_seconds_to_utc" +#define API_NAME_SYNC_AGENT_CREATE_REFERENCED_OBJECT "sync_agent_create_referenced_object" +#define API_NAME_SYNC_AGENT_GET_REFERENCED_OBJECT "sync_agent_get_referenced_object" +#define API_NAME_SYNC_AGENT_GET_ORIGINAL_OBJECT "sync_agent_get_original_object" +#define API_NAME_SYNC_AGENT_COMPARE_OBJECT "sync_agent_compare_object" +#define API_NAME_SYNC_AGENT_DAEMONIZE "sync_agent_daemonize" + +static void utc_sync_agent_framework_sync_agent_alloc_async_queue_p(void); +static void utc_sync_agent_framework_sync_agent_receive_msg_async_queue_p(void); +static void utc_sync_agent_framework_sync_agent_receive_msg_async_queue_n(void); +static void utc_sync_agent_framework_sync_agent_async_queue_length_p(void); +static void utc_sync_agent_framework_sync_agent_async_queue_length_n(void); +static void utc_sync_agent_framework_sync_agent_compress_p(void); +static void utc_sync_agent_framework_sync_agent_compress_n(void); +static void utc_sync_agent_framework_sync_agent_uncompress_p(void); +static void utc_sync_agent_framework_sync_agent_uncompress_n(void); +static void utc_sync_agent_framework_sync_agent_set_int_into_file_p(void); +static void utc_sync_agent_framework_sync_agent_set_int_into_file_n(void); +static void utc_sync_agent_framework_sync_agent_get_int_into_file_p(void); +static void utc_sync_agent_framework_sync_agent_get_int_into_file_n(void); +static void utc_sync_agent_framework_sync_agent_get_main_loop_p(void); +static void utc_sync_agent_framework_sync_agent_get_main_loop_n(void); +static void utc_sync_agent_framework_sync_agent_convert_seconds_to_utc_p(void); +static void utc_sync_agent_framework_sync_agent_convert_seconds_to_utc_n(void); +static void utc_sync_agent_framework_sync_agent_create_referenced_object_p(void); +static void utc_sync_agent_framework_sync_agent_create_referenced_object_n(void); +static void utc_sync_agent_framework_sync_agent_get_referenced_object_p(void); +static void utc_sync_agent_framework_sync_agent_get_referenced_object_n(void); +static void utc_sync_agent_framework_sync_agent_get_original_object_p(void); +static void utc_sync_agent_framework_sync_agent_get_original_object_n(void); +static void utc_sync_agent_framework_sync_agent_compare_object_p(void); +static void utc_sync_agent_framework_sync_agent_compare_object_n(void); +static void utc_sync_agent_framework_sync_agent_daemonize_p(void); + +struct tet_testlist tet_testlist[] = { + {utc_sync_agent_framework_sync_agent_alloc_async_queue_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_receive_msg_async_queue_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_receive_msg_async_queue_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_async_queue_length_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_async_queue_length_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_compress_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_compress_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_uncompress_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_uncompress_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_set_int_into_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_set_int_into_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_int_into_file_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_int_into_file_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_main_loop_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_main_loop_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_convert_seconds_to_utc_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_convert_seconds_to_utc_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_referenced_object_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_create_referenced_object_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_referenced_object_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_referenced_object_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_original_object_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_get_original_object_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_compare_object_p, POSITIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_compare_object_n, NEGATIVE_TC_IDX}, + {utc_sync_agent_framework_sync_agent_daemonize_p, POSITIVE_TC_IDX}, + {NULL, 0} +}; + +static void startup(void) +{ + /* start of TC */ +} + +static void cleanup(void) +{ + /* start of TC */ +} + +static void utc_sync_agent_framework_sync_agent_alloc_async_queue_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ALLOC_ASYNC_QUEUE; + + static sync_agent_util_async_queue_s *queue; + + queue = sync_agent_alloc_async_queue(); + if (queue == NULL) { + dts_message(api_name, "sync_agent_alloc_async_queue : returned NULL"); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_receive_msg_async_queue_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_RECEIVE_MSG_ASYNC_QUEUE; + + static sync_agent_util_async_queue_s *queue; + + queue = sync_agent_alloc_async_queue(); + if (queue == NULL) { + dts_message(api_name, "sync_agent_alloc_async_queue : returned NULL"); + dts_fail(api_name); + } + + sync_agent_send_msg_async_queue(queue, "test message"); + + char *message = sync_agent_receive_msg_async_queue(queue); + if (!strcmp(message, "test message")) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_receive_msg_async_queue returned [%s]", message); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_receive_msg_async_queue_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_RECEIVE_MSG_ASYNC_QUEUE; + + static sync_agent_util_async_queue_s *queue; + + queue = sync_agent_alloc_async_queue(); + if (queue == NULL) { + dts_message(api_name, "sync_agent_alloc_async_queue : returned NULL"); + dts_fail(api_name); + } + + sync_agent_send_msg_async_queue(queue, "test message"); + + char *message = sync_agent_receive_msg_async_queue(NULL); + if (message != NULL) { + dts_message(api_name, "sync_agent_receive_msg_async_queue returned [%s]", message); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_async_queue_length_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ASYNC_QUEUE_LENGTH; + + static sync_agent_util_async_queue_s *queue; + + queue = sync_agent_alloc_async_queue(); + if (queue == NULL) { + dts_message(api_name, "sync_agent_alloc_async_queue : returned NULL"); + dts_fail(api_name); + } + + sync_agent_send_msg_async_queue(queue, "test message 1"); + sync_agent_send_msg_async_queue(queue, "test message 2"); + sync_agent_send_msg_async_queue(queue, "test message 3"); + + int length = sync_agent_async_queue_length(queue); + if (length == 3) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_async_queue_length returned [%d] and it is wrong", length); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_async_queue_length_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_ASYNC_QUEUE_LENGTH; + + static sync_agent_util_async_queue_s *queue; + + queue = sync_agent_alloc_async_queue(); + if (queue == NULL) { + dts_message(api_name, "sync_agent_alloc_async_queue : returned NULL"); + dts_fail(api_name); + } + + sync_agent_send_msg_async_queue(queue, "test message 1"); + sync_agent_send_msg_async_queue(queue, "test message 2"); + sync_agent_send_msg_async_queue(queue, "test message 3"); + + int length = sync_agent_async_queue_length(NULL); + if (length == -1) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_async_queue_length returned [%d] and it is wrong", length); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_compress_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_COMPRESS; + + sync_agent_util_compress_result_e result = sync_agent_compress(SYNC_AGENT_UTIL_COMPRESS_TYPE_TAR, "../../../testcase/fw-test-file/target_compress", "../../../testcase/fw-test-file/target_compress.tar"); + if (result == SYNC_AGENT_UTIL_COMPRESS_SUCCESS) { + sync_agent_delete_file("../../../testcase/fw-test-file/target_compress.tar"); + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_compress returned [%d]", result); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_compress_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_COMPRESS; + + sync_agent_util_compress_result_e result = sync_agent_compress(SYNC_AGENT_UTIL_COMPRESS_TYPE_TAR, "../../../testcase/fw-test-file/target_compress_not_existing", "../../../testcase/fw-test-file/target_compress.tar"); + if (result == SYNC_AGENT_UTIL_COMPRESS_SUCCESS) { + dts_message(api_name, "sync_agent_compress returned [%d]", result); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_uncompress_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UNCOMPRESS; + + sync_agent_util_compress_result_e result = sync_agent_uncompress(SYNC_AGENT_UTIL_COMPRESS_TYPE_TAR, "../../../testcase/fw-test-file/target_uncompress.tar", "/"); + if (result == SYNC_AGENT_UTIL_COMPRESS_SUCCESS) { + sync_agent_delete_file("../../../testcase/fw-test-file/target_uncompress"); + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_uncompress returned [%d]", result); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_uncompress_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_UNCOMPRESS; + + sync_agent_util_compress_result_e result = sync_agent_uncompress(SYNC_AGENT_UTIL_COMPRESS_TYPE_TAR, "../../../testcase/fw-test-file/target_uncompress.tar_not_existing", "/"); + if (result == SYNC_AGENT_UTIL_COMPRESS_SUCCESS) { + dts_message(api_name, "sync_agent_uncompress returned [%d]", result); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_set_int_into_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SET_INT_INTO_FILE; + + int value_in = 2012; + int value_out = 0; + int result = sync_agent_set_int_into_file("test", value_in); + if (!result) { + dts_message(api_name, "sync_agent_set_int_into_file returned [%d]", result); + dts_fail(api_name); + } + + result = sync_agent_get_int_from_file("test", &value_out); + if (!result) { + dts_message(api_name, "sync_agent_get_int_from_file returned [%d]", result); + dts_fail(api_name); + } + + if (value_out == value_in) { + sync_agent_unset_file("test"); + dts_pass(api_name); + } else { + sync_agent_unset_file("test"); + dts_message(api_name, "sync_agent_compress returned [%d]", value_out); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_set_int_into_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_SET_INT_INTO_FILE; + + int value_in = 2012; + int value_out = 0; + int result = sync_agent_set_int_into_file(NULL, value_in); + if (!result) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_set_int_into_file returned [%d]", result); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_int_into_file_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_INT_INTO_FILE; + + int value_in = 2012; + int value_out = 0; + int result = sync_agent_set_int_into_file("test", value_in); + if (!result) { + dts_message(api_name, "sync_agent_set_int_into_file returned [%d]", result); + dts_fail(api_name); + } + + result = sync_agent_get_int_from_file("test", &value_out); + if (!result) { + dts_message(api_name, "sync_agent_get_int_from_file returned [%d]", result); + dts_fail(api_name); + } + + if (value_out == value_in) { + sync_agent_unset_file("test"); + dts_pass(api_name); + } else { + sync_agent_unset_file("test"); + dts_message(api_name, "sync_agent_compress returned [%d]", value_out); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_int_into_file_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_INT_INTO_FILE; + + int value_in = 2012; + int value_out = 0; + int result = sync_agent_set_int_into_file("test", value_in); + if (!result) { + dts_message(api_name, "sync_agent_set_int_into_file returned [%d]", result); + dts_fail(api_name); + } + + result = sync_agent_get_int_from_file("test_not_existsing", &value_out); + if (!result) { + sync_agent_unset_file("test"); + dts_pass(api_name); + } else { + sync_agent_unset_file("test"); + dts_message(api_name, "sync_agent_get_int_from_file returned [%d]", result); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_main_loop_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_MAIN_LOOP; + + sync_agent_run_main_loop(true); + + if (sync_agent_get_main_loop() != NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_main_loop returned NULL"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_main_loop_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_MAIN_LOOP; + + sync_agent_stop_main_loop(true); + + if (sync_agent_get_main_loop() != NULL) { + dts_message(api_name, "sync_agent_get_main_loop returned non-NULL"); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_convert_seconds_to_utc_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CONVERT_SECONDS_TO_UTC; + + int utc = sync_agent_convert_seconds_to_utc(time(NULL)); + if (utc != 0) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_convert_seconds_to_utc returned invalid value [%d]", utc); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_convert_seconds_to_utc_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CONVERT_SECONDS_TO_UTC; + + int utc = sync_agent_convert_seconds_to_utc(0); + if (utc != sync_agent_convert_seconds_to_utc(time(NULL))) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_convert_seconds_to_utc returned invalid value [%d]", utc); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_referenced_object_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_REFERENCED_OBJECT; + + char *data = (char *)calloc(1, sizeof(char)); + + ref_object = sync_agent_create_referenced_object(data, free); + if (ref_object != NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_create_referenced_object returned NULL !!!"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_create_referenced_object_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_CREATE_REFERENCED_OBJECT; + + char *data = (char *)calloc(1, sizeof(char)); + + ref_object = sync_agent_create_referenced_object(NULL, free); + if (ref_object != NULL) { + dts_message(api_name, "sync_agent_create_referenced_object returned non-NULL !!!"); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_referenced_object_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_REFERENCED_OBJECT; + + ref_object = sync_agent_get_referenced_object(ref_object); + if (ref_object != NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_referenced_object returned NULL !!!"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_referenced_object_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_REFERENCED_OBJECT; + + ref_object = sync_agent_get_referenced_object(NULL); + if (ref_object != NULL) { + dts_message(api_name, "sync_agent_get_referenced_object returned non-NULL !!!"); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_original_object_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_ORIGINAL_OBJECT; + + char *data = sync_agent_get_original_object(ref_object); + if (data != NULL) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_original_object returned NULL !!!"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_get_original_object_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_GET_ORIGINAL_OBJECT; + + char *data = sync_agent_get_original_object(NULL); + if (data != NULL) { + dts_message(api_name, "sync_agent_get_original_object returned non-NULL !!!"); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_compare_object_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_COMPARE_OBJECT; + + char *data = (char *)calloc(1, sizeof(char)); + + sync_agent_util_ref_object_s *ref_object1 = NULL; + sync_agent_util_ref_object_s *ref_object2 = NULL; + + ref_object1 = sync_agent_create_referenced_object(data, free); + ref_object2 = sync_agent_create_referenced_object(data, free); + + bool result = sync_agent_compare_object(ref_object1, ref_object2); + if (result == true) { + dts_pass(api_name); + } else { + dts_message(api_name, "sync_agent_get_original_object returned FALSE !!!"); + dts_fail(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_compare_object_n(void) +{ + char *api_name = API_NAME_SYNC_AGENT_COMPARE_OBJECT; + + char *data = (char *)calloc(1, sizeof(char)); + + sync_agent_util_ref_object_s *ref_object1 = NULL; + sync_agent_util_ref_object_s *ref_object2 = NULL; + + ref_object1 = sync_agent_create_referenced_object(data, free); + ref_object2 = sync_agent_create_referenced_object(data, free); + + bool result = sync_agent_compare_object(NULL, ref_object2); + if (result == true) { + dts_message(api_name, "sync_agent_get_original_object returned TRUE !!!"); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} + +static void utc_sync_agent_framework_sync_agent_daemonize_p(void) +{ + char *api_name = API_NAME_SYNC_AGENT_DAEMONIZE; + + int result = sync_agent_daemonize(); + if (result != 0) { + dts_message(api_name, "sync_agent_daemonize returned [%d]", result); + dts_fail(api_name); + } else { + dts_pass(api_name); + } +} diff --git a/TC/tet_scen b/TC/tet_scen new file mode 100644 index 0000000..03f029a --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,7 @@ +all + ^TEST +##### Scenarios for TEST ##### + +# Test scenario +TEST + :include:/testcase/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100644 index 0000000..1d79cc2 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=False # capture option for build operation checking +TET_BUILD_TOOL=make # build with using make command +TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build +TET_API_COMPLIANT=True # use TET API in Test Case ? +TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100644 index 0000000..02d7030 --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option +TET_CLEAN_TOOL= make clean # clean tool +TET_CLEAN_FILE= Makefile # file for clean +TET_API_COMPLIANT=True # TET API useage +TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100644 index 0000000..ae32528 --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=False # capturing execution or not +TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional +TET_EXEC_FILE= # ex) exectool : execution file/ Optional +TET_API_COMPLIANT=True # Test case or Tool usesTET API? +TET_PASS_TC_NAME=True # showing Passed TC name ? |