tizen 2.3 release
[framework/web/wearable/wrt-commons.git] / tests / files_localization / wrt_db_localization_prepare.sh
1 #!/bin/bash
2
3 # Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
4 #
5 #    Licensed under the Apache License, Version 2.0 (the "License");
6 #    you may not use this file except in compliance with the License.
7 #    You may obtain a copy of the License at
8 #
9 #        http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #    Unless required by applicable law or agreed to in writing, software
12 #    distributed under the License is distributed on an "AS IS" BASIS,
13 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #    See the License for the specific language governing permissions and
15 #    limitations under the License.
16 #
17
18 set -e
19
20 trap 'echo "Script failed"; exit 1' ERR
21
22 WRT_DB=/opt/dbspace/.wrt.db
23 WRT_DB_BCK=/tmp/wrt.db_backup
24 WIDGET_INSTALL_PATH=/opt/usr/apps
25
26 case $1 in
27     start)
28         echo "start"
29         cp $WRT_DB $WRT_DB_BCK
30         wrt_commons_create_clean_db.sh
31
32         #Widgets
33         INS_ALL_WIDGETEXT="insert into WidgetExtendedInfo(app_id, installed_path)"
34         INS_ALL_WIDGET="insert into WidgetInfo(app_id, tizen_appid)"
35         INS_ALL_ICON="insert into WidgetIcon(icon_id, app_id, icon_src, icon_width, icon_height)"
36         INS_ALL_LOCALIZED_START_FILE="insert into WidgetLocalizedStartFile(app_id, start_file_id, widget_locale, type, encoding)"
37         INS_ALL_START_FILE="insert into WidgetStartFile(start_file_id, app_id, src)"
38
39         sqlite3 $WRT_DB "${INS_ALL_WIDGET} VALUES(1, 'tizenid201')";
40         sqlite3 $WRT_DB "${INS_ALL_WIDGET} VALUES(2, 'tizenid202')";
41         sqlite3 $WRT_DB "${INS_ALL_WIDGETEXT} VALUES(1, '/opt/share/widget/tests/localization/widget1')";
42         sqlite3 $WRT_DB "${INS_ALL_WIDGETEXT} VALUES(2, '/opt/share/widget/tests/localization/widget2')";
43         sqlite3 $WRT_DB "${INS_ALL_ICON} VALUES(1,1,'icon',251,250)";
44         sqlite3 $WRT_DB "${INS_ALL_ICON} VALUES(2,1,'icon2',253,252)";
45         sqlite3 $WRT_DB "${INS_ALL_LOCALIZED_START_FILE} VALUES(1,2,'en-en','test','test')";
46         sqlite3 $WRT_DB "${INS_ALL_START_FILE} VALUES(2,1,'start_file')";
47         exit 0
48         ;;
49     stop)
50         echo "stop";
51         cp $WRT_DB_BCK $WRT_DB
52         exit 0
53         ;;
54     *)
55         echo "nothing to do"
56         exit 1
57         ;;
58 esac