revise Mode/Rule Files name
authorYoungjae Shin <yj99.shin@samsung.com>
Tue, 4 Feb 2020 06:22:39 +0000 (15:22 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Wed, 18 Mar 2020 08:53:50 +0000 (17:53 +0900)
34 files changed:
example/mode/tizen_asyncFail1_mode.xml [deleted file]
example/mode/tizen_asyncFail2_mode.xml [deleted file]
example/mode/tizen_asyncFailEx1_mode.xml [new file with mode: 0644]
example/mode/tizen_asyncFailEx2_mode.xml [new file with mode: 0644]
example/mode/tizen_asyncValidErr_mode.xml [new file with mode: 0644]
example/mode/tizen_asyncValidFail_mode.xml [deleted file]
example/mode/tizen_conflict1_mode.xml [deleted file]
example/mode/tizen_conflict2_mode.xml [deleted file]
example/mode/tizen_conflict3_mode.xml [deleted file]
example/mode/tizen_conflictErrBase_mode.xml [new file with mode: 0644]
example/mode/tizen_conflictErrExclusive_mode.xml [new file with mode: 0644]
example/mode/tizen_conflictErr_mode.xml [new file with mode: 0644]
example/mode/tizen_ex1_mode.xml [deleted file]
example/mode/tizen_ex2_mode.xml [deleted file]
example/mode/tizen_invalid1_mode.xml [deleted file]
example/mode/tizen_invalid2_mode.xml [deleted file]
example/mode/tizen_invalidValErr1_mode.xml [new file with mode: 0644]
example/mode/tizen_invalidValErr2_mode.xml [new file with mode: 0644]
example/mode/tizen_normalEx1_mode.xml [new file with mode: 0644]
example/mode/tizen_normalEx2_mode.xml [new file with mode: 0644]
example/rule/tizen_aliasValueErr_rule.xml [new file with mode: 0644]
example/rule/tizen_ex_rule.xml [deleted file]
example/rule/tizen_fail1_rule.xml [deleted file]
example/rule/tizen_fail2_rule.xml [deleted file]
example/rule/tizen_uniqueRuleErr_rule.xml [new file with mode: 0644]
packaging/modes.spec
plugin/CMakeLists.txt
plugin/tizen_test_rule.xml [new file with mode: 0644]
unittest/modes-gtest-run.sh
unittest/modes_test_conflict.cpp
unittest/modes_test_generator.cpp
unittest/modes_test_parser.cpp
unittest/modes_test_plugin.cpp
unittest/modes_test_rulemgr.cpp

diff --git a/example/mode/tizen_asyncFail1_mode.xml b/example/mode/tizen_asyncFail1_mode.xml
deleted file mode 100644 (file)
index b764ffa..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="asyncFail1" type="normal">
-    <action rule="test.sleep" type="async">5</action>
-    <action rule="test.sleep" type="async">5</action>
-    <action rule="test.sleep" type="async">5</action>
-    <action rule="test.sleep" type="async">5</action>
-    <action rule="test.sleepErrorReturn" stopOnErr="true" type="sync">1</action>
-  </mode>
-</tizenModes>
diff --git a/example/mode/tizen_asyncFail2_mode.xml b/example/mode/tizen_asyncFail2_mode.xml
deleted file mode 100644 (file)
index 74c4263..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="asyncFail2" type="oneshot">
-    <action rule="test.sleep" type="async">5</action>
-    <action rule="test.sleep" type="async">5</action>
-    <action rule="test.sleep" type="async">5</action>
-    <action rule="test.sleep" type="async">5</action>
-    <action rule="test.sleepErrorReturn" stopOnErr="true" type="sync">5</action>
-  </mode>
-</tizenModes>
diff --git a/example/mode/tizen_asyncFailEx1_mode.xml b/example/mode/tizen_asyncFailEx1_mode.xml
new file mode 100644 (file)
index 0000000..b764ffa
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="asyncFail1" type="normal">
+    <action rule="test.sleep" type="async">5</action>
+    <action rule="test.sleep" type="async">5</action>
+    <action rule="test.sleep" type="async">5</action>
+    <action rule="test.sleep" type="async">5</action>
+    <action rule="test.sleepErrorReturn" stopOnErr="true" type="sync">1</action>
+  </mode>
+</tizenModes>
diff --git a/example/mode/tizen_asyncFailEx2_mode.xml b/example/mode/tizen_asyncFailEx2_mode.xml
new file mode 100644 (file)
index 0000000..74c4263
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="asyncFail2" type="oneshot">
+    <action rule="test.sleep" type="async">5</action>
+    <action rule="test.sleep" type="async">5</action>
+    <action rule="test.sleep" type="async">5</action>
+    <action rule="test.sleep" type="async">5</action>
+    <action rule="test.sleepErrorReturn" stopOnErr="true" type="sync">5</action>
+  </mode>
+</tizenModes>
diff --git a/example/mode/tizen_asyncValidErr_mode.xml b/example/mode/tizen_asyncValidErr_mode.xml
new file mode 100644 (file)
index 0000000..763c8ff
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="async_valied" type="exclusive" hidden="true">
+    <action rule="test.sleepErrorReturn" stopOnErr="true" type="async">5</action>
+  </mode>
+</tizenModes>
diff --git a/example/mode/tizen_asyncValidFail_mode.xml b/example/mode/tizen_asyncValidFail_mode.xml
deleted file mode 100644 (file)
index 763c8ff..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="async_valied" type="exclusive" hidden="true">
-    <action rule="test.sleepErrorReturn" stopOnErr="true" type="async">5</action>
-  </mode>
-</tizenModes>
diff --git a/example/mode/tizen_conflict1_mode.xml b/example/mode/tizen_conflict1_mode.xml
deleted file mode 100644 (file)
index 5da4429..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="conflict1" type="normal">
-    <action ID="test" rule="test.printInt" restrict="lock">1</action>
-  </mode>
-</tizenModes>
diff --git a/example/mode/tizen_conflict2_mode.xml b/example/mode/tizen_conflict2_mode.xml
deleted file mode 100644 (file)
index 0c21e0a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="conflict1" type="normal">
-    <action ID="test" rule="test.printInt" restrict="lock" stopOnErr="true">2</action>
-  </mode>
-</tizenModes>
diff --git a/example/mode/tizen_conflict3_mode.xml b/example/mode/tizen_conflict3_mode.xml
deleted file mode 100644 (file)
index 43cb35b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="conflict3" type="exclusive">
-    <action ID="test" rule="test.printBool" restrict="lock">true</action>
-  </mode>
-</tizenModes>
diff --git a/example/mode/tizen_conflictErrBase_mode.xml b/example/mode/tizen_conflictErrBase_mode.xml
new file mode 100644 (file)
index 0000000..5da4429
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="conflict1" type="normal">
+    <action ID="test" rule="test.printInt" restrict="lock">1</action>
+  </mode>
+</tizenModes>
diff --git a/example/mode/tizen_conflictErrExclusive_mode.xml b/example/mode/tizen_conflictErrExclusive_mode.xml
new file mode 100644 (file)
index 0000000..43cb35b
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="conflict3" type="exclusive">
+    <action ID="test" rule="test.printBool" restrict="lock">true</action>
+  </mode>
+</tizenModes>
diff --git a/example/mode/tizen_conflictErr_mode.xml b/example/mode/tizen_conflictErr_mode.xml
new file mode 100644 (file)
index 0000000..0c21e0a
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="conflict1" type="normal">
+    <action ID="test" rule="test.printInt" restrict="lock" stopOnErr="true">2</action>
+  </mode>
+</tizenModes>
diff --git a/example/mode/tizen_ex1_mode.xml b/example/mode/tizen_ex1_mode.xml
deleted file mode 100644 (file)
index 9de72ed..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="ex1" type="normal">
-    <action ID="wifiOn" rule="test.printBool" priority="-100">on</action>
-    <action rule="test.launch" before="GoPbsKids">com.vpn.usa123</action>
-    <action ID="GoPbsKids" rule="test.url" after="wifiOn">https://pbskids.org/</action>
-    <action ID="BMJ" rule="test.connect">Modes-JBL</action>
-    <action rule="test.player" after="BMJ">beatles-yesterday.mp3</action>
-    <action ID="1" rule="test.printInt" priority="-100"
-         >PRINT_TWO</action>
-    <undo ID="undo1" rule="test.printBool">true</undo>
-  </mode>
-</tizenModes>
diff --git a/example/mode/tizen_ex2_mode.xml b/example/mode/tizen_ex2_mode.xml
deleted file mode 100644 (file)
index e062a21..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="ex2" type="exclusive" hidden="true">
-    <action ID="1" rule="test.printInt" stopOnErr="true" restrict="lock" priority="-100">PRINT_FOUR</action>
-    <action ID="wifiOff" rule="test.printBool" restrict="lock" priority="-100">off</action>
-  </mode>
-</tizenModes>
diff --git a/example/mode/tizen_invalid1_mode.xml b/example/mode/tizen_invalid1_mode.xml
deleted file mode 100644 (file)
index c34416b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="invalid1" type="exclusive">
-    <action rule="test.printBool">123</action>
-  </mode>
-</tizenModes>
diff --git a/example/mode/tizen_invalid2_mode.xml b/example/mode/tizen_invalid2_mode.xml
deleted file mode 100644 (file)
index 374eef1..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <mode name="invalid2" type="exclusive">
-    <action rule="test.printInt">PRINT_TREE</action>
-  </mode>
-</tizenModes>
diff --git a/example/mode/tizen_invalidValErr1_mode.xml b/example/mode/tizen_invalidValErr1_mode.xml
new file mode 100644 (file)
index 0000000..c34416b
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="invalid1" type="exclusive">
+    <action rule="test.printBool">123</action>
+  </mode>
+</tizenModes>
diff --git a/example/mode/tizen_invalidValErr2_mode.xml b/example/mode/tizen_invalidValErr2_mode.xml
new file mode 100644 (file)
index 0000000..374eef1
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="invalid2" type="exclusive">
+    <action rule="test.printInt">PRINT_TREE</action>
+  </mode>
+</tizenModes>
diff --git a/example/mode/tizen_normalEx1_mode.xml b/example/mode/tizen_normalEx1_mode.xml
new file mode 100644 (file)
index 0000000..9de72ed
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="ex1" type="normal">
+    <action ID="wifiOn" rule="test.printBool" priority="-100">on</action>
+    <action rule="test.launch" before="GoPbsKids">com.vpn.usa123</action>
+    <action ID="GoPbsKids" rule="test.url" after="wifiOn">https://pbskids.org/</action>
+    <action ID="BMJ" rule="test.connect">Modes-JBL</action>
+    <action rule="test.player" after="BMJ">beatles-yesterday.mp3</action>
+    <action ID="1" rule="test.printInt" priority="-100"
+         >PRINT_TWO</action>
+    <undo ID="undo1" rule="test.printBool">true</undo>
+  </mode>
+</tizenModes>
diff --git a/example/mode/tizen_normalEx2_mode.xml b/example/mode/tizen_normalEx2_mode.xml
new file mode 100644 (file)
index 0000000..e062a21
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <mode name="ex2" type="exclusive" hidden="true">
+    <action ID="1" rule="test.printInt" stopOnErr="true" restrict="lock" priority="-100">PRINT_FOUR</action>
+    <action ID="wifiOff" rule="test.printBool" restrict="lock" priority="-100">off</action>
+  </mode>
+</tizenModes>
diff --git a/example/rule/tizen_aliasValueErr_rule.xml b/example/rule/tizen_aliasValueErr_rule.xml
new file mode 100644 (file)
index 0000000..ea765f6
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <actionRule>
+    <rule name="test.changeAccuracy" type="int" since="6.0" plugin="test">
+      <conflict>test.exactness</conflict>
+      <desc>Sensor Accuracy</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.exactness" type="int" since="6.0" plugin="test">
+      <conflict>test.changeAccuracy</conflict>
+      <desc>Sensor Exactness</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.url" type="string" since="6.0" plugin="test">
+      <desc>browser</desc>
+      <domain>Web Framework</domain>
+    </rule>
+    <rule name="test.nightLight" type="int" since="6.0" plugin="test">
+      <conflict>display.autoLight</conflict>
+      <desc>It makes the screen color warmer.</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.printInt" type="int" since="6.0" plugin="test">
+      <alias name="PRINT_ZERO">0</alias>
+      <alias name="PRINT_ONE">1</alias>
+      <alias name="PRINT_TWO">2</alias>
+      <alias name="PRINT_THREE">3</alias>
+      <alias name="PRINT_FOUR">4th</alias>
+      <desc>It prints integer value</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.printBool" type="bool" since="6.0" plugin="test">
+      <alias name="on">1</alias>
+      <alias name="off">0</alias>
+      <desc>It prints boolean value</desc>
+      <domain>System</domain>
+    </rule>
+  </actionRule>
+</tizenModes>
diff --git a/example/rule/tizen_ex_rule.xml b/example/rule/tizen_ex_rule.xml
deleted file mode 100644 (file)
index 6190d9a..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <actionRule>
-    <rule name="test.changeAccuracy" type="int" since="6.0" plugin="test">
-      <conflict>test.exactness</conflict>
-      <desc>Sensor Accuracy</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.exactness" type="int" since="6.0" plugin="test">
-      <conflict>test.changeAccuracy</conflict>
-      <desc>Sensor Exactness</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.url" type="string" since="6.0" plugin="test">
-      <desc>browser</desc>
-      <domain>Web Framework</domain>
-    </rule>
-    <rule name="test.nightLight" type="int" since="6.0" plugin="test">
-      <conflict>display.autoLight</conflict>
-      <desc>It makes the screen color warmer.</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.launch" type="string" since="6.0" plugin="test">
-      <desc>Launch App</desc>
-      <domain>App Framework</domain>
-    </rule>
-    <rule name="test.connect" type="string" since="6.0" plugin="test">
-      <desc>bluetooth Audio Connect</desc>
-      <domain>Network &amp; Connectivity</domain>
-    </rule>
-    <rule name="test.player" type="string" since="6.0" plugin="test">
-      <desc>Audio/Video player</desc>
-      <domain>Multimedia</domain>
-    </rule>
-    <rule name="test.printInt" type="int" since="6.0" plugin="test">
-      <alias name="PRINT_ZERO">0</alias>
-      <alias name="PRINT_ONE">1</alias>
-      <alias name="PRINT_TWO">2</alias>
-      <alias name="PRINT_THREE">3</alias>
-      <alias name="PRINT_FOUR">4</alias>
-      <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
-      <desc>It prints integer value</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.printBool" type="bool" since="6.0" plugin="test">
-      <alias name="on">1</alias>
-      <alias name="off">0</alias>
-      <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
-      <desc>It prints boolean value</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.printDouble" type="float" since="6.0" plugin="test">
-      <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
-      <desc>It prints double value</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.printString" type="string" since="6.0" plugin="test">
-      <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
-      <desc>It prints string value</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.sleep" type="int" since="6.0" plugin="test">
-      <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
-      <desc>Sleep</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.sleepErrorReturn" type="int" since="6.0" plugin="test">
-      <desc>Sleep and return valuse is error</desc>
-      <domain>System</domain>
-    </rule>
-  </actionRule>
-</tizenModes>
diff --git a/example/rule/tizen_fail1_rule.xml b/example/rule/tizen_fail1_rule.xml
deleted file mode 100644 (file)
index 02cb688..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <actionRule>
-    <rule name="test.changeAccuracy" type="int" since="6.0" plugin="test">
-      <conflict>test.exactness</conflict>
-      <desc>Sensor Accuracy</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.exactness" type="int" since="6.0" plugin="test">
-      <conflict>test.changeAccuracy</conflict>
-      <desc>Sensor Exactness</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.url" type="string" since="6.0" plugin="test">
-      <desc>browser</desc>
-      <domain>Web Framework</domain>
-    </rule>
-    <rule name="test.nightLight" type="int" since="6.0" plugin="test">
-      <conflict>display.autoLight</conflict>
-      <desc>It makes the screen color warmer.</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.printInt" type="int" since="6.0" plugin="test">
-      <alias name="PRINT_ZERO">0</alias>
-      <alias name="PRINT_ONE">1</alias>
-      <alias name="PRINT_TWO">2</alias>
-      <alias name="PRINT_THREE">3</alias>
-      <alias name="PRINT_FOUR">4</alias>
-      <desc>It prints integer value</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.printBool" type="bool" since="6.0" plugin="test">
-      <alias name="on">1</alias>
-      <alias name="off">0</alias>
-      <desc>It prints boolean value</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.printBool" type="int" since="6.0" plugin="test1">
-      <desc>It is a duplicated Rule, It Must be unique</desc>
-      <domain>System</domain>
-    </rule>
-  </actionRule>
-</tizenModes>
diff --git a/example/rule/tizen_fail2_rule.xml b/example/rule/tizen_fail2_rule.xml
deleted file mode 100644 (file)
index ea765f6..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="6.0">
-  <actionRule>
-    <rule name="test.changeAccuracy" type="int" since="6.0" plugin="test">
-      <conflict>test.exactness</conflict>
-      <desc>Sensor Accuracy</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.exactness" type="int" since="6.0" plugin="test">
-      <conflict>test.changeAccuracy</conflict>
-      <desc>Sensor Exactness</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.url" type="string" since="6.0" plugin="test">
-      <desc>browser</desc>
-      <domain>Web Framework</domain>
-    </rule>
-    <rule name="test.nightLight" type="int" since="6.0" plugin="test">
-      <conflict>display.autoLight</conflict>
-      <desc>It makes the screen color warmer.</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.printInt" type="int" since="6.0" plugin="test">
-      <alias name="PRINT_ZERO">0</alias>
-      <alias name="PRINT_ONE">1</alias>
-      <alias name="PRINT_TWO">2</alias>
-      <alias name="PRINT_THREE">3</alias>
-      <alias name="PRINT_FOUR">4th</alias>
-      <desc>It prints integer value</desc>
-      <domain>System</domain>
-    </rule>
-    <rule name="test.printBool" type="bool" since="6.0" plugin="test">
-      <alias name="on">1</alias>
-      <alias name="off">0</alias>
-      <desc>It prints boolean value</desc>
-      <domain>System</domain>
-    </rule>
-  </actionRule>
-</tizenModes>
diff --git a/example/rule/tizen_uniqueRuleErr_rule.xml b/example/rule/tizen_uniqueRuleErr_rule.xml
new file mode 100644 (file)
index 0000000..02cb688
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <actionRule>
+    <rule name="test.changeAccuracy" type="int" since="6.0" plugin="test">
+      <conflict>test.exactness</conflict>
+      <desc>Sensor Accuracy</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.exactness" type="int" since="6.0" plugin="test">
+      <conflict>test.changeAccuracy</conflict>
+      <desc>Sensor Exactness</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.url" type="string" since="6.0" plugin="test">
+      <desc>browser</desc>
+      <domain>Web Framework</domain>
+    </rule>
+    <rule name="test.nightLight" type="int" since="6.0" plugin="test">
+      <conflict>display.autoLight</conflict>
+      <desc>It makes the screen color warmer.</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.printInt" type="int" since="6.0" plugin="test">
+      <alias name="PRINT_ZERO">0</alias>
+      <alias name="PRINT_ONE">1</alias>
+      <alias name="PRINT_TWO">2</alias>
+      <alias name="PRINT_THREE">3</alias>
+      <alias name="PRINT_FOUR">4</alias>
+      <desc>It prints integer value</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.printBool" type="bool" since="6.0" plugin="test">
+      <alias name="on">1</alias>
+      <alias name="off">0</alias>
+      <desc>It prints boolean value</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.printBool" type="int" since="6.0" plugin="test1">
+      <desc>It is a duplicated Rule, It Must be unique</desc>
+      <domain>System</domain>
+    </rule>
+  </actionRule>
+</tizenModes>
index 6a60091bd3097bcbaff4aa2a4ec85ae66dbd9847..c6c5714676a95110ec3c88cf0e32d2ef0dfd6ef7 100644 (file)
@@ -102,20 +102,18 @@ install -d -m 755 %{buildroot}%{modes_ro_dir}/mode
 install -d -m 755 %{buildroot}%{modes_ro_dir}/rule
 install -d -m 755 %{buildroot}%{modes_rw_dir}/custom-mode
 install -d -m 755 %{buildroot}%{modes_rw_dir}/undo-info
-install -m 0644 example/mode/*ex*_mode.xml %{buildroot}%{modes_ro_dir}/mode/
-install -m 0644 example/mode/*sync*_mode.xml %{buildroot}%{modes_ro_dir}/mode/
-install -m 0644 example/rule/*ex*_rule.xml %{buildroot}%{modes_ro_dir}/rule/
-install -m 0644 example/mode/*conflict*_mode.xml %{buildroot}%{modes_test_dir}/
-install -m 0644 example/mode/*invalid*_mode.xml %{buildroot}%{modes_test_dir}/
-install -m 0644 example/rule/*fail*_rule.xml %{buildroot}%{modes_test_dir}/
+install -m 0644 example/mode/*Ex*_mode.xml %{buildroot}%{modes_ro_dir}/mode/
+install -m 0644 example/mode/*Err*_mode.xml %{buildroot}%{modes_test_dir}/
+install -m 0644 example/rule/*Err*_rule.xml %{buildroot}%{modes_test_dir}/
 install -m 0755 unittest/modes-gtest-run.sh %{buildroot}%{modes_test_dir}/
 
 %install_service multi-user.target.wants %{name}.path
 
 %check
 xmllint --noout --schema schema/tizen_mode.xsd example/mode/tizen_*_mode.xml
+xmllint --noout --schema schema/tizen_action_rule.xsd plugin/tizen_test_rule.xml
 xmllint --noout --schema schema/tizen_action_rule.xsd example/rule/tizen_*_rule.xml
-bash ./unittest/modes-gtest-run.sh ./example ./unittest
+bash ./unittest/modes-gtest-run.sh %{buildroot}%{modes_ro_dir} %{buildroot}%{modes_test_dir} Building
 
 %post
 /sbin/ldconfig
index 3407ca1ac10f2b24f25f730f27befd510cf864cb..d82e2f6546595e07a9ea1d0671564b35fc3a6f43 100644 (file)
@@ -10,3 +10,4 @@ ADD_LIBRARY(${LIB_NAME} SHARED ${TEST_PLUGIN_SRCS})
 TARGET_LINK_LIBRARIES(${LIB_NAME} ${plugin_pkgs_LIBRARIES})
 SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES NO_SONAME 1 )
 INSTALL(TARGETS ${LIB_NAME} DESTINATION ${MODES_PLUGIN_DEFAULT_DIR})
+INSTALL(FILES tizen_test_rule.xml DESTINATION ${MODES_ACTIONRULE_DEFAULT_DIR})
diff --git a/plugin/tizen_test_rule.xml b/plugin/tizen_test_rule.xml
new file mode 100644 (file)
index 0000000..597f618
--- /dev/null
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="6.0">
+  <actionRule>
+    <rule name="test.changeAccuracy" type="int" since="6.0" plugin="test">
+      <conflict>test.exactness</conflict>
+      <desc>Sensor Accuracy</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.exactness" type="int" since="6.0" plugin="test">
+      <conflict>test.changeAccuracy</conflict>
+      <desc>Sensor Exactness</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.url" type="string" since="6.0" plugin="test">
+      <desc>browser</desc>
+      <domain>Web Framework</domain>
+    </rule>
+    <rule name="test.nightLight" type="int" since="6.0" plugin="test">
+      <conflict>display.autoLight</conflict>
+      <desc>It makes the screen color warmer.</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.launch" type="string" since="6.0" plugin="test">
+      <desc>Launch App</desc>
+      <domain>App Framework</domain>
+    </rule>
+    <rule name="test.connect" type="string" since="6.0" plugin="test">
+      <desc>bluetooth Audio Connect</desc>
+      <domain>Network &amp; Connectivity</domain>
+    </rule>
+    <rule name="test.player" type="string" since="6.0" plugin="test">
+      <desc>Audio/Video player</desc>
+      <domain>Multimedia</domain>
+    </rule>
+    <rule name="test.printInt" type="int" since="6.0" plugin="test">
+      <alias name="PRINT_ZERO">0</alias>
+      <alias name="PRINT_ONE">1</alias>
+      <alias name="PRINT_TWO">2</alias>
+      <alias name="PRINT_THREE">3</alias>
+      <alias name="PRINT_FOUR">4</alias>
+      <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
+      <desc>It prints integer value</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.printBool" type="bool" since="6.0" plugin="test">
+      <alias name="on">1</alias>
+      <alias name="off">0</alias>
+      <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
+      <desc>It prints boolean value</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.printDouble" type="float" since="6.0" plugin="test">
+      <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
+      <desc>It prints double value</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.printString" type="string" since="6.0" plugin="test">
+      <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
+      <desc>It prints string value</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.sleep" type="int" since="6.0" plugin="test">
+      <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
+      <desc>Sleep</desc>
+      <domain>System</domain>
+    </rule>
+    <rule name="test.sleepErrorReturn" type="int" since="6.0" plugin="test">
+      <desc>Sleep and return error after value seconds</desc>
+      <domain>System</domain>
+    </rule>
+  </actionRule>
+</tizenModes>
index 941454f24d919cd1c38f57c61e10af4b46d35d15..e85baba92371333fbdb0f1dba2bc1ddf53accec4 100755 (executable)
@@ -5,27 +5,31 @@ set -e
 
 if [ $# -lt 2 ]
 then
-       echo "Usage) $0 DATA_DIR WORKING_DIR"
+       echo "Usage) $0 DATA_DIR WORKING_DIR [Building]"
        exit 1
 fi
 
+IsBUILDING="no"
+if [ $# -gt 2 ]
+then
+       IsBUILDING=$3
+fi
+
 DATA_DIR=$1
 WORKING_DIR=$2
-CUR_DIR=$PWD
-
-cp $DATA_DIR/mode/*_mode.xml $WORKING_DIR
-cp $DATA_DIR/rule/*_rule.xml $WORKING_DIR
-mkdir -p $WORKING_DIR/extra
-sed s/ex1/ex3/g $WORKING_DIR/tizen_ex1_mode.xml > $WORKING_DIR/extra/tizen_ex3_mode.xml
-sed s/ex1/ex4/g $WORKING_DIR/tizen_ex1_mode.xml > $WORKING_DIR/extra/tizen_ex4_mode.xml
+#CUR_DIR=$PWD
 
 pushd $WORKING_DIR
 
-if [ ${DATA_DIR:0:1} == "." ]
-then # on building
-       cp $CUR_DIR/schema/*.xsd ./
-else # on Target
-       cp $DATA_DIR/schema/*.xsd ./
+cp $DATA_DIR/mode/*_mode.xml ./
+cp $DATA_DIR/rule/*_rule.xml ./
+mkdir -p ./extra
+sed s/ex1/ex3/g ./tizen_normalEx1_mode.xml > ./extra/tizen_normalEx3_mode.xml
+sed s/ex1/ex4/g ./tizen_normalEx1_mode.xml > ./extra/tizen_normalEx4_mode.xml
+cp $DATA_DIR/schema/*.xsd ./
+
+if [ "$IsBUILDING" == "no" ]
+then # on Target
        ./modes-gtest-client
        ./modes-gtest-noti
        ./modes-gtest-async
@@ -37,4 +41,7 @@ fi
 ./modes-gtest-generator
 ./modes-gtest-conflict
 ./modes-gtest-plugin
+
+rm -rf *.xsd extra
+
 popd
index 48df8e9cb29f159648fb7d578367434ec9bf1267..c72974427639e1661adf353893676540b3298ee6 100644 (file)
@@ -27,7 +27,7 @@ public:
 protected:
        void SetUp() override
        {
-               ModeXMLParser modeparser("tizen_conflict1_mode.xml", ruleMgr);
+               ModeXMLParser modeparser("tizen_conflictErrBase_mode.xml", ruleMgr);
                careTaker.pushMode(modeparser.getMode());
        }
 
@@ -57,14 +57,14 @@ ConflictTest::ConflictTest()
 
 TEST_F(ConflictTest, isSavedMode)
 {
-       ModeXMLParser modeparser("tizen_conflict1_mode.xml", ruleMgr);
+       ModeXMLParser modeparser("tizen_conflictErrBase_mode.xml", ruleMgr);
 
        EXPECT_TRUE(careTaker.isSavedMode(modeparser.getModeName()));
 }
 
-TEST_F(ConflictTest, isExcluded)
+TEST_F(ConflictTest, isExclusive)
 {
-       ModeXMLParser modeparser("tizen_conflict3_mode.xml", ruleMgr);
+       ModeXMLParser modeparser("tizen_conflictErrExclusive_mode.xml", ruleMgr);
 
        careTaker.pushMode(modeparser.getMode());
        EXPECT_TRUE(careTaker.isExclusive());
@@ -76,7 +76,7 @@ TEST_F(ConflictTest, isExcluded)
 
 TEST_F(ConflictTest, checkConflictAction)
 {
-       ModeXMLParser modeparser("tizen_conflict2_mode.xml", ruleMgr);
+       ModeXMLParser modeparser("tizen_conflictErr_mode.xml", ruleMgr);
 
        Mode mode = modeparser.getMode();
        EXPECT_TRUE(careTaker.checkConflictAction(mode));
@@ -86,6 +86,6 @@ TEST_F(ConflictTest, isConflict)
 {
        ConflictManager conflMgr(careTaker);
 
-       ModeXMLParser modeparser("tizen_conflict2_mode.xml", ruleMgr);
+       ModeXMLParser modeparser("tizen_conflictErr_mode.xml", ruleMgr);
        EXPECT_TRUE(conflMgr.isConflict(modeparser.getMode()));
 }
index 88b17899d4594eb0396719d3844419cb427201c9..65c88b2180a64772c117f22312b12db8899b167e 100644 (file)
@@ -49,21 +49,21 @@ TEST(XMLGenerator, makeModeXML)
 {
        GeneratorTest broker;
 
-       ModeXMLParser modeparser("tizen_ex1_mode.xml", broker.ruleMgr);
-       Mode mode = modeparser.getMode();
+       ModeXMLParser modeParser("tizen_normalEx1_mode.xml", broker.ruleMgr);
+       Mode mode = modeParser.getMode();
 
        try {
                XMLGenerator xmlGenerator;
-               xmlGenerator.makeModeXML("tizen_gen_ex1_mode.xml", mode);
+               xmlGenerator.makeModeXML("tizen_generatedEx1_mode.xml", mode);
        } catch (ModesEx &e) {
-               ERR("XMLGenerator(tizen_gen_ex1_mode.xml) Fail(%s)", e.what());
+               ERR("XMLGenerator(tizen_generatedEx1_mode.xml) Fail(%s)", e.what());
                FAIL();
        }
 
-       ModeXMLParser genmodeparser("tizen_gen_ex1_mode.xml", broker.ruleMgr);
-       Mode genMode = genmodeparser.getMode();
+       ModeXMLParser genModeParser("tizen_generatedEx1_mode.xml", broker.ruleMgr);
+       Mode genMode = genModeParser.getMode();
 
-       EXPECT_EQ("ex1", genmodeparser.getModeName());
+       EXPECT_EQ("ex1", genModeParser.getModeName());
        std::list<std::shared_ptr<Action>> actionList = mode.getActionList();
        EXPECT_FALSE(actionList.empty());
 
@@ -78,8 +78,8 @@ TEST(XMLGenerator, exFileName)
 {
        GeneratorTest broker;
 
-       ModeXMLParser modeparser("tizen_ex1_mode.xml", broker.ruleMgr);
-       Mode mode = modeparser.getMode();
+       ModeXMLParser modeParser("tizen_normalEx1_mode.xml", broker.ruleMgr);
+       Mode mode = modeParser.getMode();
 
        EXPECT_THROW({
                XMLGenerator xmlGenerator;
index b7e0b75563a6868cf5aace1aceda5f28d7ba1946..67a21824285f6872d44d1df2c1fd5a348c36cb15 100644 (file)
@@ -54,7 +54,7 @@ ParserTest::ParserTest()
        config.pluginDir = ".";
 
        ruleMgr.setOptions(std::string(), config.actionRuleXsdFile, config.pluginDir);
-       ruleMgr.parseActionRule("./tizen_ex_rule.xml");
+       ruleMgr.parseActionRule("./tizen_test_rule.xml");
 }
 
 list<shared_ptr<Action>> ParserTest::getActionList(Mode& m)
@@ -64,42 +64,42 @@ list<shared_ptr<Action>> ParserTest::getActionList(Mode& m)
 
 TEST_F(ParserTest, getModeName)
 {
-       ModeXMLParser modeparser("tizen_ex1_mode.xml", ruleMgr);
+       ModeXMLParser modeparser("tizen_normalEx1_mode.xml", ruleMgr);
 
        EXPECT_EQ("ex1", modeparser.getModeName());
 }
 
 TEST_F(ParserTest, modeGetName)
 {
-       ModeXMLParser modeparser("tizen_ex2_mode.xml", ruleMgr);
+       ModeXMLParser modeparser("tizen_normalEx2_mode.xml", ruleMgr);
        Mode mode = modeparser.getMode();
        EXPECT_EQ("ex2", mode.getName());
 }
 
 TEST_F(ParserTest, isHiddenTrue)
 {
-       ModeXMLParser modeparser("tizen_ex2_mode.xml", ruleMgr);
+       ModeXMLParser modeparser("tizen_normalEx2_mode.xml", ruleMgr);
 
        EXPECT_EQ(true, modeparser.isHidden());
 }
 
 TEST_F(ParserTest, isHiddenFalse)
 {
-       ModeXMLParser modeparser("tizen_ex1_mode.xml", ruleMgr);
+       ModeXMLParser modeparser("tizen_normalEx1_mode.xml", ruleMgr);
 
        EXPECT_EQ(false, modeparser.isHidden());
 }
 
 TEST_F(ParserTest, getModeType)
 {
-       ModeXMLParser modeparser("tizen_ex1_mode.xml", ruleMgr);
+       ModeXMLParser modeparser("tizen_normalEx1_mode.xml", ruleMgr);
        Mode mode = modeparser.getMode();
        EXPECT_EQ(Mode::MODE_NORMAL, mode.getModeType());
 }
 
 TEST_F(ParserTest, printAction)
 {
-       ModeXMLParser modeparser("tizen_ex1_mode.xml", ruleMgr);
+       ModeXMLParser modeparser("tizen_normalEx1_mode.xml", ruleMgr);
        Mode mode = modeparser.getMode();
 
        list<std::shared_ptr<Action>> actionList = getActionList(mode);
@@ -114,16 +114,16 @@ TEST_F(ParserTest, printAction)
 
 TEST_F(ParserTest, invalidActionValue)
 {
-       ModeXMLParser modeparser1("tizen_invalid1_mode.xml", ruleMgr);
+       ModeXMLParser modeparser1("tizen_invalidValErr1_mode.xml", ruleMgr);
        EXPECT_THROW(modeparser1.getMode(), ModesEx);
 
-       ModeXMLParser modeparser2("tizen_invalid2_mode.xml", ruleMgr);
+       ModeXMLParser modeparser2("tizen_invalidValErr2_mode.xml", ruleMgr);
        EXPECT_THROW(modeparser2.getMode(), ModesEx);
 }
 
 TEST_F(ParserTest, validateAsyncStopOnErr)
 {
-       ModeXMLParser modeparser("tizen_asyncValidFail_mode.xml", ruleMgr);
+       ModeXMLParser modeparser("tizen_asyncValidErr_mode.xml", ruleMgr);
 
        EXPECT_THROW(modeparser.validateMode(MODES_MODE_DEFAULT_XSD_FILE), ModesEx);
 }
index 8a92713e69f121ef9d1cc93add6cf97295bab2a3..ef4222d4ea3f15508406c8f5c26cc077638f942f 100644 (file)
@@ -51,7 +51,7 @@ TEST(PluginMapper, readLibraryList)
                broker.piMapper.loadPlugins();
        }
        catch (ModesEx &e) {
-               broker.piMapper.setPluginDir("../plugin");
+               broker.piMapper.setPluginDir("../../lib/modes-plugins");
                EXPECT_NO_THROW(broker.piMapper.loadPlugins());
        }
 
@@ -95,7 +95,7 @@ TEST(PluginMapper, getPluginTest)
                broker.piMapper.loadPlugins();
        }
        catch (ModesEx &e) {
-               broker.piMapper.setPluginDir("../plugin");
+               broker.piMapper.setPluginDir("../../lib/modes-plugins");
                EXPECT_NO_THROW(broker.piMapper.loadPlugins());
        }
 
index 2a44d83b08de7716e283eadc30ccec638466bf80..d357b198e2cfbbd04481ecb105d99da769b9af70 100644 (file)
@@ -58,24 +58,25 @@ TEST(RuleManagerTest, makeRuleMapP)
 TEST(RuleManagerTest, parseActionRuleP)
 {
        RuleManagerTest testBroker;
-       EXPECT_NO_THROW(testBroker.parseActionRule("./tizen_ex_rule.xml"));
+       EXPECT_NO_THROW(testBroker.parseActionRule("./tizen_test_rule.xml"));
 }
 
 TEST(RuleManagerTest, DuplicatedRule)
 {
        RuleManagerTest testBroker;
-       EXPECT_THROW(testBroker.parseActionRule("./tizen_fail1_rule.xml"), ModesEx);
+       EXPECT_THROW(testBroker.parseActionRule("./tizen_uniqueRuleErr_rule.xml"), ModesEx);
 }
 
 TEST(RuleManagerTest, InvalidValue)
 {
        RuleManagerTest testBroker;
-       EXPECT_THROW(testBroker.parseActionRule("./tizen_fail2_rule.xml"), ModesEx);
+       EXPECT_THROW(testBroker.parseActionRule("./tizen_uniqueRuleErr_rule.xml"), ModesEx);
 }
 
+// If there are any errors in a file, the file will be ignored.
 TEST(RuleManagerTest, CheckAtomicity)
 {
        RuleManagerTest testBroker;
-       EXPECT_THROW(testBroker.parseActionRule("./tizen_fail2_rule.xml"), ModesEx);
+       EXPECT_THROW(testBroker.parseActionRule("./tizen_aliasValueErr.xml"), ModesEx);
        EXPECT_TRUE(testBroker.emptyRuleMap());
 }