diff --git a/application/src/main/data/lwm2m-registry/0.xml b/application/src/main/data/lwm2m-registry/0.xml
new file mode 100644
index 0000000000..60744d35c7
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/0.xml
@@ -0,0 +1,405 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/1.xml b/application/src/main/data/lwm2m-registry/1.xml
new file mode 100644
index 0000000000..ace9efcc6a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/1.xml
@@ -0,0 +1,360 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10.xml b/application/src/main/data/lwm2m-registry/10.xml
new file mode 100644
index 0000000000..af87413a94
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10.xml
@@ -0,0 +1,217 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10241.xml b/application/src/main/data/lwm2m-registry/10241.xml
new file mode 100644
index 0000000000..5a499100f3
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10241.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10242.xml b/application/src/main/data/lwm2m-registry/10242.xml
new file mode 100644
index 0000000000..09a62806d3
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10242.xml
@@ -0,0 +1,659 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10243.xml b/application/src/main/data/lwm2m-registry/10243.xml
new file mode 100644
index 0000000000..b73ce20021
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10243.xml
@@ -0,0 +1,263 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10244.xml b/application/src/main/data/lwm2m-registry/10244.xml
new file mode 100644
index 0000000000..9f55cd47de
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10244.xml
@@ -0,0 +1,303 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10245.xml b/application/src/main/data/lwm2m-registry/10245.xml
new file mode 100644
index 0000000000..b29349130d
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10245.xml
@@ -0,0 +1,217 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10246.xml b/application/src/main/data/lwm2m-registry/10246.xml
new file mode 100644
index 0000000000..c3977d9538
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10246.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10247.xml b/application/src/main/data/lwm2m-registry/10247.xml
new file mode 100644
index 0000000000..eba05417e8
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10247.xml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10248.xml b/application/src/main/data/lwm2m-registry/10248.xml
new file mode 100644
index 0000000000..e9f69f7889
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10248.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10249.xml b/application/src/main/data/lwm2m-registry/10249.xml
new file mode 100644
index 0000000000..e1257c3dda
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10249.xml
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10250.xml b/application/src/main/data/lwm2m-registry/10250.xml
new file mode 100644
index 0000000000..015149fae2
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10250.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10251.xml b/application/src/main/data/lwm2m-registry/10251.xml
new file mode 100644
index 0000000000..3fb1c00154
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10251.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10252.xml b/application/src/main/data/lwm2m-registry/10252.xml
new file mode 100644
index 0000000000..ddaf7cb1f2
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10252.xml
@@ -0,0 +1,229 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10253.xml b/application/src/main/data/lwm2m-registry/10253.xml
new file mode 100644
index 0000000000..27da37d16a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10253.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10254.xml b/application/src/main/data/lwm2m-registry/10254.xml
new file mode 100644
index 0000000000..ea37cf8cd8
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10254.xml
@@ -0,0 +1,119 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10255.xml b/application/src/main/data/lwm2m-registry/10255.xml
new file mode 100644
index 0000000000..fd63016952
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10255.xml
@@ -0,0 +1,165 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10256.xml b/application/src/main/data/lwm2m-registry/10256.xml
new file mode 100644
index 0000000000..dbcad740d0
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10256.xml
@@ -0,0 +1,117 @@
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10257.xml b/application/src/main/data/lwm2m-registry/10257.xml
new file mode 100644
index 0000000000..75864d542b
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10257.xml
@@ -0,0 +1,275 @@
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10258.xml b/application/src/main/data/lwm2m-registry/10258.xml
new file mode 100644
index 0000000000..e2a9438170
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10258.xml
@@ -0,0 +1,89 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10259.xml b/application/src/main/data/lwm2m-registry/10259.xml
new file mode 100644
index 0000000000..d75869a122
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10259.xml
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10260.xml b/application/src/main/data/lwm2m-registry/10260.xml
new file mode 100644
index 0000000000..5cd084af73
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10260.xml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10262.xml b/application/src/main/data/lwm2m-registry/10262.xml
new file mode 100644
index 0000000000..9fd47ac3af
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10262.xml
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10263.xml b/application/src/main/data/lwm2m-registry/10263.xml
new file mode 100644
index 0000000000..07b9cde3ca
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10263.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10264.xml b/application/src/main/data/lwm2m-registry/10264.xml
new file mode 100644
index 0000000000..b11c42a21d
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10264.xml
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10265.xml b/application/src/main/data/lwm2m-registry/10265.xml
new file mode 100644
index 0000000000..2604ae86d7
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10265.xml
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10266.xml b/application/src/main/data/lwm2m-registry/10266.xml
new file mode 100644
index 0000000000..48ee41319a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10266.xml
@@ -0,0 +1,246 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10267.xml b/application/src/main/data/lwm2m-registry/10267.xml
new file mode 100644
index 0000000000..ffe70b5f2f
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10267.xml
@@ -0,0 +1,246 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10268.xml b/application/src/main/data/lwm2m-registry/10268.xml
new file mode 100644
index 0000000000..a1ccd43888
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10268.xml
@@ -0,0 +1,246 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10269.xml b/application/src/main/data/lwm2m-registry/10269.xml
new file mode 100644
index 0000000000..e4156e055e
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10269.xml
@@ -0,0 +1,246 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10270.xml b/application/src/main/data/lwm2m-registry/10270.xml
new file mode 100644
index 0000000000..b7d171920c
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10270.xml
@@ -0,0 +1,246 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10271.xml b/application/src/main/data/lwm2m-registry/10271.xml
new file mode 100644
index 0000000000..b4f8dfa6d5
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10271.xml
@@ -0,0 +1,246 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10272.xml b/application/src/main/data/lwm2m-registry/10272.xml
new file mode 100644
index 0000000000..0464c98a73
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10272.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10273.xml b/application/src/main/data/lwm2m-registry/10273.xml
new file mode 100644
index 0000000000..823adae0ed
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10273.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10274.xml b/application/src/main/data/lwm2m-registry/10274.xml
new file mode 100644
index 0000000000..f61554ca88
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10274.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10275.xml b/application/src/main/data/lwm2m-registry/10275.xml
new file mode 100644
index 0000000000..10248ea511
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10275.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10276.xml b/application/src/main/data/lwm2m-registry/10276.xml
new file mode 100644
index 0000000000..5863f0326b
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10276.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10277.xml b/application/src/main/data/lwm2m-registry/10277.xml
new file mode 100644
index 0000000000..83c6d4f0d5
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10277.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10278.xml b/application/src/main/data/lwm2m-registry/10278.xml
new file mode 100644
index 0000000000..d004f89de6
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10278.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10279.xml b/application/src/main/data/lwm2m-registry/10279.xml
new file mode 100644
index 0000000000..38838e7c94
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10279.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10280.xml b/application/src/main/data/lwm2m-registry/10280.xml
new file mode 100644
index 0000000000..de2b7b6732
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10280.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10281.xml b/application/src/main/data/lwm2m-registry/10281.xml
new file mode 100644
index 0000000000..99eab667f2
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10281.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10282.xml b/application/src/main/data/lwm2m-registry/10282.xml
new file mode 100644
index 0000000000..e603de36b3
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10282.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10283.xml b/application/src/main/data/lwm2m-registry/10283.xml
new file mode 100644
index 0000000000..fd130fa713
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10283.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10284.xml b/application/src/main/data/lwm2m-registry/10284.xml
new file mode 100644
index 0000000000..1e889da48a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10284.xml
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10286.xml b/application/src/main/data/lwm2m-registry/10286.xml
new file mode 100644
index 0000000000..39e0809788
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10286.xml
@@ -0,0 +1,48 @@
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10290.xml b/application/src/main/data/lwm2m-registry/10290.xml
new file mode 100644
index 0000000000..7b89cc06c0
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10290.xml
@@ -0,0 +1,198 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10291.xml b/application/src/main/data/lwm2m-registry/10291.xml
new file mode 100644
index 0000000000..a232ed02f9
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10291.xml
@@ -0,0 +1,208 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10292.xml b/application/src/main/data/lwm2m-registry/10292.xml
new file mode 100644
index 0000000000..00fe33e320
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10292.xml
@@ -0,0 +1,208 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10299.xml b/application/src/main/data/lwm2m-registry/10299.xml
new file mode 100644
index 0000000000..a16a7c4fc2
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10299.xml
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10300.xml b/application/src/main/data/lwm2m-registry/10300.xml
new file mode 100644
index 0000000000..234f0301a4
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10300.xml
@@ -0,0 +1,142 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10308.xml b/application/src/main/data/lwm2m-registry/10308.xml
new file mode 100644
index 0000000000..0ed1a6ea30
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10308.xml
@@ -0,0 +1,145 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10309.xml b/application/src/main/data/lwm2m-registry/10309.xml
new file mode 100644
index 0000000000..b37b435724
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10309.xml
@@ -0,0 +1,115 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10311.xml b/application/src/main/data/lwm2m-registry/10311.xml
new file mode 100644
index 0000000000..6b6a78d21d
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10311.xml
@@ -0,0 +1,192 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10313.xml b/application/src/main/data/lwm2m-registry/10313.xml
new file mode 100644
index 0000000000..4875e5d6b0
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10313.xml
@@ -0,0 +1,253 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10314.xml b/application/src/main/data/lwm2m-registry/10314.xml
new file mode 100644
index 0000000000..f003fa03c2
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10314.xml
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10315.xml b/application/src/main/data/lwm2m-registry/10315.xml
new file mode 100644
index 0000000000..da7ff8c67e
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10315.xml
@@ -0,0 +1,129 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10316.xml b/application/src/main/data/lwm2m-registry/10316.xml
new file mode 100644
index 0000000000..d10dabf99b
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10316.xml
@@ -0,0 +1,233 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10318.xml b/application/src/main/data/lwm2m-registry/10318.xml
new file mode 100644
index 0000000000..989db0de7e
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10318.xml
@@ -0,0 +1,189 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10319.xml b/application/src/main/data/lwm2m-registry/10319.xml
new file mode 100644
index 0000000000..b8ebcef6fb
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10319.xml
@@ -0,0 +1,130 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10320.xml b/application/src/main/data/lwm2m-registry/10320.xml
new file mode 100644
index 0000000000..fb48c814f0
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10320.xml
@@ -0,0 +1,141 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10322.xml b/application/src/main/data/lwm2m-registry/10322.xml
new file mode 100644
index 0000000000..98822e0efe
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10322.xml
@@ -0,0 +1,87 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10323.xml b/application/src/main/data/lwm2m-registry/10323.xml
new file mode 100644
index 0000000000..dcbdaeb91d
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10323.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10324.xml b/application/src/main/data/lwm2m-registry/10324.xml
new file mode 100644
index 0000000000..b3db2b4f06
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10324.xml
@@ -0,0 +1,77 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10326.xml b/application/src/main/data/lwm2m-registry/10326.xml
new file mode 100644
index 0000000000..cdc01a0e61
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10326.xml
@@ -0,0 +1,722 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10327.xml b/application/src/main/data/lwm2m-registry/10327.xml
new file mode 100644
index 0000000000..5f0e232a22
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10327.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10328.xml b/application/src/main/data/lwm2m-registry/10328.xml
new file mode 100644
index 0000000000..fdf39d5dc1
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10328.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10329.xml b/application/src/main/data/lwm2m-registry/10329.xml
new file mode 100644
index 0000000000..7470bec6e1
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10329.xml
@@ -0,0 +1,433 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10330.xml b/application/src/main/data/lwm2m-registry/10330.xml
new file mode 100644
index 0000000000..75c5a2ecdd
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10330.xml
@@ -0,0 +1,120 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10331.xml b/application/src/main/data/lwm2m-registry/10331.xml
new file mode 100644
index 0000000000..ca555cc0d9
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10331.xml
@@ -0,0 +1,221 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10332.xml b/application/src/main/data/lwm2m-registry/10332.xml
new file mode 100644
index 0000000000..f582373043
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10332.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10333.xml b/application/src/main/data/lwm2m-registry/10333.xml
new file mode 100644
index 0000000000..aaeb25487d
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10333.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10334.xml b/application/src/main/data/lwm2m-registry/10334.xml
new file mode 100644
index 0000000000..479406630c
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10334.xml
@@ -0,0 +1,129 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10335.xml b/application/src/main/data/lwm2m-registry/10335.xml
new file mode 100644
index 0000000000..91fe8cd9c5
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10335.xml
@@ -0,0 +1,97 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10336.xml b/application/src/main/data/lwm2m-registry/10336.xml
new file mode 100644
index 0000000000..5016e6ee13
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10336.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10337.xml b/application/src/main/data/lwm2m-registry/10337.xml
new file mode 100644
index 0000000000..6204020400
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10337.xml
@@ -0,0 +1,118 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10338.xml b/application/src/main/data/lwm2m-registry/10338.xml
new file mode 100644
index 0000000000..c66df8addf
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10338.xml
@@ -0,0 +1,124 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10339.xml b/application/src/main/data/lwm2m-registry/10339.xml
new file mode 100644
index 0000000000..5376de4a6c
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10339.xml
@@ -0,0 +1,114 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10340.xml b/application/src/main/data/lwm2m-registry/10340.xml
new file mode 100644
index 0000000000..679b46f150
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10340.xml
@@ -0,0 +1,218 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10341.xml b/application/src/main/data/lwm2m-registry/10341.xml
new file mode 100644
index 0000000000..c632fd5c57
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10341.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10342.xml b/application/src/main/data/lwm2m-registry/10342.xml
new file mode 100644
index 0000000000..644bcf9071
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10342.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10343.xml b/application/src/main/data/lwm2m-registry/10343.xml
new file mode 100644
index 0000000000..a34c80f3a6
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10343.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10344.xml b/application/src/main/data/lwm2m-registry/10344.xml
new file mode 100644
index 0000000000..d28d343ae3
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10344.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10345.xml b/application/src/main/data/lwm2m-registry/10345.xml
new file mode 100644
index 0000000000..ad489a7faa
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10345.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10346.xml b/application/src/main/data/lwm2m-registry/10346.xml
new file mode 100644
index 0000000000..4ee595e16a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10346.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10347.xml b/application/src/main/data/lwm2m-registry/10347.xml
new file mode 100644
index 0000000000..6c0808ed61
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10347.xml
@@ -0,0 +1,154 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10348.xml b/application/src/main/data/lwm2m-registry/10348.xml
new file mode 100644
index 0000000000..76451605f0
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10348.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10349.xml b/application/src/main/data/lwm2m-registry/10349.xml
new file mode 100644
index 0000000000..a4212558c4
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10349.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10350.xml b/application/src/main/data/lwm2m-registry/10350.xml
new file mode 100644
index 0000000000..1942cabe0c
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10350.xml
@@ -0,0 +1,116 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10351.xml b/application/src/main/data/lwm2m-registry/10351.xml
new file mode 100644
index 0000000000..473b440b02
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10351.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10352.xml b/application/src/main/data/lwm2m-registry/10352.xml
new file mode 100644
index 0000000000..1e7503ef42
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10352.xml
@@ -0,0 +1,114 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10353.xml b/application/src/main/data/lwm2m-registry/10353.xml
new file mode 100644
index 0000000000..0b6bb56cc4
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10353.xml
@@ -0,0 +1,87 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10354.xml b/application/src/main/data/lwm2m-registry/10354.xml
new file mode 100644
index 0000000000..60d5fc0050
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10354.xml
@@ -0,0 +1,217 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10355.xml b/application/src/main/data/lwm2m-registry/10355.xml
new file mode 100644
index 0000000000..fb38ee2767
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10355.xml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10356.xml b/application/src/main/data/lwm2m-registry/10356.xml
new file mode 100644
index 0000000000..2e362ce052
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10356.xml
@@ -0,0 +1,203 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10357.xml b/application/src/main/data/lwm2m-registry/10357.xml
new file mode 100644
index 0000000000..9487b2813d
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10357.xml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10358.xml b/application/src/main/data/lwm2m-registry/10358.xml
new file mode 100644
index 0000000000..27a3684b22
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10358.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10359.xml b/application/src/main/data/lwm2m-registry/10359.xml
new file mode 100644
index 0000000000..2fc8af9677
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10359.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10360.xml b/application/src/main/data/lwm2m-registry/10360.xml
new file mode 100644
index 0000000000..935fea848c
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10360.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10361.xml b/application/src/main/data/lwm2m-registry/10361.xml
new file mode 100644
index 0000000000..3525647afd
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10361.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10362.xml b/application/src/main/data/lwm2m-registry/10362.xml
new file mode 100644
index 0000000000..8a928e4425
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10362.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10363.xml b/application/src/main/data/lwm2m-registry/10363.xml
new file mode 100644
index 0000000000..ca9d064f2f
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10363.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10364.xml b/application/src/main/data/lwm2m-registry/10364.xml
new file mode 100644
index 0000000000..3519665e62
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10364.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10365.xml b/application/src/main/data/lwm2m-registry/10365.xml
new file mode 100644
index 0000000000..792844271e
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10365.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10366.xml b/application/src/main/data/lwm2m-registry/10366.xml
new file mode 100644
index 0000000000..44e94ae51d
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10366.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10368.xml b/application/src/main/data/lwm2m-registry/10368.xml
new file mode 100644
index 0000000000..68d3dd3ee3
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10368.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10369.xml b/application/src/main/data/lwm2m-registry/10369.xml
new file mode 100644
index 0000000000..dcf8190bda
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10369.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10371.xml b/application/src/main/data/lwm2m-registry/10371.xml
new file mode 100644
index 0000000000..73a4476865
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10371.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10374.xml b/application/src/main/data/lwm2m-registry/10374.xml
new file mode 100644
index 0000000000..a51646b95f
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10374.xml
@@ -0,0 +1,161 @@
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10375.xml b/application/src/main/data/lwm2m-registry/10375.xml
new file mode 100644
index 0000000000..5818491c51
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10375.xml
@@ -0,0 +1,148 @@
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10376.xml b/application/src/main/data/lwm2m-registry/10376.xml
new file mode 100644
index 0000000000..faec95398e
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10376.xml
@@ -0,0 +1,211 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10377.xml b/application/src/main/data/lwm2m-registry/10377.xml
new file mode 100644
index 0000000000..f46ace72aa
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10377.xml
@@ -0,0 +1,251 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/10378.xml b/application/src/main/data/lwm2m-registry/10378.xml
new file mode 100644
index 0000000000..bbd45811d0
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/10378.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/11.xml b/application/src/main/data/lwm2m-registry/11.xml
new file mode 100644
index 0000000000..438b2c3df2
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/11.xml
@@ -0,0 +1,408 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/12.xml b/application/src/main/data/lwm2m-registry/12.xml
new file mode 100644
index 0000000000..d4aad43dca
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/12.xml
@@ -0,0 +1,551 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/13.xml b/application/src/main/data/lwm2m-registry/13.xml
new file mode 100644
index 0000000000..9b30ecd225
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/13.xml
@@ -0,0 +1,209 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/14.xml b/application/src/main/data/lwm2m-registry/14.xml
new file mode 100644
index 0000000000..a1d7f7239f
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/14.xml
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/15.xml b/application/src/main/data/lwm2m-registry/15.xml
new file mode 100644
index 0000000000..f4363e3f33
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/15.xml
@@ -0,0 +1,175 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/16.xml b/application/src/main/data/lwm2m-registry/16.xml
new file mode 100644
index 0000000000..f8f2dc40df
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/16.xml
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/18830.xml b/application/src/main/data/lwm2m-registry/18830.xml
new file mode 100644
index 0000000000..87e0747d5c
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/18830.xml
@@ -0,0 +1,173 @@
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/18831.xml b/application/src/main/data/lwm2m-registry/18831.xml
new file mode 100644
index 0000000000..68dc873ed0
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/18831.xml
@@ -0,0 +1,120 @@
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/19.xml b/application/src/main/data/lwm2m-registry/19.xml
new file mode 100644
index 0000000000..c4f5cbe6ab
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/19.xml
@@ -0,0 +1,144 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/2.xml b/application/src/main/data/lwm2m-registry/2.xml
new file mode 100644
index 0000000000..4ea5805b36
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/2.xml
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/20.xml b/application/src/main/data/lwm2m-registry/20.xml
new file mode 100644
index 0000000000..68aa96048c
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/20.xml
@@ -0,0 +1,142 @@
+
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/2048.xml b/application/src/main/data/lwm2m-registry/2048.xml
new file mode 100644
index 0000000000..0bc99cffd1
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/2048.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/2049.xml b/application/src/main/data/lwm2m-registry/2049.xml
new file mode 100644
index 0000000000..7509b22160
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/2049.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/2050.xml b/application/src/main/data/lwm2m-registry/2050.xml
new file mode 100644
index 0000000000..da27a90de0
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/2050.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/2051.xml b/application/src/main/data/lwm2m-registry/2051.xml
new file mode 100644
index 0000000000..1f4ecda5d1
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/2051.xml
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/2052.xml b/application/src/main/data/lwm2m-registry/2052.xml
new file mode 100644
index 0000000000..abaae1b54e
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/2052.xml
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/2053.xml b/application/src/main/data/lwm2m-registry/2053.xml
new file mode 100644
index 0000000000..a765a7894a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/2053.xml
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/2054.xml b/application/src/main/data/lwm2m-registry/2054.xml
new file mode 100644
index 0000000000..3935fb7253
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/2054.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/2055.xml b/application/src/main/data/lwm2m-registry/2055.xml
new file mode 100644
index 0000000000..cbd0dc5796
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/2055.xml
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/2056.xml b/application/src/main/data/lwm2m-registry/2056.xml
new file mode 100644
index 0000000000..ddd50e269a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/2056.xml
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/2057.xml b/application/src/main/data/lwm2m-registry/2057.xml
new file mode 100644
index 0000000000..68d4bcd135
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/2057.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/21.xml b/application/src/main/data/lwm2m-registry/21.xml
new file mode 100644
index 0000000000..5685648bad
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/21.xml
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/22.xml b/application/src/main/data/lwm2m-registry/22.xml
new file mode 100644
index 0000000000..02fed409ae
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/22.xml
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/23.xml b/application/src/main/data/lwm2m-registry/23.xml
new file mode 100644
index 0000000000..55db80cc77
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/23.xml
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/24.xml b/application/src/main/data/lwm2m-registry/24.xml
new file mode 100644
index 0000000000..7dd6942646
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/24.xml
@@ -0,0 +1,163 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/25.xml b/application/src/main/data/lwm2m-registry/25.xml
new file mode 100644
index 0000000000..5ab62b3c36
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/25.xml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/26.xml b/application/src/main/data/lwm2m-registry/26.xml
new file mode 100644
index 0000000000..0f77aad973
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/26.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/27.xml b/application/src/main/data/lwm2m-registry/27.xml
new file mode 100644
index 0000000000..9f30947997
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/27.xml
@@ -0,0 +1,322 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/28.xml b/application/src/main/data/lwm2m-registry/28.xml
new file mode 100644
index 0000000000..8edd51bcc5
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/28.xml
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3.xml b/application/src/main/data/lwm2m-registry/3.xml
new file mode 100644
index 0000000000..cb360acd10
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3.xml
@@ -0,0 +1,331 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3200.xml b/application/src/main/data/lwm2m-registry/3200.xml
new file mode 100644
index 0000000000..6a6310b5bb
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3200.xml
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3201.xml b/application/src/main/data/lwm2m-registry/3201.xml
new file mode 100644
index 0000000000..b950077387
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3201.xml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3202.xml b/application/src/main/data/lwm2m-registry/3202.xml
new file mode 100644
index 0000000000..7814f6ccf9
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3202.xml
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3203.xml b/application/src/main/data/lwm2m-registry/3203.xml
new file mode 100644
index 0000000000..0316e920a5
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3203.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3300.xml b/application/src/main/data/lwm2m-registry/3300.xml
new file mode 100644
index 0000000000..f7a5b8a3e2
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3300.xml
@@ -0,0 +1,178 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3301.xml b/application/src/main/data/lwm2m-registry/3301.xml
new file mode 100644
index 0000000000..6604464f20
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3301.xml
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3302.xml b/application/src/main/data/lwm2m-registry/3302.xml
new file mode 100644
index 0000000000..fe9e886408
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3302.xml
@@ -0,0 +1,158 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3303.xml b/application/src/main/data/lwm2m-registry/3303.xml
new file mode 100644
index 0000000000..2db5da74c8
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3303.xml
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3304.xml b/application/src/main/data/lwm2m-registry/3304.xml
new file mode 100644
index 0000000000..7331c5f83a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3304.xml
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3305.xml b/application/src/main/data/lwm2m-registry/3305.xml
new file mode 100644
index 0000000000..f927a44a59
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3305.xml
@@ -0,0 +1,278 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3306.xml b/application/src/main/data/lwm2m-registry/3306.xml
new file mode 100644
index 0000000000..748bc0f005
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3306.xml
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3308.xml b/application/src/main/data/lwm2m-registry/3308.xml
new file mode 100644
index 0000000000..f1d5c18f12
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3308.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3310.xml b/application/src/main/data/lwm2m-registry/3310.xml
new file mode 100644
index 0000000000..6b4e04d6b6
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3310.xml
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3311.xml b/application/src/main/data/lwm2m-registry/3311.xml
new file mode 100644
index 0000000000..4c98be2522
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3311.xml
@@ -0,0 +1,127 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3312.xml b/application/src/main/data/lwm2m-registry/3312.xml
new file mode 100644
index 0000000000..17bd0312db
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3312.xml
@@ -0,0 +1,127 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3313.xml b/application/src/main/data/lwm2m-registry/3313.xml
new file mode 100644
index 0000000000..43d0d63b88
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3313.xml
@@ -0,0 +1,157 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3314.xml b/application/src/main/data/lwm2m-registry/3314.xml
new file mode 100644
index 0000000000..96ebc5a537
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3314.xml
@@ -0,0 +1,147 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3315.xml b/application/src/main/data/lwm2m-registry/3315.xml
new file mode 100644
index 0000000000..d54a09edd8
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3315.xml
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3316.xml b/application/src/main/data/lwm2m-registry/3316.xml
new file mode 100644
index 0000000000..16a20a219a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3316.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3317.xml b/application/src/main/data/lwm2m-registry/3317.xml
new file mode 100644
index 0000000000..9d41da70de
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3317.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3318.xml b/application/src/main/data/lwm2m-registry/3318.xml
new file mode 100644
index 0000000000..957b593c89
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3318.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3319.xml b/application/src/main/data/lwm2m-registry/3319.xml
new file mode 100644
index 0000000000..e3a13ea3ef
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3319.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3320.xml b/application/src/main/data/lwm2m-registry/3320.xml
new file mode 100644
index 0000000000..9ec16fb671
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3320.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3321.xml b/application/src/main/data/lwm2m-registry/3321.xml
new file mode 100644
index 0000000000..e4a1f80bf1
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3321.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3322.xml b/application/src/main/data/lwm2m-registry/3322.xml
new file mode 100644
index 0000000000..838ed44995
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3322.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3323.xml b/application/src/main/data/lwm2m-registry/3323.xml
new file mode 100644
index 0000000000..e65c11c123
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3323.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3324.xml b/application/src/main/data/lwm2m-registry/3324.xml
new file mode 100644
index 0000000000..b80d427b91
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3324.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3325.xml b/application/src/main/data/lwm2m-registry/3325.xml
new file mode 100644
index 0000000000..c0577d64cd
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3325.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3326.xml b/application/src/main/data/lwm2m-registry/3326.xml
new file mode 100644
index 0000000000..e247637bcf
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3326.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3327.xml b/application/src/main/data/lwm2m-registry/3327.xml
new file mode 100644
index 0000000000..9cc689459f
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3327.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3328.xml b/application/src/main/data/lwm2m-registry/3328.xml
new file mode 100644
index 0000000000..752ebe0c53
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3328.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3329.xml b/application/src/main/data/lwm2m-registry/3329.xml
new file mode 100644
index 0000000000..fe221a1564
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3329.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3330.xml b/application/src/main/data/lwm2m-registry/3330.xml
new file mode 100644
index 0000000000..baec2dab14
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3330.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3331.xml b/application/src/main/data/lwm2m-registry/3331.xml
new file mode 100644
index 0000000000..1094d5bf31
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3331.xml
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3332.xml b/application/src/main/data/lwm2m-registry/3332.xml
new file mode 100644
index 0000000000..d4026e9558
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3332.xml
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3333.xml b/application/src/main/data/lwm2m-registry/3333.xml
new file mode 100644
index 0000000000..1fc7117482
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3333.xml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3334.xml b/application/src/main/data/lwm2m-registry/3334.xml
new file mode 100644
index 0000000000..4ff3e6c6a6
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3334.xml
@@ -0,0 +1,229 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3335.xml b/application/src/main/data/lwm2m-registry/3335.xml
new file mode 100644
index 0000000000..9f608653f5
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3335.xml
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3336.xml b/application/src/main/data/lwm2m-registry/3336.xml
new file mode 100644
index 0000000000..68fea3b90e
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3336.xml
@@ -0,0 +1,149 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3337.xml b/application/src/main/data/lwm2m-registry/3337.xml
new file mode 100644
index 0000000000..fa4eefbe81
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3337.xml
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3338.xml b/application/src/main/data/lwm2m-registry/3338.xml
new file mode 100644
index 0000000000..fd1fba3332
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3338.xml
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3339.xml b/application/src/main/data/lwm2m-registry/3339.xml
new file mode 100644
index 0000000000..194685474e
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3339.xml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3340.xml b/application/src/main/data/lwm2m-registry/3340.xml
new file mode 100644
index 0000000000..35de944f3a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3340.xml
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3341.xml b/application/src/main/data/lwm2m-registry/3341.xml
new file mode 100644
index 0000000000..38e8fb8d9d
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3341.xml
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3342.xml b/application/src/main/data/lwm2m-registry/3342.xml
new file mode 100644
index 0000000000..cd27717ed4
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3342.xml
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3343.xml b/application/src/main/data/lwm2m-registry/3343.xml
new file mode 100644
index 0000000000..3aa109923a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3343.xml
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3344.xml b/application/src/main/data/lwm2m-registry/3344.xml
new file mode 100644
index 0000000000..2dd8648a19
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3344.xml
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3345.xml b/application/src/main/data/lwm2m-registry/3345.xml
new file mode 100644
index 0000000000..bb234638a9
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3345.xml
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3346.xml b/application/src/main/data/lwm2m-registry/3346.xml
new file mode 100644
index 0000000000..d49322f32a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3346.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3347.xml b/application/src/main/data/lwm2m-registry/3347.xml
new file mode 100644
index 0000000000..136e3445b9
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3347.xml
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3348.xml b/application/src/main/data/lwm2m-registry/3348.xml
new file mode 100644
index 0000000000..9309b4b3dd
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3348.xml
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3349.xml b/application/src/main/data/lwm2m-registry/3349.xml
new file mode 100644
index 0000000000..28029e7a6a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3349.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3350.xml b/application/src/main/data/lwm2m-registry/3350.xml
new file mode 100644
index 0000000000..f4f8477fdc
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3350.xml
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3351.xml b/application/src/main/data/lwm2m-registry/3351.xml
new file mode 100644
index 0000000000..9219a765df
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3351.xml
@@ -0,0 +1,131 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3352.xml b/application/src/main/data/lwm2m-registry/3352.xml
new file mode 100644
index 0000000000..0e519c4951
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3352.xml
@@ -0,0 +1,124 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3353.xml b/application/src/main/data/lwm2m-registry/3353.xml
new file mode 100644
index 0000000000..1881a3b3bb
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3353.xml
@@ -0,0 +1,123 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3354.xml b/application/src/main/data/lwm2m-registry/3354.xml
new file mode 100644
index 0000000000..702be4cabc
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3354.xml
@@ -0,0 +1,134 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3355.xml b/application/src/main/data/lwm2m-registry/3355.xml
new file mode 100644
index 0000000000..fb56230fdf
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3355.xml
@@ -0,0 +1,156 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3356.xml b/application/src/main/data/lwm2m-registry/3356.xml
new file mode 100644
index 0000000000..95c7fc7835
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3356.xml
@@ -0,0 +1,120 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3357.xml b/application/src/main/data/lwm2m-registry/3357.xml
new file mode 100644
index 0000000000..935b7c4ba7
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3357.xml
@@ -0,0 +1,131 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3358.xml b/application/src/main/data/lwm2m-registry/3358.xml
new file mode 100644
index 0000000000..2784d6a990
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3358.xml
@@ -0,0 +1,106 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3359.xml b/application/src/main/data/lwm2m-registry/3359.xml
new file mode 100644
index 0000000000..91cb845e7a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3359.xml
@@ -0,0 +1,105 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3360.xml b/application/src/main/data/lwm2m-registry/3360.xml
new file mode 100644
index 0000000000..12b2302854
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3360.xml
@@ -0,0 +1,128 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3361.xml b/application/src/main/data/lwm2m-registry/3361.xml
new file mode 100644
index 0000000000..3d354bffac
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3361.xml
@@ -0,0 +1,130 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3362.xml b/application/src/main/data/lwm2m-registry/3362.xml
new file mode 100644
index 0000000000..3cb73eb79a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3362.xml
@@ -0,0 +1,97 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3363.xml b/application/src/main/data/lwm2m-registry/3363.xml
new file mode 100644
index 0000000000..3b44b91f26
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3363.xml
@@ -0,0 +1,100 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3364.xml b/application/src/main/data/lwm2m-registry/3364.xml
new file mode 100644
index 0000000000..0a042d12d2
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3364.xml
@@ -0,0 +1,97 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3365.xml b/application/src/main/data/lwm2m-registry/3365.xml
new file mode 100644
index 0000000000..83dbf0c807
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3365.xml
@@ -0,0 +1,123 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3366.xml b/application/src/main/data/lwm2m-registry/3366.xml
new file mode 100644
index 0000000000..5498af2a3d
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3366.xml
@@ -0,0 +1,176 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3367.xml b/application/src/main/data/lwm2m-registry/3367.xml
new file mode 100644
index 0000000000..1f35cf4cc5
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3367.xml
@@ -0,0 +1,138 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3368.xml b/application/src/main/data/lwm2m-registry/3368.xml
new file mode 100644
index 0000000000..40c17bfd37
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3368.xml
@@ -0,0 +1,100 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3369.xml b/application/src/main/data/lwm2m-registry/3369.xml
new file mode 100644
index 0000000000..b93bb86644
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3369.xml
@@ -0,0 +1,105 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3370.xml b/application/src/main/data/lwm2m-registry/3370.xml
new file mode 100644
index 0000000000..667ab0a281
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3370.xml
@@ -0,0 +1,141 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3371.xml b/application/src/main/data/lwm2m-registry/3371.xml
new file mode 100644
index 0000000000..fbc0860870
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3371.xml
@@ -0,0 +1,141 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3372.xml b/application/src/main/data/lwm2m-registry/3372.xml
new file mode 100644
index 0000000000..49d585a973
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3372.xml
@@ -0,0 +1,115 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3373.xml b/application/src/main/data/lwm2m-registry/3373.xml
new file mode 100644
index 0000000000..fb2af328b3
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3373.xml
@@ -0,0 +1,115 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3374.xml b/application/src/main/data/lwm2m-registry/3374.xml
new file mode 100644
index 0000000000..be7ecdc34e
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3374.xml
@@ -0,0 +1,132 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3375.xml b/application/src/main/data/lwm2m-registry/3375.xml
new file mode 100644
index 0000000000..75fb2a5a42
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3375.xml
@@ -0,0 +1,150 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3376.xml b/application/src/main/data/lwm2m-registry/3376.xml
new file mode 100644
index 0000000000..542f816da0
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3376.xml
@@ -0,0 +1,97 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3377.xml b/application/src/main/data/lwm2m-registry/3377.xml
new file mode 100644
index 0000000000..515eb36439
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3377.xml
@@ -0,0 +1,168 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3378.xml b/application/src/main/data/lwm2m-registry/3378.xml
new file mode 100644
index 0000000000..970d245a90
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3378.xml
@@ -0,0 +1,115 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3379.xml b/application/src/main/data/lwm2m-registry/3379.xml
new file mode 100644
index 0000000000..87137da530
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3379.xml
@@ -0,0 +1,123 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3380.xml b/application/src/main/data/lwm2m-registry/3380.xml
new file mode 100644
index 0000000000..8290651569
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3380.xml
@@ -0,0 +1,204 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3381.xml b/application/src/main/data/lwm2m-registry/3381.xml
new file mode 100644
index 0000000000..db2e4d52e8
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3381.xml
@@ -0,0 +1,110 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3382.xml b/application/src/main/data/lwm2m-registry/3382.xml
new file mode 100644
index 0000000000..8f066837c8
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3382.xml
@@ -0,0 +1,108 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3383.xml b/application/src/main/data/lwm2m-registry/3383.xml
new file mode 100644
index 0000000000..663ac45faa
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3383.xml
@@ -0,0 +1,99 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3384.xml b/application/src/main/data/lwm2m-registry/3384.xml
new file mode 100644
index 0000000000..a18c6b910b
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3384.xml
@@ -0,0 +1,112 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3385.xml b/application/src/main/data/lwm2m-registry/3385.xml
new file mode 100644
index 0000000000..cc0a99182a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3385.xml
@@ -0,0 +1,110 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3386.xml b/application/src/main/data/lwm2m-registry/3386.xml
new file mode 100644
index 0000000000..43937efadb
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3386.xml
@@ -0,0 +1,105 @@
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3387.xml b/application/src/main/data/lwm2m-registry/3387.xml
new file mode 100644
index 0000000000..c50ecb47bc
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3387.xml
@@ -0,0 +1,224 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3388.xml b/application/src/main/data/lwm2m-registry/3388.xml
new file mode 100644
index 0000000000..c1b5e54206
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3388.xml
@@ -0,0 +1,178 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3389.xml b/application/src/main/data/lwm2m-registry/3389.xml
new file mode 100644
index 0000000000..7e3d0c7cdb
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3389.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3390.xml b/application/src/main/data/lwm2m-registry/3390.xml
new file mode 100644
index 0000000000..0e56d0a19a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3390.xml
@@ -0,0 +1,298 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3391.xml b/application/src/main/data/lwm2m-registry/3391.xml
new file mode 100644
index 0000000000..0b4ce12cd0
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3391.xml
@@ -0,0 +1,258 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3392.xml b/application/src/main/data/lwm2m-registry/3392.xml
new file mode 100644
index 0000000000..07b1b154e4
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3392.xml
@@ -0,0 +1,198 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3393.xml b/application/src/main/data/lwm2m-registry/3393.xml
new file mode 100644
index 0000000000..e3c883ac70
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3393.xml
@@ -0,0 +1,268 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3394.xml b/application/src/main/data/lwm2m-registry/3394.xml
new file mode 100644
index 0000000000..767100e145
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3394.xml
@@ -0,0 +1,177 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3395.xml b/application/src/main/data/lwm2m-registry/3395.xml
new file mode 100644
index 0000000000..29b4ce6b67
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3395.xml
@@ -0,0 +1,182 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3396.xml b/application/src/main/data/lwm2m-registry/3396.xml
new file mode 100644
index 0000000000..c3183f8e29
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3396.xml
@@ -0,0 +1,270 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3397.xml b/application/src/main/data/lwm2m-registry/3397.xml
new file mode 100644
index 0000000000..b8a3bed8d0
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3397.xml
@@ -0,0 +1,302 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3398.xml b/application/src/main/data/lwm2m-registry/3398.xml
new file mode 100644
index 0000000000..de3e24113d
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3398.xml
@@ -0,0 +1,107 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3399.xml b/application/src/main/data/lwm2m-registry/3399.xml
new file mode 100644
index 0000000000..8c29c4af82
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3399.xml
@@ -0,0 +1,238 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3400.xml b/application/src/main/data/lwm2m-registry/3400.xml
new file mode 100644
index 0000000000..aea142daba
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3400.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3401.xml b/application/src/main/data/lwm2m-registry/3401.xml
new file mode 100644
index 0000000000..1b088f1737
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3401.xml
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3402.xml b/application/src/main/data/lwm2m-registry/3402.xml
new file mode 100644
index 0000000000..5cf405a66a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3402.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3403.xml b/application/src/main/data/lwm2m-registry/3403.xml
new file mode 100644
index 0000000000..f3690e5df5
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3403.xml
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3404.xml b/application/src/main/data/lwm2m-registry/3404.xml
new file mode 100644
index 0000000000..24250ab608
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3404.xml
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3405.xml b/application/src/main/data/lwm2m-registry/3405.xml
new file mode 100644
index 0000000000..f6939917ae
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3405.xml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3406.xml b/application/src/main/data/lwm2m-registry/3406.xml
new file mode 100644
index 0000000000..ccc7601eeb
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3406.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3407.xml b/application/src/main/data/lwm2m-registry/3407.xml
new file mode 100644
index 0000000000..7f29324566
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3407.xml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3408.xml b/application/src/main/data/lwm2m-registry/3408.xml
new file mode 100644
index 0000000000..4d5ff67eef
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3408.xml
@@ -0,0 +1,79 @@
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3410.xml b/application/src/main/data/lwm2m-registry/3410.xml
new file mode 100644
index 0000000000..63449e590b
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3410.xml
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3411.xml b/application/src/main/data/lwm2m-registry/3411.xml
new file mode 100644
index 0000000000..6339b847bd
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3411.xml
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3412.xml b/application/src/main/data/lwm2m-registry/3412.xml
new file mode 100644
index 0000000000..c3675639da
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3412.xml
@@ -0,0 +1,288 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3413.xml b/application/src/main/data/lwm2m-registry/3413.xml
new file mode 100644
index 0000000000..e699cb67dd
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3413.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3414.xml b/application/src/main/data/lwm2m-registry/3414.xml
new file mode 100644
index 0000000000..b3f7ad4567
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3414.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3415.xml b/application/src/main/data/lwm2m-registry/3415.xml
new file mode 100644
index 0000000000..5a76ca93a3
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3415.xml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3416.xml b/application/src/main/data/lwm2m-registry/3416.xml
new file mode 100644
index 0000000000..bf9f23b6ac
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3416.xml
@@ -0,0 +1,518 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3417.xml b/application/src/main/data/lwm2m-registry/3417.xml
new file mode 100644
index 0000000000..d22a318d84
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3417.xml
@@ -0,0 +1,188 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3418.xml b/application/src/main/data/lwm2m-registry/3418.xml
new file mode 100644
index 0000000000..6ff07dfa94
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3418.xml
@@ -0,0 +1,348 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3419.xml b/application/src/main/data/lwm2m-registry/3419.xml
new file mode 100644
index 0000000000..88b66119a7
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3419.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3420.xml b/application/src/main/data/lwm2m-registry/3420.xml
new file mode 100644
index 0000000000..835f4ec8a5
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3420.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3421.xml b/application/src/main/data/lwm2m-registry/3421.xml
new file mode 100644
index 0000000000..dadf8d8f47
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3421.xml
@@ -0,0 +1,618 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3423.xml b/application/src/main/data/lwm2m-registry/3423.xml
new file mode 100644
index 0000000000..6e0aaf3b21
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3423.xml
@@ -0,0 +1,158 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3424.xml b/application/src/main/data/lwm2m-registry/3424.xml
new file mode 100644
index 0000000000..01df43cbaf
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3424.xml
@@ -0,0 +1,178 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3425.xml b/application/src/main/data/lwm2m-registry/3425.xml
new file mode 100644
index 0000000000..dd94f14dfd
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3425.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3426.xml b/application/src/main/data/lwm2m-registry/3426.xml
new file mode 100644
index 0000000000..7f33c1bc1a
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3426.xml
@@ -0,0 +1,188 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3427.xml b/application/src/main/data/lwm2m-registry/3427.xml
new file mode 100644
index 0000000000..4ffe60c2bc
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3427.xml
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3428.xml b/application/src/main/data/lwm2m-registry/3428.xml
new file mode 100644
index 0000000000..68dab08269
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3428.xml
@@ -0,0 +1,268 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3429.xml b/application/src/main/data/lwm2m-registry/3429.xml
new file mode 100644
index 0000000000..e5f6f46b75
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3429.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3430.xml b/application/src/main/data/lwm2m-registry/3430.xml
new file mode 100644
index 0000000000..76a14c0656
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3430.xml
@@ -0,0 +1,371 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3431.xml b/application/src/main/data/lwm2m-registry/3431.xml
new file mode 100644
index 0000000000..8f0ec363d1
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3431.xml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3432.xml b/application/src/main/data/lwm2m-registry/3432.xml
new file mode 100644
index 0000000000..4816248320
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3432.xml
@@ -0,0 +1,218 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3433.xml b/application/src/main/data/lwm2m-registry/3433.xml
new file mode 100644
index 0000000000..018f2af954
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3433.xml
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3434.xml b/application/src/main/data/lwm2m-registry/3434.xml
new file mode 100644
index 0000000000..b06852cbe1
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3434.xml
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3435.xml b/application/src/main/data/lwm2m-registry/3435.xml
new file mode 100644
index 0000000000..1694afc32b
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3435.xml
@@ -0,0 +1,178 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3436.xml b/application/src/main/data/lwm2m-registry/3436.xml
new file mode 100644
index 0000000000..a450edf280
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3436.xml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3437.xml b/application/src/main/data/lwm2m-registry/3437.xml
new file mode 100644
index 0000000000..284911326e
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3437.xml
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3438.xml b/application/src/main/data/lwm2m-registry/3438.xml
new file mode 100644
index 0000000000..2e2405c161
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3438.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3439.xml b/application/src/main/data/lwm2m-registry/3439.xml
new file mode 100644
index 0000000000..b702866ce0
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3439.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3441.xml b/application/src/main/data/lwm2m-registry/3441.xml
new file mode 100644
index 0000000000..bdd5efca6c
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3441.xml
@@ -0,0 +1,262 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/3442.xml b/application/src/main/data/lwm2m-registry/3442.xml
new file mode 100644
index 0000000000..b4607cead7
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/3442.xml
@@ -0,0 +1,332 @@
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/4.xml b/application/src/main/data/lwm2m-registry/4.xml
new file mode 100644
index 0000000000..dc3f100cc4
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/4.xml
@@ -0,0 +1,258 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/5.xml b/application/src/main/data/lwm2m-registry/5.xml
new file mode 100644
index 0000000000..02188533b2
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/5.xml
@@ -0,0 +1,255 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/500.xml b/application/src/main/data/lwm2m-registry/500.xml
new file mode 100644
index 0000000000..df21a5aa80
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/500.xml
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/501.xml b/application/src/main/data/lwm2m-registry/501.xml
new file mode 100644
index 0000000000..402cfc0b78
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/501.xml
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/502.xml b/application/src/main/data/lwm2m-registry/502.xml
new file mode 100644
index 0000000000..5b85aa4515
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/502.xml
@@ -0,0 +1,214 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/503.xml b/application/src/main/data/lwm2m-registry/503.xml
new file mode 100644
index 0000000000..6c6e627a94
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/503.xml
@@ -0,0 +1,434 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/504.xml b/application/src/main/data/lwm2m-registry/504.xml
new file mode 100644
index 0000000000..25c033f59d
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/504.xml
@@ -0,0 +1,341 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/505.xml b/application/src/main/data/lwm2m-registry/505.xml
new file mode 100644
index 0000000000..a89c59ca41
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/505.xml
@@ -0,0 +1,262 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/507.xml b/application/src/main/data/lwm2m-registry/507.xml
new file mode 100644
index 0000000000..650a0e8904
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/507.xml
@@ -0,0 +1,115 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/508.xml b/application/src/main/data/lwm2m-registry/508.xml
new file mode 100644
index 0000000000..7f45059dd5
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/508.xml
@@ -0,0 +1,115 @@
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/509.xml b/application/src/main/data/lwm2m-registry/509.xml
new file mode 100644
index 0000000000..17ff50250f
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/509.xml
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/510.xml b/application/src/main/data/lwm2m-registry/510.xml
new file mode 100644
index 0000000000..302377bbff
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/510.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/6.xml b/application/src/main/data/lwm2m-registry/6.xml
new file mode 100644
index 0000000000..8b1b3da625
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/6.xml
@@ -0,0 +1,143 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/7.xml b/application/src/main/data/lwm2m-registry/7.xml
new file mode 100644
index 0000000000..451780da1f
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/7.xml
@@ -0,0 +1,164 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/8.xml b/application/src/main/data/lwm2m-registry/8.xml
new file mode 100644
index 0000000000..a9296999f5
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/8.xml
@@ -0,0 +1,141 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/data/lwm2m-registry/9.xml b/application/src/main/data/lwm2m-registry/9.xml
new file mode 100644
index 0000000000..4186b1248d
--- /dev/null
+++ b/application/src/main/data/lwm2m-registry/9.xml
@@ -0,0 +1,321 @@
+
+
+
+
+
+
+
diff --git a/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java b/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java
index c0f4bd5cf4..257db58a9b 100644
--- a/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java
+++ b/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java
@@ -26,6 +26,7 @@ import org.thingsboard.server.service.component.ComponentDiscoveryService;
import org.thingsboard.server.service.install.DatabaseEntitiesUpgradeService;
import org.thingsboard.server.service.install.DatabaseTsUpgradeService;
import org.thingsboard.server.service.install.EntityDatabaseSchemaService;
+import org.thingsboard.server.service.install.InstallScripts;
import org.thingsboard.server.service.install.NoSqlKeyspaceService;
import org.thingsboard.server.service.install.SystemDataLoaderService;
import org.thingsboard.server.service.install.TsDatabaseSchemaService;
@@ -88,6 +89,9 @@ public class ThingsboardInstallService {
@Autowired(required = false)
private TsLatestMigrateService latestMigrateService;
+ @Autowired
+ private InstallScripts installScripts;
+
public void performInstall() {
try {
if (isUpgrade) {
@@ -242,6 +246,7 @@ public class ThingsboardInstallService {
databaseEntitiesUpgradeService.upgradeDatabase("3.4.4");
log.info("Updating system data...");
systemDataLoaderService.updateSystemWidgets();
+ installScripts.loadSystemLwm2mResources();
break;
//TODO update CacheCleanupService on the next version upgrade
default:
@@ -284,6 +289,7 @@ public class ThingsboardInstallService {
systemDataLoaderService.createQueues();
// systemDataLoaderService.loadSystemPlugins();
// systemDataLoaderService.loadSystemRules();
+ installScripts.loadSystemLwm2mResources();
if (loadDemo) {
log.info("Loading demo data...");
@@ -302,3 +308,4 @@ public class ThingsboardInstallService {
}
}
+
diff --git a/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java b/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java
index 7f63ed5310..0ccb201cb9 100644
--- a/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java
+++ b/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java
@@ -21,7 +21,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.thingsboard.server.common.data.Dashboard;
+import org.thingsboard.server.common.data.ResourceType;
import org.thingsboard.server.common.data.StringUtils;
+import org.thingsboard.server.common.data.TbResource;
+import org.thingsboard.server.common.data.exception.ThingsboardException;
import org.thingsboard.server.common.data.id.CustomerId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.oauth2.OAuth2ClientRegistrationTemplate;
@@ -30,6 +33,7 @@ import org.thingsboard.server.common.data.rule.RuleChainMetaData;
import org.thingsboard.server.common.data.widget.WidgetTypeDetails;
import org.thingsboard.server.common.data.widget.WidgetsBundle;
import org.thingsboard.server.dao.dashboard.DashboardService;
+import org.thingsboard.server.dao.exception.DataValidationException;
import org.thingsboard.server.dao.oauth2.OAuth2ConfigTemplateService;
import org.thingsboard.server.dao.resource.ResourceService;
import org.thingsboard.server.dao.rule.RuleChainService;
@@ -41,9 +45,11 @@ import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.Base64;
import java.util.Optional;
import static org.thingsboard.server.service.install.DatabaseHelper.objectMapper;
+import static org.thingsboard.server.utils.LwM2mObjectModelUtils.toLwm2mResource;
/**
* Created by ashvayka on 18.04.18.
@@ -65,7 +71,7 @@ public class InstallScripts {
public static final String WIDGET_BUNDLES_DIR = "widget_bundles";
public static final String OAUTH2_CONFIG_TEMPLATES_DIR = "oauth2_config_templates";
public static final String DASHBOARDS_DIR = "dashboards";
- public static final String MODELS_DIR = "models";
+ public static final String MODELS_LWM2M_DIR = "lwm2m-registry";
public static final String CREDENTIALS_DIR = "credentials";
public static final String EDGE_MANAGEMENT = "edge_management";
@@ -260,4 +266,45 @@ public class InstallScripts {
);
}
}
+
+ public void loadSystemLwm2mResources() {
+ Path resourceLwm2mPath = Paths.get(dataDir, MODELS_LWM2M_DIR);
+ try (DirectoryStream dirStream = Files.newDirectoryStream(resourceLwm2mPath, path -> path.toString().endsWith(InstallScripts.XML_EXT))) {
+ dirStream.forEach(
+ path -> {
+ try {
+ String data = Base64.getEncoder().encodeToString(Files.readAllBytes(path));
+ TbResource tbResource = new TbResource();
+ tbResource.setTenantId(TenantId.SYS_TENANT_ID);
+ tbResource.setData(data);
+ tbResource.setResourceType(ResourceType.LWM2M_MODEL);
+ tbResource.setFileName(path.toFile().getName());
+ doSaveLwm2mResource(tbResource);
+ } catch (Exception e) {
+ log.error("Unable to load resource lwm2m object model from file: [{}]", path.toString());
+ throw new RuntimeException("resource lwm2m object model from file", e);
+ }
+ }
+ );
+ } catch (Exception e) {
+ log.error("Unable to load resources lwm2m object model from file: [{}]", resourceLwm2mPath.toString());
+ throw new RuntimeException("resource lwm2m object model from file", e);
+ }
+ }
+
+ private void doSaveLwm2mResource(TbResource resource) throws ThingsboardException {
+ try {
+ log.trace("Executing saveResource [{}]", resource);
+ if (StringUtils.isEmpty(resource.getData())) {
+ throw new DataValidationException("Resource data should be specified!");
+ }
+ toLwm2mResource(resource);
+ resourceService.saveResource(resource);
+ } catch (DataValidationException e) {
+ log.debug("[{}] {}", resource.getFileName(), e.getMessage());
+ } catch (Exception ex) {
+ throw ex;
+ }
+ }
}
+
diff --git a/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java b/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java
index c06e102af7..5cf051367a 100644
--- a/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java
+++ b/application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java
@@ -18,8 +18,6 @@ package org.thingsboard.server.service.resource;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.leshan.core.model.DDFFileParser;
import org.eclipse.leshan.core.model.DefaultDDFFileValidator;
-import org.eclipse.leshan.core.model.InvalidDDFFileException;
-import org.eclipse.leshan.core.model.ObjectModel;
import org.springframework.stereotype.Service;
import org.thingsboard.server.common.data.EntityType;
import org.thingsboard.server.common.data.ResourceType;
@@ -28,13 +26,10 @@ import org.thingsboard.server.common.data.TbResource;
import org.thingsboard.server.common.data.TbResourceInfo;
import org.thingsboard.server.common.data.User;
import org.thingsboard.server.common.data.audit.ActionType;
-import org.thingsboard.server.common.data.exception.ThingsboardErrorCode;
import org.thingsboard.server.common.data.exception.ThingsboardException;
import org.thingsboard.server.common.data.id.TbResourceId;
import org.thingsboard.server.common.data.id.TenantId;
-import org.thingsboard.server.common.data.lwm2m.LwM2mInstance;
import org.thingsboard.server.common.data.lwm2m.LwM2mObject;
-import org.thingsboard.server.common.data.lwm2m.LwM2mResourceObserve;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.dao.exception.DataValidationException;
@@ -42,19 +37,15 @@ import org.thingsboard.server.dao.resource.ResourceService;
import org.thingsboard.server.queue.util.TbCoreComponent;
import org.thingsboard.server.service.entitiy.AbstractTbEntityService;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Base64;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import static org.thingsboard.server.common.data.lwm2m.LwM2mConstants.LWM2M_SEPARATOR_KEY;
-import static org.thingsboard.server.common.data.lwm2m.LwM2mConstants.LWM2M_SEPARATOR_SEARCH_TEXT;
import static org.thingsboard.server.dao.device.DeviceServiceImpl.INCORRECT_TENANT_ID;
import static org.thingsboard.server.dao.service.Validator.validateId;
+import static org.thingsboard.server.utils.LwM2mObjectModelUtils.toLwM2mObject;
+import static org.thingsboard.server.utils.LwM2mObjectModelUtils.toLwm2mResource;
@Slf4j
@Service
@@ -137,47 +128,6 @@ public class DefaultTbResourceService extends AbstractTbEntityService implements
return "DESC".equals(sortOrder) ? comparator.reversed() : comparator;
}
- private LwM2mObject toLwM2mObject(TbResource resource, boolean isSave) {
- try {
- DDFFileParser ddfFileParser = new DDFFileParser(new DefaultDDFFileValidator());
- List objectModels =
- ddfFileParser.parse(new ByteArrayInputStream(Base64.getDecoder().decode(resource.getData())), resource.getSearchText());
- if (objectModels.size() == 0) {
- return null;
- } else {
- ObjectModel obj = objectModels.get(0);
- LwM2mObject lwM2mObject = new LwM2mObject();
- lwM2mObject.setId(obj.id);
- lwM2mObject.setKeyId(resource.getResourceKey());
- lwM2mObject.setName(obj.name);
- lwM2mObject.setMultiple(obj.multiple);
- lwM2mObject.setMandatory(obj.mandatory);
- LwM2mInstance instance = new LwM2mInstance();
- instance.setId(0);
- List resources = new ArrayList<>();
- obj.resources.forEach((k, v) -> {
- if (isSave) {
- LwM2mResourceObserve lwM2MResourceObserve = new LwM2mResourceObserve(k, v.name, false, false, false);
- resources.add(lwM2MResourceObserve);
- } else if (v.operations.isReadable()) {
- LwM2mResourceObserve lwM2MResourceObserve = new LwM2mResourceObserve(k, v.name, false, false, false);
- resources.add(lwM2MResourceObserve);
- }
- });
- if (isSave || resources.size() > 0) {
- instance.setResources(resources.toArray(LwM2mResourceObserve[]::new));
- lwM2mObject.setInstances(new LwM2mInstance[]{instance});
- return lwM2mObject;
- } else {
- return null;
- }
- }
- } catch (IOException | InvalidDDFFileException e) {
- log.error("Could not parse the XML of objectModel with name [{}]", resource.getSearchText(), e);
- return null;
- }
- }
-
@Override
public TbResource save(TbResource tbResource, User user) throws ThingsboardException {
ActionType actionType = tbResource.getId() == null ? ActionType.ADDED : ActionType.UPDATED;
@@ -215,35 +165,11 @@ public class DefaultTbResourceService extends AbstractTbEntityService implements
throw new DataValidationException("Resource data should be specified!");
}
if (ResourceType.LWM2M_MODEL.equals(resource.getResourceType())) {
- try {
- List objectModels =
- ddfFileParser.parse(new ByteArrayInputStream(Base64.getDecoder().decode(resource.getData())), resource.getSearchText());
- if (!objectModels.isEmpty()) {
- ObjectModel objectModel = objectModels.get(0);
-
- String resourceKey = objectModel.id + LWM2M_SEPARATOR_KEY + objectModel.version;
- String name = objectModel.name;
- resource.setResourceKey(resourceKey);
- if (resource.getId() == null) {
- resource.setTitle(name + " id=" + objectModel.id + " v" + objectModel.version);
- }
- resource.setSearchText(resourceKey + LWM2M_SEPARATOR_SEARCH_TEXT + name);
- } else {
- throw new DataValidationException(String.format("Could not parse the XML of objectModel with name %s", resource.getSearchText()));
- }
- } catch (InvalidDDFFileException e) {
- log.error("Failed to parse file {}", resource.getFileName(), e);
- throw new DataValidationException("Failed to parse file " + resource.getFileName());
- } catch (IOException e) {
- throw new ThingsboardException(e, ThingsboardErrorCode.GENERAL);
- }
- if (resource.getResourceType().equals(ResourceType.LWM2M_MODEL) && toLwM2mObject(resource, true) == null) {
- throw new DataValidationException(String.format("Could not parse the XML of objectModel with name %s", resource.getSearchText()));
- }
+ toLwm2mResource(resource);
} else {
resource.setResourceKey(resource.getFileName());
}
-
return resourceService.saveResource(resource);
}
}
+
diff --git a/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/settings/DefaultJwtSettingsValidator.java b/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/settings/DefaultJwtSettingsValidator.java
index 274630cc39..dddb011fd5 100644
--- a/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/settings/DefaultJwtSettingsValidator.java
+++ b/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/settings/DefaultJwtSettingsValidator.java
@@ -36,10 +36,10 @@ public class DefaultJwtSettingsValidator implements JwtSettingsValidator {
if (StringUtils.isEmpty(jwtSettings.getTokenIssuer())) {
throw new DataValidationException("JWT token issuer should be specified!");
}
- if (Optional.ofNullable(jwtSettings.getRefreshTokenExpTime()).orElse(0) <= TimeUnit.MINUTES.toSeconds(15)) {
+ if (Optional.ofNullable(jwtSettings.getRefreshTokenExpTime()).orElse(0) < TimeUnit.MINUTES.toSeconds(15)) {
throw new DataValidationException("JWT refresh token expiration time should be at least 15 minutes!");
}
- if (Optional.ofNullable(jwtSettings.getTokenExpirationTime()).orElse(0) <= TimeUnit.MINUTES.toSeconds(1)) {
+ if (Optional.ofNullable(jwtSettings.getTokenExpirationTime()).orElse(0) < TimeUnit.MINUTES.toSeconds(1)) {
throw new DataValidationException("JWT token expiration time should be at least 1 minute!");
}
if (jwtSettings.getTokenExpirationTime() >= jwtSettings.getRefreshTokenExpTime()) {
diff --git a/application/src/main/java/org/thingsboard/server/utils/LwM2mObjectModelUtils.java b/application/src/main/java/org/thingsboard/server/utils/LwM2mObjectModelUtils.java
new file mode 100644
index 0000000000..bb2e49bd62
--- /dev/null
+++ b/application/src/main/java/org/thingsboard/server/utils/LwM2mObjectModelUtils.java
@@ -0,0 +1,114 @@
+/**
+ * Copyright © 2016-2023 The Thingsboard Authors
+ *
+ * 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.
+ */
+package org.thingsboard.server.utils;
+
+import lombok.extern.slf4j.Slf4j;
+import org.eclipse.leshan.core.model.DDFFileParser;
+import org.eclipse.leshan.core.model.DefaultDDFFileValidator;
+import org.eclipse.leshan.core.model.InvalidDDFFileException;
+import org.eclipse.leshan.core.model.ObjectModel;
+import org.thingsboard.server.common.data.ResourceType;
+import org.thingsboard.server.common.data.TbResource;
+import org.thingsboard.server.common.data.exception.ThingsboardErrorCode;
+import org.thingsboard.server.common.data.exception.ThingsboardException;
+import org.thingsboard.server.common.data.lwm2m.LwM2mInstance;
+import org.thingsboard.server.common.data.lwm2m.LwM2mObject;
+import org.thingsboard.server.common.data.lwm2m.LwM2mResourceObserve;
+import org.thingsboard.server.dao.exception.DataValidationException;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.List;
+
+import static org.thingsboard.server.common.data.lwm2m.LwM2mConstants.LWM2M_SEPARATOR_KEY;
+import static org.thingsboard.server.common.data.lwm2m.LwM2mConstants.LWM2M_SEPARATOR_SEARCH_TEXT;
+
+@Slf4j
+public class LwM2mObjectModelUtils {
+
+ private static final DDFFileParser ddfFileParser = new DDFFileParser(new DefaultDDFFileValidator());
+
+ public static void toLwm2mResource (TbResource resource) throws ThingsboardException {
+ try {
+ List objectModels =
+ ddfFileParser.parse(new ByteArrayInputStream(Base64.getDecoder().decode(resource.getData())), resource.getSearchText());
+ if (!objectModels.isEmpty()) {
+ ObjectModel objectModel = objectModels.get(0);
+
+ String resourceKey = objectModel.id + LWM2M_SEPARATOR_KEY + objectModel.version;
+ String name = objectModel.name;
+ resource.setResourceKey(resourceKey);
+ if (resource.getId() == null) {
+ resource.setTitle(name + " id=" + objectModel.id + " v" + objectModel.version);
+ }
+ resource.setSearchText(resourceKey + LWM2M_SEPARATOR_SEARCH_TEXT + name);
+ } else {
+ throw new DataValidationException(String.format("Could not parse the XML of objectModel with name %s", resource.getSearchText()));
+ }
+ } catch (InvalidDDFFileException e) {
+ log.error("Failed to parse file {}", resource.getFileName(), e);
+ throw new DataValidationException("Failed to parse file " + resource.getFileName());
+ } catch (IOException e) {
+ throw new ThingsboardException(e, ThingsboardErrorCode.GENERAL);
+ }
+ if (resource.getResourceType().equals(ResourceType.LWM2M_MODEL) && toLwM2mObject(resource, true) == null) {
+ throw new DataValidationException(String.format("Could not parse the XML of objectModel with name %s", resource.getSearchText()));
+ }
+ }
+
+ public static LwM2mObject toLwM2mObject(TbResource resource, boolean isSave) {
+ try {
+ List objectModels =
+ ddfFileParser.parse(new ByteArrayInputStream(Base64.getDecoder().decode(resource.getData())), resource.getSearchText());
+ if (objectModels.size() == 0) {
+ return null;
+ } else {
+ ObjectModel obj = objectModels.get(0);
+ LwM2mObject lwM2mObject = new LwM2mObject();
+ lwM2mObject.setId(obj.id);
+ lwM2mObject.setKeyId(resource.getResourceKey());
+ lwM2mObject.setName(obj.name);
+ lwM2mObject.setMultiple(obj.multiple);
+ lwM2mObject.setMandatory(obj.mandatory);
+ LwM2mInstance instance = new LwM2mInstance();
+ instance.setId(0);
+ List resources = new ArrayList<>();
+ obj.resources.forEach((k, v) -> {
+ if (isSave) {
+ LwM2mResourceObserve lwM2MResourceObserve = new LwM2mResourceObserve(k, v.name, false, false, false);
+ resources.add(lwM2MResourceObserve);
+ } else if (v.operations.isReadable()) {
+ LwM2mResourceObserve lwM2MResourceObserve = new LwM2mResourceObserve(k, v.name, false, false, false);
+ resources.add(lwM2MResourceObserve);
+ }
+ });
+ if (isSave || resources.size() > 0) {
+ instance.setResources(resources.toArray(LwM2mResourceObserve[]::new));
+ lwM2mObject.setInstances(new LwM2mInstance[]{instance});
+ return lwM2mObject;
+ } else {
+ return null;
+ }
+ }
+ } catch (IOException | InvalidDDFFileException e) {
+ log.error("Could not parse the XML of objectModel with name [{}]", resource.getSearchText(), e);
+ return null;
+ }
+ }
+
+}
diff --git a/application/src/test/java/org/thingsboard/server/controller/AbstractWebTest.java b/application/src/test/java/org/thingsboard/server/controller/AbstractWebTest.java
index c09f259aaa..c9b739bad1 100644
--- a/application/src/test/java/org/thingsboard/server/controller/AbstractWebTest.java
+++ b/application/src/test/java/org/thingsboard/server/controller/AbstractWebTest.java
@@ -862,7 +862,10 @@ public abstract class AbstractWebTest extends AbstractInMemoryStorageTest {
protected void awaitForDeviceActorToReceiveSubscription(DeviceId deviceId, FeatureType featureType, int subscriptionCount) {
DeviceActorMessageProcessor processor = getDeviceActorProcessor(deviceId);
Map subscriptions = (Map) ReflectionTestUtils.getField(processor, getMapName(featureType));
- Awaitility.await("Device actor received subscription command from the transport").atMost(TIMEOUT, TimeUnit.SECONDS).until(() -> subscriptions.size() == subscriptionCount);
+ Awaitility.await("Device actor received subscription command from the transport").atMost(5, TimeUnit.SECONDS).until(() -> {
+ log.warn("device {}, subscriptions.size() == {}", deviceId, subscriptions.size());
+ return subscriptions.size() == subscriptionCount;
+ });
}
protected static String getMapName(FeatureType featureType) {
diff --git a/application/src/test/java/org/thingsboard/server/edge/BaseDeviceEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/BaseDeviceEdgeTest.java
index 98508e72ce..904a6246ab 100644
--- a/application/src/test/java/org/thingsboard/server/edge/BaseDeviceEdgeTest.java
+++ b/application/src/test/java/org/thingsboard/server/edge/BaseDeviceEdgeTest.java
@@ -671,6 +671,7 @@ abstract public class BaseDeviceEdgeTest extends AbstractEdgeTest {
client.setCallback(onUpdateCallback);
client.subscribeAndWait("v1/devices/me/attributes", MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(device.getId(), FeatureType.ATTRIBUTES, 1);
edgeImitator.expectResponsesAmount(1);
@@ -690,7 +691,7 @@ abstract public class BaseDeviceEdgeTest extends AbstractEdgeTest {
edgeImitator.sendUplinkMsg(uplinkMsgBuilder.build());
Assert.assertTrue(edgeImitator.waitForResponses());
- Assert.assertTrue(onUpdateCallback.getSubscribeLatch().await(5, TimeUnit.SECONDS));
+ Assert.assertTrue(onUpdateCallback.getSubscribeLatch().await(30, TimeUnit.SECONDS));
Assert.assertEquals(JacksonUtil.OBJECT_MAPPER.createObjectNode().put(attrKey, attrValue),
JacksonUtil.fromBytes(onUpdateCallback.getPayloadBytes()));
diff --git a/application/src/test/java/org/thingsboard/server/service/resource/sql/BaseTbResourceServiceTest.java b/application/src/test/java/org/thingsboard/server/service/resource/sql/BaseTbResourceServiceTest.java
index ce02296733..e2c5985553 100644
--- a/application/src/test/java/org/thingsboard/server/service/resource/sql/BaseTbResourceServiceTest.java
+++ b/application/src/test/java/org/thingsboard/server/service/resource/sql/BaseTbResourceServiceTest.java
@@ -19,9 +19,8 @@ import com.datastax.oss.driver.api.core.uuid.Uuids;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Assertions;
import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.EntityInfo;
import org.thingsboard.server.common.data.ResourceType;
@@ -45,6 +44,7 @@ import java.util.Base64;
import java.util.Collections;
import java.util.List;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@DaoSqlTest
@@ -115,10 +115,6 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest {
.andExpect(status().isOk());
}
- @SuppressWarnings("deprecation")
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Test
public void testSaveResourceWithMaxSumDataSizeOutOfLimit() throws Exception {
loginSysAdmin();
@@ -137,9 +133,9 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest {
Assert.assertEquals(1, resourceService.sumDataSizeByTenantId(tenantId));
try {
- thrown.expect(DataValidationException.class);
- thrown.expectMessage(String.format("Failed to create the tb resource, files size limit is exhausted %d bytes!", limit));
- createResource("test1", 1 + DEFAULT_FILE_NAME);
+ assertThatThrownBy(() -> createResource("test1", 1 + DEFAULT_FILE_NAME))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("Failed to create the tb resource, files size limit is exhausted %d bytes!", limit);
} finally {
defaultTenantProfile.getProfileData().setConfiguration(DefaultTenantProfileConfiguration.builder().maxResourcesInBytes(0).build());
loginSysAdmin();
@@ -237,7 +233,7 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest {
resourceService.delete(savedResource, null);
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveTbResourceWithExistsFileName() throws Exception {
TbResource resource = new TbResource();
resource.setTenantId(tenantId);
@@ -256,23 +252,27 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest {
resource.setData("Test Data");
try {
- resourceService.save(resource2);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ resourceService.save(resource2);
+ });
} finally {
resourceService.delete(savedResource, null);
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveTbResourceWithEmptyTitle() throws Exception {
TbResource resource = new TbResource();
resource.setTenantId(tenantId);
resource.setResourceType(ResourceType.JKS);
resource.setFileName(DEFAULT_FILE_NAME);
resource.setData("Test Data");
- resourceService.save(resource);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ resourceService.save(resource);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveTbResourceWithInvalidTenant() throws Exception {
TbResource resource = new TbResource();
resource.setTenantId(TenantId.fromUUID(Uuids.timeBased()));
@@ -280,7 +280,9 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest {
resource.setTitle("My resource");
resource.setFileName(DEFAULT_FILE_NAME);
resource.setData("Test Data");
- resourceService.save(resource);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ resourceService.save(resource);
+ });
}
@Test
diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/AbstractLwM2MIntegrationTest.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/AbstractLwM2MIntegrationTest.java
index ef00a3050e..c92369e3c2 100644
--- a/application/src/test/java/org/thingsboard/server/transport/lwm2m/AbstractLwM2MIntegrationTest.java
+++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/AbstractLwM2MIntegrationTest.java
@@ -70,7 +70,7 @@ import org.thingsboard.server.service.telemetry.cmd.v2.LatestValueCmd;
import org.thingsboard.server.transport.AbstractTransportIntegrationTest;
import org.thingsboard.server.transport.lwm2m.client.LwM2MTestClient;
import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClientContext;
-import org.thingsboard.server.transport.lwm2m.server.uplink.DefaultLwM2mUplinkMsgHandler;
+import org.thingsboard.server.transport.lwm2m.server.uplink.LwM2mUplinkMsgHandler;
import java.io.IOException;
import java.net.ServerSocket;
@@ -108,7 +108,7 @@ import static org.thingsboard.server.transport.lwm2m.Lwm2mTestHelper.LwM2MProfil
public abstract class AbstractLwM2MIntegrationTest extends AbstractTransportIntegrationTest {
@SpyBean
- DefaultLwM2mUplinkMsgHandler defaultLwM2mUplinkMsgHandlerTest;
+ LwM2mUplinkMsgHandler defaultLwM2mUplinkMsgHandlerTest;
@Autowired
private LwM2mClientContext clientContextTest;
diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/client/LwM2MTestClient.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/client/LwM2MTestClient.java
index 7cb5f88733..449ac4c2ae 100644
--- a/application/src/test/java/org/thingsboard/server/transport/lwm2m/client/LwM2MTestClient.java
+++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/client/LwM2MTestClient.java
@@ -45,7 +45,7 @@ import org.junit.Assert;
import org.mockito.Mockito;
import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClient;
import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClientContext;
-import org.thingsboard.server.transport.lwm2m.server.uplink.DefaultLwM2mUplinkMsgHandler;
+import org.thingsboard.server.transport.lwm2m.server.uplink.LwM2mUplinkMsgHandler;
import org.thingsboard.server.transport.lwm2m.utils.LwM2mValueConverterImpl;
import java.io.IOException;
@@ -109,12 +109,12 @@ public class LwM2MTestClient {
private LwM2MLocationParams locationParams;
private LwM2mTemperatureSensor lwM2MTemperatureSensor;
private Set clientStates;
- private DefaultLwM2mUplinkMsgHandler defaultLwM2mUplinkMsgHandlerTest;
+ private LwM2mUplinkMsgHandler defaultLwM2mUplinkMsgHandlerTest;
private LwM2mClientContext clientContext;
public void init(Security security, Configuration coapConfig, int port, boolean isRpc, boolean isBootstrap,
int shortServerId, int shortServerIdBs, Security securityBs,
- DefaultLwM2mUplinkMsgHandler defaultLwM2mUplinkMsgHandler,
+ LwM2mUplinkMsgHandler defaultLwM2mUplinkMsgHandler,
LwM2mClientContext clientContext) throws InvalidDDFFileException, IOException {
Assert.assertNull("client already initialized", leshanClient);
this.defaultLwM2mUplinkMsgHandlerTest = defaultLwM2mUplinkMsgHandler;
diff --git a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv3/attributes/AbstractMqttAttributesIntegrationTest.java b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv3/attributes/AbstractMqttAttributesIntegrationTest.java
index f8165b0237..fa6c4d16a3 100644
--- a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv3/attributes/AbstractMqttAttributesIntegrationTest.java
+++ b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv3/attributes/AbstractMqttAttributesIntegrationTest.java
@@ -354,6 +354,8 @@ public abstract class AbstractMqttAttributesIntegrationTest extends AbstractMqtt
SHARED_ATTRIBUTES_PAYLOAD, String.class, status().isOk());
client.publishAndWait(attrPubTopic, CLIENT_ATTRIBUTES_PAYLOAD.getBytes());
client.subscribeAndWait(attrSubTopic, MqttQoS.AT_MOST_ONCE);
+ //RequestAttributes does not make any subscriptions in device actor
+
String update = getWsClient().waitForUpdate();
assertThat(update).as("ws update received").isNotBlank();
MqttTestCallback callback = new MqttTestCallback(attrSubTopic.replace("+", "1"));
@@ -383,6 +385,8 @@ public abstract class AbstractMqttAttributesIntegrationTest extends AbstractMqtt
doPostAsync("/api/plugins/telemetry/DEVICE/" + savedDevice.getId().getId() + "/attributes/SHARED_SCOPE", SHARED_ATTRIBUTES_PAYLOAD, String.class, status().isOk());
client.publishAndWait(attrPubTopic, getAttributesProtoPayloadBytes());
client.subscribeAndWait(attrSubTopic, MqttQoS.AT_MOST_ONCE);
+ //RequestAttributes does not make any subscriptions in device actor
+
String update = getWsClient().waitForUpdate();
assertThat(update).as("ws update received").isNotBlank();
MqttTestCallback callback = new MqttTestCallback(attrSubTopic.replace("+", "1"));
@@ -442,6 +446,7 @@ public abstract class AbstractMqttAttributesIntegrationTest extends AbstractMqtt
assertThat(update).as("ws update received").isNotBlank();
client.subscribeAndWait(GATEWAY_ATTRIBUTES_RESPONSE_TOPIC, MqttQoS.AT_LEAST_ONCE);
+ //RequestAttributes does not make any subscriptions in device actor
MqttTestCallback clientAttributesCallback = new MqttTestCallback(GATEWAY_ATTRIBUTES_RESPONSE_TOPIC);
client.setCallback(clientAttributesCallback);
@@ -495,6 +500,7 @@ public abstract class AbstractMqttAttributesIntegrationTest extends AbstractMqtt
assertThat(update).as("ws update received").isNotBlank();
client.subscribeAndWait(GATEWAY_ATTRIBUTES_RESPONSE_TOPIC, MqttQoS.AT_LEAST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(device.getId(), FeatureType.ATTRIBUTES, 1);
MqttTestCallback clientAttributesCallback = new MqttTestCallback(GATEWAY_ATTRIBUTES_RESPONSE_TOPIC);
client.setCallback(clientAttributesCallback);
diff --git a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv3/credentials/BasicMqttCredentialsTest.java b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv3/credentials/BasicMqttCredentialsTest.java
index 32f7647048..3880141c36 100644
--- a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv3/credentials/BasicMqttCredentialsTest.java
+++ b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv3/credentials/BasicMqttCredentialsTest.java
@@ -20,6 +20,7 @@ import org.eclipse.paho.client.mqttv3.MqttException;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.common.data.Device;
import org.thingsboard.server.common.data.StringUtils;
@@ -115,7 +116,7 @@ public class BasicMqttCredentialsTest extends AbstractMqttIntegrationTest {
testTelemetryIsDelivered(accessToken2Device, mqttTestClient5);
}
- @Test(expected = MqttException.class)
+ @Test
public void testCorrectClientIdAndUserNameButWrongPassword() throws Exception {
// Not correct. Correct clientId and username, but wrong password
MqttTestClient mqttTestClient = new MqttTestClient(CLIENT_ID);
@@ -125,7 +126,9 @@ public class BasicMqttCredentialsTest extends AbstractMqttIntegrationTest {
} catch (MqttException e) {
Assert.assertEquals(4, e.getReasonCode()); // 4 - Reason code for bad username or password in MQTT v3
}
- testTelemetryIsNotDelivered(clientIdAndUserNameAndPasswordDevice3, mqttTestClient);
+ Assertions.assertThrows(MqttException.class, () -> {
+ testTelemetryIsNotDelivered(clientIdAndUserNameAndPasswordDevice3, mqttTestClient);
+ });
}
private void testTelemetryIsDelivered(Device device, MqttTestClient client) throws Exception {
diff --git a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv3/rpc/AbstractMqttServerSideRpcIntegrationTest.java b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv3/rpc/AbstractMqttServerSideRpcIntegrationTest.java
index 924b4d50a6..205386a32e 100644
--- a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv3/rpc/AbstractMqttServerSideRpcIntegrationTest.java
+++ b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv3/rpc/AbstractMqttServerSideRpcIntegrationTest.java
@@ -223,7 +223,6 @@ public abstract class AbstractMqttServerSideRpcIntegrationTest extends AbstractM
MqttTestCallback callback = new MqttTestCallback(GATEWAY_RPC_TOPIC);
client.setCallback(callback);
- client.subscribeAndWait(GATEWAY_RPC_TOPIC, MqttQoS.AT_MOST_ONCE);
subscribeAndCheckSubscription(client, GATEWAY_RPC_TOPIC, savedDevice.getId(), FeatureType.RPC);
String setGpioRequest = "{\"method\": \"toggle_gpio\", \"params\": {\"pin\":1}}";
diff --git a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/attributes/AbstractAttributesMqttV5Test.java b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/attributes/AbstractAttributesMqttV5Test.java
index e3dfc6fb55..347b397ef5 100644
--- a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/attributes/AbstractAttributesMqttV5Test.java
+++ b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/attributes/AbstractAttributesMqttV5Test.java
@@ -21,6 +21,7 @@ import org.junit.Before;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.common.data.device.profile.MqttTopics;
import org.thingsboard.server.common.data.id.DeviceId;
+import org.thingsboard.server.common.msg.session.FeatureType;
import org.thingsboard.server.transport.mqtt.MqttTestConfigProperties;
import org.thingsboard.server.transport.mqtt.mqttv5.AbstractMqttV5Test;
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestCallback;
@@ -104,6 +105,7 @@ public abstract class AbstractAttributesMqttV5Test extends AbstractMqttV5Test {
MqttV5TestCallback onUpdateCallback = new MqttV5TestCallback();
client.setCallback(onUpdateCallback);
client.subscribeAndWait(MqttTopics.DEVICE_ATTRIBUTES_TOPIC, MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.ATTRIBUTES, 1);
doPostAsync("/api/plugins/telemetry/DEVICE/" + savedDevice.getId().getId() + "/attributes/SHARED_SCOPE", SHARED_ATTRIBUTES_PAYLOAD, String.class, status().isOk());
onUpdateCallback.getSubscribeLatch().await(3, TimeUnit.SECONDS);
diff --git a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/client/connection/AbstractMqttV5ClientConnectionTest.java b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/client/connection/AbstractMqttV5ClientConnectionTest.java
index 81b015e245..93d349e0ec 100644
--- a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/client/connection/AbstractMqttV5ClientConnectionTest.java
+++ b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/client/connection/AbstractMqttV5ClientConnectionTest.java
@@ -25,6 +25,7 @@ import org.eclipse.paho.mqttv5.common.packet.MqttReturnCode;
import org.eclipse.paho.mqttv5.common.packet.MqttWireMessage;
import org.junit.Assert;
import org.thingsboard.server.common.data.device.profile.MqttTopics;
+import org.thingsboard.server.common.msg.session.FeatureType;
import org.thingsboard.server.transport.mqtt.AbstractMqttIntegrationTest;
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestCallback;
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestClient;
@@ -101,6 +102,7 @@ public abstract class AbstractMqttV5ClientConnectionTest extends AbstractMqttInt
MqttV5TestCallback onUpdateCallback = new MqttV5TestCallback();
client.setCallback(onUpdateCallback);
client.subscribeAndWait(MqttTopics.DEVICE_ATTRIBUTES_TOPIC, MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.ATTRIBUTES, 1);
String payload = "{\"sharedStr\":\"" + StringUtils.repeat("*", valueLen) + "\"}";
diff --git a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/client/subscribe/AbstractMqttV5ClientSubscriptionTest.java b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/client/subscribe/AbstractMqttV5ClientSubscriptionTest.java
index f681ad5b55..aebb5a7ed2 100644
--- a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/client/subscribe/AbstractMqttV5ClientSubscriptionTest.java
+++ b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/client/subscribe/AbstractMqttV5ClientSubscriptionTest.java
@@ -22,6 +22,7 @@ import org.eclipse.paho.mqttv5.common.packet.MqttSubAck;
import org.eclipse.paho.mqttv5.common.packet.MqttWireMessage;
import org.junit.Assert;
import org.thingsboard.server.common.data.device.profile.MqttTopics;
+import org.thingsboard.server.common.msg.session.FeatureType;
import org.thingsboard.server.transport.mqtt.AbstractMqttIntegrationTest;
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestClient;
@@ -34,6 +35,7 @@ public abstract class AbstractMqttV5ClientSubscriptionTest extends AbstractMqttI
client.connectAndWait(accessToken);
IMqttToken subscriptionResult = client.subscribeAndWait(MqttTopics.DEVICE_ATTRIBUTES_TOPIC, MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.ATTRIBUTES, 1);
MqttWireMessage response = subscriptionResult.getResponse();
@@ -52,6 +54,7 @@ public abstract class AbstractMqttV5ClientSubscriptionTest extends AbstractMqttI
client.connectAndWait(accessToken);
IMqttToken iMqttToken = client.subscribeAndWait("wrong/topic/+", MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.ATTRIBUTES, 0);
Assert.assertEquals(MESSAGE_TYPE_SUBACK,iMqttToken.getResponse().getType());
MqttSubAck subAck = (MqttSubAck) iMqttToken.getResponse();
Assert.assertEquals(1, subAck.getReturnCodes().length);
diff --git a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/client/unsubscribe/AbstractMqttV5ClientUnsubscribeTest.java b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/client/unsubscribe/AbstractMqttV5ClientUnsubscribeTest.java
index 835e225da4..ca534b9999 100644
--- a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/client/unsubscribe/AbstractMqttV5ClientUnsubscribeTest.java
+++ b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/client/unsubscribe/AbstractMqttV5ClientUnsubscribeTest.java
@@ -22,6 +22,7 @@ import org.eclipse.paho.mqttv5.common.packet.MqttUnsubAck;
import org.eclipse.paho.mqttv5.common.packet.MqttWireMessage;
import org.junit.Assert;
import org.thingsboard.server.common.data.device.profile.MqttTopics;
+import org.thingsboard.server.common.msg.session.FeatureType;
import org.thingsboard.server.transport.mqtt.AbstractMqttIntegrationTest;
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestClient;
@@ -34,6 +35,7 @@ public abstract class AbstractMqttV5ClientUnsubscribeTest extends AbstractMqttIn
client.connectAndWait(accessToken);
client.subscribeAndWait(MqttTopics.DEVICE_ATTRIBUTES_TOPIC, MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.ATTRIBUTES, 1);
IMqttToken unsubscribeResult = client.unsubscribeAndWait(MqttTopics.DEVICE_ATTRIBUTES_TOPIC);
MqttWireMessage response = unsubscribeResult.getResponse();
Assert.assertEquals(MESSAGE_TYPE_UNSUBACK, response.getType());
diff --git a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/rpc/AbstractMqttV5RpcTest.java b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/rpc/AbstractMqttV5RpcTest.java
index b6604439da..aecd1124e3 100644
--- a/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/rpc/AbstractMqttV5RpcTest.java
+++ b/application/src/test/java/org/thingsboard/server/transport/mqtt/mqttv5/rpc/AbstractMqttV5RpcTest.java
@@ -22,6 +22,7 @@ import org.eclipse.paho.mqttv5.common.MqttException;
import org.eclipse.paho.mqttv5.common.MqttMessage;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.common.data.StringUtils;
+import org.thingsboard.server.common.msg.session.FeatureType;
import org.thingsboard.server.transport.mqtt.mqttv5.AbstractMqttV5Test;
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestCallback;
import org.thingsboard.server.transport.mqtt.mqttv5.MqttV5TestClient;
@@ -45,6 +46,7 @@ public abstract class AbstractMqttV5RpcTest extends AbstractMqttV5Test {
MqttV5TestCallback callback = new MqttV5TestCallback(DEVICE_RPC_REQUESTS_SUB_TOPIC.replace("+", "0"));
client.setCallback(callback);
client.subscribeAndWait(DEVICE_RPC_REQUESTS_SUB_TOPIC, MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.RPC, 1);
String setGpioRequest = "{\"method\":\"setGpio\",\"params\":{\"pin\": \"23\",\"value\": 1}}";
String result = doPostAsync("/api/rpc/oneway/" + savedDevice.getId(), setGpioRequest, String.class, status().isOk());
@@ -59,6 +61,7 @@ public abstract class AbstractMqttV5RpcTest extends AbstractMqttV5Test {
MqttV5TestClient client = new MqttV5TestClient();
client.connectAndWait(accessToken);
client.subscribeAndWait(DEVICE_RPC_REQUESTS_SUB_TOPIC, MqttQoS.AT_LEAST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedDevice.getId(), FeatureType.RPC, 1);
MqttV5TestRpcCallback callback = new MqttV5TestRpcCallback(client, DEVICE_RPC_REQUESTS_SUB_TOPIC.replace("+", "0"));
client.setCallback(callback);
String setGpioRequest = "{\"method\":\"setGpio\",\"params\":{\"pin\": \"26\",\"value\": 1}}";
diff --git a/application/src/test/java/org/thingsboard/server/transport/mqtt/sparkplug/attributes/AbstractMqttV5ClientSparkplugAttributesTest.java b/application/src/test/java/org/thingsboard/server/transport/mqtt/sparkplug/attributes/AbstractMqttV5ClientSparkplugAttributesTest.java
index 04349d0672..4e05e44668 100644
--- a/application/src/test/java/org/thingsboard/server/transport/mqtt/sparkplug/attributes/AbstractMqttV5ClientSparkplugAttributesTest.java
+++ b/application/src/test/java/org/thingsboard/server/transport/mqtt/sparkplug/attributes/AbstractMqttV5ClientSparkplugAttributesTest.java
@@ -20,6 +20,7 @@ import io.netty.handler.codec.mqtt.MqttQoS;
import lombok.extern.slf4j.Slf4j;
import org.junit.Assert;
import org.thingsboard.server.common.data.Device;
+import org.thingsboard.server.common.msg.session.FeatureType;
import org.thingsboard.server.transport.mqtt.sparkplug.AbstractMqttV5ClientSparkplugTest;
import org.thingsboard.server.transport.mqtt.util.sparkplug.MetricDataType;
import org.thingsboard.server.transport.mqtt.util.sparkplug.SparkplugMessageType;
@@ -50,6 +51,7 @@ public abstract class AbstractMqttV5ClientSparkplugAttributesTest extends Abstra
String SHARED_ATTRIBUTES_PAYLOAD = "{\"" + keyNodeRebirth + "\":" + value + "}";
Assert.assertTrue("Connection node is failed", client.isConnected());
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.ATTRIBUTES, 1);
doPostAsync("/api/plugins/telemetry/DEVICE/" + savedGateway.getId().getId() + "/attributes/SHARED_SCOPE", SHARED_ATTRIBUTES_PAYLOAD, String.class, status().isOk());
await(alias + SparkplugMessageType.NBIRTH.name())
.atMost(40, TimeUnit.SECONDS)
@@ -75,6 +77,7 @@ public abstract class AbstractMqttV5ClientSparkplugAttributesTest extends Abstra
connectionWithNBirth(metricDataType, metricKey, metricValue);
Assert.assertTrue("Connection node is failed", client.isConnected());
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.ATTRIBUTES, 1);
// Boolean <-> String
boolean expectedValue = true;
@@ -138,6 +141,7 @@ public abstract class AbstractMqttV5ClientSparkplugAttributesTest extends Abstra
connectionWithNBirth(metricDataType, metricKey, metricValue);
Assert.assertTrue("Connection node is failed", client.isConnected());
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.ATTRIBUTES, 1);
// Long <-> String
String valueStr = "123";
@@ -189,6 +193,7 @@ public abstract class AbstractMqttV5ClientSparkplugAttributesTest extends Abstra
connectionWithNBirth(metricDataType, metricKey, metricValue);
Assert.assertTrue("Connection node is failed", client.isConnected());
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.ATTRIBUTES, 1);
// Float <-> String
String valueStr = "123.345";
@@ -240,6 +245,7 @@ public abstract class AbstractMqttV5ClientSparkplugAttributesTest extends Abstra
connectionWithNBirth(metricDataType, metricKey, metricValue);
Assert.assertTrue("Connection node is failed", client.isConnected());
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.ATTRIBUTES, 1);
// Double <-> String
String valueStr = "123345456";
@@ -291,6 +297,7 @@ public abstract class AbstractMqttV5ClientSparkplugAttributesTest extends Abstra
connectionWithNBirth(metricDataType, metricKey, metricValue);
Assert.assertTrue("Connection node is failed", client.isConnected());
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.ATTRIBUTES, 1);
// String <-> Long
long valueLong = 123345456L;
diff --git a/application/src/test/java/org/thingsboard/server/transport/mqtt/sparkplug/connection/AbstractMqttV5ClientSparkplugConnectionTest.java b/application/src/test/java/org/thingsboard/server/transport/mqtt/sparkplug/connection/AbstractMqttV5ClientSparkplugConnectionTest.java
index 5f9b794739..1a5781afd4 100644
--- a/application/src/test/java/org/thingsboard/server/transport/mqtt/sparkplug/connection/AbstractMqttV5ClientSparkplugConnectionTest.java
+++ b/application/src/test/java/org/thingsboard/server/transport/mqtt/sparkplug/connection/AbstractMqttV5ClientSparkplugConnectionTest.java
@@ -137,6 +137,12 @@ public abstract class AbstractMqttV5ClientSparkplugConnectionTest extends Abstra
}
}
+ /**
+ * OFFLINE_All
+ * @param cntDevices
+ * @throws Exception
+ */
+
protected void processConnectClientWithCorrectAccessTokenWithNDEATH_State_ONLINE_All_Then_OFFLINE_All(int cntDevices) throws Exception {
long ts = calendar.getTimeInMillis();
List devices = connectClientWithCorrectAccessTokenWithNDEATHCreatedDevices(cntDevices, ts);
@@ -166,6 +172,7 @@ public abstract class AbstractMqttV5ClientSparkplugConnectionTest extends Abstra
}
}
+
private boolean findEqualsKeyValueInKvEntrys(List finalFuture, TsKvEntry tsKvEntry) {
for (TsKvEntry kvEntry : finalFuture) {
if (kvEntry.getKey().equals(tsKvEntry.getKey()) && kvEntry.getValue().equals(tsKvEntry.getValue())) {
@@ -174,5 +181,5 @@ public abstract class AbstractMqttV5ClientSparkplugConnectionTest extends Abstra
}
return false;
}
-
}
+
diff --git a/application/src/test/java/org/thingsboard/server/transport/mqtt/sparkplug/rpc/AbstractMqttV5RpcSparkplugTest.java b/application/src/test/java/org/thingsboard/server/transport/mqtt/sparkplug/rpc/AbstractMqttV5RpcSparkplugTest.java
index b08baac875..036b779de1 100644
--- a/application/src/test/java/org/thingsboard/server/transport/mqtt/sparkplug/rpc/AbstractMqttV5RpcSparkplugTest.java
+++ b/application/src/test/java/org/thingsboard/server/transport/mqtt/sparkplug/rpc/AbstractMqttV5RpcSparkplugTest.java
@@ -20,6 +20,7 @@ import lombok.extern.slf4j.Slf4j;
import org.junit.Assert;
import org.junit.Test;
import org.thingsboard.server.common.data.Device;
+import org.thingsboard.server.common.msg.session.FeatureType;
import org.thingsboard.server.transport.mqtt.sparkplug.AbstractMqttV5ClientSparkplugTest;
import org.thingsboard.server.transport.mqtt.util.sparkplug.SparkplugMessageType;
@@ -45,6 +46,7 @@ public abstract class AbstractMqttV5RpcSparkplugTest extends AbstractMqttV5Clie
connectionWithNBirth(metricBirthDataType_Int32, metricBirthName_Int32, nextInt32());
Assert.assertTrue("Connection node is failed", client.isConnected());
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.RPC, 1);
String expected = "{\"result\":\"Success: " + SparkplugMessageType.NCMD.name() + "\"}";
String actual = sendRPCSparkplug(NCMD.name(), sparkplugRpcRequest, savedGateway);
await(alias + SparkplugMessageType.NCMD.name())
@@ -79,6 +81,7 @@ public abstract class AbstractMqttV5RpcSparkplugTest extends AbstractMqttV5Clie
connectionWithNBirth(metricBirthDataType_Int32, metricBirthName_Int32, nextInt32());
Assert.assertTrue("Connection node is failed", client.isConnected());
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.RPC, 1);
String invalidateTypeMessageName = "RCMD";
String expected = "{\"result\":\"" + INVALID_ARGUMENTS + "\",\"error\":\"Failed to convert device RPC command to MQTT msg: " +
invalidateTypeMessageName + "{\\\"metricName\\\":\\\"" + metricBirthName_Int32 + "\\\",\\\"value\\\":" + metricBirthValue_Int32 + "}\"}";
@@ -92,6 +95,7 @@ public abstract class AbstractMqttV5RpcSparkplugTest extends AbstractMqttV5Clie
connectionWithNBirth(metricBirthDataType_Int32, metricBirthName_Int32, nextInt32());
Assert.assertTrue("Connection node is failed", client.isConnected());
client.subscribeAndWait(NAMESPACE + "/" + groupId + "/" + NCMD.name() + "/" + edgeNode + "/#", MqttQoS.AT_MOST_ONCE);
+ awaitForDeviceActorToReceiveSubscription(savedGateway.getId(), FeatureType.RPC, 1);
String metricNameBad = metricBirthName_Int32 + "_Bad";
String sparkplugRpcRequestBad = "{\"metricName\":\"" + metricNameBad + "\",\"value\":" + metricBirthValue_Int32 + "}";
String expected = "{\"result\":\"BAD_REQUEST_PARAMS\",\"error\":\"Failed send To Node Rpc Request: " +
diff --git a/application/src/test/resources/logback-test.xml b/application/src/test/resources/logback-test.xml
index 23e6d8c2f6..953b7094a4 100644
--- a/application/src/test/resources/logback-test.xml
+++ b/application/src/test/resources/logback-test.xml
@@ -21,6 +21,13 @@
+
+
+
+
+
+
+
diff --git a/common/cluster-api/src/main/proto/queue.proto b/common/cluster-api/src/main/proto/queue.proto
index f4992cbba7..d8c55c5917 100644
--- a/common/cluster-api/src/main/proto/queue.proto
+++ b/common/cluster-api/src/main/proto/queue.proto
@@ -186,7 +186,6 @@ message GetOrCreateDeviceFromGatewayRequestMsg {
int64 gatewayIdLSB = 2;
string deviceName = 3;
string deviceType = 4;
- bool sparkplug = 5;
}
message GetOrCreateDeviceFromGatewayResponseMsg {
diff --git a/common/data/src/test/java/org/thingsboard/server/common/data/UUIDConverterTest.java b/common/data/src/test/java/org/thingsboard/server/common/data/UUIDConverterTest.java
index e2af72892f..cad0d9370c 100644
--- a/common/data/src/test/java/org/thingsboard/server/common/data/UUIDConverterTest.java
+++ b/common/data/src/test/java/org/thingsboard/server/common/data/UUIDConverterTest.java
@@ -18,6 +18,7 @@ package org.thingsboard.server.common.data;
import com.datastax.oss.driver.api.core.uuid.Uuids;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@@ -58,9 +59,11 @@ public class UUIDConverterTest {
Assert.assertEquals(UUID.fromString("58e0a7d7-eebc-11d8-9669-0800200c9a66"), result);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void nonV1UuidToStringTest() {
- UUIDConverter.fromTimeUUID(UUID.fromString("58e0a7d7-eebc-01d8-9669-0800200c9a66"));
+ Assertions.assertThrows(IllegalArgumentException.class, () -> {
+ UUIDConverter.fromTimeUUID(UUID.fromString("58e0a7d7-eebc-01d8-9669-0800200c9a66"));
+ });
}
@Test
diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/DefaultLwM2mTransportService.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/DefaultLwM2mTransportService.java
index f4b52a0f5f..3eb096cd38 100644
--- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/DefaultLwM2mTransportService.java
+++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/DefaultLwM2mTransportService.java
@@ -25,6 +25,7 @@ import org.eclipse.leshan.core.node.codec.DefaultLwM2mEncoder;
import org.eclipse.leshan.server.californium.LeshanServer;
import org.eclipse.leshan.server.californium.LeshanServerBuilder;
import org.eclipse.leshan.server.californium.registration.CaliforniumRegistrationStore;
+import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;
import org.thingsboard.server.cache.ota.OtaPackageDataCache;
import org.thingsboard.server.common.data.DataConstants;
@@ -35,7 +36,7 @@ import org.thingsboard.server.transport.lwm2m.config.LwM2MTransportServerConfig;
import org.thingsboard.server.transport.lwm2m.secure.TbLwM2MAuthorizer;
import org.thingsboard.server.transport.lwm2m.secure.TbLwM2MDtlsCertificateVerifier;
import org.thingsboard.server.transport.lwm2m.server.store.TbSecurityStore;
-import org.thingsboard.server.transport.lwm2m.server.uplink.DefaultLwM2mUplinkMsgHandler;
+import org.thingsboard.server.transport.lwm2m.server.uplink.LwM2mUplinkMsgHandler;
import org.thingsboard.server.transport.lwm2m.utils.LwM2mValueConverterImpl;
import javax.annotation.PreDestroy;
@@ -56,6 +57,7 @@ import static org.thingsboard.server.transport.lwm2m.server.ota.DefaultLwM2MOtaU
@Slf4j
@Component
+@DependsOn({"lwM2mDownlinkMsgHandler", "lwM2mUplinkMsgHandler"})
@TbLwM2mTransportComponent
@RequiredArgsConstructor
public class DefaultLwM2mTransportService implements LwM2MTransportService {
@@ -66,7 +68,7 @@ public class DefaultLwM2mTransportService implements LwM2MTransportService {
private final LwM2mTransportContext context;
private final LwM2MTransportServerConfig config;
private final OtaPackageDataCache otaPackageDataCache;
- private final DefaultLwM2mUplinkMsgHandler handler;
+ private final LwM2mUplinkMsgHandler handler;
private final CaliforniumRegistrationStore registrationStore;
private final TbSecurityStore securityStore;
private final TbLwM2MDtlsCertificateVerifier certificateVerifier;
diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientContextImpl.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientContextImpl.java
index 49a77d1eea..d624badc1a 100644
--- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientContextImpl.java
+++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientContextImpl.java
@@ -42,7 +42,7 @@ import org.thingsboard.server.transport.lwm2m.server.ota.LwM2MOtaUpdateService;
import org.thingsboard.server.transport.lwm2m.server.session.LwM2MSessionManager;
import org.thingsboard.server.transport.lwm2m.server.store.TbLwM2MClientStore;
import org.thingsboard.server.transport.lwm2m.server.store.TbMainSecurityStore;
-import org.thingsboard.server.transport.lwm2m.server.uplink.DefaultLwM2mUplinkMsgHandler;
+import org.thingsboard.server.transport.lwm2m.server.uplink.LwM2mUplinkMsgHandler;
import org.thingsboard.server.transport.lwm2m.utils.LwM2MTransportUtil;
import java.util.Arrays;
@@ -75,7 +75,7 @@ public class LwM2mClientContextImpl implements LwM2mClientContext {
@Autowired
@Lazy
- private DefaultLwM2mUplinkMsgHandler defaultLwM2MUplinkMsgHandler;
+ private LwM2mUplinkMsgHandler defaultLwM2MUplinkMsgHandler;
@Autowired
@Lazy
private LwM2MOtaUpdateService otaUpdateService;
diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/downlink/DefaultLwM2mDownlinkMsgHandler.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/downlink/DefaultLwM2mDownlinkMsgHandler.java
index 735fa36e1e..ecc57a7458 100644
--- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/downlink/DefaultLwM2mDownlinkMsgHandler.java
+++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/downlink/DefaultLwM2mDownlinkMsgHandler.java
@@ -85,6 +85,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.RejectedExecutionException;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -103,7 +104,7 @@ import static org.thingsboard.server.transport.lwm2m.utils.LwM2MTransportUtil.ge
import static org.thingsboard.server.transport.lwm2m.utils.LwM2MTransportUtil.validateVersionedId;
@Slf4j
-@Service
+@Service("lwM2mDownlinkMsgHandler")
@TbLwM2mTransportComponent
@RequiredArgsConstructor
public class DefaultLwM2mDownlinkMsgHandler extends LwM2MExecutorAwareService implements LwM2mDownlinkMsgHandler {
@@ -124,6 +125,7 @@ public class DefaultLwM2mDownlinkMsgHandler extends LwM2MExecutorAwareService im
@PreDestroy
public void destroy() {
+ log.trace("Destroying {}", getClass().getSimpleName());
super.destroy();
}
@@ -521,16 +523,22 @@ public class DefaultLwM2mDownlinkMsgHandler extends LwM2MExecutorAwareService im
private , T extends LwM2mResponse> void handleDownlinkError(LwM2mClient client, R request, DownlinkRequestCallback callback, Exception e) {
log.trace("[{}] Received downlink error: {}.", client.getEndpoint(), e);
- client.updateLastUplinkTime();
- executor.submit(() -> {
- if (e instanceof TimeoutException || e instanceof ClientSleepingException) {
- log.trace("[{}] Received {}, client is probably sleeping", client.getEndpoint(), e.getClass().getSimpleName());
- clientContext.asleep(client);
- } else {
- log.trace("[{}] Received {}", client.getEndpoint(), e.getClass().getSimpleName());
- }
- callback.onError(toString(request), e);
- });
+ try {
+ client.updateLastUplinkTime();
+ executor.submit(() -> {
+ if (e instanceof TimeoutException || e instanceof ClientSleepingException) {
+ log.trace("[{}] Received {}, client is probably sleeping", client.getEndpoint(), e.getClass().getSimpleName());
+ clientContext.asleep(client);
+ } else {
+ log.trace("[{}] Received {}", client.getEndpoint(), e.getClass().getSimpleName());
+ }
+ callback.onError(toString(request), e);
+ });
+ } catch (RejectedExecutionException ree) {
+ log.warn("[{}] Can not handle downlink error. Executor already down", client.getEndpoint(), ree);
+ } catch (Exception exception) {
+ log.warn("[{}] Can not handle downlink error", client.getEndpoint(), exception);
+ }
}
private WriteRequest getWriteRequestSingleResource(ResourceModel.Type type, ContentFormat contentFormat, int objectId, int instanceId, int resourceId, Object value) {
diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/ota/DefaultLwM2MOtaUpdateService.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/ota/DefaultLwM2MOtaUpdateService.java
index 153e3894fb..f59643cbeb 100644
--- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/ota/DefaultLwM2MOtaUpdateService.java
+++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/ota/DefaultLwM2MOtaUpdateService.java
@@ -146,6 +146,7 @@ public class DefaultLwM2MOtaUpdateService extends LwM2MExecutorAwareService impl
@PreDestroy
public void destroy() {
+ log.trace("Destroying {}", getClass().getSimpleName());
super.destroy();
}
diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/uplink/DefaultLwM2mUplinkMsgHandler.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/uplink/DefaultLwM2mUplinkMsgHandler.java
index c790d2495c..25e3a6b591 100644
--- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/uplink/DefaultLwM2mUplinkMsgHandler.java
+++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/uplink/DefaultLwM2mUplinkMsgHandler.java
@@ -20,6 +20,8 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.leshan.core.ResponseCode;
import org.eclipse.leshan.core.model.ObjectModel;
@@ -32,6 +34,7 @@ import org.eclipse.leshan.core.node.LwM2mPath;
import org.eclipse.leshan.core.node.LwM2mResource;
import org.eclipse.leshan.core.node.LwM2mResourceInstance;
import org.eclipse.leshan.core.node.LwM2mSingleResource;
+import org.eclipse.leshan.core.node.codec.LwM2mValueConverter;
import org.eclipse.leshan.core.observation.Observation;
import org.eclipse.leshan.core.request.*;
import org.eclipse.leshan.core.request.WriteRequest.Mode;
@@ -122,69 +125,41 @@ import static org.thingsboard.server.transport.lwm2m.utils.LwM2MTransportUtil.fr
@Slf4j
-@Service
+@Service("lwM2mUplinkMsgHandler")
@TbLwM2mTransportComponent
+@RequiredArgsConstructor
public class DefaultLwM2mUplinkMsgHandler extends LwM2MExecutorAwareService implements LwM2mUplinkMsgHandler {
- public LwM2mValueConverterImpl converter;
+ @Getter
+ private final LwM2mValueConverter converter = LwM2mValueConverterImpl.getInstance();;
private final TransportService transportService;
private final LwM2mTransportContext context;
+ @Lazy
private final LwM2MAttributesService attributesService;
private final LwM2MSessionManager sessionManager;
+ @Lazy
private final LwM2MOtaUpdateService otaService;
private final LwM2MTransportServerConfig config;
private final LwM2MTelemetryLogService logService;
private final LwM2mTransportServerHelper helper;
private final TbLwM2MDtlsSessionStore sessionStore;
private final LwM2mClientContext clientContext;
- private final LwM2mDownlinkMsgHandler defaultLwM2MDownlinkMsgHandler;
+ private final LwM2mDownlinkMsgHandler defaultLwM2MDownlinkMsgHandler; //Do not use Lazy because we need live executor to handle msgs
private final LwM2mVersionedModelProvider modelProvider;
private final RegistrationStore registrationStore;
private final TbLwM2mSecurityStore securityStore;
private final LwM2MModelConfigService modelConfigService;
- public DefaultLwM2mUplinkMsgHandler(TransportService transportService,
- LwM2MTransportServerConfig config,
- LwM2mTransportServerHelper helper,
- LwM2mClientContext clientContext,
- LwM2MTelemetryLogService logService,
- LwM2MSessionManager sessionManager,
- @Lazy LwM2MOtaUpdateService otaService,
- @Lazy LwM2MAttributesService attributesService,
- @Lazy LwM2mDownlinkMsgHandler defaultLwM2MDownlinkMsgHandler,
- LwM2mTransportContext context,
- TbLwM2MDtlsSessionStore sessionStore,
- LwM2mVersionedModelProvider modelProvider,
- RegistrationStore registrationStore,
- TbLwM2mSecurityStore securityStore,
- LwM2MModelConfigService modelConfigService) {
- this.transportService = transportService;
- this.sessionManager = sessionManager;
- this.attributesService = attributesService;
- this.otaService = otaService;
- this.config = config;
- this.helper = helper;
- this.clientContext = clientContext;
- this.logService = logService;
- this.defaultLwM2MDownlinkMsgHandler = defaultLwM2MDownlinkMsgHandler;
- this.context = context;
- this.sessionStore = sessionStore;
- this.modelProvider = modelProvider;
- this.registrationStore = registrationStore;
- this.securityStore = securityStore;
- this.modelConfigService = modelConfigService;
- }
-
@PostConstruct
public void init() {
super.init();
this.context.getScheduler().scheduleAtFixedRate(this::reportActivity, new Random().nextInt((int) config.getSessionReportTimeout()), config.getSessionReportTimeout(), TimeUnit.MILLISECONDS);
- this.converter = LwM2mValueConverterImpl.getInstance();
}
@PreDestroy
public void destroy() {
+ log.trace("Destroying {}", getClass().getSimpleName());
super.destroy();
}
@@ -955,6 +930,7 @@ public class DefaultLwM2mUplinkMsgHandler extends LwM2MExecutorAwareService impl
*
* @param lwM2MClient - LwM2M Client
*/
+ @Override
public void initAttributes(LwM2mClient lwM2MClient, boolean logFailedUpdateOfNonChangedValue) {
Map keyNamesMap = this.getNamesFromProfileForSharedAttributes(lwM2MClient);
if (!keyNamesMap.isEmpty()) {
diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/uplink/LwM2mUplinkMsgHandler.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/uplink/LwM2mUplinkMsgHandler.java
index 0b2d819fa8..9beebe5279 100644
--- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/uplink/LwM2mUplinkMsgHandler.java
+++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/uplink/LwM2mUplinkMsgHandler.java
@@ -15,6 +15,7 @@
*/
package org.thingsboard.server.transport.lwm2m.server.uplink;
+import org.eclipse.leshan.core.node.codec.LwM2mValueConverter;
import org.eclipse.leshan.core.observation.Observation;
import org.eclipse.leshan.core.request.CreateRequest;
import org.eclipse.leshan.core.request.SendRequest;
@@ -69,5 +70,10 @@ public interface LwM2mUplinkMsgHandler {
void onToTransportUpdateCredentials(TransportProtos.SessionInfoProto sessionInfo, TransportProtos.ToTransportUpdateCredentialsProto updateCredentials);
+ void initAttributes(LwM2mClient lwM2MClient, boolean logFailedUpdateOfNonChangedValue);
+
LwM2MTransportServerConfig getConfig();
+
+ LwM2mValueConverter getConverter();
+
}
diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/utils/LwM2MTransportUtil.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/utils/LwM2MTransportUtil.java
index f207e7d05a..861261d951 100644
--- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/utils/LwM2MTransportUtil.java
+++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/utils/LwM2MTransportUtil.java
@@ -52,7 +52,7 @@ import org.thingsboard.server.transport.lwm2m.server.ota.firmware.FirmwareUpdate
import org.thingsboard.server.transport.lwm2m.server.ota.firmware.FirmwareUpdateState;
import org.thingsboard.server.transport.lwm2m.server.ota.software.SoftwareUpdateResult;
import org.thingsboard.server.transport.lwm2m.server.ota.software.SoftwareUpdateState;
-import org.thingsboard.server.transport.lwm2m.server.uplink.DefaultLwM2mUplinkMsgHandler;
+import org.thingsboard.server.transport.lwm2m.server.uplink.LwM2mUplinkMsgHandler;
import java.util.ArrayList;
import java.util.Arrays;
@@ -289,12 +289,12 @@ public class LwM2MTransportUtil {
* Attribute pmax = new Attribute(MAXIMUM_PERIOD, "60");
* Attribute [] attrs = {gt, st};
*/
- public static SimpleDownlinkRequest createWriteAttributeRequest(String target, Object params, DefaultLwM2mUplinkMsgHandler serviceImpl) {
+ public static SimpleDownlinkRequest createWriteAttributeRequest(String target, Object params, LwM2mUplinkMsgHandler serviceImpl) {
AttributeSet attrSet = new AttributeSet(createWriteAttributes(params, serviceImpl, target));
return attrSet.getAttributes().size() > 0 ? new WriteAttributesRequest(target, attrSet) : null;
}
- private static Attribute[] createWriteAttributes(Object params, DefaultLwM2mUplinkMsgHandler serviceImpl, String target) {
+ private static Attribute[] createWriteAttributes(Object params, LwM2mUplinkMsgHandler serviceImpl, String target) {
List attributeLists = new ArrayList<>();
Map map = JacksonUtil.convertValue(params, new TypeReference<>() {
});
@@ -366,19 +366,19 @@ public class LwM2MTransportUtil {
return newValues;
}
- public static Object convertWriteAttributes(String type, Object value, DefaultLwM2mUplinkMsgHandler serviceImpl, String target) {
+ public static Object convertWriteAttributes(String type, Object value, LwM2mUplinkMsgHandler serviceImpl, String target) {
switch (type) {
/** Integer [0:255]; */
case DIMENSION:
- Long dim = (Long) serviceImpl.converter.convertValue(value, equalsResourceTypeGetSimpleName(value), INTEGER, new LwM2mPath(target));
+ Long dim = (Long) serviceImpl.getConverter().convertValue(value, equalsResourceTypeGetSimpleName(value), INTEGER, new LwM2mPath(target));
return dim >= 0 && dim <= 255 ? dim : null;
/**String;*/
case OBJECT_VERSION:
- return serviceImpl.converter.convertValue(value, equalsResourceTypeGetSimpleName(value), STRING, new LwM2mPath(target));
+ return serviceImpl.getConverter().convertValue(value, equalsResourceTypeGetSimpleName(value), STRING, new LwM2mPath(target));
/**INTEGER */
case MINIMUM_PERIOD:
case MAXIMUM_PERIOD:
- return serviceImpl.converter.convertValue(value, equalsResourceTypeGetSimpleName(value), INTEGER, new LwM2mPath(target));
+ return serviceImpl.getConverter().convertValue(value, equalsResourceTypeGetSimpleName(value), INTEGER, new LwM2mPath(target));
/**Float; */
case GREATER_THAN:
case LESSER_THAN:
@@ -386,7 +386,7 @@ public class LwM2MTransportUtil {
if (value.getClass().getSimpleName().equals("String")) {
value = Double.valueOf((String) value);
}
- return serviceImpl.converter.convertValue(value, equalsResourceTypeGetSimpleName(value), FLOAT, new LwM2mPath(target));
+ return serviceImpl.getConverter().convertValue(value, equalsResourceTypeGetSimpleName(value), FLOAT, new LwM2mPath(target));
default:
return null;
}
diff --git a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java
index 0d43fc6c93..69f5f78475 100644
--- a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java
+++ b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java
@@ -399,7 +399,7 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
case NBIRTH:
case NCMD:
case NDATA:
- sparkplugSessionHandler.onAttributesTelemetryProto(msgId, sparkplugBProtoNode, deviceSessionCtx.getDeviceInfo().getDeviceName(), sparkplugTopic);
+ sparkplugSessionHandler.onAttributesTelemetryProto(msgId, sparkplugBProtoNode, sparkplugTopic);
break;
default:
}
@@ -410,7 +410,7 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
case DBIRTH:
case DCMD:
case DDATA:
- sparkplugSessionHandler.onAttributesTelemetryProto(msgId, sparkplugBProtoDevice, sparkplugTopic.getDeviceId(), sparkplugTopic);
+ sparkplugSessionHandler.onAttributesTelemetryProto(msgId, sparkplugBProtoDevice, sparkplugTopic);
break;
case DDEATH:
sparkplugSessionHandler.onDeviceDisconnect(mqttMsg, sparkplugTopic.getDeviceId());
@@ -1060,15 +1060,15 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
}
}
- private void checkSparkplugNodeSession(MqttConnectMessage connectMessage, ChannelHandlerContext ctx) {
+ private void checkSparkplugNodeSession(MqttConnectMessage connectMessage, ChannelHandlerContext ctx, SessionMetaData sessionMetaData) {
try {
if (sparkplugSessionHandler == null) {
SparkplugTopic sparkplugTopicNode = validatedSparkplugTopicConnectedNode(connectMessage);
if (sparkplugTopicNode != null) {
SparkplugBProto.Payload sparkplugBProtoNode = SparkplugBProto.Payload.parseFrom(connectMessage.payload().willMessageInBytes());
sparkplugSessionHandler = new SparkplugNodeSessionHandler(this, deviceSessionCtx, sessionId, sparkplugTopicNode);
- sparkplugSessionHandler.onAttributesTelemetryProto(0, sparkplugBProtoNode,
- deviceSessionCtx.getDeviceInfo().getDeviceName(), sparkplugTopicNode);
+ sparkplugSessionHandler.onAttributesTelemetryProto(0, sparkplugBProtoNode, sparkplugTopicNode);
+ sessionMetaData.setOverwriteActivityTime(true);
} else {
log.trace("[{}][{}] Failed to fetch sparkplugDevice connect: sparkplugTopicName without SparkplugMessageType.NDEATH.", sessionId, deviceSessionCtx.getDeviceInfo().getDeviceName());
throw new ThingsboardException("Invalid request body", ThingsboardErrorCode.BAD_REQUEST_PARAMS);
@@ -1145,7 +1145,7 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
public void onSuccess(Void msg) {
SessionMetaData sessionMetaData = transportService.registerAsyncSession(deviceSessionCtx.getSessionInfo(), MqttTransportHandler.this);
if (deviceSessionCtx.isSparkplug()) {
- checkSparkplugNodeSession(connectMessage, ctx);
+ checkSparkplugNodeSession(connectMessage, ctx, sessionMetaData);
} else {
checkGatewaySession(sessionMetaData);
}
diff --git a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/AbstractGatewaySessionHandler.java b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/AbstractGatewaySessionHandler.java
index 2bb59dc9e8..ab0b7be5db 100644
--- a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/AbstractGatewaySessionHandler.java
+++ b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/AbstractGatewaySessionHandler.java
@@ -253,7 +253,6 @@ public abstract class AbstractGatewaySessionHandler() {
@Override
diff --git a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/SparkplugNodeSessionHandler.java b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/SparkplugNodeSessionHandler.java
index fc480fa882..9b1e3e664e 100644
--- a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/SparkplugNodeSessionHandler.java
+++ b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/SparkplugNodeSessionHandler.java
@@ -101,7 +101,8 @@ public class SparkplugNodeSessionHandler extends AbstractGatewaySessionHandler contextListenableFuture;
@@ -113,7 +114,7 @@ public class SparkplugNodeSessionHandler extends AbstractGatewaySessionHandler deviceCtx = onDeviceConnectProto(deviceName);
+ ListenableFuture deviceCtx = onDeviceConnectProto(topic);
contextListenableFuture = Futures.transform(deviceCtx, ctx -> {
if (topic.isType(DBIRTH)) {
sendSparkplugStateOnTelemetry(ctx.getSessionInfo(), deviceName, ONLINE,
@@ -218,10 +219,10 @@ public class SparkplugNodeSessionHandler extends AbstractGatewaySessionHandler onDeviceConnectProto(String deviceName) throws ThingsboardException {
+ private ListenableFuture onDeviceConnectProto(SparkplugTopic topic) throws ThingsboardException {
try {
String deviceType = this.gateway.getDeviceType() + "-node";
- return onDeviceConnect(deviceName, deviceType);
+ return onDeviceConnect(topic.getNodeDeviceName(), deviceType);
} catch (RuntimeException e) {
log.error("Failed Sparkplug Device connect proto!", e);
throw new ThingsboardException(e, ThingsboardErrorCode.BAD_REQUEST_PARAMS);
diff --git a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/util/sparkplug/SparkplugTopic.java b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/util/sparkplug/SparkplugTopic.java
index be721f11bb..2fc49e2b69 100644
--- a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/util/sparkplug/SparkplugTopic.java
+++ b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/util/sparkplug/SparkplugTopic.java
@@ -161,4 +161,9 @@ public class SparkplugTopic {
public boolean isNode() {
return this.deviceId == null;
}
+
+ public String getNodeDeviceName() {
+ return isNode() ? edgeNodeId : deviceId;
+ }
}
+
diff --git a/common/transport/transport-api/src/test/java/JsonConverterTest.java b/common/transport/transport-api/src/test/java/JsonConverterTest.java
index a60516e784..39ed04a29a 100644
--- a/common/transport/transport-api/src/test/java/JsonConverterTest.java
+++ b/common/transport/transport-api/src/test/java/JsonConverterTest.java
@@ -16,20 +16,18 @@
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;
import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.thingsboard.server.common.transport.adaptor.JsonConverter;
import java.util.ArrayList;
-@RunWith(MockitoJUnitRunner.class)
public class JsonConverterTest {
- private static final JsonParser JSON_PARSER = new JsonParser();
+ private final JsonParser JSON_PARSER = new JsonParser();
- @Before
+ @BeforeEach
public void before() {
JsonConverter.setTypeCastEnabled(true);
}
@@ -88,15 +86,19 @@ public class JsonConverterTest {
Assert.assertEquals("10000000000000000000", result.get(0L).get(0).getStrValue().get());
}
- @Test(expected = JsonSyntaxException.class)
+ @Test
public void testParseBigDecimalOutOfLongRangeWithoutParsing() {
JsonConverter.setTypeCastEnabled(false);
- JsonConverter.convertToTelemetry(JSON_PARSER.parse("{\"meterReadingDelta\": 89701010051400054084}"), 0L);
+ Assertions.assertThrows(JsonSyntaxException.class, () -> {
+ JsonConverter.convertToTelemetry(JSON_PARSER.parse("{\"meterReadingDelta\": 89701010051400054084}"), 0L);
+ });
}
- @Test(expected = JsonSyntaxException.class)
+ @Test
public void testParseBigDecimalOutOfLongRangeWithoutParsing2() {
JsonConverter.setTypeCastEnabled(false);
- JsonConverter.convertToTelemetry(JSON_PARSER.parse("{\"meterReadingDelta\": 9.9701010061400066E19}"), 0L);
+ Assertions.assertThrows(JsonSyntaxException.class, () -> {
+ JsonConverter.convertToTelemetry(JSON_PARSER.parse("{\"meterReadingDelta\": 9.9701010061400066E19}"), 0L);
+ });
}
}
diff --git a/dao/src/main/java/org/thingsboard/server/dao/entity/DefaultEntityServiceRegistry.java b/dao/src/main/java/org/thingsboard/server/dao/entity/DefaultEntityServiceRegistry.java
index a8b1d97bac..232905e9fc 100644
--- a/dao/src/main/java/org/thingsboard/server/dao/entity/DefaultEntityServiceRegistry.java
+++ b/dao/src/main/java/org/thingsboard/server/dao/entity/DefaultEntityServiceRegistry.java
@@ -15,27 +15,31 @@
*/
package org.thingsboard.server.dao.entity;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
+import org.springframework.context.event.ContextRefreshedEvent;
+import org.springframework.context.event.EventListener;
+import org.springframework.core.Ordered;
+import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;
import org.thingsboard.server.common.data.EntityType;
-import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;
@Service
+@RequiredArgsConstructor
+@Slf4j
public class DefaultEntityServiceRegistry implements EntityServiceRegistry {
private final ApplicationContext applicationContext;
- private final Map entityDaoServicesMap;
+ private final Map entityDaoServicesMap = new HashMap<>();
- public DefaultEntityServiceRegistry(ApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- this.entityDaoServicesMap = new HashMap<>();
- }
-
- @PostConstruct
+ @EventListener(ContextRefreshedEvent.class)
+ @Order(Ordered.HIGHEST_PRECEDENCE)
public void init() {
+ log.debug("Initializing EntityServiceRegistry on ContextRefreshedEvent");
applicationContext.getBeansOfType(EntityDaoService.class).values().forEach(entityDaoService -> {
EntityType entityType = entityDaoService.getEntityType();
entityDaoServicesMap.put(entityType, entityDaoService);
@@ -43,6 +47,7 @@ public class DefaultEntityServiceRegistry implements EntityServiceRegistry {
entityDaoServicesMap.put(EntityType.RULE_NODE, entityDaoService);
}
});
+ log.debug("Initialized EntityServiceRegistry total [{}] entries", entityDaoServicesMap.size());
}
@Override
diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultAlarmQueryRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultAlarmQueryRepository.java
index ecf9c1c95f..d9fd2cc66d 100644
--- a/dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultAlarmQueryRepository.java
+++ b/dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultAlarmQueryRepository.java
@@ -148,6 +148,10 @@ public class DefaultAlarmQueryRepository implements AlarmQueryRepository {
}
EntityDataSortOrder sortOrder = pageLink.getSortOrder();
+ if (sortOrder != null && EntityKeyType.ALARM_FIELD.equals(sortOrder.getKey().getType()) && ASSIGNEE_KEY.equalsIgnoreCase(sortOrder.getKey().getKey())) {
+ sortOrder = new EntityDataSortOrder(new EntityKey(EntityKeyType.ALARM_FIELD, ASSIGNEE_EMAIL_KEY), sortOrder.getDirection());
+ }
+
List alarmFields = new ArrayList<>();
for (EntityKey key : query.getAlarmFields()) {
if (EntityKeyType.ALARM_FIELD.equals(key.getType()) && ASSIGNEE_KEY.equalsIgnoreCase(key.getKey())) {
@@ -265,6 +269,8 @@ public class DefaultAlarmQueryRepository implements AlarmQueryRepository {
}
if (pageLink.getAssigneeId() != null) {
+ addAndIfNeeded(wherePart, addAnd);
+ addAnd = true;
ctx.addUuidParameter("assigneeId", pageLink.getAssigneeId().getId());
wherePart.append(" a.assignee_id = :assigneeId");
}
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/AbstractServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/AbstractServiceTest.java
index 7f1f5e9ca0..55f3bb58c8 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/AbstractServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/AbstractServiceTest.java
@@ -18,6 +18,8 @@ package org.thingsboard.server.dao.service;
import com.datastax.oss.driver.api.core.uuid.Uuids;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.After;
+import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@@ -47,44 +49,17 @@ import org.thingsboard.server.common.data.id.HasId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.ota.ChecksumAlgorithm;
import org.thingsboard.server.common.data.ota.OtaPackageType;
-import org.thingsboard.server.dao.alarm.AlarmCommentService;
-import org.thingsboard.server.dao.alarm.AlarmService;
-import org.thingsboard.server.dao.asset.AssetProfileService;
-import org.thingsboard.server.dao.asset.AssetService;
import org.thingsboard.server.dao.audit.AuditLogLevelFilter;
import org.thingsboard.server.dao.audit.AuditLogLevelMask;
import org.thingsboard.server.dao.audit.AuditLogLevelProperties;
-import org.thingsboard.server.dao.component.ComponentDescriptorService;
-import org.thingsboard.server.dao.customer.CustomerService;
-import org.thingsboard.server.dao.dashboard.DashboardService;
-import org.thingsboard.server.dao.device.DeviceCredentialsService;
-import org.thingsboard.server.dao.device.DeviceProfileService;
-import org.thingsboard.server.dao.device.DeviceService;
-import org.thingsboard.server.dao.edge.EdgeEventService;
-import org.thingsboard.server.dao.edge.EdgeService;
-import org.thingsboard.server.dao.entity.EntityService;
-import org.thingsboard.server.dao.entityview.EntityViewService;
-import org.thingsboard.server.dao.event.EventService;
-import org.thingsboard.server.dao.ota.OtaPackageService;
-import org.thingsboard.server.dao.queue.QueueService;
-import org.thingsboard.server.dao.relation.RelationService;
-import org.thingsboard.server.dao.resource.ResourceService;
-import org.thingsboard.server.dao.rpc.RpcService;
-import org.thingsboard.server.dao.rule.RuleChainService;
-import org.thingsboard.server.dao.settings.AdminSettingsService;
-import org.thingsboard.server.dao.tenant.TenantProfileService;
import org.thingsboard.server.dao.tenant.TenantService;
-import org.thingsboard.server.dao.timeseries.TimeseriesService;
-import org.thingsboard.server.dao.usagerecord.ApiUsageStateService;
-import org.thingsboard.server.dao.user.UserService;
-import org.thingsboard.server.dao.widget.WidgetTypeService;
-import org.thingsboard.server.dao.widget.WidgetsBundleService;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
+import java.util.UUID;
import static org.junit.Assert.assertNotNull;
@@ -100,91 +75,20 @@ public abstract class AbstractServiceTest {
public static final TenantId SYSTEM_TENANT_ID = TenantId.SYS_TENANT_ID;
- @Autowired
- protected UserService userService;
-
- @Autowired
- protected ApiUsageStateService apiUsageStateService;
-
- @Autowired
- protected AdminSettingsService adminSettingsService;
-
@Autowired
protected TenantService tenantService;
- @Autowired
- protected CustomerService customerService;
-
- @Autowired
- protected DeviceService deviceService;
-
- @Autowired
- protected AssetService assetService;
-
- @Autowired
- protected EntityViewService entityViewService;
-
- @Autowired
- protected EntityService entityService;
-
- @Autowired
- protected DeviceCredentialsService deviceCredentialsService;
-
- @Autowired
- protected WidgetsBundleService widgetsBundleService;
-
- @Autowired
- protected WidgetTypeService widgetTypeService;
-
- @Autowired
- protected DashboardService dashboardService;
-
- @Autowired
- protected TimeseriesService tsService;
-
- @Autowired
- protected EventService eventService;
-
- @Autowired
- protected RelationService relationService;
-
- @Autowired
- protected AlarmService alarmService;
- @Autowired
- protected AlarmCommentService alarmCommentService;
-
- @Autowired
- protected RuleChainService ruleChainService;
-
- @Autowired
- protected EdgeService edgeService;
-
- @Autowired
- protected EdgeEventService edgeEventService;
+ protected TenantId tenantId;
- @Autowired
- private ComponentDescriptorService componentDescriptorService;
-
- @Autowired
- protected TenantProfileService tenantProfileService;
-
- @Autowired
- protected DeviceProfileService deviceProfileService;
-
- @Autowired
- protected AssetProfileService assetProfileService;
-
- @Autowired
- protected ResourceService resourceService;
-
- @Autowired
- protected OtaPackageService otaPackageService;
-
- @Autowired
- protected RpcService rpcService;
+ @Before
+ public void beforeAbstractService() {
+ tenantId = createTenant();
+ }
- @Autowired
- protected QueueService queueService;
+ @After
+ public void afterAbstractService() {
+ tenantService.deleteTenants();
+ }
public class IdComparator implements Comparator {
@Override
@@ -270,7 +174,7 @@ public abstract class AbstractServiceTest {
public TenantId createTenant() {
Tenant tenant = new Tenant();
- tenant.setTitle("My tenant " + Uuids.timeBased());
+ tenant.setTitle("My tenant " + UUID.randomUUID());
Tenant savedTenant = tenantService.saveTenant(tenant);
assertNotNull(savedTenant);
return savedTenant.getId();
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseAdminSettingsServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseAdminSettingsServiceTest.java
index 1905a0b784..3b8659f93c 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseAdminSettingsServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseAdminSettingsServiceTest.java
@@ -19,11 +19,17 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.AdminSettings;
import org.thingsboard.server.dao.exception.DataValidationException;
+import org.thingsboard.server.dao.settings.AdminSettingsService;
public abstract class BaseAdminSettingsServiceTest extends AbstractServiceTest {
+ @Autowired
+ AdminSettingsService adminSettingsService;
+
@Test
public void testFindAdminSettingsByKey() {
AdminSettings adminSettings = adminSettingsService.findAdminSettingsByKey(SYSTEM_TENANT_ID, "general");
@@ -54,17 +60,21 @@ public abstract class BaseAdminSettingsServiceTest extends AbstractServiceTest {
Assert.assertEquals(adminSettings.getJsonValue(), savedAdminSettings.getJsonValue());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveAdminSettingsWithEmptyKey() {
AdminSettings adminSettings = adminSettingsService.findAdminSettingsByKey(SYSTEM_TENANT_ID, "mail");
adminSettings.setKey(null);
- adminSettingsService.saveAdminSettings(SYSTEM_TENANT_ID, adminSettings);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ adminSettingsService.saveAdminSettings(SYSTEM_TENANT_ID, adminSettings);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testChangeAdminSettingsKey() {
AdminSettings adminSettings = adminSettingsService.findAdminSettingsByKey(SYSTEM_TENANT_ID, "mail");
adminSettings.setKey("newKey");
- adminSettingsService.saveAdminSettings(SYSTEM_TENANT_ID, adminSettings);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ adminSettingsService.saveAdminSettings(SYSTEM_TENANT_ID, adminSettings);
+ });
}
}
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseAlarmCommentServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseAlarmCommentServiceTest.java
index 688793d6c6..1144ec6513 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseAlarmCommentServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseAlarmCommentServiceTest.java
@@ -20,21 +20,22 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import org.testcontainers.shaded.org.apache.commons.lang3.RandomStringUtils;
import org.thingsboard.common.util.JacksonUtil;
-import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.User;
import org.thingsboard.server.common.data.alarm.Alarm;
import org.thingsboard.server.common.data.alarm.AlarmComment;
import org.thingsboard.server.common.data.alarm.AlarmCommentInfo;
import org.thingsboard.server.common.data.alarm.AlarmSeverity;
-import org.thingsboard.server.common.data.alarm.AlarmStatus;
import org.thingsboard.server.common.data.id.AssetId;
-import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.id.UserId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.security.Authority;
+import org.thingsboard.server.dao.alarm.AlarmCommentService;
+import org.thingsboard.server.dao.alarm.AlarmService;
+import org.thingsboard.server.dao.user.UserService;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
@@ -43,19 +44,19 @@ import static org.thingsboard.server.common.data.alarm.AlarmCommentType.OTHER;
public abstract class BaseAlarmCommentServiceTest extends AbstractServiceTest {
+ @Autowired
+ AlarmService alarmService;
+ @Autowired
+ AlarmCommentService alarmCommentService;
+ @Autowired
+ UserService userService;
+
public static final String TEST_ALARM = "TEST_ALARM";
- private TenantId tenantId;
private Alarm alarm;
private User user;
@Before
public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
-
alarm = Alarm.builder().tenantId(tenantId).originator(new AssetId(Uuids.timeBased()))
.type(TEST_ALARM)
.severity(AlarmSeverity.CRITICAL)
@@ -74,7 +75,6 @@ public abstract class BaseAlarmCommentServiceTest extends AbstractServiceTest {
@After
public void after() {
alarmService.deleteAlarm(tenantId, alarm.getId());
- tenantService.deleteTenant(tenantId);
}
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseAlarmServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseAlarmServiceTest.java
index b7f5135533..9c81bfd232 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseAlarmServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseAlarmServiceTest.java
@@ -16,14 +16,12 @@
package org.thingsboard.server.dao.service;
import com.datastax.oss.driver.api.core.uuid.Uuids;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.Device;
-import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.User;
import org.thingsboard.server.common.data.alarm.Alarm;
import org.thingsboard.server.common.data.alarm.AlarmCreateOrUpdateActiveRequest;
@@ -36,9 +34,7 @@ import org.thingsboard.server.common.data.alarm.AlarmStatus;
import org.thingsboard.server.common.data.alarm.AlarmUpdateRequest;
import org.thingsboard.server.common.data.asset.Asset;
import org.thingsboard.server.common.data.id.AssetId;
-import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
-import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.page.SortOrder;
import org.thingsboard.server.common.data.page.TimePageLink;
import org.thingsboard.server.common.data.query.AlarmData;
@@ -52,7 +48,12 @@ import org.thingsboard.server.common.data.relation.EntityRelation;
import org.thingsboard.server.common.data.relation.RelationTypeGroup;
import org.thingsboard.server.common.data.security.Authority;
import org.thingsboard.server.dao.alarm.AlarmApiCallResult;
-import org.thingsboard.server.dao.alarm.AlarmOperationResult;
+import org.thingsboard.server.dao.alarm.AlarmService;
+import org.thingsboard.server.dao.asset.AssetService;
+import org.thingsboard.server.dao.customer.CustomerService;
+import org.thingsboard.server.dao.device.DeviceService;
+import org.thingsboard.server.dao.relation.RelationService;
+import org.thingsboard.server.dao.user.UserService;
import java.util.Arrays;
import java.util.Collections;
@@ -61,29 +62,24 @@ import java.util.concurrent.ExecutionException;
public abstract class BaseAlarmServiceTest extends AbstractServiceTest {
- public static final String TEST_ALARM = "TEST_ALARM";
+ @Autowired
+ AlarmService alarmService;
+ @Autowired
+ AssetService assetService;
+ @Autowired
+ CustomerService customerService;
+ @Autowired
+ DeviceService deviceService;
+ @Autowired
+ RelationService relationService;
+ @Autowired
+ UserService userService;
+ public static final String TEST_ALARM = "TEST_ALARM";
private static final String TEST_TENANT_EMAIL = "testtenant@thingsboard.org";
private static final String TEST_TENANT_FIRST_NAME = "testtenantfirstname";
private static final String TEST_TENANT_LAST_NAME = "testtenantlastname";
- private TenantId tenantId;
-
- @Before
- public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
- }
-
- @After
- public void after() {
- tenantService.deleteTenant(tenantId);
- }
-
-
@Test
public void testSaveAndFetchAlarm() throws ExecutionException, InterruptedException {
AssetId parentId = new AssetId(Uuids.timeBased());
@@ -271,6 +267,7 @@ public abstract class BaseAlarmServiceTest extends AbstractServiceTest {
pageLink.setPage(0);
pageLink.setPageSize(10);
pageLink.setAssigneeId(tenantUser.getId());
+ pageLink.setSortOrder(new EntityDataSortOrder(new EntityKey(EntityKeyType.ALARM_FIELD, "assignee")));
PageData assignedAlarms = alarmService.findAlarmDataByQueryForEntities(tenantId, toQuery(pageLink), Collections.singletonList(created.getOriginator()));
Assert.assertNotNull(assignedAlarms.getData());
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseApiUsageStateServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseApiUsageStateServiceTest.java
index 2ea7147a65..2ee2f74b3e 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseApiUsageStateServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseApiUsageStateServiceTest.java
@@ -15,33 +15,18 @@
*/
package org.thingsboard.server.dao.service;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.ApiUsageStateValue;
-import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.ApiUsageState;
-import org.thingsboard.server.common.data.id.TenantId;
+import org.thingsboard.server.dao.usagerecord.ApiUsageStateService;
public abstract class BaseApiUsageStateServiceTest extends AbstractServiceTest {
- private TenantId tenantId;
-
- @Before
- public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
- }
-
- @After
- public void after() {
- tenantService.deleteTenant(tenantId);
- }
+ @Autowired
+ ApiUsageStateService apiUsageStateService;
@Test
public void testFindApiUsageStateByTenantId() {
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseAssetProfileServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseAssetProfileServiceTest.java
index 345671968e..02bf4b1b1a 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseAssetProfileServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseAssetProfileServiceTest.java
@@ -19,18 +19,18 @@ import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.common.util.ThingsBoardThreadFactory;
-import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.asset.Asset;
import org.thingsboard.server.common.data.asset.AssetProfile;
import org.thingsboard.server.common.data.asset.AssetProfileInfo;
-import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
+import org.thingsboard.server.dao.asset.AssetProfileService;
+import org.thingsboard.server.dao.asset.AssetService;
import org.thingsboard.server.dao.exception.DataValidationException;
import java.util.ArrayList;
@@ -45,21 +45,10 @@ public abstract class BaseAssetProfileServiceTest extends AbstractServiceTest {
private IdComparator idComparator = new IdComparator<>();
private IdComparator assetProfileInfoIdComparator = new IdComparator<>();
- private TenantId tenantId;
-
- @Before
- public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
- }
-
- @After
- public void after() {
- tenantService.deleteTenant(tenantId);
- }
+ @Autowired
+ AssetProfileService assetProfileService;
+ @Autowired
+ AssetService assetService;
@Test
public void testSaveAssetProfile() {
@@ -150,22 +139,26 @@ public abstract class BaseAssetProfileServiceTest extends AbstractServiceTest {
Assert.assertEquals(savedAssetProfile2.getId(), defaultAssetProfile.getId());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveAssetProfileWithEmptyName() {
AssetProfile assetProfile = new AssetProfile();
assetProfile.setTenantId(tenantId);
- assetProfileService.saveAssetProfile(assetProfile);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ assetProfileService.saveAssetProfile(assetProfile);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveAssetProfileWithSameName() {
AssetProfile assetProfile = this.createAssetProfile(tenantId, "Asset Profile");
assetProfileService.saveAssetProfile(assetProfile);
AssetProfile assetProfile2 = this.createAssetProfile(tenantId, "Asset Profile");
- assetProfileService.saveAssetProfile(assetProfile2);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ assetProfileService.saveAssetProfile(assetProfile2);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testDeleteAssetProfileWithExistingAsset() {
AssetProfile assetProfile = this.createAssetProfile(tenantId, "Asset Profile");
AssetProfile savedAssetProfile = assetProfileService.saveAssetProfile(assetProfile);
@@ -174,7 +167,9 @@ public abstract class BaseAssetProfileServiceTest extends AbstractServiceTest {
asset.setName("Test asset");
asset.setAssetProfileId(savedAssetProfile.getId());
assetService.saveAsset(asset);
- assetProfileService.deleteAssetProfile(tenantId, savedAssetProfile.getId());
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ assetProfileService.deleteAssetProfile(tenantId, savedAssetProfile.getId());
+ });
}
@Test
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseAssetServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseAssetServiceTest.java
index 9fe9752a85..9f4c8fe363 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseAssetServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseAssetServiceTest.java
@@ -16,10 +16,10 @@
package org.thingsboard.server.dao.service;
import com.datastax.oss.driver.api.core.uuid.Uuids;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.EntitySubtype;
import org.thingsboard.server.common.data.StringUtils;
@@ -30,6 +30,8 @@ import org.thingsboard.server.common.data.id.CustomerId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
+import org.thingsboard.server.dao.asset.AssetService;
+import org.thingsboard.server.dao.customer.CustomerService;
import org.thingsboard.server.dao.exception.DataValidationException;
import java.util.ArrayList;
@@ -40,23 +42,12 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID;
public abstract class BaseAssetServiceTest extends AbstractServiceTest {
- private IdComparator idComparator = new IdComparator<>();
-
- private TenantId tenantId;
-
- @Before
- public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
- }
+ @Autowired
+ AssetService assetService;
+ @Autowired
+ CustomerService customerService;
- @After
- public void after() {
- tenantService.deleteTenant(tenantId);
- }
+ private IdComparator idComparator = new IdComparator<>();
@Test
public void testSaveAsset() {
@@ -83,63 +74,73 @@ public abstract class BaseAssetServiceTest extends AbstractServiceTest {
assetService.deleteAsset(tenantId, savedAsset.getId());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveAssetWithEmptyName() {
Asset asset = new Asset();
asset.setTenantId(tenantId);
asset.setType("default");
- assetService.saveAsset(asset);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ assetService.saveAsset(asset);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveAssetWithEmptyTenant() {
Asset asset = new Asset();
asset.setName("My asset");
asset.setType("default");
- assetService.saveAsset(asset);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ assetService.saveAsset(asset);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveAssetWithInvalidTenant() {
Asset asset = new Asset();
asset.setName("My asset");
asset.setType("default");
asset.setTenantId(TenantId.fromUUID(Uuids.timeBased()));
- assetService.saveAsset(asset);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ assetService.saveAsset(asset);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testAssignAssetToNonExistentCustomer() {
Asset asset = new Asset();
asset.setName("My asset");
asset.setType("default");
asset.setTenantId(tenantId);
- asset = assetService.saveAsset(asset);
+ Asset savedAsset = assetService.saveAsset(asset);
try {
- assetService.assignAssetToCustomer(tenantId, asset.getId(), new CustomerId(Uuids.timeBased()));
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ assetService.assignAssetToCustomer(tenantId, savedAsset.getId(), new CustomerId(Uuids.timeBased()));
+ });
} finally {
- assetService.deleteAsset(tenantId, asset.getId());
+ assetService.deleteAsset(tenantId, savedAsset.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testAssignAssetToCustomerFromDifferentTenant() {
Asset asset = new Asset();
asset.setName("My asset");
asset.setType("default");
asset.setTenantId(tenantId);
- asset = assetService.saveAsset(asset);
+ Asset savedAsset = assetService.saveAsset(asset);
Tenant tenant = new Tenant();
tenant.setTitle("Test different tenant");
tenant = tenantService.saveTenant(tenant);
Customer customer = new Customer();
customer.setTenantId(tenant.getId());
customer.setTitle("Test different customer");
- customer = customerService.saveCustomer(customer);
+ Customer savedCustomer = customerService.saveCustomer(customer);
try {
- assetService.assignAssetToCustomer(tenantId, asset.getId(), customer.getId());
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ assetService.assignAssetToCustomer(tenantId, savedAsset.getId(), savedCustomer.getId());
+ });
} finally {
- assetService.deleteAsset(tenantId, asset.getId());
+ assetService.deleteAsset(tenantId, savedAsset.getId());
tenantService.deleteTenant(tenant.getId());
}
}
@@ -209,12 +210,6 @@ public abstract class BaseAssetServiceTest extends AbstractServiceTest {
@Test
public void testFindAssetsByTenantId() {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
-
List assets = new ArrayList<>();
for (int i=0;i<178;i++) {
Asset asset = new Asset();
@@ -246,8 +241,6 @@ public abstract class BaseAssetServiceTest extends AbstractServiceTest {
pageData = assetService.findAssetsByTenantId(tenantId, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertTrue(pageData.getData().isEmpty());
-
- tenantService.deleteTenant(tenantId);
}
@Test
@@ -408,12 +401,6 @@ public abstract class BaseAssetServiceTest extends AbstractServiceTest {
@Test
public void testFindAssetsByTenantIdAndCustomerId() {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
-
Customer customer = new Customer();
customer.setTitle("Test customer");
customer.setTenantId(tenantId);
@@ -452,8 +439,6 @@ public abstract class BaseAssetServiceTest extends AbstractServiceTest {
pageData = assetService.findAssetInfosByTenantIdAndCustomerId(tenantId, customerId, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertTrue(pageData.getData().isEmpty());
-
- tenantService.deleteTenant(tenantId);
}
@Test
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseCustomerServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseCustomerServiceTest.java
index 11d82ad963..371d8abb99 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseCustomerServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseCustomerServiceTest.java
@@ -24,6 +24,8 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.common.util.ThingsBoardExecutors;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.StringUtils;
@@ -31,6 +33,7 @@ import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
+import org.thingsboard.server.dao.customer.CustomerService;
import org.thingsboard.server.dao.exception.DataValidationException;
import java.util.ArrayList;
@@ -40,28 +43,22 @@ import java.util.concurrent.TimeUnit;
import static org.assertj.core.api.Assertions.assertThat;
public abstract class BaseCustomerServiceTest extends AbstractServiceTest {
+
+ @Autowired
+ CustomerService customerService;
+
static final int TIMEOUT = 30;
ListeningExecutorService executor;
- private TenantId tenantId;
-
@Before
public void before() {
executor = MoreExecutors.listeningDecorator(ThingsBoardExecutors.newWorkStealingPool(8, getClass()));
-
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
- }
+ }
@After
public void after() {
executor.shutdownNow();
-
- tenantService.deleteTenant(tenantId);
}
@Test
@@ -99,35 +96,43 @@ public abstract class BaseCustomerServiceTest extends AbstractServiceTest {
customerService.deleteCustomer(tenantId, savedCustomer.getId());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveCustomerWithEmptyTitle() {
Customer customer = new Customer();
customer.setTenantId(tenantId);
- customerService.saveCustomer(customer);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ customerService.saveCustomer(customer);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveCustomerWithEmptyTenant() {
Customer customer = new Customer();
customer.setTitle("My customer");
- customerService.saveCustomer(customer);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ customerService.saveCustomer(customer);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveCustomerWithInvalidTenant() {
Customer customer = new Customer();
customer.setTitle("My customer");
customer.setTenantId(TenantId.fromUUID(Uuids.timeBased()));
- customerService.saveCustomer(customer);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ customerService.saveCustomer(customer);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveCustomerWithInvalidEmail() {
Customer customer = new Customer();
customer.setTenantId(tenantId);
customer.setTitle("My customer");
customer.setEmail("invalid@mail");
- customerService.saveCustomer(customer);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ customerService.saveCustomer(customer);
+ });
}
@Test
@@ -143,11 +148,6 @@ public abstract class BaseCustomerServiceTest extends AbstractServiceTest {
@Test
public void testFindCustomersByTenantId() throws Exception {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
List> futures = new ArrayList<>(135);
for (int i = 0; i < 135; i++) {
@@ -178,8 +178,6 @@ public abstract class BaseCustomerServiceTest extends AbstractServiceTest {
pageData = customerService.findCustomersByTenantId(tenantId, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertTrue(pageData.getData().isEmpty());
-
- tenantService.deleteTenant(tenantId);
}
@Test
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseDashboardServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseDashboardServiceTest.java
index 88d66e9586..7ccd5e6211 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseDashboardServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseDashboardServiceTest.java
@@ -16,10 +16,10 @@
package org.thingsboard.server.dao.service;
import com.datastax.oss.driver.api.core.uuid.Uuids;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.Dashboard;
import org.thingsboard.server.common.data.DashboardInfo;
@@ -32,6 +32,9 @@ import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.page.SortOrder;
+import org.thingsboard.server.dao.customer.CustomerService;
+import org.thingsboard.server.dao.dashboard.DashboardService;
+import org.thingsboard.server.dao.edge.EdgeService;
import org.thingsboard.server.dao.exception.DataValidationException;
import java.io.IOException;
@@ -41,24 +44,15 @@ import java.util.List;
import java.util.concurrent.ExecutionException;
public abstract class BaseDashboardServiceTest extends AbstractServiceTest {
-
- private IdComparator idComparator = new IdComparator<>();
-
- private TenantId tenantId;
- @Before
- public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
- }
+ @Autowired
+ CustomerService customerService;
+ @Autowired
+ DashboardService dashboardService;
+ @Autowired
+ EdgeService edgeService;
- @After
- public void after() {
- tenantService.deleteTenant(tenantId);
- }
+ private IdComparator idComparator = new IdComparator<>();
@Test
public void testSaveDashboard() throws IOException {
@@ -82,58 +76,68 @@ public abstract class BaseDashboardServiceTest extends AbstractServiceTest {
dashboardService.deleteDashboard(tenantId, savedDashboard.getId());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDashboardWithEmptyTitle() {
Dashboard dashboard = new Dashboard();
dashboard.setTenantId(tenantId);
- dashboardService.saveDashboard(dashboard);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ dashboardService.saveDashboard(dashboard);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDashboardWithEmptyTenant() {
Dashboard dashboard = new Dashboard();
dashboard.setTitle("My dashboard");
- dashboardService.saveDashboard(dashboard);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ dashboardService.saveDashboard(dashboard);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDashboardWithInvalidTenant() {
Dashboard dashboard = new Dashboard();
dashboard.setTitle("My dashboard");
dashboard.setTenantId(TenantId.fromUUID(Uuids.timeBased()));
- dashboardService.saveDashboard(dashboard);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ dashboardService.saveDashboard(dashboard);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testAssignDashboardToNonExistentCustomer() {
Dashboard dashboard = new Dashboard();
dashboard.setTitle("My dashboard");
dashboard.setTenantId(tenantId);
- dashboard = dashboardService.saveDashboard(dashboard);
+ Dashboard savedDashboard = dashboardService.saveDashboard(dashboard);
try {
- dashboardService.assignDashboardToCustomer(tenantId, dashboard.getId(), new CustomerId(Uuids.timeBased()));
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ dashboardService.assignDashboardToCustomer(tenantId, savedDashboard.getId(), new CustomerId(Uuids.timeBased()));
+ });
} finally {
- dashboardService.deleteDashboard(tenantId, dashboard.getId());
+ dashboardService.deleteDashboard(tenantId, savedDashboard.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testAssignDashboardToCustomerFromDifferentTenant() {
Dashboard dashboard = new Dashboard();
dashboard.setTitle("My dashboard");
dashboard.setTenantId(tenantId);
- dashboard = dashboardService.saveDashboard(dashboard);
+ Dashboard savedDashboard = dashboardService.saveDashboard(dashboard);
Tenant tenant = new Tenant();
tenant.setTitle("Test different tenant [dashboard]");
tenant = tenantService.saveTenant(tenant);
Customer customer = new Customer();
customer.setTenantId(tenant.getId());
customer.setTitle("Test different customer");
- customer = customerService.saveCustomer(customer);
+ Customer savedCustomer = customerService.saveCustomer(customer);
try {
- dashboardService.assignDashboardToCustomer(tenantId, dashboard.getId(), customer.getId());
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ dashboardService.assignDashboardToCustomer(tenantId, savedDashboard.getId(), savedCustomer.getId());
+ });
} finally {
- dashboardService.deleteDashboard(tenantId, dashboard.getId());
+ dashboardService.deleteDashboard(tenantId, savedDashboard.getId());
tenantService.deleteTenant(tenant.getId());
}
}
@@ -165,12 +169,6 @@ public abstract class BaseDashboardServiceTest extends AbstractServiceTest {
@Test
public void testFindDashboardsByTenantId() {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
-
List dashboards = new ArrayList<>();
for (int i=0;i<165;i++) {
Dashboard dashboard = new Dashboard();
@@ -201,18 +199,10 @@ public abstract class BaseDashboardServiceTest extends AbstractServiceTest {
pageData = dashboardService.findDashboardsByTenantId(tenantId, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertTrue(pageData.getData().isEmpty());
-
- tenantService.deleteTenant(tenantId);
}
@Test
public void testFindMobileDashboardsByTenantId() {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
-
List mobileDashboards = new ArrayList<>();
for (int i=0;i<165;i++) {
Dashboard dashboard = new Dashboard();
@@ -261,8 +251,6 @@ public abstract class BaseDashboardServiceTest extends AbstractServiceTest {
pageData = dashboardService.findMobileDashboardsByTenantId(tenantId, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertTrue(pageData.getData().isEmpty());
-
- tenantService.deleteTenant(tenantId);
}
@Test
@@ -342,12 +330,6 @@ public abstract class BaseDashboardServiceTest extends AbstractServiceTest {
@Test
public void testFindDashboardsByTenantIdAndCustomerId() throws ExecutionException, InterruptedException {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
-
Customer customer = new Customer();
customer.setTitle("Test customer");
customer.setTenantId(tenantId);
@@ -385,29 +367,29 @@ public abstract class BaseDashboardServiceTest extends AbstractServiceTest {
pageData = dashboardService.findDashboardsByTenantIdAndCustomerId(tenantId, customerId, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertTrue(pageData.getData().isEmpty());
-
- tenantService.deleteTenant(tenantId);
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testAssignDashboardToNonExistentEdge() {
Dashboard dashboard = new Dashboard();
dashboard.setTitle("My dashboard");
dashboard.setTenantId(tenantId);
- dashboard = dashboardService.saveDashboard(dashboard);
+ Dashboard savedDashboard = dashboardService.saveDashboard(dashboard);
try {
- dashboardService.assignDashboardToEdge(tenantId, dashboard.getId(), new EdgeId(Uuids.timeBased()));
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ dashboardService.assignDashboardToEdge(tenantId, savedDashboard.getId(), new EdgeId(Uuids.timeBased()));
+ });
} finally {
- dashboardService.deleteDashboard(tenantId, dashboard.getId());
+ dashboardService.deleteDashboard(tenantId, savedDashboard.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testAssignDashboardToEdgeFromDifferentTenant() {
Dashboard dashboard = new Dashboard();
dashboard.setTitle("My dashboard");
dashboard.setTenantId(tenantId);
- dashboard = dashboardService.saveDashboard(dashboard);
+ Dashboard savedDashboard = dashboardService.saveDashboard(dashboard);
Tenant tenant = new Tenant();
tenant.setTitle("Test different tenant [edge]");
tenant = tenantService.saveTenant(tenant);
@@ -418,11 +400,13 @@ public abstract class BaseDashboardServiceTest extends AbstractServiceTest {
edge.setType("default");
edge.setSecret(StringUtils.randomAlphanumeric(20));
edge.setRoutingKey(StringUtils.randomAlphanumeric(20));
- edge = edgeService.saveEdge(edge);
+ Edge savedEdge = edgeService.saveEdge(edge);
try {
- dashboardService.assignDashboardToEdge(tenantId, dashboard.getId(), edge.getId());
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ dashboardService.assignDashboardToEdge(tenantId, savedDashboard.getId(), savedEdge.getId());
+ });
} finally {
- dashboardService.deleteDashboard(tenantId, dashboard.getId());
+ dashboardService.deleteDashboard(tenantId, savedDashboard.getId());
tenantService.deleteTenant(tenant.getId());
}
}
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseDeviceCredentialsServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseDeviceCredentialsServiceTest.java
index a1d4543c58..4512a5fa4f 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseDeviceCredentialsServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseDeviceCredentialsServiceTest.java
@@ -16,44 +16,35 @@
package org.thingsboard.server.dao.service;
import com.datastax.oss.driver.api.core.uuid.Uuids;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.Device;
-import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.id.DeviceCredentialsId;
import org.thingsboard.server.common.data.id.DeviceId;
-import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.security.DeviceCredentials;
import org.thingsboard.server.common.data.security.DeviceCredentialsType;
+import org.thingsboard.server.dao.device.DeviceCredentialsService;
+import org.thingsboard.server.dao.device.DeviceService;
import org.thingsboard.server.dao.exception.DataValidationException;
public abstract class BaseDeviceCredentialsServiceTest extends AbstractServiceTest {
- private TenantId tenantId;
+ @Autowired
+ DeviceCredentialsService deviceCredentialsService;
+ @Autowired
+ DeviceService deviceService;
- @Before
- public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
- }
-
- @After
- public void after() {
- tenantService.deleteTenant(tenantId);
- }
-
- @Test(expected = DataValidationException.class)
+ @Test
public void testCreateDeviceCredentials() {
DeviceCredentials deviceCredentials = new DeviceCredentials();
- deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDeviceCredentialsWithEmptyDevice() {
Device device = new Device();
device.setName("My device");
@@ -63,13 +54,15 @@ public abstract class BaseDeviceCredentialsServiceTest extends AbstractServiceTe
DeviceCredentials deviceCredentials = deviceCredentialsService.findDeviceCredentialsByDeviceId(tenantId, device.getId());
deviceCredentials.setDeviceId(null);
try {
- deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
+ });
} finally {
deviceService.deleteDevice(tenantId, device.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDeviceCredentialsWithEmptyCredentialsType() {
Device device = new Device();
device.setName("My device");
@@ -79,13 +72,15 @@ public abstract class BaseDeviceCredentialsServiceTest extends AbstractServiceTe
DeviceCredentials deviceCredentials = deviceCredentialsService.findDeviceCredentialsByDeviceId(tenantId, device.getId());
deviceCredentials.setCredentialsType(null);
try {
- deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
+ });
} finally {
deviceService.deleteDevice(tenantId, device.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDeviceCredentialsWithEmptyCredentialsId() {
Device device = new Device();
device.setName("My device");
@@ -95,13 +90,15 @@ public abstract class BaseDeviceCredentialsServiceTest extends AbstractServiceTe
DeviceCredentials deviceCredentials = deviceCredentialsService.findDeviceCredentialsByDeviceId(tenantId, device.getId());
deviceCredentials.setCredentialsId(null);
try {
- deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
+ });
} finally {
deviceService.deleteDevice(tenantId, device.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveNonExistentDeviceCredentials() {
Device device = new Device();
device.setName("My device");
@@ -115,13 +112,15 @@ public abstract class BaseDeviceCredentialsServiceTest extends AbstractServiceTe
newDeviceCredentials.setCredentialsType(deviceCredentials.getCredentialsType());
newDeviceCredentials.setCredentialsId(deviceCredentials.getCredentialsId());
try {
- deviceCredentialsService.updateDeviceCredentials(tenantId, newDeviceCredentials);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceCredentialsService.updateDeviceCredentials(tenantId, newDeviceCredentials);
+ });
} finally {
deviceService.deleteDevice(tenantId, device.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDeviceCredentialsWithNonExistentDevice() {
Device device = new Device();
device.setName("My device");
@@ -131,7 +130,9 @@ public abstract class BaseDeviceCredentialsServiceTest extends AbstractServiceTe
DeviceCredentials deviceCredentials = deviceCredentialsService.findDeviceCredentialsByDeviceId(tenantId, device.getId());
deviceCredentials.setDeviceId(new DeviceId(Uuids.timeBased()));
try {
- deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
+ });
} finally {
deviceService.deleteDevice(tenantId, device.getId());
}
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseDeviceProfileServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseDeviceProfileServiceTest.java
index 744de8f027..fa43d98374 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseDeviceProfileServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseDeviceProfileServiceTest.java
@@ -19,23 +19,24 @@ import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.common.util.ThingsBoardThreadFactory;
import org.thingsboard.server.common.data.Device;
import org.thingsboard.server.common.data.DeviceProfile;
import org.thingsboard.server.common.data.DeviceProfileInfo;
import org.thingsboard.server.common.data.DeviceTransportType;
import org.thingsboard.server.common.data.OtaPackage;
-import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.ota.ChecksumAlgorithm;
-import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
+import org.thingsboard.server.dao.device.DeviceProfileService;
+import org.thingsboard.server.dao.device.DeviceService;
import org.thingsboard.server.dao.exception.DataValidationException;
+import org.thingsboard.server.dao.ota.OtaPackageService;
import java.nio.ByteBuffer;
import java.util.ArrayList;
@@ -43,7 +44,6 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
@@ -51,25 +51,16 @@ import static org.thingsboard.server.common.data.ota.OtaPackageType.FIRMWARE;
public abstract class BaseDeviceProfileServiceTest extends AbstractServiceTest {
+ @Autowired
+ DeviceProfileService deviceProfileService;
+ @Autowired
+ DeviceService deviceService;
+ @Autowired
+ OtaPackageService otaPackageService;
+
private IdComparator idComparator = new IdComparator<>();
private IdComparator deviceProfileInfoIdComparator = new IdComparator<>();
- private TenantId tenantId;
-
- @Before
- public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
- }
-
- @After
- public void after() {
- tenantService.deleteTenant(tenantId);
- }
-
@Test
public void testSaveDeviceProfile() {
DeviceProfile deviceProfile = this.createDeviceProfile(tenantId, "Device Profile");
@@ -196,23 +187,27 @@ public abstract class BaseDeviceProfileServiceTest extends AbstractServiceTest {
Assert.assertEquals(savedDeviceProfile2.getId(), defaultDeviceProfile.getId());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDeviceProfileWithEmptyName() {
DeviceProfile deviceProfile = new DeviceProfile();
deviceProfile.setTenantId(tenantId);
- deviceProfileService.saveDeviceProfile(deviceProfile);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceProfileService.saveDeviceProfile(deviceProfile);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDeviceProfileWithSameName() {
DeviceProfile deviceProfile = this.createDeviceProfile(tenantId, "Device Profile");
deviceProfileService.saveDeviceProfile(deviceProfile);
DeviceProfile deviceProfile2 = this.createDeviceProfile(tenantId, "Device Profile");
- deviceProfileService.saveDeviceProfile(deviceProfile2);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceProfileService.saveDeviceProfile(deviceProfile2);
+ });
}
@Ignore
- @Test(expected = DataValidationException.class)
+ @Test
public void testChangeDeviceProfileTypeWithExistingDevices() {
DeviceProfile deviceProfile = this.createDeviceProfile(tenantId, "Device Profile");
DeviceProfile savedDeviceProfile = deviceProfileService.saveDeviceProfile(deviceProfile);
@@ -224,10 +219,12 @@ public abstract class BaseDeviceProfileServiceTest extends AbstractServiceTest {
deviceService.saveDevice(device);
//TODO: once we have more profile types, we should test that we can not change profile type in runtime and uncomment the @Ignore.
// savedDeviceProfile.setType(DeviceProfileType.LWM2M);
- deviceProfileService.saveDeviceProfile(savedDeviceProfile);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceProfileService.saveDeviceProfile(savedDeviceProfile);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testChangeDeviceProfileTransportTypeWithExistingDevices() {
DeviceProfile deviceProfile = this.createDeviceProfile(tenantId, "Device Profile");
DeviceProfile savedDeviceProfile = deviceProfileService.saveDeviceProfile(deviceProfile);
@@ -238,10 +235,12 @@ public abstract class BaseDeviceProfileServiceTest extends AbstractServiceTest {
device.setDeviceProfileId(savedDeviceProfile.getId());
deviceService.saveDevice(device);
savedDeviceProfile.setTransportType(DeviceTransportType.MQTT);
- deviceProfileService.saveDeviceProfile(savedDeviceProfile);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceProfileService.saveDeviceProfile(savedDeviceProfile);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testDeleteDeviceProfileWithExistingDevice() {
DeviceProfile deviceProfile = this.createDeviceProfile(tenantId, "Device Profile");
DeviceProfile savedDeviceProfile = deviceProfileService.saveDeviceProfile(deviceProfile);
@@ -251,7 +250,9 @@ public abstract class BaseDeviceProfileServiceTest extends AbstractServiceTest {
device.setType("default");
device.setDeviceProfileId(savedDeviceProfile.getId());
deviceService.saveDevice(device);
- deviceProfileService.deleteDeviceProfile(tenantId, savedDeviceProfile.getId());
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceProfileService.deleteDeviceProfile(tenantId, savedDeviceProfile.getId());
+ });
}
@Test
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseDeviceServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseDeviceServiceTest.java
index ea2fa9546f..73b71ceae3 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseDeviceServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseDeviceServiceTest.java
@@ -19,9 +19,9 @@ import com.datastax.oss.driver.api.core.uuid.Uuids;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.Device;
import org.thingsboard.server.common.data.DeviceInfo;
@@ -39,26 +39,43 @@ import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.security.DeviceCredentials;
import org.thingsboard.server.common.data.security.DeviceCredentialsType;
import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration;
+import org.thingsboard.server.dao.customer.CustomerService;
+import org.thingsboard.server.dao.device.DeviceCredentialsService;
+import org.thingsboard.server.dao.device.DeviceProfileService;
+import org.thingsboard.server.dao.device.DeviceService;
import org.thingsboard.server.dao.exception.DataValidationException;
+import org.thingsboard.server.dao.ota.OtaPackageService;
+import org.thingsboard.server.dao.tenant.TenantProfileService;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.thingsboard.server.common.data.ota.OtaPackageType.FIRMWARE;
import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID;
public abstract class BaseDeviceServiceTest extends AbstractServiceTest {
- private IdComparator idComparator = new IdComparator<>();
+ @Autowired
+ CustomerService customerService;
+ @Autowired
+ DeviceCredentialsService deviceCredentialsService;
+ @Autowired
+ DeviceProfileService deviceProfileService;
+ @Autowired
+ DeviceService deviceService;
+ @Autowired
+ OtaPackageService otaPackageService;
+ @Autowired
+ TenantProfileService tenantProfileService;
- private TenantId tenantId;
+ private IdComparator idComparator = new IdComparator<>();
private TenantId anotherTenantId;
@Before
public void before() {
- tenantId = createTenant();
anotherTenantId = createTenant();
}
@@ -71,10 +88,6 @@ public abstract class BaseDeviceServiceTest extends AbstractServiceTest {
tenantProfileService.deleteTenantProfiles(anotherTenantId);
}
- @SuppressWarnings("deprecation")
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Test
public void testSaveDevicesWithoutMaxDeviceLimit() {
Device device = this.saveDevice(tenantId, "My device");
@@ -91,7 +104,7 @@ public abstract class BaseDeviceServiceTest extends AbstractServiceTest {
deleteDevice(tenantId, device);
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDevicesWithMaxDeviceOutOfLimit() {
TenantProfile defaultTenantProfile = tenantProfileService.findDefaultTenantProfile(tenantId);
defaultTenantProfile.getProfileData().setConfiguration(DefaultTenantProfileConfiguration.builder().maxDevices(1).build());
@@ -102,7 +115,9 @@ public abstract class BaseDeviceServiceTest extends AbstractServiceTest {
this.saveDevice(tenantId, "My first device");
Assert.assertEquals(1, deviceService.countByTenantId(tenantId));
- this.saveDevice(tenantId, "My second device that out of maxDeviceCount limit");
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ this.saveDevice(tenantId, "My second device that out of maxDeviceCount limit");
+ });
}
@Test
@@ -241,68 +256,78 @@ public abstract class BaseDeviceServiceTest extends AbstractServiceTest {
savedDevice.setFirmwareId(savedFirmware.getId());
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("Can't assign firmware with different deviceProfile!");
- deviceService.saveDevice(savedDevice);
+ assertThatThrownBy(() -> deviceService.saveDevice(savedDevice))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("Can't assign firmware with different deviceProfile!");
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDeviceWithEmptyName() {
Device device = new Device();
device.setType("default");
device.setTenantId(tenantId);
- deviceService.saveDevice(device);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceService.saveDevice(device);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDeviceWithEmptyTenant() {
Device device = new Device();
device.setName("My device");
device.setType("default");
- deviceService.saveDevice(device);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceService.saveDevice(device);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDeviceWithInvalidTenant() {
Device device = new Device();
device.setName("My device");
device.setType("default");
device.setTenantId(TenantId.fromUUID(Uuids.timeBased()));
- deviceService.saveDevice(device);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceService.saveDevice(device);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testAssignDeviceToNonExistentCustomer() {
Device device = new Device();
device.setName("My device");
device.setType("default");
device.setTenantId(tenantId);
- device = deviceService.saveDevice(device);
+ Device savedDevice = deviceService.saveDevice(device);
try {
- deviceService.assignDeviceToCustomer(tenantId, device.getId(), new CustomerId(Uuids.timeBased()));
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceService.assignDeviceToCustomer(tenantId, savedDevice.getId(), new CustomerId(Uuids.timeBased()));
+ });
} finally {
- deviceService.deleteDevice(tenantId, device.getId());
+ deviceService.deleteDevice(tenantId, savedDevice.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testAssignDeviceToCustomerFromDifferentTenant() {
Device device = new Device();
device.setName("My device");
device.setType("default");
device.setTenantId(tenantId);
- device = deviceService.saveDevice(device);
+ Device savedDevice = deviceService.saveDevice(device);
Tenant tenant = new Tenant();
tenant.setTitle("Test different tenant");
tenant = tenantService.saveTenant(tenant);
Customer customer = new Customer();
customer.setTenantId(tenant.getId());
customer.setTitle("Test different customer");
- customer = customerService.saveCustomer(customer);
+ Customer savedCustomer = customerService.saveCustomer(customer);
try {
- deviceService.assignDeviceToCustomer(tenantId, device.getId(), customer.getId());
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ deviceService.assignDeviceToCustomer(tenantId, savedDevice.getId(), savedCustomer.getId());
+ });
} finally {
- deviceService.deleteDevice(tenantId, device.getId());
+ deviceService.deleteDevice(tenantId, savedDevice.getId());
tenantService.deleteTenant(tenant.getId());
}
}
@@ -376,12 +401,6 @@ public abstract class BaseDeviceServiceTest extends AbstractServiceTest {
@Test
public void testFindDevicesByTenantId() {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
-
List devices = new ArrayList<>();
for (int i = 0; i < 178; i++) {
Device device = new Device();
@@ -413,8 +432,6 @@ public abstract class BaseDeviceServiceTest extends AbstractServiceTest {
pageData = deviceService.findDevicesByTenantId(tenantId, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertTrue(pageData.getData().isEmpty());
-
- tenantService.deleteTenant(tenantId);
}
@Test
@@ -575,12 +592,6 @@ public abstract class BaseDeviceServiceTest extends AbstractServiceTest {
@Test
public void testFindDevicesByTenantIdAndCustomerId() {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
-
Customer customer = new Customer();
customer.setTitle("Test customer");
customer.setTenantId(tenantId);
@@ -619,8 +630,6 @@ public abstract class BaseDeviceServiceTest extends AbstractServiceTest {
pageData = deviceService.findDeviceInfosByTenantIdAndCustomerId(tenantId, customerId, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertTrue(pageData.getData().isEmpty());
-
- tenantService.deleteTenant(tenantId);
}
@Test
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseEdgeEventServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseEdgeEventServiceTest.java
index 3bd47cc991..3b942dab5f 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseEdgeEventServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseEdgeEventServiceTest.java
@@ -21,6 +21,7 @@ import com.google.common.util.concurrent.ListenableFuture;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.edge.EdgeEvent;
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
import org.thingsboard.server.common.data.edge.EdgeEventType;
@@ -32,20 +33,20 @@ import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.SortOrder;
import org.thingsboard.server.common.data.page.TimePageLink;
+import org.thingsboard.server.dao.edge.EdgeEventService;
import java.io.IOException;
import java.text.ParseException;
-import java.time.LocalDateTime;
-import java.time.Month;
-import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.TimeUnit;
import static org.apache.commons.lang3.time.DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT;
public abstract class BaseEdgeEventServiceTest extends AbstractServiceTest {
+ @Autowired
+ EdgeEventService edgeEventService;
+
long timeBeforeStartTime;
long startTime;
long eventTime;
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseEdgeServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseEdgeServiceTest.java
index 5aced56afd..9b307b2f8c 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseEdgeServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseEdgeServiceTest.java
@@ -17,10 +17,10 @@ package org.thingsboard.server.dao.service;
import com.datastax.oss.driver.api.core.uuid.Uuids;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.EntitySubtype;
@@ -35,7 +35,10 @@ import org.thingsboard.server.common.data.rule.RuleChain;
import org.thingsboard.server.common.data.rule.RuleChainMetaData;
import org.thingsboard.server.common.data.rule.RuleChainType;
import org.thingsboard.server.common.data.rule.RuleNode;
+import org.thingsboard.server.dao.customer.CustomerService;
+import org.thingsboard.server.dao.edge.EdgeService;
import org.thingsboard.server.dao.exception.DataValidationException;
+import org.thingsboard.server.dao.rule.RuleChainService;
import java.util.ArrayList;
import java.util.Arrays;
@@ -46,23 +49,14 @@ import static org.thingsboard.server.dao.model.ModelConstants.NULL_UUID;
public abstract class BaseEdgeServiceTest extends AbstractServiceTest {
- private IdComparator idComparator = new IdComparator<>();
-
- private TenantId tenantId;
-
- @Before
- public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
- }
+ @Autowired
+ CustomerService customerService;
+ @Autowired
+ EdgeService edgeService;
+ @Autowired
+ RuleChainService ruleChainService;
- @After
- public void after() {
- tenantService.deleteTenant(tenantId);
- }
+ private IdComparator idComparator = new IdComparator<>();
@Test
public void testSaveEdge() {
@@ -86,57 +80,67 @@ public abstract class BaseEdgeServiceTest extends AbstractServiceTest {
edgeService.deleteEdge(tenantId, savedEdge.getId());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveEdgeWithEmptyName() {
Edge edge = new Edge();
edge.setType("default");
edge.setTenantId(tenantId);
- edgeService.saveEdge(edge);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ edgeService.saveEdge(edge);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveEdgeWithEmptyTenant() {
Edge edge = new Edge();
edge.setName("My edge");
edge.setType("default");
- edgeService.saveEdge(edge);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ edgeService.saveEdge(edge);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveEdgeWithInvalidTenant() {
Edge edge = new Edge();
edge.setName("My edge");
edge.setType("default");
edge.setTenantId(TenantId.fromUUID(Uuids.timeBased()));
- edgeService.saveEdge(edge);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ edgeService.saveEdge(edge);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testAssignEdgeToNonExistentCustomer() {
Edge edge = constructEdge("My edge", "default");
- edge = edgeService.saveEdge(edge);
+ Edge savedEdge = edgeService.saveEdge(edge);
try {
- edgeService.assignEdgeToCustomer(tenantId, edge.getId(), new CustomerId(Uuids.timeBased()));
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ edgeService.assignEdgeToCustomer(tenantId, savedEdge.getId(), new CustomerId(Uuids.timeBased()));
+ });
} finally {
- edgeService.deleteEdge(tenantId, edge.getId());
+ edgeService.deleteEdge(tenantId, savedEdge.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testAssignEdgeToCustomerFromDifferentTenant() {
Edge edge = constructEdge("My edge", "default");
- edge = edgeService.saveEdge(edge);
+ Edge savedEdge = edgeService.saveEdge(edge);
Tenant tenant = new Tenant();
tenant.setTitle("Test different tenant");
tenant = tenantService.saveTenant(tenant);
Customer customer = new Customer();
customer.setTenantId(tenant.getId());
customer.setTitle("Test different customer");
- customer = customerService.saveCustomer(customer);
+ Customer savedCustomer = customerService.saveCustomer(customer);
try {
- edgeService.assignEdgeToCustomer(tenantId, edge.getId(), customer.getId());
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ edgeService.assignEdgeToCustomer(tenantId, savedEdge.getId(), savedCustomer.getId());
+ });
} finally {
- edgeService.deleteEdge(tenantId, edge.getId());
+ edgeService.deleteEdge(tenantId, savedEdge.getId());
tenantService.deleteTenant(tenant.getId());
}
}
@@ -193,12 +197,6 @@ public abstract class BaseEdgeServiceTest extends AbstractServiceTest {
@Test
public void testFindEdgesByTenantId() {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
-
List edges = new ArrayList<>();
for (int i = 0; i < 178; i++) {
Edge edge = constructEdge(tenantId, "Edge " + i, "default");
@@ -227,8 +225,6 @@ public abstract class BaseEdgeServiceTest extends AbstractServiceTest {
pageData = edgeService.findEdgesByTenantId(tenantId, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertTrue(pageData.getData().isEmpty());
-
- tenantService.deleteTenant(tenantId);
}
@Test
@@ -377,12 +373,6 @@ public abstract class BaseEdgeServiceTest extends AbstractServiceTest {
@Test
public void testFindEdgesByTenantIdAndCustomerId() {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
-
Customer customer = new Customer();
customer.setTitle("Test customer");
customer.setTenantId(tenantId);
@@ -418,8 +408,6 @@ public abstract class BaseEdgeServiceTest extends AbstractServiceTest {
pageData = edgeService.findEdgesByTenantIdAndCustomerId(tenantId, customerId, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertTrue(pageData.getData().isEmpty());
-
- tenantService.deleteTenant(tenantId);
}
@Test
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceRegistryTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceRegistryTest.java
index 81a512dc95..87b6bbdd80 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceRegistryTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceRegistryTest.java
@@ -28,7 +28,7 @@ import org.thingsboard.server.dao.rule.RuleChainService;
public abstract class BaseEntityServiceRegistryTest extends AbstractServiceTest {
@Autowired
- private EntityServiceRegistry entityServiceRegistry;
+ EntityServiceRegistry entityServiceRegistry;
@Test
public void givenAllEntityTypes_whenGetServiceByEntityTypeCalled_thenAllBeansExists() {
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceTest.java
index 7c80bef095..1af63c0ed7 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceTest.java
@@ -21,9 +21,7 @@ import com.google.common.util.concurrent.ListenableFuture;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomUtils;
import org.hamcrest.Matchers;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.ResultSetExtractor;
@@ -31,7 +29,6 @@ import org.thingsboard.server.common.data.DataConstants;
import org.thingsboard.server.common.data.Device;
import org.thingsboard.server.common.data.EntityType;
import org.thingsboard.server.common.data.StringUtils;
-import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.asset.Asset;
import org.thingsboard.server.common.data.edge.Edge;
import org.thingsboard.server.common.data.id.CustomerId;
@@ -73,8 +70,13 @@ import org.thingsboard.server.common.data.relation.EntityRelation;
import org.thingsboard.server.common.data.relation.EntitySearchDirection;
import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter;
import org.thingsboard.server.common.data.relation.RelationTypeGroup;
+import org.thingsboard.server.dao.asset.AssetService;
import org.thingsboard.server.dao.attributes.AttributesService;
+import org.thingsboard.server.dao.device.DeviceService;
+import org.thingsboard.server.dao.edge.EdgeService;
+import org.thingsboard.server.dao.entity.EntityService;
import org.thingsboard.server.dao.model.sqlts.ts.TsKvEntity;
+import org.thingsboard.server.dao.relation.RelationService;
import org.thingsboard.server.dao.sql.relation.RelationRepository;
import org.thingsboard.server.dao.timeseries.TimeseriesService;
@@ -100,30 +102,21 @@ public abstract class BaseEntityServiceTest extends AbstractServiceTest {
static final int ENTITY_COUNT = 5;
@Autowired
- private AttributesService attributesService;
-
+ AssetService assetService;
@Autowired
- private TimeseriesService timeseriesService;
-
- private TenantId tenantId;
-
+ AttributesService attributesService;
@Autowired
- private RelationRepository relationRepository;
-
- @Before
- public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
- }
-
- @After
- public void after() {
- tenantService.deleteTenant(tenantId);
- }
-
+ DeviceService deviceService;
+ @Autowired
+ EdgeService edgeService;
+ @Autowired
+ EntityService entityService;
+ @Autowired
+ RelationRepository relationRepository;
+ @Autowired
+ RelationService relationService;
+ @Autowired
+ TimeseriesService timeseriesService;
@Test
public void testCountEntitiesByQuery() throws InterruptedException {
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseOAuth2ConfigTemplateServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseOAuth2ConfigTemplateServiceTest.java
index 3ab182519c..510ca0f2db 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseOAuth2ConfigTemplateServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseOAuth2ConfigTemplateServiceTest.java
@@ -19,6 +19,7 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.oauth2.MapperType;
@@ -51,12 +52,14 @@ public abstract class BaseOAuth2ConfigTemplateServiceTest extends AbstractServic
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveDuplicateProviderId() {
OAuth2ClientRegistrationTemplate first = validClientRegistrationTemplate("providerId");
OAuth2ClientRegistrationTemplate second = validClientRegistrationTemplate("providerId");
oAuth2ConfigTemplateService.saveClientRegistrationTemplate(first);
- oAuth2ConfigTemplateService.saveClientRegistrationTemplate(second);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ oAuth2ConfigTemplateService.saveClientRegistrationTemplate(second);
+ });
}
@Test
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseOAuth2ServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseOAuth2ServiceTest.java
index 42ea18bdec..73dd08d53c 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseOAuth2ServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseOAuth2ServiceTest.java
@@ -20,6 +20,7 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.StringUtils;
import org.thingsboard.server.common.data.oauth2.MapperType;
@@ -61,7 +62,7 @@ public abstract class BaseOAuth2ServiceTest extends AbstractServiceTest {
Assert.assertTrue(oAuth2Service.findOAuth2Info().getOauth2ParamsInfos().isEmpty());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveHttpAndMixedDomainsTogether() {
OAuth2Info oAuth2Info = new OAuth2Info(true, Lists.newArrayList(
OAuth2ParamsInfo.builder()
@@ -77,10 +78,12 @@ public abstract class BaseOAuth2ServiceTest extends AbstractServiceTest {
))
.build()
));
- oAuth2Service.saveOAuth2Info(oAuth2Info);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ oAuth2Service.saveOAuth2Info(oAuth2Info);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveHttpsAndMixedDomainsTogether() {
OAuth2Info oAuth2Info = new OAuth2Info(true, Lists.newArrayList(
OAuth2ParamsInfo.builder()
@@ -96,7 +99,9 @@ public abstract class BaseOAuth2ServiceTest extends AbstractServiceTest {
))
.build()
));
- oAuth2Service.saveOAuth2Info(oAuth2Info);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ oAuth2Service.saveOAuth2Info(oAuth2Info);
+ });
}
@Test
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseOtaPackageServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseOtaPackageServiceTest.java
index c89e7c4b69..d430e1945a 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseOtaPackageServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseOtaPackageServiceTest.java
@@ -19,16 +19,14 @@ import com.datastax.oss.driver.api.core.uuid.Uuids;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.common.data.Device;
import org.thingsboard.server.common.data.DeviceProfile;
import org.thingsboard.server.common.data.OtaPackage;
import org.thingsboard.server.common.data.OtaPackageInfo;
import org.thingsboard.server.common.data.StringUtils;
-import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.TenantProfile;
import org.thingsboard.server.common.data.id.DeviceProfileId;
import org.thingsboard.server.common.data.id.TenantId;
@@ -36,7 +34,11 @@ import org.thingsboard.server.common.data.ota.ChecksumAlgorithm;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration;
+import org.thingsboard.server.dao.device.DeviceProfileService;
+import org.thingsboard.server.dao.device.DeviceService;
import org.thingsboard.server.dao.exception.DataValidationException;
+import org.thingsboard.server.dao.ota.OtaPackageService;
+import org.thingsboard.server.dao.tenant.TenantProfileService;
import java.nio.ByteBuffer;
import java.util.ArrayList;
@@ -44,6 +46,7 @@ import java.util.Collections;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.thingsboard.server.common.data.ota.OtaPackageType.FIRMWARE;
public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
@@ -60,28 +63,25 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
private final IdComparator idComparator = new IdComparator<>();
- private TenantId tenantId;
-
private DeviceProfileId deviceProfileId;
+ @Autowired
+ DeviceProfileService deviceProfileService;
+ @Autowired
+ DeviceService deviceService;
+ @Autowired
+ OtaPackageService otaPackageService;
+ @Autowired
+ TenantProfileService tenantProfileService;
+
@Before
public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
-
DeviceProfile deviceProfile = this.createDeviceProfile(tenantId, "Device Profile");
DeviceProfile savedDeviceProfile = deviceProfileService.saveDeviceProfile(deviceProfile);
Assert.assertNotNull(savedDeviceProfile);
deviceProfileId = savedDeviceProfile.getId();
}
- @SuppressWarnings("deprecation")
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@After
public void after() {
tenantService.deleteTenant(tenantId);
@@ -99,9 +99,9 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
createAndSaveFirmware(tenantId, "1");
Assert.assertEquals(1, otaPackageService.sumDataSizeByTenantId(tenantId));
- thrown.expect(DataValidationException.class);
- thrown.expectMessage(String.format("Failed to create the ota package, files size limit is exhausted %d bytes!", DATA_SIZE));
- createAndSaveFirmware(tenantId, "2");
+ assertThatThrownBy(() -> createAndSaveFirmware(tenantId, "2"))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("Failed to create the ota package, files size limit is exhausted %d bytes!", DATA_SIZE);
}
@Test
@@ -243,9 +243,9 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
firmware.setChecksum(CHECKSUM);
firmware.setData(DATA);
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("OtaPackage should be assigned to tenant!");
- otaPackageService.saveOtaPackage(firmware);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackage(firmware))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("OtaPackage should be assigned to tenant!");
}
@Test
@@ -261,9 +261,9 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
firmware.setChecksum(CHECKSUM);
firmware.setData(DATA);
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("Type should be specified!");
- otaPackageService.saveOtaPackage(firmware);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackage(firmware))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("Type should be specified!");
}
@Test
@@ -279,9 +279,9 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
firmware.setChecksum(CHECKSUM);
firmware.setData(DATA);
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("OtaPackage title should be specified!");
- otaPackageService.saveOtaPackage(firmware);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackage(firmware))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("OtaPackage title should be specified!");
}
@Test
@@ -297,9 +297,9 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
firmware.setChecksum(CHECKSUM);
firmware.setData(DATA);
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("OtaPackage file name should be specified!");
- otaPackageService.saveOtaPackage(firmware);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackage(firmware))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("OtaPackage file name should be specified!");
}
@Test
@@ -315,9 +315,9 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
firmware.setChecksum(CHECKSUM);
firmware.setData(DATA);
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("OtaPackage content type should be specified!");
- otaPackageService.saveOtaPackage(firmware);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackage(firmware))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("OtaPackage content type should be specified!");
}
@Test
@@ -333,9 +333,9 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
firmware.setChecksumAlgorithm(CHECKSUM_ALGORITHM);
firmware.setChecksum(CHECKSUM);
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("OtaPackage data should be specified!");
- otaPackageService.saveOtaPackage(firmware);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackage(firmware))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("OtaPackage data should be specified!");
}
@Test
@@ -352,9 +352,9 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
firmware.setChecksum(CHECKSUM);
firmware.setData(DATA);
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("OtaPackage is referencing to non-existent tenant!");
- otaPackageService.saveOtaPackage(firmware);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackage(firmware))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("OtaPackage is referencing to non-existent tenant!");
}
@Test
@@ -371,9 +371,9 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
firmware.setChecksum(CHECKSUM);
firmware.setData(DATA);
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("OtaPackage is referencing to non-existent device profile!");
- otaPackageService.saveOtaPackage(firmware);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackage(firmware))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("OtaPackage is referencing to non-existent device profile!");
}
@Test
@@ -389,9 +389,9 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
firmware.setChecksumAlgorithm(CHECKSUM_ALGORITHM);
firmware.setData(DATA);
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("OtaPackage checksum should be specified!");
- otaPackageService.saveOtaPackage(firmware);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackage(firmware))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("OtaPackage checksum should be specified!");
}
@Test
@@ -411,17 +411,17 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
newFirmwareInfo.setTitle(TITLE);
newFirmwareInfo.setVersion(VERSION);
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("OtaPackage with such title and version already exists!");
- otaPackageService.saveOtaPackageInfo(newFirmwareInfo, false);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackageInfo(newFirmwareInfo, false))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("OtaPackage with such title and version already exists!");
}
@Test
public void testSaveFirmwareWithExistingTitleAndVersion() {
createAndSaveFirmware(tenantId, VERSION);
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("OtaPackage with such title and version already exists!");
- createAndSaveFirmware(tenantId, VERSION);
+ assertThatThrownBy(() -> createAndSaveFirmware(tenantId, VERSION))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("OtaPackage with such title and version already exists!");
}
@Test
@@ -436,9 +436,9 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
Device savedDevice = deviceService.saveDevice(device);
try {
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("The otaPackage referenced by the devices cannot be deleted!");
- otaPackageService.deleteOtaPackage(tenantId, savedFirmware.getId());
+ assertThatThrownBy(() -> otaPackageService.deleteOtaPackage(tenantId, savedFirmware.getId()))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("The otaPackage referenced by the devices cannot be deleted!");
} finally {
deviceService.deleteDevice(tenantId, savedDevice.getId());
otaPackageService.deleteOtaPackage(tenantId, savedFirmware.getId());
@@ -448,12 +448,12 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
@Test
public void testUpdateDeviceProfileId() {
OtaPackage savedFirmware = createAndSaveFirmware(tenantId, VERSION);
+ savedFirmware.setDeviceProfileId(null);
try {
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("Updating otaPackage deviceProfile is prohibited!");
- savedFirmware.setDeviceProfileId(null);
- otaPackageService.saveOtaPackage(savedFirmware);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackage(savedFirmware))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("Updating otaPackage deviceProfile is prohibited!");
} finally {
otaPackageService.deleteOtaPackage(tenantId, savedFirmware.getId());
}
@@ -482,9 +482,9 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
deviceProfileService.saveDeviceProfile(savedDeviceProfile);
try {
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("The otaPackage referenced by the device profile cannot be deleted!");
- otaPackageService.deleteOtaPackage(tenantId, savedFirmware.getId());
+ assertThatThrownBy(() -> otaPackageService.deleteOtaPackage(tenantId, savedFirmware.getId()))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("The otaPackage referenced by the device profile cannot be deleted!");
} finally {
deviceProfileService.deleteDeviceProfile(tenantId, savedDeviceProfile.getId());
}
@@ -636,12 +636,18 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
firmwareInfo.setType(FIRMWARE);
firmwareInfo.setTitle(TITLE);
firmwareInfo.setVersion(VERSION);
+
firmwareInfo.setUrl(" ");
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("Ota package URL should be specified!");
- otaPackageService.saveOtaPackageInfo(firmwareInfo, true);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackageInfo(firmwareInfo, true))
+ .as("firmwareInfo url set whitespaces")
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("Ota package URL should be specified!");
+
firmwareInfo.setUrl("");
- otaPackageService.saveOtaPackageInfo(firmwareInfo, true);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackageInfo(firmwareInfo, true))
+ .as("firmwareInfo url is empty")
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("Ota package URL should be specified!");
}
@Test
@@ -655,12 +661,10 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
firmwareInfo.setTenantId(tenantId);
OtaPackageInfo savedFirmwareInfo = otaPackageService.saveOtaPackageInfo(firmwareInfo, true);
-
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("Updating otaPackage URL is prohibited!");
-
savedFirmwareInfo.setUrl("https://newurl.com");
- otaPackageService.saveOtaPackageInfo(savedFirmwareInfo, true);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackageInfo(savedFirmwareInfo, true))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("Updating otaPackage URL is prohibited!");
}
@Test
@@ -673,10 +677,9 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
firmwareInfo.setUrl(URL);
firmwareInfo.setTenantId(tenantId);
- thrown.expect(DataValidationException.class);
- thrown.expectMessage("title length must be equal or less than 255");
-
- otaPackageService.saveOtaPackageInfo(firmwareInfo, true);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackageInfo(firmwareInfo, true))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("title length must be equal or less than 255");
}
@Test
@@ -687,11 +690,11 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
firmwareInfo.setUrl(URL);
firmwareInfo.setTenantId(tenantId);
firmwareInfo.setTitle(TITLE);
-
firmwareInfo.setVersion(StringUtils.random(257));
- thrown.expectMessage("version length must be equal or less than 255");
- otaPackageService.saveOtaPackageInfo(firmwareInfo, true);
+ assertThatThrownBy(() -> otaPackageService.saveOtaPackageInfo(firmwareInfo, true))
+ .isInstanceOf(DataValidationException.class)
+ .hasMessageContaining("version length must be equal or less than 255");
}
private OtaPackage createAndSaveFirmware(TenantId tenantId, String version) {
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseQueueServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseQueueServiceTest.java
index d4242fb1c4..9d2c2bac5a 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseQueueServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseQueueServiceTest.java
@@ -19,6 +19,8 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.DataConstants;
import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.TenantProfile;
@@ -34,6 +36,8 @@ import org.thingsboard.server.common.data.queue.SubmitStrategyType;
import org.thingsboard.server.common.data.tenant.profile.TenantProfileData;
import org.thingsboard.server.common.data.tenant.profile.TenantProfileQueueConfiguration;
import org.thingsboard.server.dao.exception.DataValidationException;
+import org.thingsboard.server.dao.queue.QueueService;
+import org.thingsboard.server.dao.tenant.TenantProfileService;
import java.util.ArrayList;
import java.util.Collections;
@@ -41,6 +45,11 @@ import java.util.List;
public abstract class BaseQueueServiceTest extends AbstractServiceTest {
+ @Autowired
+ TenantProfileService tenantProfileService;
+ @Autowired
+ QueueService queueService;
+
private IdComparator idComparator = new IdComparator<>();
private TenantId tenantId;
@@ -82,7 +91,7 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
Tenant tenant = new Tenant();
tenant.setTitle("My tenant");
- tenant.setTenantProfileId(tenantProfileId);
+ tenant.setTenantProfileId(tenantProfileId); //custom profile
Tenant savedTenant = tenantService.saveTenant(tenant);
Assert.assertNotNull(savedTenant);
tenantId = savedTenant.getId();
@@ -139,7 +148,7 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queueService.deleteQueue(tenantId, foundQueue.getId());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithEmptyName() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -149,10 +158,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setPackProcessingTimeout(2000);
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.setProcessingStrategy(createTestProcessingStrategy());
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithInvalidName() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -163,10 +174,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setPackProcessingTimeout(2000);
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.setProcessingStrategy(createTestProcessingStrategy());
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithEmptyTopic() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -176,10 +189,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setPackProcessingTimeout(2000);
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.setProcessingStrategy(createTestProcessingStrategy());
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithInvalidTopic() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -190,10 +205,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setPackProcessingTimeout(2000);
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.setProcessingStrategy(createTestProcessingStrategy());
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithEmptyPollInterval() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -203,10 +220,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setPackProcessingTimeout(2000);
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.setProcessingStrategy(createTestProcessingStrategy());
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithEmptyPartitions() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -216,10 +235,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setPackProcessingTimeout(2000);
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.setProcessingStrategy(createTestProcessingStrategy());
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithEmptyPackProcessingTimeout() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -229,10 +250,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setPartitions(1);
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.setProcessingStrategy(createTestProcessingStrategy());
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithEmptySubmitStrategy() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -242,10 +265,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setPartitions(1);
queue.setPackProcessingTimeout(2000);
queue.setProcessingStrategy(createTestProcessingStrategy());
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithEmptyProcessingStrategy() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -255,10 +280,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setPartitions(1);
queue.setPackProcessingTimeout(2000);
queue.setSubmitStrategy(createTestSubmitStrategy());
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithEmptySubmitStrategyType() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -270,10 +297,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.getSubmitStrategy().setType(null);
queue.setProcessingStrategy(createTestProcessingStrategy());
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithEmptySubmitStrategyBatchSize() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -286,10 +315,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.getSubmitStrategy().setType(SubmitStrategyType.BATCH);
queue.getSubmitStrategy().setBatchSize(0);
queue.setProcessingStrategy(createTestProcessingStrategy());
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithEmptyProcessingStrategyType() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -301,10 +332,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.setProcessingStrategy(createTestProcessingStrategy());
queue.getProcessingStrategy().setType(null);
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithNegativeProcessingStrategyRetries() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -316,10 +349,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.setProcessingStrategy(createTestProcessingStrategy());
queue.getProcessingStrategy().setRetries(-1);
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithNegativeProcessingStrategyFailurePercentage() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -331,10 +366,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.setProcessingStrategy(createTestProcessingStrategy());
queue.getProcessingStrategy().setFailurePercentage(-1);
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithNegativeProcessingStrategyPauseBetweenRetries() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -346,10 +383,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.setProcessingStrategy(createTestProcessingStrategy());
queue.getProcessingStrategy().setPauseBetweenRetries(-1);
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithProcessingStrategyPauseBetweenRetriesBiggerThenMaxPauseBetweenRetries() {
Queue queue = new Queue();
queue.setTenantId(tenantId);
@@ -361,10 +400,12 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.setProcessingStrategy(createTestProcessingStrategy());
queue.getProcessingStrategy().setPauseBetweenRetries(100);
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveQueueWithNotIsolatedTenant() {
Tenant tenant = new Tenant();
tenant.setTitle("Not isolated tenant");
@@ -381,7 +422,9 @@ public abstract class BaseQueueServiceTest extends AbstractServiceTest {
queue.setSubmitStrategy(createTestSubmitStrategy());
queue.setProcessingStrategy(createTestProcessingStrategy());
try {
- queueService.saveQueue(queue);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ queueService.saveQueue(queue);
+ });
} finally {
tenantService.deleteTenant(savedTenant.getId());
}
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseRelationServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseRelationServiceTest.java
index 82c50f2438..d60a896aec 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseRelationServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseRelationServiceTest.java
@@ -22,6 +22,8 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.EntityType;
import org.thingsboard.server.common.data.id.AssetId;
import org.thingsboard.server.common.data.id.DeviceId;
@@ -32,6 +34,7 @@ import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter;
import org.thingsboard.server.common.data.relation.RelationTypeGroup;
import org.thingsboard.server.common.data.relation.RelationsSearchParameters;
import org.thingsboard.server.dao.exception.DataValidationException;
+import org.thingsboard.server.dao.relation.RelationService;
import java.util.ArrayList;
import java.util.Collections;
@@ -41,6 +44,9 @@ import java.util.concurrent.ExecutionException;
public abstract class BaseRelationServiceTest extends AbstractServiceTest {
+ @Autowired
+ RelationService relationService;
+
@Before
public void before() {
}
@@ -334,28 +340,34 @@ public abstract class BaseRelationServiceTest extends AbstractServiceTest {
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveRelationWithEmptyFrom() throws ExecutionException, InterruptedException {
EntityRelation relation = new EntityRelation();
relation.setTo(new AssetId(Uuids.timeBased()));
relation.setType(EntityRelation.CONTAINS_TYPE);
- Assert.assertTrue(saveRelation(relation));
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ Assert.assertTrue(saveRelation(relation));
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveRelationWithEmptyTo() throws ExecutionException, InterruptedException {
EntityRelation relation = new EntityRelation();
relation.setFrom(new AssetId(Uuids.timeBased()));
relation.setType(EntityRelation.CONTAINS_TYPE);
- Assert.assertTrue(saveRelation(relation));
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ Assert.assertTrue(saveRelation(relation));
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveRelationWithEmptyType() throws ExecutionException, InterruptedException {
EntityRelation relation = new EntityRelation();
relation.setFrom(new AssetId(Uuids.timeBased()));
relation.setTo(new AssetId(Uuids.timeBased()));
- Assert.assertTrue(saveRelation(relation));
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ Assert.assertTrue(saveRelation(relation));
+ });
}
@Test
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseRuleChainServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseRuleChainServiceTest.java
index 18c6e110d5..e3c5234942 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseRuleChainServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseRuleChainServiceTest.java
@@ -17,10 +17,10 @@ package org.thingsboard.server.dao.service;
import com.datastax.oss.driver.api.core.uuid.Uuids;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.StringUtils;
import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.edge.Edge;
@@ -33,7 +33,9 @@ import org.thingsboard.server.common.data.rule.RuleChain;
import org.thingsboard.server.common.data.rule.RuleChainMetaData;
import org.thingsboard.server.common.data.rule.RuleChainType;
import org.thingsboard.server.common.data.rule.RuleNode;
+import org.thingsboard.server.dao.edge.EdgeService;
import org.thingsboard.server.dao.exception.DataValidationException;
+import org.thingsboard.server.dao.rule.RuleChainService;
import java.io.IOException;
import java.util.ArrayList;
@@ -45,25 +47,14 @@ import java.util.List;
*/
public abstract class BaseRuleChainServiceTest extends AbstractServiceTest {
+ @Autowired
+ EdgeService edgeService;
+ @Autowired
+ RuleChainService ruleChainService;
+
private IdComparator idComparator = new IdComparator<>();
private IdComparator ruleNodeIdComparator = new IdComparator<>();
- private TenantId tenantId;
-
- @Before
- public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
- }
-
- @After
- public void after() {
- tenantService.deleteTenant(tenantId);
- }
-
@Test
public void testSaveRuleChain() throws IOException {
RuleChain ruleChain = new RuleChain();
@@ -86,19 +77,23 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest {
ruleChainService.deleteRuleChainById(tenantId, savedRuleChain.getId());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveRuleChainWithEmptyName() {
RuleChain ruleChain = new RuleChain();
ruleChain.setTenantId(tenantId);
- ruleChainService.saveRuleChain(ruleChain);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ ruleChainService.saveRuleChain(ruleChain);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveRuleChainWithInvalidTenant() {
RuleChain ruleChain = new RuleChain();
ruleChain.setName("My RuleChain");
ruleChain.setTenantId(TenantId.fromUUID(Uuids.timeBased()));
- ruleChainService.saveRuleChain(ruleChain);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ ruleChainService.saveRuleChain(ruleChain);
+ });
}
@Test
@@ -128,12 +123,6 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest {
@Test
public void testFindRuleChainsByTenantId() {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
-
List ruleChains = new ArrayList<>();
for (int i = 0; i < 165; i++) {
RuleChain ruleChain = new RuleChain();
@@ -164,8 +153,6 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest {
pageData = ruleChainService.findTenantRuleChainsByType(tenantId, RuleChainType.CORE, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertTrue(pageData.getData().isEmpty());
-
- tenantService.deleteTenant(tenantId);
}
@Test
@@ -321,14 +308,18 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest {
ruleChainService.deleteRuleChainById(tenantId, savedRuleChainMetaData.getRuleChainId());
}
- @Test(expected = DataValidationException.class)
- public void testUpdateRuleChainMetaDataWithCirclingRelation() throws Exception {
- ruleChainService.saveRuleChainMetaData(tenantId, createRuleChainMetadataWithCirclingRelation());
+ @Test
+ public void testUpdateRuleChainMetaDataWithCirclingRelation() {
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ ruleChainService.saveRuleChainMetaData(tenantId, createRuleChainMetadataWithCirclingRelation());
+ });
}
- @Test(expected = DataValidationException.class)
- public void testUpdateRuleChainMetaDataWithCirclingRelation2() throws Exception {
- ruleChainService.saveRuleChainMetaData(tenantId, createRuleChainMetadataWithCirclingRelation2());
+ @Test
+ public void testUpdateRuleChainMetaDataWithCirclingRelation2() {
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ ruleChainService.saveRuleChainMetaData(tenantId, createRuleChainMetadataWithCirclingRelation2());
+ });
}
@Test
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseTenantProfileServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseTenantProfileServiceTest.java
index a21a8e5845..6d41da2965 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseTenantProfileServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseTenantProfileServiceTest.java
@@ -18,7 +18,10 @@ package org.thingsboard.server.dao.service;
import com.fasterxml.jackson.databind.node.NullNode;
import org.junit.After;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.DataConstants;
import org.thingsboard.server.common.data.EntityInfo;
import org.thingsboard.server.common.data.Tenant;
@@ -35,6 +38,7 @@ import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileCon
import org.thingsboard.server.common.data.tenant.profile.TenantProfileData;
import org.thingsboard.server.common.data.tenant.profile.TenantProfileQueueConfiguration;
import org.thingsboard.server.dao.exception.DataValidationException;
+import org.thingsboard.server.dao.tenant.TenantProfileService;
import java.util.ArrayList;
import java.util.Collections;
@@ -43,9 +47,20 @@ import java.util.stream.Collectors;
public abstract class BaseTenantProfileServiceTest extends AbstractServiceTest {
+ @Autowired
+ TenantProfileService tenantProfileService;
+
private IdComparator idComparator = new IdComparator<>();
private IdComparator tenantProfileInfoIdComparator = new IdComparator<>();
+ @Before
+ public void before() {
+ //this test requires no Tenants in the database
+ tenantId = null;
+ tenantService.deleteTenants();
+ tenantProfileService.deleteTenantProfiles(TenantId.SYS_TENANT_ID);
+ }
+
@After
public void after() {
tenantProfileService.deleteTenantProfiles(TenantId.SYS_TENANT_ID);
@@ -154,30 +169,36 @@ public abstract class BaseTenantProfileServiceTest extends AbstractServiceTest {
Assert.assertEquals(savedTenantProfile2.getId(), defaultTenantProfile.getId());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveTenantProfileWithEmptyName() {
TenantProfile tenantProfile = new TenantProfile();
- tenantProfileService.saveTenantProfile(TenantId.SYS_TENANT_ID, tenantProfile);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ tenantProfileService.saveTenantProfile(TenantId.SYS_TENANT_ID, tenantProfile);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveTenantProfileWithSameName() {
TenantProfile tenantProfile = this.createTenantProfile("Tenant Profile");
tenantProfileService.saveTenantProfile(TenantId.SYS_TENANT_ID, tenantProfile);
TenantProfile tenantProfile2 = this.createTenantProfile("Tenant Profile");
- tenantProfileService.saveTenantProfile(TenantId.SYS_TENANT_ID, tenantProfile2);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ tenantProfileService.saveTenantProfile(TenantId.SYS_TENANT_ID, tenantProfile2);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveSameTenantProfileWithDifferentIsolatedTbRuleEngine() {
TenantProfile tenantProfile = this.createTenantProfile("Tenant Profile");
TenantProfile savedTenantProfile = tenantProfileService.saveTenantProfile(TenantId.SYS_TENANT_ID, tenantProfile);
savedTenantProfile.setIsolatedTbRuleEngine(true);
addMainQueueConfig(savedTenantProfile);
- tenantProfileService.saveTenantProfile(TenantId.SYS_TENANT_ID, savedTenantProfile);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ tenantProfileService.saveTenantProfile(TenantId.SYS_TENANT_ID, savedTenantProfile);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testDeleteTenantProfileWithExistingTenant() {
TenantProfile tenantProfile = this.createTenantProfile("Tenant Profile");
TenantProfile savedTenantProfile = tenantProfileService.saveTenantProfile(TenantId.SYS_TENANT_ID, tenantProfile);
@@ -186,7 +207,9 @@ public abstract class BaseTenantProfileServiceTest extends AbstractServiceTest {
tenant.setTenantProfileId(savedTenantProfile.getId());
tenant = tenantService.saveTenant(tenant);
try {
- tenantProfileService.deleteTenantProfile(TenantId.SYS_TENANT_ID, savedTenantProfile.getId());
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ tenantProfileService.deleteTenantProfile(TenantId.SYS_TENANT_ID, savedTenantProfile.getId());
+ });
} finally {
tenantService.deleteTenant(tenant.getId());
}
@@ -294,7 +317,7 @@ public abstract class BaseTenantProfileServiceTest extends AbstractServiceTest {
return tenantProfile;
}
- private void addMainQueueConfig(TenantProfile tenantProfile) {
+ public static void addMainQueueConfig(TenantProfile tenantProfile) {
TenantProfileQueueConfiguration mainQueueConfiguration = new TenantProfileQueueConfiguration();
mainQueueConfiguration.setName(DataConstants.MAIN_QUEUE_NAME);
mainQueueConfiguration.setTopic(DataConstants.MAIN_QUEUE_TOPIC);
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseTenantServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseTenantServiceTest.java
index 4e4fc44c56..938272c0a8 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseTenantServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseTenantServiceTest.java
@@ -17,29 +17,13 @@ package org.thingsboard.server.dao.service;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.cache.TbTransactionalCache;
-import org.thingsboard.server.common.data.Customer;
-import org.thingsboard.server.common.data.Dashboard;
-import org.thingsboard.server.common.data.DashboardInfo;
-import org.thingsboard.server.common.data.Device;
-import org.thingsboard.server.common.data.DeviceProfile;
-import org.thingsboard.server.common.data.DeviceProfileType;
-import org.thingsboard.server.common.data.DeviceTransportType;
-import org.thingsboard.server.common.data.EntityView;
-import org.thingsboard.server.common.data.OtaPackage;
-import org.thingsboard.server.common.data.OtaPackageInfo;
-import org.thingsboard.server.common.data.ResourceType;
-import org.thingsboard.server.common.data.StringUtils;
-import org.thingsboard.server.common.data.TbResource;
-import org.thingsboard.server.common.data.TbResourceInfo;
-import org.thingsboard.server.common.data.Tenant;
-import org.thingsboard.server.common.data.TenantInfo;
-import org.thingsboard.server.common.data.TenantProfile;
-import org.thingsboard.server.common.data.User;
+import org.thingsboard.server.common.data.*;
import org.thingsboard.server.common.data.asset.Asset;
import org.thingsboard.server.common.data.device.profile.DeviceProfileData;
import org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration;
@@ -52,11 +36,24 @@ import org.thingsboard.server.common.data.rpc.RpcStatus;
import org.thingsboard.server.common.data.rule.RuleChain;
import org.thingsboard.server.common.data.rule.RuleChainType;
import org.thingsboard.server.common.data.security.Authority;
-import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration;
-import org.thingsboard.server.common.data.tenant.profile.TenantProfileData;
import org.thingsboard.server.common.data.widget.WidgetsBundle;
+import org.thingsboard.server.dao.asset.AssetService;
+import org.thingsboard.server.dao.customer.CustomerService;
+import org.thingsboard.server.dao.dashboard.DashboardService;
+import org.thingsboard.server.dao.device.DeviceProfileService;
+import org.thingsboard.server.dao.device.DeviceService;
+import org.thingsboard.server.dao.edge.EdgeService;
+import org.thingsboard.server.dao.entityview.EntityViewService;
import org.thingsboard.server.dao.exception.DataValidationException;
+import org.thingsboard.server.dao.ota.OtaPackageService;
+import org.thingsboard.server.dao.resource.ResourceService;
+import org.thingsboard.server.dao.rpc.RpcService;
+import org.thingsboard.server.dao.rule.RuleChainService;
import org.thingsboard.server.dao.tenant.TenantDao;
+import org.thingsboard.server.dao.tenant.TenantProfileService;
+import org.thingsboard.server.dao.usagerecord.ApiUsageStateService;
+import org.thingsboard.server.dao.user.UserService;
+import org.thingsboard.server.dao.widget.WidgetsBundleService;
import java.util.ArrayList;
import java.util.Collections;
@@ -70,16 +67,45 @@ import static org.mockito.Mockito.verify;
public abstract class BaseTenantServiceTest extends AbstractServiceTest {
- private IdComparator idComparator = new IdComparator<>();
-
@SpyBean
- protected TenantDao tenantDao;
+ TenantDao tenantDao;
@Autowired
- protected TbTransactionalCache cache;
-
+ ApiUsageStateService apiUsageStateService;
+ @Autowired
+ AssetService assetService;
+ @Autowired
+ CustomerService customerService;
+ @Autowired
+ DashboardService dashboardService;
+ @Autowired
+ DeviceProfileService deviceProfileService;
+ @Autowired
+ DeviceService deviceService;
+ @Autowired
+ EdgeService edgeService;
+ @Autowired
+ EntityViewService entityViewService;
+ @Autowired
+ OtaPackageService otaPackageService;
+ @Autowired
+ ResourceService resourceService;
+ @Autowired
+ RpcService rpcService;
+ @Autowired
+ RuleChainService ruleChainService;
@Autowired
- protected TbTransactionalCache existsTenantCache;
+ TbTransactionalCache existsTenantCache;
+ @Autowired
+ TbTransactionalCache cache;
+ @Autowired
+ TenantProfileService tenantProfileService;
+ @Autowired
+ UserService userService;
+ @Autowired
+ WidgetsBundleService widgetsBundleService;
+
+ private final IdComparator idComparator = new IdComparator<>();
@Test
public void testSaveTenant() {
@@ -121,18 +147,22 @@ public abstract class BaseTenantServiceTest extends AbstractServiceTest {
tenantService.deleteTenant(savedTenant.getId());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveTenantWithEmptyTitle() {
Tenant tenant = new Tenant();
- tenantService.saveTenant(tenant);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ tenantService.saveTenant(tenant);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveTenantWithInvalidEmail() {
Tenant tenant = new Tenant();
tenant.setTitle("My tenant");
tenant.setEmail("invalid@mail");
- tenantService.saveTenant(tenant);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ tenantService.saveTenant(tenant);
+ });
}
@Test
@@ -147,6 +177,7 @@ public abstract class BaseTenantServiceTest extends AbstractServiceTest {
@Test
public void testFindTenants() {
+ tenantService.deleteTenants();
List tenants = new ArrayList<>();
PageLink pageLink = new PageLink(17);
PageData pageData = tenantService.findTenants(pageLink);
@@ -261,7 +292,7 @@ public abstract class BaseTenantServiceTest extends AbstractServiceTest {
@Test
public void testFindTenantInfos() {
-
+ tenantService.deleteTenants();
List tenants = new ArrayList<>();
PageLink pageLink = new PageLink(17);
PageData pageData = tenantService.findTenantInfos(pageLink);
@@ -301,23 +332,6 @@ public abstract class BaseTenantServiceTest extends AbstractServiceTest {
}
- @Test(expected = DataValidationException.class)
- public void testSaveTenantWithIsolatedProfileInMonolithSetup() {
- TenantProfile tenantProfile = new TenantProfile();
- tenantProfile.setName("Isolated Tenant Profile");
- TenantProfileData profileData = new TenantProfileData();
- profileData.setConfiguration(new DefaultTenantProfileConfiguration());
- tenantProfile.setProfileData(profileData);
- tenantProfile.setDefault(false);
- tenantProfile.setIsolatedTbRuleEngine(true);
- TenantProfile isolatedTenantProfile = tenantProfileService.saveTenantProfile(TenantId.SYS_TENANT_ID, tenantProfile);
-
- Tenant tenant = new Tenant();
- tenant.setTitle("Tenant");
- tenant.setTenantProfileId(isolatedTenantProfile.getId());
- tenantService.saveTenant(tenant);
- }
-
@Test
public void testGettingTenantAddingItToCache() {
Tenant tenant = new Tenant();
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseUserServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseUserServiceTest.java
index d7885a1cb2..14917f6807 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseUserServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseUserServiceTest.java
@@ -15,10 +15,11 @@
*/
package org.thingsboard.server.dao.service;
-import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.StringUtils;
@@ -32,7 +33,9 @@ import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.security.Authority;
import org.thingsboard.server.common.data.security.UserCredentials;
import org.thingsboard.server.common.data.security.UserSettings;
+import org.thingsboard.server.dao.customer.CustomerService;
import org.thingsboard.server.dao.exception.DataValidationException;
+import org.thingsboard.server.dao.user.UserService;
import java.util.ArrayList;
import java.util.Collections;
@@ -40,19 +43,17 @@ import java.util.List;
public abstract class BaseUserServiceTest extends AbstractServiceTest {
+ @Autowired
+ CustomerService customerService;
+ @Autowired
+ UserService userService;
+
private IdComparator idComparator = new IdComparator<>();
- private TenantId tenantId;
private UserSettings userSettings;
@Before
public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
-
User tenantAdmin = new User();
tenantAdmin.setAuthority(Authority.TENANT_ADMIN);
tenantAdmin.setTenantId(tenantId);
@@ -74,11 +75,6 @@ public abstract class BaseUserServiceTest extends AbstractServiceTest {
userSettings = createUserSettings(customerUser.getId());
}
- @After
- public void after() {
- tenantService.deleteTenant(tenantId);
- }
-
@Test
public void testFindUserByEmail() {
User user = userService.findUserByEmail(SYSTEM_TENANT_ID, "sysadmin@thingsboard.org");
@@ -142,32 +138,40 @@ public abstract class BaseUserServiceTest extends AbstractServiceTest {
userService.deleteUser(tenantId, savedUser.getId());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveUserWithSameEmail() {
User tenantAdminUser = userService.findUserByEmail(tenantId, "tenant@thingsboard.org");
tenantAdminUser.setEmail("sysadmin@thingsboard.org");
- userService.saveUser(tenantAdminUser);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ userService.saveUser(tenantAdminUser);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveUserWithInvalidEmail() {
User tenantAdminUser = userService.findUserByEmail(tenantId, "tenant@thingsboard.org");
tenantAdminUser.setEmail("tenant_thingsboard.org");
- userService.saveUser(tenantAdminUser);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ userService.saveUser(tenantAdminUser);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveUserWithEmptyEmail() {
User tenantAdminUser = userService.findUserByEmail(tenantId, "tenant@thingsboard.org");
tenantAdminUser.setEmail(null);
- userService.saveUser(tenantAdminUser);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ userService.saveUser(tenantAdminUser);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveUserWithoutTenant() {
User tenantAdminUser = userService.findUserByEmail(tenantId, "tenant@thingsboard.org");
tenantAdminUser.setTenantId(null);
- userService.saveUser(tenantAdminUser);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ userService.saveUser(tenantAdminUser);
+ });
}
@Test
@@ -200,17 +204,13 @@ public abstract class BaseUserServiceTest extends AbstractServiceTest {
Assert.assertEquals(1, users.size());
Assert.assertEquals(tenantAdminUser, users.get(0));
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
+ TenantId secondTenantId = createTenant();
List tenantAdmins = new ArrayList<>();
for (int i = 0; i < 124; i++) {
User user = new User();
user.setAuthority(Authority.TENANT_ADMIN);
- user.setTenantId(tenantId);
+ user.setTenantId(secondTenantId);
user.setEmail("testTenant" + i + "@thingsboard.org");
tenantAdmins.add(userService.saveUser(user));
}
@@ -218,7 +218,7 @@ public abstract class BaseUserServiceTest extends AbstractServiceTest {
List loadedTenantAdmins = new ArrayList<>();
PageLink pageLink = new PageLink(33);
do {
- pageData = userService.findTenantAdmins(tenantId, pageLink);
+ pageData = userService.findTenantAdmins(secondTenantId, pageLink);
loadedTenantAdmins.addAll(pageData.getData());
if (pageData.hasNext()) {
pageLink = pageLink.nextPageLink();
@@ -230,10 +230,10 @@ public abstract class BaseUserServiceTest extends AbstractServiceTest {
Assert.assertEquals(tenantAdmins, loadedTenantAdmins);
- tenantService.deleteTenant(tenantId);
+ tenantService.deleteTenant(secondTenantId);
pageLink = new PageLink(33);
- pageData = userService.findTenantAdmins(tenantId, pageLink);
+ pageData = userService.findTenantAdmins(secondTenantId, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertTrue(pageData.getData().isEmpty());
@@ -241,12 +241,6 @@ public abstract class BaseUserServiceTest extends AbstractServiceTest {
@Test
public void testFindTenantAdminsByEmail() {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
-
String email1 = "testEmail1";
List tenantAdminsEmail1 = new ArrayList<>();
@@ -323,8 +317,6 @@ public abstract class BaseUserServiceTest extends AbstractServiceTest {
pageData = userService.findTenantAdmins(tenantId, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertEquals(0, pageData.getData().size());
-
- tenantService.deleteTenant(tenantId);
}
@Test
@@ -337,12 +329,6 @@ public abstract class BaseUserServiceTest extends AbstractServiceTest {
Assert.assertEquals(1, users.size());
Assert.assertEquals(customerUser, users.get(0));
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
-
Customer customer = new Customer();
customer.setTitle("Test customer");
customer.setTenantId(tenantId);
@@ -385,12 +371,6 @@ public abstract class BaseUserServiceTest extends AbstractServiceTest {
@Test
public void testFindCustomerUsersByEmail() {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
-
Customer customer = new Customer();
customer.setTitle("Test customer");
customer.setTenantId(tenantId);
@@ -476,8 +456,6 @@ public abstract class BaseUserServiceTest extends AbstractServiceTest {
pageData = userService.findCustomerUsers(tenantId, customerId, pageLink);
Assert.assertFalse(pageData.hasNext());
Assert.assertEquals(0, pageData.getData().size());
-
- tenantService.deleteTenant(tenantId);
}
private UserSettings createUserSettings(UserId userId) {
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseWidgetTypeServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseWidgetTypeServiceTest.java
index 404e6fe2e1..b04053f6d9 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseWidgetTypeServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseWidgetTypeServiceTest.java
@@ -18,17 +18,18 @@ package org.thingsboard.server.dao.service;
import com.datastax.oss.driver.api.core.uuid.Uuids;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
-import org.thingsboard.server.common.data.Tenant;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.widget.WidgetType;
import org.thingsboard.server.common.data.widget.WidgetTypeDetails;
import org.thingsboard.server.common.data.widget.WidgetsBundle;
import org.thingsboard.server.dao.exception.DataValidationException;
import org.thingsboard.server.dao.model.ModelConstants;
+import org.thingsboard.server.dao.widget.WidgetTypeService;
+import org.thingsboard.server.dao.widget.WidgetsBundleService;
import java.io.IOException;
import java.util.ArrayList;
@@ -37,23 +38,12 @@ import java.util.List;
public abstract class BaseWidgetTypeServiceTest extends AbstractServiceTest {
- private IdComparator idComparator = new IdComparator<>();
-
- private TenantId tenantId;
+ @Autowired
+ WidgetsBundleService widgetsBundleService;
+ @Autowired
+ WidgetTypeService widgetTypeService;
- @Before
- public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
- }
-
- @After
- public void after() {
- tenantService.deleteTenant(tenantId);
- }
+ private IdComparator idComparator = new IdComparator<>();
@Test
public void testSaveWidgetType() throws IOException {
@@ -88,7 +78,7 @@ public abstract class BaseWidgetTypeServiceTest extends AbstractServiceTest {
widgetsBundleService.deleteWidgetsBundle(tenantId, savedWidgetsBundle.getId());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveWidgetTypeWithEmptyName() throws IOException {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setTenantId(tenantId);
@@ -100,22 +90,26 @@ public abstract class BaseWidgetTypeServiceTest extends AbstractServiceTest {
widgetType.setBundleAlias(savedWidgetsBundle.getAlias());
widgetType.setDescriptor(new ObjectMapper().readValue("{ \"someKey\": \"someValue\" }", JsonNode.class));
try {
- widgetTypeService.saveWidgetType(widgetType);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ widgetTypeService.saveWidgetType(widgetType);
+ });
} finally {
widgetsBundleService.deleteWidgetsBundle(tenantId, savedWidgetsBundle.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveWidgetTypeWithEmptyBundleAlias() throws IOException {
WidgetTypeDetails widgetType = new WidgetTypeDetails();
widgetType.setTenantId(tenantId);
widgetType.setName("Widget Type");
widgetType.setDescriptor(new ObjectMapper().readValue("{ \"someKey\": \"someValue\" }", JsonNode.class));
- widgetTypeService.saveWidgetType(widgetType);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ widgetTypeService.saveWidgetType(widgetType);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveWidgetTypeWithEmptyDescriptor() throws IOException {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setTenantId(tenantId);
@@ -128,13 +122,15 @@ public abstract class BaseWidgetTypeServiceTest extends AbstractServiceTest {
widgetType.setBundleAlias(savedWidgetsBundle.getAlias());
widgetType.setDescriptor(new ObjectMapper().readValue("{}", JsonNode.class));
try {
- widgetTypeService.saveWidgetType(widgetType);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ widgetTypeService.saveWidgetType(widgetType);
+ });
} finally {
widgetsBundleService.deleteWidgetsBundle(tenantId, savedWidgetsBundle.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveWidgetTypeWithInvalidTenant() throws IOException {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setTenantId(tenantId);
@@ -147,23 +143,27 @@ public abstract class BaseWidgetTypeServiceTest extends AbstractServiceTest {
widgetType.setName("Widget Type");
widgetType.setDescriptor(new ObjectMapper().readValue("{ \"someKey\": \"someValue\" }", JsonNode.class));
try {
- widgetTypeService.saveWidgetType(widgetType);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ widgetTypeService.saveWidgetType(widgetType);
+ });
} finally {
widgetsBundleService.deleteWidgetsBundle(tenantId, savedWidgetsBundle.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveWidgetTypeWithInvalidBundleAlias() throws IOException {
WidgetTypeDetails widgetType = new WidgetTypeDetails();
widgetType.setTenantId(tenantId);
widgetType.setBundleAlias("some_alias");
widgetType.setName("Widget Type");
widgetType.setDescriptor(new ObjectMapper().readValue("{ \"someKey\": \"someValue\" }", JsonNode.class));
- widgetTypeService.saveWidgetType(widgetType);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ widgetTypeService.saveWidgetType(widgetType);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testUpdateWidgetTypeTenant() throws IOException {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setTenantId(tenantId);
@@ -178,13 +178,15 @@ public abstract class BaseWidgetTypeServiceTest extends AbstractServiceTest {
WidgetTypeDetails savedWidgetType = widgetTypeService.saveWidgetType(widgetType);
savedWidgetType.setTenantId(TenantId.fromUUID(ModelConstants.NULL_UUID));
try {
- widgetTypeService.saveWidgetType(savedWidgetType);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ widgetTypeService.saveWidgetType(savedWidgetType);
+ });
} finally {
widgetsBundleService.deleteWidgetsBundle(tenantId, savedWidgetsBundle.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testUpdateWidgetTypeBundleAlias() throws IOException {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setTenantId(tenantId);
@@ -199,13 +201,15 @@ public abstract class BaseWidgetTypeServiceTest extends AbstractServiceTest {
WidgetTypeDetails savedWidgetType = widgetTypeService.saveWidgetType(widgetType);
savedWidgetType.setBundleAlias("some_alias");
try {
- widgetTypeService.saveWidgetType(savedWidgetType);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ widgetTypeService.saveWidgetType(savedWidgetType);
+ });
} finally {
widgetsBundleService.deleteWidgetsBundle(tenantId, savedWidgetsBundle.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testUpdateWidgetTypeAlias() throws IOException {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setTenantId(tenantId);
@@ -220,7 +224,9 @@ public abstract class BaseWidgetTypeServiceTest extends AbstractServiceTest {
WidgetTypeDetails savedWidgetType = widgetTypeService.saveWidgetType(widgetType);
savedWidgetType.setAlias("some_alias");
try {
- widgetTypeService.saveWidgetType(savedWidgetType);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ widgetTypeService.saveWidgetType(savedWidgetType);
+ });
} finally {
widgetsBundleService.deleteWidgetsBundle(tenantId, savedWidgetsBundle.getId());
}
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseWidgetsBundleServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseWidgetsBundleServiceTest.java
index ac86572cdb..8f04eaec62 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseWidgetsBundleServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseWidgetsBundleServiceTest.java
@@ -16,17 +16,17 @@
package org.thingsboard.server.dao.service;
import com.datastax.oss.driver.api.core.uuid.Uuids;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
-import org.thingsboard.server.common.data.Tenant;
+import org.junit.jupiter.api.Assertions;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.widget.WidgetsBundle;
import org.thingsboard.server.dao.exception.DataValidationException;
import org.thingsboard.server.dao.model.ModelConstants;
+import org.thingsboard.server.dao.widget.WidgetsBundleService;
import java.io.IOException;
import java.util.ArrayList;
@@ -35,23 +35,10 @@ import java.util.List;
public abstract class BaseWidgetsBundleServiceTest extends AbstractServiceTest {
- private IdComparator idComparator = new IdComparator<>();
-
- private TenantId tenantId;
-
- @Before
- public void before() {
- Tenant tenant = new Tenant();
- tenant.setTitle("My tenant");
- Tenant savedTenant = tenantService.saveTenant(tenant);
- Assert.assertNotNull(savedTenant);
- tenantId = savedTenant.getId();
- }
+ @Autowired
+ WidgetsBundleService widgetsBundleService;
- @After
- public void after() {
- tenantService.deleteTenant(tenantId);
- }
+ private IdComparator idComparator = new IdComparator<>();
@Test
public void testSaveWidgetsBundle() throws IOException {
@@ -77,22 +64,26 @@ public abstract class BaseWidgetsBundleServiceTest extends AbstractServiceTest {
widgetsBundleService.deleteWidgetsBundle(tenantId, savedWidgetsBundle.getId());
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveWidgetsBundleWithEmptyTitle() {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setTenantId(tenantId);
- widgetsBundleService.saveWidgetsBundle(widgetsBundle);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ widgetsBundleService.saveWidgetsBundle(widgetsBundle);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testSaveWidgetsBundleWithInvalidTenant() {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setTitle("My widgets bundle");
widgetsBundle.setTenantId(TenantId.fromUUID(Uuids.timeBased()));
- widgetsBundleService.saveWidgetsBundle(widgetsBundle);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ widgetsBundleService.saveWidgetsBundle(widgetsBundle);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testUpdateWidgetsBundleTenant() {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setTitle("My widgets bundle");
@@ -100,13 +91,15 @@ public abstract class BaseWidgetsBundleServiceTest extends AbstractServiceTest {
WidgetsBundle savedWidgetsBundle = widgetsBundleService.saveWidgetsBundle(widgetsBundle);
savedWidgetsBundle.setTenantId(TenantId.fromUUID(ModelConstants.NULL_UUID));
try {
- widgetsBundleService.saveWidgetsBundle(savedWidgetsBundle);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ widgetsBundleService.saveWidgetsBundle(savedWidgetsBundle);
+ });
} finally {
widgetsBundleService.deleteWidgetsBundle(tenantId, savedWidgetsBundle.getId());
}
}
- @Test(expected = DataValidationException.class)
+ @Test
public void testUpdateWidgetsBundleAlias() {
WidgetsBundle widgetsBundle = new WidgetsBundle();
widgetsBundle.setTitle("My widgets bundle");
@@ -114,7 +107,9 @@ public abstract class BaseWidgetsBundleServiceTest extends AbstractServiceTest {
WidgetsBundle savedWidgetsBundle = widgetsBundleService.saveWidgetsBundle(widgetsBundle);
savedWidgetsBundle.setAlias("new_alias");
try {
- widgetsBundleService.saveWidgetsBundle(savedWidgetsBundle);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ widgetsBundleService.saveWidgetsBundle(savedWidgetsBundle);
+ });
} finally {
widgetsBundleService.deleteWidgetsBundle(tenantId, savedWidgetsBundle.getId());
}
@@ -240,11 +235,6 @@ public abstract class BaseWidgetsBundleServiceTest extends AbstractServiceTest {
@Test
public void testFindTenantWidgetsBundlesByTenantId() {
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
List widgetsBundles = new ArrayList<>();
for (int i=0;i<127;i++) {
@@ -277,7 +267,6 @@ public abstract class BaseWidgetsBundleServiceTest extends AbstractServiceTest {
Assert.assertFalse(pageData.hasNext());
Assert.assertTrue(pageData.getData().isEmpty());
- tenantService.deleteTenant(tenantId);
}
@Test
@@ -285,11 +274,6 @@ public abstract class BaseWidgetsBundleServiceTest extends AbstractServiceTest {
List systemWidgetsBundles = widgetsBundleService.findSystemWidgetsBundles(tenantId);
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
TenantId systemTenantId = TenantId.fromUUID(ModelConstants.NULL_UUID);
List createdWidgetsBundles = new ArrayList<>();
@@ -362,8 +346,6 @@ public abstract class BaseWidgetsBundleServiceTest extends AbstractServiceTest {
Collections.sort(loadedWidgetsBundles, idComparator);
Assert.assertEquals(systemWidgetsBundles, loadedWidgetsBundles);
-
- tenantService.deleteTenant(tenantId);
}
@Test
@@ -371,11 +353,6 @@ public abstract class BaseWidgetsBundleServiceTest extends AbstractServiceTest {
List systemWidgetsBundles = widgetsBundleService.findSystemWidgetsBundles(tenantId);
- Tenant tenant = new Tenant();
- tenant.setTitle("Test tenant");
- tenant = tenantService.saveTenant(tenant);
-
- TenantId tenantId = tenant.getId();
TenantId systemTenantId = TenantId.fromUUID(ModelConstants.NULL_UUID);
List createdWidgetsBundles = new ArrayList<>();
@@ -423,8 +400,6 @@ public abstract class BaseWidgetsBundleServiceTest extends AbstractServiceTest {
Collections.sort(loadedWidgetsBundles, idComparator);
Assert.assertEquals(systemWidgetsBundles, loadedWidgetsBundles);
-
- tenantService.deleteTenant(tenantId);
}
}
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/DataValidatorTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/DataValidatorTest.java
index 6e195b266c..40262ac2b8 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/DataValidatorTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/DataValidatorTest.java
@@ -15,7 +15,8 @@
*/
package org.thingsboard.server.dao.service;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import org.thingsboard.server.dao.exception.DataValidationException;
public class DataValidatorTest {
@@ -26,38 +27,50 @@ public class DataValidatorTest {
DataValidator.validateEmail(email);
}
- @Test(expected = DataValidationException.class)
+ @Test
public void validateInvalidEmail1() {
String email = "test:1@mail.io";
- DataValidator.validateEmail(email);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ DataValidator.validateEmail(email);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void validateInvalidEmail2() {
String email = "test()1@mail.io";
- DataValidator.validateEmail(email);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ DataValidator.validateEmail(email);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void validateInvalidEmail3() {
String email = "test[]1@mail.io";
- DataValidator.validateEmail(email);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ DataValidator.validateEmail(email);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void validateInvalidEmail4() {
String email = "test\\1@mail.io";
- DataValidator.validateEmail(email);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ DataValidator.validateEmail(email);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void validateInvalidEmail5() {
String email = "test\"1@mail.io";
- DataValidator.validateEmail(email);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ DataValidator.validateEmail(email);
+ });
}
- @Test(expected = DataValidationException.class)
+ @Test
public void validateInvalidEmail6() {
String email = "test<>1@mail.io";
- DataValidator.validateEmail(email);
+ Assertions.assertThrows(DataValidationException.class, () -> {
+ DataValidator.validateEmail(email);
+ });
}
-}
\ No newline at end of file
+}
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/NoXssValidatorTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/NoXssValidatorTest.java
index fa1caca815..f2618da6b8 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/NoXssValidatorTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/NoXssValidatorTest.java
@@ -16,7 +16,7 @@
package org.thingsboard.server.dao.service;
import com.fasterxml.jackson.databind.node.TextNode;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.thingsboard.common.util.JacksonUtil;
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/event/BaseEventServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/event/BaseEventServiceTest.java
index 4b0cf9a1b1..1b0825aff3 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/event/BaseEventServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/event/BaseEventServiceTest.java
@@ -19,6 +19,7 @@ import com.datastax.oss.driver.api.core.uuid.Uuids;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.EventInfo;
import org.thingsboard.server.common.data.event.Event;
import org.thingsboard.server.common.data.event.EventType;
@@ -31,6 +32,7 @@ import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.SortOrder;
import org.thingsboard.server.common.data.page.TimePageLink;
+import org.thingsboard.server.dao.event.EventService;
import org.thingsboard.server.dao.service.AbstractServiceTest;
import java.text.ParseException;
@@ -39,6 +41,10 @@ import java.util.List;
import static org.apache.commons.lang3.time.DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT;
public abstract class BaseEventServiceTest extends AbstractServiceTest {
+
+ @Autowired
+ EventService eventService;
+
long timeBeforeStartTime;
long startTime;
long eventTime;
diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/timeseries/BaseTimeseriesServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/timeseries/BaseTimeseriesServiceTest.java
index 924f515143..962dc7e246 100644
--- a/dao/src/test/java/org/thingsboard/server/dao/service/timeseries/BaseTimeseriesServiceTest.java
+++ b/dao/src/test/java/org/thingsboard/server/dao/service/timeseries/BaseTimeseriesServiceTest.java
@@ -21,6 +21,7 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.EntityView;
import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.id.DeviceId;
@@ -39,7 +40,9 @@ import org.thingsboard.server.common.data.kv.ReadTsKvQueryResult;
import org.thingsboard.server.common.data.kv.StringDataEntry;
import org.thingsboard.server.common.data.kv.TsKvEntry;
import org.thingsboard.server.common.data.objects.TelemetryEntityView;
+import org.thingsboard.server.dao.entityview.EntityViewService;
import org.thingsboard.server.dao.service.AbstractServiceTest;
+import org.thingsboard.server.dao.timeseries.TimeseriesService;
import java.util.ArrayList;
import java.util.Arrays;
@@ -59,6 +62,13 @@ import static org.junit.Assert.assertNotNull;
@Slf4j
public abstract class BaseTimeseriesServiceTest extends AbstractServiceTest {
+
+ @Autowired
+ TimeseriesService tsService;
+
+ @Autowired
+ EntityViewService entityViewService;
+
static final int MAX_TIMEOUT = 30;
private static final String STRING_KEY = "stringKey";
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/base/AbstractBasePage.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/base/AbstractBasePage.java
index cd4ca51698..6384e17426 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/base/AbstractBasePage.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/base/AbstractBasePage.java
@@ -16,7 +16,6 @@
package org.thingsboard.server.msa.ui.base;
import lombok.SneakyThrows;
-import lombok.extern.slf4j.Slf4j;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
@@ -34,7 +33,8 @@ import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
-@Slf4j
+import static org.assertj.core.api.Assertions.fail;
+
abstract public class AbstractBasePage {
public static final long WAIT_TIMEOUT = TimeUnit.SECONDS.toMillis(30);
protected WebDriver driver;
@@ -59,8 +59,7 @@ abstract public class AbstractBasePage {
try {
return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locator)));
} catch (WebDriverException e) {
- log.error("No visibility element: " + locator);
- return null;
+ return fail("No visibility element: " + locator);
}
}
@@ -68,8 +67,7 @@ abstract public class AbstractBasePage {
try {
return wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(locator)));
} catch (WebDriverException e) {
- log.error("No presence element: " + locator);
- return null;
+ return fail("No presence element: " + locator);
}
}
@@ -77,8 +75,7 @@ abstract public class AbstractBasePage {
try {
return wait.until(ExpectedConditions.elementToBeClickable(By.xpath(locator)));
} catch (WebDriverException e) {
- log.error("No clickable element: " + locator);
- return null;
+ return fail("No clickable element: " + locator);
}
}
@@ -87,8 +84,7 @@ abstract public class AbstractBasePage {
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locator)));
return driver.findElements(By.xpath(locator));
} catch (WebDriverException e) {
- log.error("No visibility elements: " + locator);
- return null;
+ return fail("No visibility elements: " + locator);
}
}
@@ -97,8 +93,7 @@ abstract public class AbstractBasePage {
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(locator)));
return driver.findElements(By.xpath(locator));
} catch (WebDriverException e) {
- log.error("No clickable elements: " + locator);
- return null;
+ return fail("No clickable elements: " + locator);
}
}
@@ -106,7 +101,7 @@ abstract public class AbstractBasePage {
try {
wait.until(ExpectedConditions.urlContains(urlPath));
} catch (WebDriverException e) {
- log.error("This URL path is missing");
+ fail("This URL path is missing");
}
}
@@ -122,7 +117,7 @@ abstract public class AbstractBasePage {
try {
return wait.until(ExpectedConditions.not(ExpectedConditions.visibilityOfElementLocated(By.xpath(locator))));
} catch (WebDriverException e) {
- throw new AssertionError("Element is present");
+ return fail("Element is present");
}
}
@@ -130,7 +125,7 @@ abstract public class AbstractBasePage {
try {
return wait.until(ExpectedConditions.not(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath(locator))));
} catch (WebDriverException e) {
- throw new AssertionError("Elements is present");
+ return fail("Elements is present");
}
}
@@ -138,7 +133,7 @@ abstract public class AbstractBasePage {
try {
wait.until(ExpectedConditions.numberOfWindowsToBe(tabNumber));
} catch (WebDriverException e) {
- log.error("No tabs with this number");
+ fail("No tabs with this number: " + tabNumber);
}
}
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/base/AbstractDriverBaseTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/base/AbstractDriverBaseTest.java
index 29574a1942..e88397b781 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/base/AbstractDriverBaseTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/base/AbstractDriverBaseTest.java
@@ -18,7 +18,6 @@ package org.thingsboard.server.msa.ui.base;
import io.github.bonigarcia.wdm.WebDriverManager;
import io.qameta.allure.Allure;
import lombok.extern.slf4j.Slf4j;
-import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.OutputType;
@@ -48,9 +47,9 @@ import java.io.ByteArrayInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.Duration;
-import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
+import static org.assertj.core.api.Assertions.fail;
import static org.thingsboard.server.msa.TestProperties.getBaseUiUrl;
import static org.thingsboard.server.msa.ui.utils.Const.TENANT_EMAIL;
import static org.thingsboard.server.msa.ui.utils.Const.TENANT_PASSWORD;
@@ -73,6 +72,7 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
testRestClient.login(TENANT_EMAIL, TENANT_PASSWORD);
ChromeOptions options = new ChromeOptions();
options.setAcceptInsecureCerts(true);
+ options.addArguments("-remote-allow-origins=*"); //temporary fix after updating google chrome
if (instance.isActive()) {
RemoteWebDriver remoteWebDriver = new RemoteWebDriver(new URL(REMOTE_WEBDRIVER_HOST), options);
remoteWebDriver.setFileDetector(new LocalFileDetector());
@@ -82,12 +82,12 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
driver = new ChromeDriver(options);
}
driver.manage().window().setSize(dimension);
- openLocalhost();
+ openBaseUiUrl();
}
@BeforeMethod
public void open() {
- openHomePage();
+ openBaseUiUrl();
}
@AfterMethod
@@ -101,12 +101,13 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
driver.quit();
}
- public void openLocalhost() {
- driver.get(getBaseUiUrl());
+ public String getJwtTokenFromLocalStorage() {
+ js = (JavascriptExecutor) driver;
+ return (String) js.executeScript("return window.localStorage.getItem('jwt_token');");
}
- public void openHomePage() {
- driver.get(getBaseUiUrl() + "/home");
+ public void openBaseUiUrl() {
+ driver.get(getBaseUiUrl());
}
public String getUrl() {
@@ -122,7 +123,7 @@ abstract public class AbstractDriverBaseTest extends AbstractContainerTest {
try {
wait.until(ExpectedConditions.urlContains(urlPath));
} catch (WebDriverException e) {
- log.error("This URL path is missing");
+ return fail("URL not contains " + urlPath);
}
return driver.getCurrentUrl().contains(urlPath);
}
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/CustomerPageElements.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/CustomerPageElements.java
index de9e9d5bac..1d69ddd5fc 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/CustomerPageElements.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/CustomerPageElements.java
@@ -31,18 +31,18 @@ public class CustomerPageElements extends OtherPageElementsHelper {
private static final String CITY = ENTITY + "/../..//mat-cell[contains(@class,'city')]/span";
private static final String TITLES = "//mat-cell[contains(@class,'cdk-column-title')]/span";
protected static final String EDIT_MENU_DASHBOARD_FIELD = "//input[@formcontrolname='dashboard']";
- private static final String EDIT_MENU_DASHBOARD = "//div[@class='cdk-overlay-pane']//span/span";
- private static final String MANAGE_CUSTOMERS_USERS_BTN = ENTITY + "/../..//mat-icon[contains(text(),' account_circle')]/../..";
- private static final String MANAGE_CUSTOMERS_ASSETS_BTN = ENTITY + "/../..//mat-icon[contains(text(),' domain')]/../..";
- private static final String MANAGE_CUSTOMERS_DEVICES_BTN = ENTITY + "/../..//mat-icon[contains(text(),' devices_other')]/../..";
- private static final String MANAGE_CUSTOMERS_DASHBOARDS_BTN = ENTITY + "/../..//mat-icon[contains(text(),' dashboard')]/../..";
- private static final String MANAGE_CUSTOMERS_EDGE_BTN = ENTITY + "/../..//mat-icon[contains(text(),' router')]/../..";
+ private static final String EDIT_MENU_DASHBOARD = "//div[@class='cdk-overlay-pane']//span/span[contains(text(),'%s')]";
+ private static final String MANAGE_CUSTOMERS_USERS_BTN = ENTITY + "/ancestor::mat-row//mat-icon[contains(text(),' account_circle')]";
+ private static final String MANAGE_CUSTOMERS_ASSETS_BTN = ENTITY + "/ancestor::mat-row//mat-icon[contains(text(),' domain')]/parent::button";
+ private static final String MANAGE_CUSTOMERS_DEVICES_BTN = ENTITY + "/ancestor::mat-row//mat-icon[contains(text(),'devices_other')]/parent::button";
+ private static final String MANAGE_CUSTOMERS_DASHBOARDS_BTN = ENTITY + "/ancestor::mat-row//mat-icon[contains(text(),'dashboard')]/parent::button";
+ private static final String MANAGE_CUSTOMERS_EDGE_BTN = ENTITY + "/ancestor::mat-row//mat-icon[contains(text(),'router')]/parent::button";
private static final String ADD_USER_EMAIL = "//tb-add-user-dialog//input[@formcontrolname='email']";
private static final String ACTIVATE_WINDOW_OK_BTN = "//span[contains(text(),'OK')]";
private static final String USER_LOGIN_BTN = "//mat-icon[@data-mat-icon-name='login']";
private static final String USERS_WIDGET = "//tb-widget";
private static final String SELECT_COUNTRY_MENU = "//mat-form-field//mat-select[@formcontrolname='country']";
- private static final String COUNTRIES = "//span[@class='mat-option-text']";
+ private static final String COUNTRIES = "//span[@class='mdc-list-item__primary-text']";
protected static final String INPUT_FIELD = "//input[@formcontrolname='%s']";
protected static final String INPUT_FIELD_NAME_TITLE = "title";
private static final String INPUT_FIELD_NAME_CITY = "city";
@@ -54,7 +54,7 @@ public class CustomerPageElements extends OtherPageElementsHelper {
private static final String INPUT_FIELD_NAME_NUMBER = "phoneNumber";
private static final String INPUT_FIELD_NAME_ASSIGNED_LIST = "entity";
private static final String ASSIGNED_BTN = "//button[@type='submit']";
- private static final String HIDE_HOME_DASHBOARD_TOOLBAR = "//mat-checkbox[@formcontrolname='homeDashboardHideToolbar']/label";
+ private static final String HIDE_HOME_DASHBOARD_TOOLBAR = "//mat-checkbox[@formcontrolname='homeDashboardHideToolbar']//label";
private static final String FILTER_BTN = "//tb-filters-edit";
private static final String TIME_BTN = "//tb-timewindow";
private static final String CUSTOMER_ICON_HEADER = "//tb-breadcrumb//span[contains(text(),'Customer %s')]";
@@ -104,8 +104,8 @@ public class CustomerPageElements extends OtherPageElementsHelper {
return waitUntilVisibilityOfElementLocated(EDIT_MENU_DASHBOARD_FIELD);
}
- public WebElement editMenuDashboard() {
- return waitUntilElementToBeClickable(EDIT_MENU_DASHBOARD);
+ public WebElement editMenuDashboard(String dashboardName) {
+ return waitUntilElementToBeClickable(String.format(EDIT_MENU_DASHBOARD, dashboardName));
}
public WebElement phoneNumberEntityView() {
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/CustomerPageHelper.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/CustomerPageHelper.java
index d657388354..030bf630cb 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/CustomerPageHelper.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/CustomerPageHelper.java
@@ -17,6 +17,7 @@ package org.thingsboard.server.msa.ui.pages;
import lombok.extern.slf4j.Slf4j;
import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
@@ -111,11 +112,9 @@ public class CustomerPageHelper extends CustomerPageElements {
titleFieldEntityView().sendKeys(newTitle);
}
- public void chooseDashboard() {
+ public void chooseDashboard(String dashboardName) {
editMenuDashboardField().click();
- sleep(0.5);
- editMenuDashboard().click();
- sleep(0.5);
+ editMenuDashboard(dashboardName).click();
}
public void createCustomersUser() {
@@ -156,4 +155,9 @@ public class CustomerPageHelper extends CustomerPageElements {
public void addCustomerViewEnterName(CharSequence keysToEnter) {
enterText(titleFieldAddEntityView(), keysToEnter);
}
+
+ public void enterPhoneNumber(String number) {
+ phoneNumberEntityView().sendKeys(number);
+ phoneNumberEntityView().sendKeys(Keys.TAB);
+ }
}
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DashboardPageHelper.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DashboardPageHelper.java
index e6ec13fd1f..6449cf0cbb 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DashboardPageHelper.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DashboardPageHelper.java
@@ -33,8 +33,8 @@ public class DashboardPageHelper extends DashboardPageElements {
}
public void assignedCustomer(String title) {
- manageAssignedEntityListField().click();
- manageAssignedEntity(title).click();
- manageAssignedUpdateBtn().click();
+ jsClick(manageAssignedEntityListField());
+ jsClick(manageAssignedEntity(title));
+ jsClick(manageAssignedUpdateBtn());
}
}
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OpenRuleChainPageElements.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OpenRuleChainPageElements.java
index 9a51392690..6fd114ad1d 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OpenRuleChainPageElements.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OpenRuleChainPageElements.java
@@ -24,8 +24,7 @@ public class OpenRuleChainPageElements extends AbstractBasePage {
super(driver);
}
- private static final String DONE_BTN = "//mat-icon[contains(text(),'done')]/../..";
- private static final String DONE_BTN_DISABLE = "//mat-icon[contains(text(),'done')]/../parent::button[@disabled='true']";
+ private static final String DONE_BTN = "//mat-icon[contains(text(),'done')]/parent::button";
private static final String INPUT_NODE = "//div[@class='tb-rule-node tb-input-type']";
private static final String HEAD_RULE_CHAIN_NAME = "//div[@class='tb-breadcrumb']/span[2]";
@@ -37,10 +36,6 @@ public class OpenRuleChainPageElements extends AbstractBasePage {
return waitUntilVisibilityOfElementLocated(HEAD_RULE_CHAIN_NAME);
}
- public String getDoneBtnDisable() {
- return DONE_BTN_DISABLE;
- }
-
public WebElement doneBtn() {
return waitUntilElementToBeClickable(DONE_BTN);
}
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OpenRuleChainPageHelper.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OpenRuleChainPageHelper.java
index 1a87102687..7bba9586dc 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OpenRuleChainPageHelper.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OpenRuleChainPageHelper.java
@@ -16,6 +16,7 @@
package org.thingsboard.server.msa.ui.pages;
import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
public class OpenRuleChainPageHelper extends OpenRuleChainPageElements {
public OpenRuleChainPageHelper(WebDriver driver) {
@@ -32,7 +33,7 @@ public class OpenRuleChainPageHelper extends OpenRuleChainPageElements {
return headName;
}
- public void waitUntilDoneBtnDisable() {
- waitUntilVisibilityOfElementLocated(getDoneBtnDisable());
+ public void waitUntilBtnDisable(WebElement element) {
+ waitUntilAttributeContains(element, "disabled", "true");
}
}
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElements.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElements.java
index 99e737dba1..7cb5da3bc6 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElements.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElements.java
@@ -28,7 +28,7 @@ public class OtherPageElements extends AbstractBasePage {
}
protected static final String ENTITY = "//mat-row//span[contains(text(),'%s')]";
- protected static final String DELETE_BTN = ENTITY + "/../..//mat-icon[contains(text(),' delete')]/../..";
+ protected static final String DELETE_BTN = ENTITY + "/ancestor::mat-row//mat-icon[contains(text(),'delete')]/ancestor::button";
protected static final String DETAILS_BTN = ENTITY + "/../..//mat-icon[contains(text(),'edit')]/../..";
private static final String ENTITY_COUNT = "//div[@class='mat-paginator-range-label']";
private static final String WARNING_DELETE_POPUP_YES = "//tb-confirm-dialog//button[2]";
@@ -37,11 +37,11 @@ public class OtherPageElements extends AbstractBasePage {
private static final String HELP_BTN = "//mat-icon[contains(text(),'help')]/ancestor::button";
private static final String CHECKBOX = "//mat-row//span[contains(text(),'%s')]/../..//mat-checkbox";
private static final String CHECKBOXES = "//tbody//mat-checkbox";
- private static final String DELETE_SELECTED_BTN = "//span[contains(text(),'selected')]//..//mat-icon/../..";
+ private static final String DELETE_SELECTED_BTN = "//div[@class='mat-toolbar-tools']//mat-icon[contains(text(),'delete')]/parent::button";
private static final String DELETE_BTNS = "//mat-icon[contains(text(),' delete')]/../..";
private static final String MARKS_CHECKBOX = "//mat-row[contains (@class,'mat-selected')]//mat-checkbox[contains(@class, 'checked')]";
private static final String SELECT_ALL_CHECKBOX = "//thead//mat-checkbox";
- private static final String ALL_ENTITY = "//mat-row[@class='mat-row cdk-row mat-row-select ng-star-inserted']";
+ private static final String ALL_ENTITY = "//mat-row[@class='mat-mdc-row mdc-data-table__row cdk-row mat-row-select ng-star-inserted']";
private static final String EDIT_PENCIL_BTN = "//tb-details-panel//mat-icon[contains(text(),'edit')]/ancestor::button";
private static final String NAME_FIELD_EDIT_VIEW = "//input[@formcontrolname='name']";
private static final String HEADER_NAME_VIEW = "//header//div[@class='tb-details-title']/span";
@@ -50,14 +50,13 @@ public class OtherPageElements extends AbstractBasePage {
private static final String DESCRIPTION_ADD_ENTITY_VIEW = "//tb-add-entity-dialog//textarea";
private static final String DEBUG_CHECKBOX_EDIT = "//mat-checkbox[@formcontrolname='debugMode']";
private static final String DEBUG_CHECKBOX_VIEW = "//mat-checkbox[@formcontrolname='debugMode']//input";
- private static final String CLOSE_ENTITY_VIEW_BTN = "//header//mat-icon[contains(text(),'close')]/../..";
- private static final String SEARCH_BTN = "//mat-toolbar//mat-icon[contains(text(),'search')]/.." +
- "/parent::button[@class='mat-focus-indicator mat-tooltip-trigger mat-icon-button mat-button-base ng-star-inserted']";
+ private static final String CLOSE_ENTITY_VIEW_BTN = "//header//mat-icon[contains(text(),'close')]/parent::button";
+ private static final String SEARCH_BTN = "//mat-toolbar//mat-icon[contains(text(),'search')]/ancestor::button[contains(@class,'ng-star')]";
private static final String SORT_BY_NAME_BTN = "//div[contains(text(),'Name')]";
private static final String SORT_BY_TITLE_BTN = "//div[contains(text(),'Title')]";
private static final String SORT_BY_TIME_BTN = "//div[contains(text(),'Created time')]/..";
private static final String CREATED_TIME = "//tbody[@role='rowgroup']//mat-cell[2]/span";
- private static final String PLUS_BTN = "//mat-icon[contains(text(),'add')]/../parent::button";
+ private static final String PLUS_BTN = "//mat-icon[contains(text(),'add')]/ancestor::button";
private static final String CREATE_VIEW_ADD_BTN = "//span[contains(text(),'Add')]/..";
private static final String WARNING_MESSAGE = "//tb-snack-bar-component/div/div";
private static final String ERROR_MESSAGE = "//mat-error";
@@ -66,7 +65,7 @@ public class OtherPageElements extends AbstractBasePage {
private static final String ENTITY_FROM_LIST = "//div[@role='listbox']/mat-option//span[contains(text(),'%s')]";
protected static final String ADD_ENTITY_VIEW = "//tb-add-entity-dialog";
protected static final String STATE_CONTROLLER = "//tb-entity-state-controller";
- private static final String SEARCH_FIELD = "//input[contains (@data-placeholder,'Search')]";
+ private static final String SEARCH_FIELD = "//input[contains (@placeholder,'Search')]";
private static final String BROWSE_FILE = "//input[@class='file-input']";
private static final String IMPORT_BROWSE_FILE = "//mat-dialog-container//span[contains(text(),'Import')]/..";
private static final String IMPORTING_FILE = "//div[contains(text(),'%s')]";
@@ -158,7 +157,7 @@ public class OtherPageElements extends AbstractBasePage {
}
public WebElement debugCheckboxView() {
- return waitUntilVisibilityOfElementLocated(DEBUG_CHECKBOX_VIEW);
+ return waitUntilPresenceOfElementLocated(DEBUG_CHECKBOX_VIEW);
}
public WebElement closeEntityViewBtn() {
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElementsHelper.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElementsHelper.java
index 45a0dddc98..815e118a9b 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElementsHelper.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/OtherPageElementsHelper.java
@@ -62,48 +62,22 @@ public class OtherPageElementsHelper extends OtherPageElements {
}
public String deleteRuleChainTrash(String entityName) {
- String s = "";
- if (deleteBtn(entityName) != null) {
- deleteBtn(entityName).click();
- warningPopUpYesBtn().click();
- return entityName;
- } else {
- for (int i = 0; i < deleteBtns().size(); i++) {
- if (deleteBtns().get(i).isEnabled()) {
- deleteBtns().get(i).click();
- warningPopUpYesBtn().click();
- if (elementIsNotPresent(getWarningMessage())) {
- s = driver.findElements(By.xpath(getDeleteBtns()
- + "/../../../mat-cell/following-sibling::mat-cell/following-sibling::mat-cell[contains(@class,'cdk-column-name')]/span")).get(i).getText();
- break;
- }
- }
- }
- return s;
- }
+ deleteBtn(entityName).click();
+ warningPopUpYesBtn().click();
+ return entityName;
}
public String deleteSelected(String entityName) {
- String s = "";
- if (deleteBtn(entityName) != null) {
- checkBox(entityName).click();
- deleteSelectedBtn().click();
- warningPopUpYesBtn().click();
- return entityName;
- } else {
- for (int i = 0; i < checkBoxes().size(); i++) {
- if (checkBoxes().get(i).isDisplayed()) {
- s = driver.findElements(By.xpath(getCheckboxes() + "/../../mat-cell/following-sibling::mat-cell/following-sibling::mat-cell[contains(@class,'cdk-column-name')]/span")).get(i).getText();
- checkBox(s).click();
- deleteSelectedBtn().click();
- warningPopUpYesBtn().click();
- if (elementIsNotPresent(getWarningMessage())) {
- break;
- }
- }
- }
- return s;
- }
+ checkBox(entityName).click();
+ jsClick(deleteSelectedBtn());
+ warningPopUpYesBtn().click();
+ return entityName;
+ }
+
+ public void deleteSelected(int countOfCheckBoxes) {
+ clickOnCheckBoxes(countOfCheckBoxes);
+ jsClick(deleteSelectedBtn());
+ warningPopUpYesBtn().click();
}
public void searchEntity(String namePath) {
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/RuleChainsPageElements.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/RuleChainsPageElements.java
index b34c5ccb86..c1b72efbeb 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/RuleChainsPageElements.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/RuleChainsPageElements.java
@@ -25,7 +25,7 @@ public class RuleChainsPageElements extends OtherPageElementsHelper {
super(driver);
}
- private static final String MAKE_ROOT_BTN = ENTITY + "/../..//mat-icon[contains(text(),' flag')]/../..";
+ private static final String MAKE_ROOT_BTN = ENTITY + "/ancestor::mat-row//mat-icon[contains(text(),'flag')]/ancestor::button";
private static final String ROOT = ENTITY + "/../..//mat-icon[text() = 'check_box']";
private static final String ROOT_DISABLE = ENTITY + "/../..//mat-icon[text() = 'check_box_outline_blank']";
private static final String CREATED_TIME = ENTITY + "/../..//mat-cell/span[contains(text(),'%s')]";
@@ -35,7 +35,7 @@ public class RuleChainsPageElements extends OtherPageElementsHelper {
private static final String DELETE_RULE_CHAIN_FROM_VIEW_BTN = "//span[contains(text(),' Delete')]";
private static final String IMPORT_RULE_CHAIN_BTN = "//span[contains(text(),'Import rule chain')]";
private static final String OPEN_RULE_CHAIN_FROM_VIEW = "//span[contains(text(),'Open rule chain')]";
- private static final String MAKE_ROOT_FROM_VIEW = "(//span[contains(text(),' Make rule chain root ')]/..)[1]";
+ private static final String MAKE_ROOT_FROM_VIEW = "//span[contains(text(),' Make rule chain root ')]/parent::button";
private static final String ROOT_ACTIVE_CHECKBOXES = "//mat-icon[text() = 'check_box']";
private static final String ALL_NAMES = "//mat-icon[contains(text(),'check')]/../../../mat-cell[contains(@class,'name')]/span";
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/AssetProfileEditMenuTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/AssetProfileEditMenuTest.java
index 0d02bd9434..d94fb029ad 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/AssetProfileEditMenuTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/AssetProfileEditMenuTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.openqa.selenium.Keys;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
@@ -54,8 +56,10 @@ public class AssetProfileEditMenuTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Asset profiles smoke")
+ @Feature("Edit asset profile")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Change name by edit menu")
public void changeName() {
String name = ENTITY_NAME + random();
String newName = "Changed" + getRandomNumber();
@@ -77,8 +81,10 @@ public class AssetProfileEditMenuTest extends AbstractDriverBaseTest {
Assert.assertEquals(nameAfter, newName);
}
+ @Epic("Asset profiles smoke")
+ @Feature("Edit asset profile")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Delete name and save")
public void deleteName() {
String name = ENTITY_NAME + random();
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
@@ -92,8 +98,10 @@ public class AssetProfileEditMenuTest extends AbstractDriverBaseTest {
Assert.assertFalse(profilesPage.doneBtnEditViewVisible().isEnabled());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Edit asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Save only with space")
public void saveWithOnlySpaceInName() {
String name = ENTITY_NAME + random();
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
@@ -110,8 +118,10 @@ public class AssetProfileEditMenuTest extends AbstractDriverBaseTest {
Assert.assertEquals(profilesPage.warningMessage().getText(), EMPTY_ASSET_PROFILE_MESSAGE);
}
+ @Epic("Asset profiles smoke")
+ @Feature("Edit asset profile")
@Test(priority = 30, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "editMenuDescription")
- @Description
+ @Description("Write the description and save the changes/Change the description and save the changes/Delete the description and save the changes")
public void editDescription(String description, String newDescription, String finalDescription) {
String name = ENTITY_NAME + random();
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name, description));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/CreateAssetProfileImportTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/CreateAssetProfileImportTest.java
index 275eb866ce..8816f878e7 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/CreateAssetProfileImportTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/CreateAssetProfileImportTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -55,8 +57,10 @@ public class CreateAssetProfileImportTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Asset profiles smoke")
+ @Feature("Import asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Import asset profile")
public void importAssetProfile() {
sideBarMenuView.openAssetProfiles();
profilesPage.openImportAssetProfileView();
@@ -69,8 +73,10 @@ public class CreateAssetProfileImportTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entity(IMPORT_ASSET_PROFILE_NAME).isDisplayed());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Import asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Import txt file")
public void importTxtFile() {
sideBarMenuView.openDeviceProfiles();
profilesPage.openImportDeviceProfileView();
@@ -80,8 +86,10 @@ public class CreateAssetProfileImportTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.importingFile(EMPTY_IMPORT_MESSAGE).isDisplayed());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Import asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Drop json file and delete it")
public void addFileToImportAndRemove() {
sideBarMenuView.openAssetProfiles();
profilesPage.openImportAssetProfileView();
@@ -93,8 +101,10 @@ public class CreateAssetProfileImportTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entityIsNotPresent(IMPORT_ASSET_PROFILE_NAME));
}
+ @Epic("Asset profiles smoke")
+ @Feature("Import asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Import asset profile with same name")
public void importAssetProfileWithSameName() {
String name = IMPORT_ASSET_PROFILE_NAME;
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
@@ -111,8 +121,10 @@ public class CreateAssetProfileImportTest extends AbstractDriverBaseTest {
Assert.assertEquals(profilesPage.warningMessage().getText(), SAME_NAME_WARNING_ASSET_PROFILE_MESSAGE);
}
+ @Epic("Asset profiles smoke")
+ @Feature("Import asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Import asset profile without refresh")
public void importAssetProfileWithoutRefresh() {
sideBarMenuView.openAssetProfiles();
profilesPage.openImportAssetProfileView();
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/CreateAssetProfileTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/CreateAssetProfileTest.java
index cb7d70f33f..bc5b04cd43 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/CreateAssetProfileTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/CreateAssetProfileTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -52,8 +54,10 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Asset profiles smoke")
+ @Feature("Create asset profile")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Add asset profile after specifying the name (text/numbers /special characters)")
public void createAssetProfile() {
String name = ENTITY_NAME + random();
@@ -68,8 +72,10 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entity(name).isDisplayed());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Create asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Add asset profile after specifying the name with details")
public void createAssetProfileWithDetails() {
String name = ENTITY_NAME + random();
String ruleChain = "Root Rule Chain";
@@ -103,8 +109,10 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
Assert.assertEquals(description, profilesPage.getDescription());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Create asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Create asset profile with the same name")
public void createAssetProfileWithSameName() {
String name = ENTITY_NAME + random();
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
@@ -122,8 +130,10 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.addAssetProfileView().isDisplayed());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Create asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Add asset profile without the name")
public void createAssetProfileWithoutName() {
sideBarMenuView.openAssetProfiles();
profilesPage.openCreateAssetProfileView();
@@ -131,8 +141,10 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
Assert.assertFalse(profilesPage.addBtnV().isEnabled());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Create asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Create asset profile only with spase in name")
public void createAssetProfileWithOnlySpaceInName() {
sideBarMenuView.openAssetProfiles();
profilesPage.openCreateAssetProfileView();
@@ -146,8 +158,10 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.addAssetProfileView().isDisplayed());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Create asset profile")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Add asset profile after specifying the name (text/numbers /special characters) without refresh")
public void createAssetProfileWithoutRefresh() {
String name = ENTITY_NAME + random();
@@ -161,15 +175,17 @@ public class CreateAssetProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entity(name).isDisplayed());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Create asset profile")
@Test(priority = 40, groups = "smoke")
- @Description
+ @Description("Go to asset profile documentation page")
public void documentation() {
String urlPath = "docs/user-guide/asset-profiles/";
sideBarMenuView.openAssetProfiles();
- profilesPage.allEntity().get(0).click();
+ profilesPage.profileNames().get(0).click();
profilesPage.goToProfileHelpPage();
- Assert.assertTrue(urlContains(urlPath));
+ Assert.assertTrue(urlContains(urlPath), "URL not contains " + urlPath);
}
}
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/DeleteAssetProfileTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/DeleteAssetProfileTest.java
index 1525849df7..8241685a25 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/DeleteAssetProfileTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/DeleteAssetProfileTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -40,8 +42,10 @@ public class DeleteAssetProfileTest extends AbstractDriverBaseTest {
profilesPage = new ProfilesPageHelper(driver);
}
+ @Epic("Asset profiles smoke")
+ @Feature("Delete one asset profile")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove the asset profile by clicking on the trash icon in the right side of asset profile")
public void removeAssetProfile() {
String name = ENTITY_NAME + random();
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
@@ -54,8 +58,10 @@ public class DeleteAssetProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entityIsNotPresent(name));
}
+ @Epic("Asset profiles smoke")
+ @Feature("Delete one asset profile")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove the asset profile by clicking on the 'Delete asset profile' btn in the entity view")
public void removeAssetProfileFromView() {
String name = ENTITY_NAME + random();
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
@@ -69,8 +75,10 @@ public class DeleteAssetProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entityIsNotPresent(name));
}
+ @Epic("Asset profiles smoke")
+ @Feature("Delete one asset profile")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove asset profile by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
public void removeSelectedAssetProfile() {
String name = ENTITY_NAME + random();
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
@@ -84,16 +92,20 @@ public class DeleteAssetProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entityIsNotPresent(name));
}
+ @Epic("Asset profiles smoke")
+ @Feature("Delete one asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the default asset profile by clicking on the trash icon in the right side of asset profile")
public void removeDefaultAssetProfile() {
sideBarMenuView.openAssetProfiles();
Assert.assertFalse(profilesPage.deleteBtn("default").isEnabled());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Delete one asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the Default asset profile by clicking on the 'Delete asset profile' btn in the entity view")
public void removeDefaultAssetProfileFromView() {
sideBarMenuView.openAssetProfiles();
profilesPage.entity("default").click();
@@ -101,8 +113,10 @@ public class DeleteAssetProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.deleteAssetProfileFromViewBtnIsNotDisplayed());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Delete one asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the default asset profile by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
public void removeSelectedDefaultAssetProfile() {
sideBarMenuView.openAssetProfiles();
@@ -110,8 +124,10 @@ public class DeleteAssetProfileTest extends AbstractDriverBaseTest {
Assert.assertFalse(profilesPage.presentCheckBox("default").isDisplayed());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Delete one asset profile")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Remove the asset profile by clicking on the trash icon in the right side of asset profile without refresh")
public void removeAssetProfileWithoutRefresh() {
String name = ENTITY_NAME + random();
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/DeleteSeveralAssetProfilesTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/DeleteSeveralAssetProfilesTest.java
index 40436c6ea0..ffed0483c0 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/DeleteSeveralAssetProfilesTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/DeleteSeveralAssetProfilesTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -39,8 +41,10 @@ public class DeleteSeveralAssetProfilesTest extends AbstractDriverBaseTest {
profilesPage = new ProfilesPageHelper(driver);
}
+ @Epic("Asset profiles smoke")
+ @Feature("Delete several asset profile")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove several asset profiles by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
public void canDeleteSeveralAssetProfilesByTopBtn() {
String name1 = ENTITY_NAME + random() + "1";
String name2 = ENTITY_NAME + random() + "2";
@@ -57,8 +61,11 @@ public class DeleteSeveralAssetProfilesTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.profileIsNotPresent(name2));
}
+ @Epic("Asset profiles smoke")
+ @Feature("Delete several asset profile")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove several asset profiles by mark all the asset profiles on the page by clicking in the topmost " +
+ "checkbox and then clicking on the trash icon in the menu that appears")
public void selectAllDAssetProfiles() {
String name1 = ENTITY_NAME + random() + "1";
String name2 = ENTITY_NAME + random() +"2";
@@ -75,8 +82,11 @@ public class DeleteSeveralAssetProfilesTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.profileIsNotPresent(name2));
}
+ @Epic("Asset profiles smoke")
+ @Feature("Delete several asset profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the default asset profile by mark all the asset profiles on the page by clicking in the " +
+ "topmost checkbox and then clicking on the trash icon in the menu that appears")
public void removeDefaultAssetProfile() {
sideBarMenuView.openAssetProfiles();
profilesPage.selectAllCheckBox().click();
@@ -85,8 +95,11 @@ public class DeleteSeveralAssetProfilesTest extends AbstractDriverBaseTest {
Assert.assertFalse(profilesPage.deleteBtn("default").isEnabled());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Delete several asset profile")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Remove several asset profiles by mark in the checkbox and then click on the trash can icon in the menu " +
+ "that appears at the top without refresh")
public void deleteSeveralAssetProfilesByTopBtnWithoutRefresh() {
String name1 = ENTITY_NAME + random() + "1";
String name2 = ENTITY_NAME + random() + "2";
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/MakeAssetProfileDefaultTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/MakeAssetProfileDefaultTest.java
index 761c390338..c7c56d197b 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/MakeAssetProfileDefaultTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/MakeAssetProfileDefaultTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -47,8 +49,10 @@ public class MakeAssetProfileDefaultTest extends AbstractDriverBaseTest {
testRestClient.deleteAssetProfile(getAssetProfileByName(name).getId());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Make asset profile default")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Make asset profile default by clicking on the 'Make asset profile default' icon in the right corner")
public void makeDeviceProfileDefaultByRightCornerBtn() {
String name = ENTITY_NAME + random();
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
@@ -61,8 +65,10 @@ public class MakeAssetProfileDefaultTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.defaultCheckbox(name).isDisplayed());
}
+ @Epic("Asset profiles smoke")
+ @Feature("Make asset profile default")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Make asset profile default by clicking on the 'Make asset profile default' button in the entity view")
public void makeDeviceProfileDefaultFromView() {
String name = ENTITY_NAME + random();
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/SearchAssetProfileTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/SearchAssetProfileTest.java
index 16de1924e7..3197c56d50 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/SearchAssetProfileTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/SearchAssetProfileTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -48,8 +50,11 @@ public class SearchAssetProfileTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Asset profiles smoke")
+ @Feature("Search asset profile")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "assetProfileSearch")
- @Description
+ @Description("Search asset profile by first word in the name/Search asset profile by second word in the name/" +
+ "Search asset profile by symbol in the name/Search asset profile by number in the name")
public void searchFirstWord(String name, String namePath) {
testRestClient.postAssetProfile(EntityPrototypes.defaultAssetProfile(name));
this.name = name;
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/SortByNameTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/SortByNameTest.java
index 6104e80e80..b5cf7a97d9 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/SortByNameTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/assetProfileSmoke/SortByNameTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.assetProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -48,8 +50,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Asset profiles smoke")
+ @Feature("Sort by name")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
- @Description
+ @Description("Sort asset profile 'UP'")
public void specialCharacterUp(String name) {
testRestClient.postAssetProfile(defaultAssetProfile(name));
this.name = name;
@@ -61,8 +65,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
Assert.assertEquals(profilesPage.getProfileName(), name);
}
+ @Epic("Asset profiles smoke")
+ @Feature("Sort by name")
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
- @Description
+ @Description("Sort asset profile 'UP'")
public void allSortUp(String assetProfile, String assetProfileSymbol, String assetProfileNumber) {
testRestClient.postAssetProfile(defaultAssetProfile(assetProfileSymbol));
testRestClient.postAssetProfile(defaultAssetProfile(assetProfile));
@@ -86,8 +92,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
Assert.assertEquals(thirdAssetProfile, assetProfile);
}
+ @Epic("Asset profiles smoke")
+ @Feature("Sort by name")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
- @Description
+ @Description("Sort asset profile 'DAWN'")
public void specialCharacterDown(String name) {
testRestClient.postAssetProfile(defaultAssetProfile(name));
this.name = name;
@@ -99,8 +107,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
Assert.assertEquals(profilesPage.getProfileName(), name);
}
+ @Epic("Asset profiles smoke")
+ @Feature("Sort by name")
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
- @Description
+ @Description("Sort asset profile 'DOWN'")
public void allSortDown(String assetProfile, String assetProfileSymbol, String assetProfileNumber) {
testRestClient.postAssetProfile(defaultAssetProfile(assetProfileSymbol));
testRestClient.postAssetProfile(defaultAssetProfile(assetProfile));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CreateCustomerTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CreateCustomerTest.java
index b0659ac328..81fcd6a020 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CreateCustomerTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CreateCustomerTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.openqa.selenium.Keys;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
@@ -52,8 +54,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Customers smoke tests")
+ @Feature("Create customer")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Add customer specifying the name (text/numbers /special characters)")
public void createCustomer() {
String customerName = ENTITY_NAME + random();
@@ -68,8 +72,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
Assert.assertTrue(customerPage.customer(customerName).isDisplayed());
}
+ @Epic("Customers smoke tests")
+ @Feature("Create customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Add customer after specifying the name (text/numbers /special characters) with full information")
public void createCustomerWithFullInformation() {
String customerName = ENTITY_NAME + random();
String text = "Text";
@@ -112,8 +118,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
Assert.assertEquals(customerPage.getCustomerCity(), text);
}
+ @Epic("Customers smoke tests")
+ @Feature("Create customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Add customer without the name")
public void createCustomerWithoutName() {
sideBarMenuView.customerBtn().click();
customerPage.plusBtn().click();
@@ -121,8 +129,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
Assert.assertFalse(customerPage.addBtnV().isEnabled());
}
+ @Epic("Customers smoke tests")
+ @Feature("Create customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Create customer only with spase in name")
public void createCustomerWithOnlySpace() {
sideBarMenuView.customerBtn().click();
customerPage.plusBtn().click();
@@ -136,8 +146,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
Assert.assertTrue(customerPage.addEntityView().isDisplayed());
}
+ @Epic("Customers smoke tests")
+ @Feature("Create customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Create a customer with the same name")
public void createCustomerSameName() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
@@ -153,8 +165,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
Assert.assertTrue(customerPage.addEntityView().isDisplayed());
}
+ @Epic("Customers smoke tests")
+ @Feature("Create customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Add customer specifying the name (text/numbers /special characters) without refresh")
public void createCustomerWithoutRefresh() {
String customerName = ENTITY_NAME + random();
@@ -168,8 +182,10 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
Assert.assertTrue(customerPage.customer(customerName).isDisplayed());
}
+ @Epic("Customers smoke tests")
+ @Feature("Create customer")
@Test(priority = 40, groups = "smoke")
- @Description
+ @Description("Go to customer documentation page")
public void documentation() {
String urlPath = "docs/user-guide/ui/customers/";
@@ -178,6 +194,6 @@ public class CreateCustomerTest extends AbstractDriverBaseTest {
customerPage.customer(customerPage.getCustomerName()).click();
customerPage.goToHelpPage();
- Assert.assertTrue(urlContains(urlPath));
+ Assert.assertTrue(urlContains(urlPath), "URL contains " + urlPath);
}
}
\ No newline at end of file
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CustomerEditMenuTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CustomerEditMenuTest.java
index c47ae92468..c07e450bc4 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CustomerEditMenuTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/CustomerEditMenuTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -63,13 +65,15 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
@BeforeMethod
public void reLogin() {
- if (getUrl().contains("/login")) {
+ if (getJwtTokenFromLocalStorage() == null) {
loginPage.authorizationTenant();
}
}
+ @Epic("Customers smoke tests")
+ @Feature("Edit customer")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Change title by edit menu")
public void changeTitle() {
String customerName = "Changed" + getRandomNumber();
testRestClient.postCustomer(defaultCustomerPrototype(ENTITY_NAME + random()));
@@ -89,8 +93,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
Assert.assertEquals(titleAfter, customerName);
}
+ @Epic("Customers smoke tests")
+ @Feature("Edit customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Delete title and save")
public void deleteTitle() {
sideBarMenuView.customerBtn().click();
customerPage.entityTitles().get(0).click();
@@ -100,8 +106,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
Assert.assertFalse(customerPage.doneBtnEditViewVisible().isEnabled());
}
+ @Epic("Customers smoke tests")
+ @Feature("Edit customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Save only with space in title")
public void saveOnlyWithSpace() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
@@ -117,8 +125,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
Assert.assertEquals(customerPage.getCustomerName(), customerPage.getHeaderName());
}
+ @Epic("Customers smoke tests")
+ @Feature("Edit customer")
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "editMenuDescription")
- @Description
+ @Description("Write the description and save the changes/Change the description and save the changes/Delete the description and save the changes")
public void editDescription(String description, String newDescription, String finalDescription) {
String name = ENTITY_NAME + random();
testRestClient.postCustomer(EntityPrototypes.defaultCustomerPrototype(name, description));
@@ -134,8 +144,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
Assert.assertEquals(customerPage.getDescription(), finalDescription);
}
+ @Epic("Customers smoke tests")
+ @Feature("Edit customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Assigned dashboard from dashboards page")
public void assignedDashboardFromDashboard() {
String customerName = ENTITY_NAME + random();
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
@@ -147,22 +159,24 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
dashboardPage.assignedCustomer(customerName);
sideBarMenuView.customerBtn().click();
customerPage.entity(customerName).click();
- customerPage.editPencilBtn().click();
- customerPage.chooseDashboard();
+ jsClick(customerPage.editPencilBtn());
+ customerPage.chooseDashboard(dashboardPage.getDashboardTitle());
customerPage.doneBtnEditView().click();
customerPage.setDashboardFromView();
customerPage.closeEntityViewBtn().click();
- customerPage.manageCustomersUserBtn(customerName).click();
+ jsClick(customerPage.manageCustomersUserBtn(customerName));
customerPage.createCustomersUser();
- customerPage.userLoginBtn().click();
+ jsClick(customerPage.userLoginBtn());
Assert.assertNotNull(customerPage.usersWidget());
Assert.assertTrue(customerPage.usersWidget().isDisplayed());
Assert.assertEquals(customerPage.getDashboardFromView(), dashboardPage.getDashboardTitle());
}
+ @Epic("Customers smoke tests")
+ @Feature("Edit customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Assigned dashboard")
public void assignedDashboard() {
String customerName = ENTITY_NAME + random();
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
@@ -173,22 +187,24 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
customerPage.assignedDashboard();
sideBarMenuView.customerBtn().click();
customerPage.entity(customerName).click();
- customerPage.editPencilBtn().click();
- customerPage.chooseDashboard();
+ jsClick(customerPage.editPencilBtn());
+ customerPage.chooseDashboard(customerPage.getDashboard());
customerPage.doneBtnEditView().click();
customerPage.setDashboardFromView();
customerPage.closeEntityViewBtn().click();
- customerPage.manageCustomersUserBtn(customerName).click();
+ jsClick(customerPage.manageCustomersUserBtn(customerName));
customerPage.createCustomersUser();
- customerPage.userLoginBtn().click();
+ jsClick(customerPage.userLoginBtn());
Assert.assertNotNull(customerPage.usersWidget());
Assert.assertTrue(customerPage.usersWidget().isDisplayed());
Assert.assertEquals(customerPage.getDashboard(), customerPage.getDashboardFromView());
}
+ @Epic("Customers smoke tests")
+ @Feature("Edit customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Assigned dashboard without hide")
public void assignedDashboardWithoutHide() {
String customerName = ENTITY_NAME + random();
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
@@ -199,15 +215,15 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
customerPage.assignedDashboard();
sideBarMenuView.customerBtn().click();
customerPage.entity(customerName).click();
- customerPage.editPencilBtn().click();
- customerPage.chooseDashboard();
+ jsClick(customerPage.editPencilBtn());
+ customerPage.chooseDashboard(customerPage.getDashboard());
customerPage.hideHomeDashboardToolbarCheckbox().click();
customerPage.doneBtnEditView().click();
customerPage.setDashboardFromView();
customerPage.closeEntityViewBtn().click();
- customerPage.manageCustomersUserBtn(customerName).click();
+ jsClick(customerPage.manageCustomersUserBtn(customerName));
customerPage.createCustomersUser();
- customerPage.userLoginBtn().click();
+ jsClick(customerPage.userLoginBtn());
Assert.assertNotNull(customerPage.usersWidget());
Assert.assertTrue(customerPage.usersWidget().isDisplayed());
@@ -220,8 +236,10 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
Assert.assertTrue(customerPage.timeBtn().isDisplayed());
}
+ @Epic("Customers smoke tests")
+ @Feature("Edit customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Add phone number")
public void addPhoneNumber() {
String customerName = ENTITY_NAME + random();
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
@@ -237,24 +255,26 @@ public class CustomerEditMenuTest extends AbstractDriverBaseTest {
Assert.assertTrue(customerPage.phoneNumberEntityView().getAttribute("value").contains(number));
}
+ @Epic("Customers smoke tests")
+ @Feature("Edit customer")
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "incorrectPhoneNumber")
- @Description
+ @Description("Add incorrect phone number")
public void addIncorrectPhoneNumber(String number) {
sideBarMenuView.customerBtn().click();
customerPage.entityTitles().get(0).click();
customerPage.editPencilBtn().click();
- customerPage.phoneNumberEntityView().sendKeys(number);
- boolean doneBtnIsEnable = customerPage.doneBtnEditViewVisible().isEnabled();
- customerPage.doneBtnEditViewVisible().click();
+ customerPage.enterPhoneNumber(number);
- Assert.assertFalse(doneBtnIsEnable);
+ Assert.assertFalse(customerPage.doneBtnEditViewVisible().isEnabled());
Assert.assertNotNull(customerPage.errorMessage());
Assert.assertTrue(customerPage.errorMessage().isDisplayed());
Assert.assertEquals(customerPage.errorMessage().getText(), PHONE_NUMBER_ERROR_MESSAGE);
}
+ @Epic("Customers smoke tests")
+ @Feature("Edit customer")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Add all information")
public void addAllInformation() {
String customerName = ENTITY_NAME + random();
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/DeleteCustomerTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/DeleteCustomerTest.java
index 3f535ce113..6421c30c31 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/DeleteCustomerTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/DeleteCustomerTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -43,8 +45,10 @@ public class DeleteCustomerTest extends AbstractDriverBaseTest {
ruleChainsPage = new RuleChainsPageHelper(driver);
}
+ @Epic("Customers smoke tests")
+ @Feature("Delete customer")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove the customer by clicking on the trash icon in the right side of refresh")
public void removeCustomerByRightSideBtn() {
String customer = ENTITY_NAME + random();
testRestClient.postCustomer(defaultCustomerPrototype(customer));
@@ -56,8 +60,10 @@ public class DeleteCustomerTest extends AbstractDriverBaseTest {
Assert.assertTrue(customerPage.entityIsNotPresent(deletedCustomer));
}
+ @Epic("Customers smoke tests")
+ @Feature("Delete customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove customer by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
public void removeSelectedCustomer() {
String customerName = ENTITY_NAME + random();
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
@@ -69,23 +75,27 @@ public class DeleteCustomerTest extends AbstractDriverBaseTest {
Assert.assertTrue(ruleChainsPage.entityIsNotPresent(deletedCustomer));
}
+ @Epic("Customers smoke tests")
+ @Feature("Delete customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the customer by clicking on the 'Delete customer' btn in the entity view")
public void removeFromCustomerView() {
String customerName = ENTITY_NAME + random();
testRestClient.postCustomer(defaultCustomerPrototype(customerName));
sideBarMenuView.customerBtn().click();
customerPage.entity(customerName).click();
- customerPage.customerViewDeleteBtn().click();
+ jsClick(customerPage.customerViewDeleteBtn());
customerPage.warningPopUpYesBtn().click();
- customerPage.refreshBtn().click();
+ jsClick(customerPage.refreshBtn());
Assert.assertTrue(customerPage.entityIsNotPresent(customerName));
}
+ @Epic("Customers smoke tests")
+ @Feature("Delete customer")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the customer by clicking on the trash icon in the right side of customer without refresh")
public void removeCustomerByRightSideBtnWithoutRefresh() {
String customer = ENTITY_NAME + random();
testRestClient.postCustomer(defaultCustomerPrototype(customer));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/DeleteSeveralCustomerTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/DeleteSeveralCustomerTest.java
index 635505b64a..be3e9b65ed 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/DeleteSeveralCustomerTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/DeleteSeveralCustomerTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -40,8 +42,10 @@ public class DeleteSeveralCustomerTest extends AbstractDriverBaseTest {
customerPage = new CustomerPageHelper(driver);
}
+ @Epic("Customers smoke tests")
+ @Feature("Delete several customer")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove several customers by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
public void canDeleteSeveralCustomersByTopBtn() {
String title1 = ENTITY_NAME + random() + "1";
String title2 = ENTITY_NAME + random() + "2";
@@ -49,29 +53,33 @@ public class DeleteSeveralCustomerTest extends AbstractDriverBaseTest {
testRestClient.postCustomer(defaultCustomerPrototype(title2));
sideBarMenuView.customerBtn().click();
- customerPage.clickOnCheckBoxes(2);
- customerPage.deleteSelectedBtn().click();
- customerPage.warningPopUpYesBtn().click();
+ customerPage.deleteSelected(2);
customerPage.refreshBtn().click();
Assert.assertTrue(customerPage.customerIsNotPresent(title1));
Assert.assertTrue(customerPage.customerIsNotPresent(title2));
}
+ @Epic("Customers smoke tests")
+ @Feature("Delete several customer")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove several customers by mark all the Customers on the page by clicking in the topmost checkbox " +
+ "and then clicking on the trash icon in the menu that appears")
public void selectAllCustomers() {
sideBarMenuView.customerBtn().click();
customerPage.selectAllCheckBox().click();
- customerPage.deleteSelectedBtn().click();
+ jsClick(customerPage.deleteSelectedBtn());
Assert.assertNotNull(customerPage.warningPopUpTitle());
Assert.assertTrue(customerPage.warningPopUpTitle().isDisplayed());
Assert.assertTrue(customerPage.warningPopUpTitle().getText().contains(String.valueOf(customerPage.markCheckbox().size())));
}
+ @Epic("Customers smoke tests")
+ @Feature("Delete several customer")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Remove several customers by mark in the checkbox and then click on the trash can icon in the menu " +
+ "that appears at the top without refresh")
public void deleteSeveralCustomersByTopBtnWithoutRefresh() {
String title1 = ENTITY_NAME + random() + "1";
String title2 = ENTITY_NAME + random() + "2";
@@ -79,9 +87,7 @@ public class DeleteSeveralCustomerTest extends AbstractDriverBaseTest {
testRestClient.postCustomer(defaultCustomerPrototype(title2));
sideBarMenuView.customerBtn().click();
- customerPage.clickOnCheckBoxes(2);
- customerPage.deleteSelectedBtn().click();
- customerPage.warningPopUpYesBtn().click();
+ customerPage.deleteSelected(2);
Assert.assertTrue(customerPage.customerIsNotPresent(title1));
Assert.assertTrue(customerPage.customerIsNotPresent(title2));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersAssetsTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersAssetsTest.java
index 405a028a15..13555aad01 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersAssetsTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersAssetsTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -37,8 +39,10 @@ public class ManageCustomersAssetsTest extends AbstractDriverBaseTest {
customerPage = new CustomerPageHelper(driver);
}
+ @Epic("Customers smoke tests")
+ @Feature("Manage customer assets")
@Test(groups = "smoke")
- @Description
+ @Description("Open manage window by right corner btn")
public void openWindowByRightCornerBtn() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
@@ -50,13 +54,15 @@ public class ManageCustomersAssetsTest extends AbstractDriverBaseTest {
Assert.assertTrue(customerPage.customerManageWindowIconHead().getText().contains(manage));
}
+ @Epic("Customers smoke tests")
+ @Feature("Manage customer assets")
@Test(groups = "smoke")
- @Description
+ @Description("Open manage window by btn in entity view")
public void openWindowByView() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
customerPage.entity(customerPage.getCustomerName()).click();
- customerPage.manageCustomersAssetsBtnView().click();
+ jsClick(customerPage.manageCustomersAssetsBtnView());
Assert.assertTrue(urlContains(manage.toLowerCase()));
Assert.assertNotNull(customerPage.customerAssetsIconHeader());
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersDashboardsTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersDashboardsTest.java
index f1f27c96cf..670fbd941a 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersDashboardsTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersDashboardsTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -36,8 +38,10 @@ public class ManageCustomersDashboardsTest extends AbstractDriverBaseTest {
customerPage = new CustomerPageHelper(driver);
}
+ @Epic("Customers smoke tests")
+ @Feature("Manage customer dashboards")
@Test(groups = "smoke")
- @Description
+ @Description("Open manage window by right corner btn")
public void openWindowByRightCornerBtn() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
@@ -49,13 +53,15 @@ public class ManageCustomersDashboardsTest extends AbstractDriverBaseTest {
Assert.assertTrue(customerPage.customerManageWindowIconHead().getText().contains(manage));
}
+ @Epic("Customers smoke tests")
+ @Feature("Manage customer dashboards")
@Test(groups = "smoke")
- @Description
+ @Description("Open manage window by btn in entity view")
public void openWindowByView() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
customerPage.entity(customerPage.getCustomerName()).click();
- customerPage.manageCustomersDashboardsBtnView().click();
+ jsClick(customerPage.manageCustomersDashboardsBtnView());
Assert.assertTrue(urlContains(manage.toLowerCase()));
Assert.assertNotNull(customerPage.customerDashboardIconHeader());
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersDevicesTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersDevicesTest.java
index fde5b87e52..bb5fe0d41a 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersDevicesTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersDevicesTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -36,8 +38,10 @@ public class ManageCustomersDevicesTest extends AbstractDriverBaseTest {
customerPage = new CustomerPageHelper(driver);
}
+ @Epic("Customers smoke tests")
+ @Feature("Manage customer devices")
@Test(groups = "smoke")
- @Description
+ @Description("Open manage window by right corner btn")
public void openWindowByRightCornerBtn() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
@@ -49,13 +53,15 @@ public class ManageCustomersDevicesTest extends AbstractDriverBaseTest {
Assert.assertTrue(customerPage.customerManageWindowIconHead().getText().contains(manage));
}
+ @Epic("Customers smoke tests")
+ @Feature("Manage customer devices")
@Test(groups = "smoke")
- @Description
+ @Description("Open manage window by btn in entity view")
public void openWindowByView() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
customerPage.entity(customerPage.getCustomerName()).click();
- customerPage.manageCustomersDeviceBtnView().click();
+ jsClick(customerPage.manageCustomersDeviceBtnView());
Assert.assertTrue(urlContains(manage.toLowerCase()));
Assert.assertNotNull(customerPage.customerDevicesIconHeader());
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersEdgesTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersEdgesTest.java
index 184f506584..5a34d106c6 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersEdgesTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersEdgesTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -37,8 +39,10 @@ public class ManageCustomersEdgesTest extends AbstractDriverBaseTest {
customerPage = new CustomerPageHelper(driver);
}
+ @Epic("Customers smoke tests")
+ @Feature("Manage customer edges")
@Test(groups = "smoke")
- @Description
+ @Description("Open manage window by right corner btn")
public void openWindowByRightCornerBtn() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
@@ -50,13 +54,15 @@ public class ManageCustomersEdgesTest extends AbstractDriverBaseTest {
Assert.assertTrue(customerPage.customerManageWindowIconHead().getText().contains(iconText));
}
+ @Epic("Customers smoke tests")
+ @Feature("Manage customer edges")
@Test(groups = "smoke")
- @Description
+ @Description("Open manage window by btn in entity view")
public void openWindowByView() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
customerPage.entity(customerPage.getCustomerName()).click();
- customerPage.manageCustomersEdgeBtnView().click();
+ jsClick(customerPage.manageCustomersEdgeBtnView());
Assert.assertTrue(urlContains("edgeInstances"));
Assert.assertNotNull(customerPage.customerEdgeIconHeader());
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersUsersTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersUsersTest.java
index 9b8a7b8eef..9fe16410ec 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersUsersTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/ManageCustomersUsersTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -37,12 +39,14 @@ public class ManageCustomersUsersTest extends AbstractDriverBaseTest {
customerPage = new CustomerPageHelper(driver);
}
+ @Epic("Customers smoke tests")
+ @Feature("Manage customer users")
@Test(groups = "smoke")
- @Description
+ @Description("Open manage window by right corner btn")
public void openWindowByRightCornerBtn() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
- customerPage.manageCustomersUserBtn(customerPage.getCustomerName()).click();
+ jsClick(customerPage.manageCustomersUserBtn(customerPage.getCustomerName()));
Assert.assertTrue(urlContains("user"));
Assert.assertNotNull(customerPage.customerUserIconHeader());
@@ -50,13 +54,15 @@ public class ManageCustomersUsersTest extends AbstractDriverBaseTest {
Assert.assertTrue(customerPage.customerManageWindowIconHead().getText().contains(iconText));
}
+ @Epic("Customers smoke tests")
+ @Feature("Manage customer users")
@Test(groups = "smoke")
- @Description
+ @Description("Open manage window by btn in entity view")
public void openWindowByView() {
sideBarMenuView.customerBtn().click();
customerPage.setCustomerName();
customerPage.entity(customerPage.getCustomerName()).click();
- customerPage.manageCustomersUserBtnView().click();
+ jsClick(customerPage.manageCustomersUserBtnView());
Assert.assertTrue(urlContains("user"));
Assert.assertNotNull(customerPage.customerUserIconHeader());
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/SearchCustomerTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/SearchCustomerTest.java
index 2ff2a6fef9..8e317073d0 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/SearchCustomerTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/SearchCustomerTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -39,8 +41,10 @@ public class SearchCustomerTest extends AbstractDriverBaseTest {
customerPage = new CustomerPageHelper(driver);
}
+ @Epic("Customers smoke tests")
+ @Feature("Search customer")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "customerNameForSearchByFirstAndSecondWord")
- @Description
+ @Description("Search customer by first word in the name/*CHANGE TESTCASE*")
public void searchFirstWord(String namePath) {
sideBarMenuView.customerBtn().click();
customerPage.searchEntity(namePath);
@@ -48,8 +52,10 @@ public class SearchCustomerTest extends AbstractDriverBaseTest {
customerPage.allEntity().forEach(x -> Assert.assertTrue(x.getText().contains(namePath)));
}
+ @Epic("Customers smoke tests")
+ @Feature("Search customer")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSearchBySymbolAndNumber")
- @Description
+ @Description("Search customer by symbol in the name/Search customer by number in the name")
public void searchNumber(String name, String namePath) {
testRestClient.postCustomer(defaultCustomerPrototype(name));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/SortByNameTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/SortByNameTest.java
index 296ab2c847..f60e7997a4 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/SortByNameTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/customerSmoke/SortByNameTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.customerSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -48,8 +50,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Customers smoke tests")
+ @Feature("Sort customers by name")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
- @Description
+ @Description("Sort customers 'UP'")
public void specialCharacterUp(String title) {
testRestClient.postCustomer(defaultCustomerPrototype(title));
this.customerName = title;
@@ -61,8 +65,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
Assert.assertEquals(customerPage.getCustomerName(), title);
}
+ @Epic("Customers smoke tests")
+ @Feature("Sort customers by name")
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
- @Description
+ @Description("Sort customers 'UP'")
public void allSortUp(String customer, String customerSymbol, String customerNumber) {
testRestClient.postCustomer(defaultCustomerPrototype(customerSymbol));
testRestClient.postCustomer(defaultCustomerPrototype(customer));
@@ -86,8 +92,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
Assert.assertEquals(thirdCustomer, customer);
}
+ @Epic("Customers smoke tests")
+ @Feature("Sort customers by name")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
- @Description
+ @Description("Sort customers 'DOWN'")
public void specialCharacterDown(String title) {
testRestClient.postCustomer(defaultCustomerPrototype(title));
customerName = title;
@@ -99,8 +107,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
Assert.assertEquals(customerPage.getCustomerName(), title);
}
+ @Epic("Customers smoke tests")
+ @Feature("Sort customers by name")
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
- @Description
+ @Description("Sort customers 'DOWN'")
public void allSortDown(String customer, String customerSymbol, String customerNumber) {
testRestClient.postCustomer(defaultCustomerPrototype(customerSymbol));
testRestClient.postCustomer(defaultCustomerPrototype(customer));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileImportTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileImportTest.java
index 1c530d33ad..436f19c3d4 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileImportTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileImportTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -55,8 +57,10 @@ public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Device profile smoke tests")
+ @Feature("Create device profile")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Import device profile")
public void importDeviceProfile() {
sideBarMenuView.openDeviceProfiles();
profilesPage.openImportDeviceProfileView();
@@ -69,8 +73,10 @@ public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entity(IMPORT_DEVICE_PROFILE_NAME).isDisplayed());
}
+ @Epic("Device profile smoke tests")
+ @Feature("Create device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Import txt file")
public void importTxtFile() {
sideBarMenuView.openDeviceProfiles();
profilesPage.openImportDeviceProfileView();
@@ -80,8 +86,10 @@ public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.importingFile(EMPTY_IMPORT_MESSAGE).isDisplayed());
}
+ @Epic("Device profile smoke tests")
+ @Feature("Create device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Drop json file and delete it")
public void addFileTiImportAndRemove() {
sideBarMenuView.openDeviceProfiles();
profilesPage.openImportDeviceProfileView();
@@ -93,8 +101,10 @@ public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entityIsNotPresent(IMPORT_DEVICE_PROFILE_NAME));
}
+ @Epic("Device profile smoke tests")
+ @Feature("Create device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Import device profile with same name")
public void importDeviceProfileWithSameName() {
String name = IMPORT_DEVICE_PROFILE_NAME;
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
@@ -111,8 +121,10 @@ public class CreateDeviceProfileImportTest extends AbstractDriverBaseTest {
Assert.assertEquals(profilesPage.warningMessage().getText(), SAME_NAME_WARNING_DEVICE_PROFILE_MESSAGE);
}
+ @Epic("Device profile smoke tests")
+ @Feature("Create device profile")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Import device profile without refresh")
public void importDeviceProfileWithoutRefresh() {
sideBarMenuView.openDeviceProfiles();
profilesPage.openImportDeviceProfileView();
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileTest.java
index b983b7fe5f..d5f9791241 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/CreateDeviceProfileTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.openqa.selenium.Keys;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
@@ -54,8 +56,10 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Device profile smoke tests")
+ @Feature("Create device profile")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Add device profile after specifying the name (text/numbers /special characters)")
public void createDeviceProfile() {
String name = ENTITY_NAME + random();
@@ -70,8 +74,10 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entity(name).isDisplayed());
}
+ @Epic("Device profile smoke tests")
+ @Feature("Create device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Add device profile after specifying the name with details")
public void createDeviceProfileWithDetails() {
String name = ENTITY_NAME + random();
String ruleChain = "Root Rule Chain";
@@ -105,8 +111,10 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
Assert.assertEquals(description, profilesPage.getDescription());
}
+ @Epic("Device profile smoke tests")
+ @Feature("Create device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Create a device profile with the same name")
public void createDeviseProfileWithSameName() {
String name = ENTITY_NAME + random();
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
@@ -124,8 +132,10 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.addDeviceProfileView().isDisplayed());
}
+ @Epic("Device profile smoke tests")
+ @Feature("Create device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Add device profile without the name")
public void createDeviceProfileWithoutName() {
sideBarMenuView.openDeviceProfiles();
profilesPage.openCreateDeviceProfileView();
@@ -137,8 +147,10 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
Assert.assertEquals(profilesPage.errorMessage().getText(), NAME_IS_REQUIRED_MESSAGE);
}
+ @Epic("Device profile smoke tests")
+ @Feature("Create device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Create device profile only with spase in name")
public void createDeviseProfileWithOnlySpaceInName() {
sideBarMenuView.openDeviceProfiles();
profilesPage.openCreateDeviceProfileView();
@@ -152,8 +164,10 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.addDeviceProfileView().isDisplayed());
}
+ @Epic("Device profile smoke tests")
+ @Feature("Create device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Add device profile after specifying the name (text/numbers /special characters) without refresh")
public void createDeviceProfileWithoutRefresh() {
String name = ENTITY_NAME + random();
@@ -167,16 +181,18 @@ public class CreateDeviceProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entity(name).isDisplayed());
}
+ @Epic("Device profile smoke tests")
+ @Feature("Create device profile")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Go to device profile documentation page")
public void documentation() {
String urlPath = "docs/user-guide/device-profiles/";
sideBarMenuView.openDeviceProfiles();
- profilesPage.allEntity().get(0).click();
+ profilesPage.profileNames().get(0).click();
profilesPage.goToProfileHelpPage();
- Assert.assertTrue(urlContains(urlPath));
+ Assert.assertTrue(urlContains(urlPath), "URL contains " + urlPath);
}
}
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeleteDeviceProfileTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeleteDeviceProfileTest.java
index 3dd6c2b28d..ccc97b8c94 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeleteDeviceProfileTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeleteDeviceProfileTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -40,8 +42,10 @@ public class DeleteDeviceProfileTest extends AbstractDriverBaseTest {
profilesPage = new ProfilesPageHelper(driver);
}
+ @Epic("Device profile smoke tests")
+ @Feature("Delete one device profile")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove the device profile by clicking on the trash icon in the right side of device profile")
public void removeDeviceProfile() {
String name = ENTITY_NAME + random();
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
@@ -54,8 +58,10 @@ public class DeleteDeviceProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entityIsNotPresent(name));
}
+ @Epic("Device profile smoke tests")
+ @Feature("Delete one device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the device profile by clicking on the 'Delete device profile' btn in the entity view")
public void removeDeviceProfileFromView() {
String name = ENTITY_NAME + random();
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
@@ -69,8 +75,10 @@ public class DeleteDeviceProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entityIsNotPresent(name));
}
+ @Epic("Device profile smoke tests")
+ @Feature("Delete one device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove device profile by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
public void removeSelectedDeviceProfile() {
String name = ENTITY_NAME + random();
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
@@ -84,16 +92,20 @@ public class DeleteDeviceProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.entityIsNotPresent(name));
}
+ @Epic("Device profile smoke tests")
+ @Feature("Delete one device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the default device profile by clicking on the trash icon in the right side of device profile")
public void removeDefaultDeviceProfile() {
sideBarMenuView.openDeviceProfiles();
Assert.assertFalse(profilesPage.deleteBtn("default").isEnabled());
}
+ @Epic("Device profile smoke tests")
+ @Feature("Delete one device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the Default device profile by clicking on the 'Delete device profile' btn in the entity view")
public void removeDefaultDeviceProfileFromView() {
sideBarMenuView.openDeviceProfiles();
profilesPage.entity("default").click();
@@ -101,17 +113,20 @@ public class DeleteDeviceProfileTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.deleteDeviceProfileFromViewBtnIsNotDisplayed());
}
+ @Epic("Device profile smoke tests")
+ @Feature("Delete one device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the default device profile by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
public void removeSelectedDefaultDeviceProfile() {
sideBarMenuView.openDeviceProfiles();
Assert.assertNotNull(profilesPage.presentCheckBox("default"));
Assert.assertFalse(profilesPage.presentCheckBox("default").isDisplayed());
}
-
+ @Epic("Device profile smoke tests")
+ @Feature("Delete one device profile")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Remove the device profile by clicking on the trash icon in the right side of device profile without refresh")
public void removeDeviceProfileWithoutRefresh() {
String name = ENTITY_NAME + random();
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeleteSeveralDeviceProfilesTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeleteSeveralDeviceProfilesTest.java
index 8459474c38..a6b0b4e930 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeleteSeveralDeviceProfilesTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeleteSeveralDeviceProfilesTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -39,8 +41,10 @@ public class DeleteSeveralDeviceProfilesTest extends AbstractDriverBaseTest {
profilesPage = new ProfilesPageHelper(driver);
}
+ @Epic("Device profile smoke tests")
+ @Feature("Delete several device profiles")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove several device profiles by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
public void canDeleteSeveralDeviceProfilesByTopBtn() {
String name1 = ENTITY_NAME + random() + "1";
String name2 = ENTITY_NAME + random() + "2";
@@ -57,8 +61,10 @@ public class DeleteSeveralDeviceProfilesTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.profileIsNotPresent(name2));
}
+ @Epic("Device profile smoke tests")
+ @Feature("Delete several device profiles")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove several device profiles by mark all the device profiles on the page by clicking in the topmost checkbox and then clicking on the trash icon in the menu that appears")
public void selectAllDeviceProfiles() {
sideBarMenuView.openDeviceProfiles();
profilesPage.selectAllCheckBox().click();
@@ -69,8 +75,10 @@ public class DeleteSeveralDeviceProfilesTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.warningPopUpTitle().getText().contains(String.valueOf(profilesPage.markCheckbox().size())));
}
+ @Epic("Device profile smoke tests")
+ @Feature("Delete several device profiles")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the default device profile by mark all the device profiles on the page by clicking in the topmost checkbox and then clicking on the trash icon in the menu that appears")
public void removeDefaultDeviceProfile() {
sideBarMenuView.openDeviceProfiles();
profilesPage.selectAllCheckBox().click();
@@ -79,8 +87,10 @@ public class DeleteSeveralDeviceProfilesTest extends AbstractDriverBaseTest {
Assert.assertFalse(profilesPage.deleteBtn("default").isEnabled());
}
+ @Epic("Device profile smoke tests")
+ @Feature("Delete several device profiles")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Remove several device profiles by mark in the checkbox and then click on the trash can icon in the menu that appears at the top without refresh")
public void deleteSeveralDeviceProfilesByTopBtnWithoutRefresh() {
String name1 = ENTITY_NAME + random() + "1";
String name2 = ENTITY_NAME + random() + "2";
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeviceProfileEditMenuTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeviceProfileEditMenuTest.java
index 9d889f2e54..12a7ed5616 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeviceProfileEditMenuTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/DeviceProfileEditMenuTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.openqa.selenium.Keys;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
@@ -54,8 +56,10 @@ public class DeviceProfileEditMenuTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Device profile smoke tests")
+ @Feature("Edit device profile")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Change name by edit menu")
public void changeName() {
String name = ENTITY_NAME + random();
String newName = "Changed" + getRandomNumber();
@@ -77,8 +81,10 @@ public class DeviceProfileEditMenuTest extends AbstractDriverBaseTest {
Assert.assertEquals(titleAfter, newName);
}
+ @Epic("Device profile smoke tests")
+ @Feature("Edit device profile")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Delete name and save")
public void deleteName() {
String name = ENTITY_NAME + random();
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
@@ -92,8 +98,10 @@ public class DeviceProfileEditMenuTest extends AbstractDriverBaseTest {
Assert.assertFalse(profilesPage.doneBtnEditViewVisible().isEnabled());
}
+ @Epic("Device profile smoke tests")
+ @Feature("Edit device profile")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Save only with space in name")
public void saveWithOnlySpaceInName() {
String name = ENTITY_NAME + random();
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name));
@@ -110,8 +118,10 @@ public class DeviceProfileEditMenuTest extends AbstractDriverBaseTest {
Assert.assertEquals(profilesPage.warningMessage().getText(), EMPTY_DEVICE_PROFILE_MESSAGE);
}
+ @Epic("Device profile smoke tests")
+ @Feature("Edit device profile")
@Test(priority = 30, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "editMenuDescription")
- @Description
+ @Description("Write the description and save the changes/Change the description and save the changes/Delete the description and save the changes")
public void editDescription(String description, String newDescription, String finalDescription) {
String name = ENTITY_NAME + random();
testRestClient.postDeviceProfile(EntityPrototypes.defaultDeviceProfile(name, description));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/MakeDeviceProfileDefaultTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/MakeDeviceProfileDefaultTest.java
index 9ef711eee4..c9b746bdd6 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/MakeDeviceProfileDefaultTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/MakeDeviceProfileDefaultTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -41,8 +43,10 @@ public class MakeDeviceProfileDefaultTest extends AbstractDriverBaseTest {
testRestClient.setDefaultDeviceProfile(getDeviceProfileByName("default").getId());
}
+ @Epic("Device profile smoke tests")
+ @Feature("Make device profile default")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Make device profile default by clicking on the 'Make device profile default' icon in the right corner")
public void makeDeviceProfileDefaultByRightCornerBtn() {
sideBarMenuView.openDeviceProfiles();
profilesPage.setProfileName();
@@ -53,8 +57,10 @@ public class MakeDeviceProfileDefaultTest extends AbstractDriverBaseTest {
Assert.assertTrue(profilesPage.defaultCheckbox(profile).isDisplayed());
}
+ @Epic("Device profile smoke tests")
+ @Feature("Make device profile default")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Make device profile default by clicking on the 'Make device profile default' button in the entity view")
public void makeDeviceProfileDefaultFromView() {
sideBarMenuView.openDeviceProfiles();
profilesPage.setProfileName();
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/SearchDeviceProfileTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/SearchDeviceProfileTest.java
index bb6b82b3a9..8482fa6cbc 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/SearchDeviceProfileTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/SearchDeviceProfileTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -49,8 +51,11 @@ public class SearchDeviceProfileTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Device profiles smoke")
+ @Feature("Search device profile")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "deviceProfileSearch")
- @Description
+ @Description("Search device profile by first word in the name/Search device profile by second word in the name/" +
+ "Search device profile by symbol in the name/Search asset profile by number in the name")
public void searchFirstWord(String name, String namePath) {
testRestClient.postDeviceProfile(defaultDeviceProfile(name));
this.name = name;
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/SortByNameTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/SortByNameTest.java
index a6c1a7b0cf..93dc659f6e 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/SortByNameTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/deviceProfileSmoke/SortByNameTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.deviceProfileSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -48,8 +50,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Device profiles smoke")
+ @Feature("Sort device profile by name")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
- @Description
+ @Description("Sort device profile 'UP'")
public void specialCharacterUp(String name) {
testRestClient.postDeviceProfile(defaultDeviceProfile(name));
this.name = name;
@@ -61,8 +65,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
Assert.assertEquals(profilesPage.getProfileName(), name);
}
+ @Epic("Device profiles smoke")
+ @Feature("Sort device profile by name")
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
- @Description
+ @Description("Sort device profile 'UP'")
public void allSortUp(String deviceProfile, String deviceProfileSymbol, String deviceProfileNumber) {
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfileSymbol));
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfile));
@@ -86,8 +92,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
Assert.assertEquals(thirdDeviceProfile, deviceProfile);
}
+ @Epic("Device profiles smoke")
+ @Feature("Sort device profile by name")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
- @Description
+ @Description("Sort device profile 'DOWN'")
public void specialCharacterDown(String name) {
testRestClient.postDeviceProfile(defaultDeviceProfile(name));
this.name = name;
@@ -99,8 +107,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
Assert.assertEquals(profilesPage.getProfileName(), name);
}
+ @Epic("Device profiles smoke")
+ @Feature("Sort device profile by name")
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
- @Description
+ @Description("Sort device profile 'DOWN'")
public void allSortDown(String deviceProfile, String deviceProfileSymbol, String deviceProfileNumber) {
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfileSymbol));
testRestClient.postDeviceProfile(defaultDeviceProfile(deviceProfile));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/CreateRuleChainImportTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/CreateRuleChainImportTest.java
index 14d3a0a6cd..dd2f8a5895 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/CreateRuleChainImportTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/CreateRuleChainImportTest.java
@@ -16,6 +16,9 @@
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
+import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -58,8 +61,10 @@ public class CreateRuleChainImportTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Import rule chain")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Drop json file")
public void importRuleChain() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openImportRuleChainView();
@@ -69,8 +74,10 @@ public class CreateRuleChainImportTest extends AbstractDriverBaseTest {
Assert.assertTrue(ruleChainsPage.importingFile(IMPORT_RULE_CHAIN_FILE_NAME).isDisplayed());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Import rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Drop json file and delete it")
public void importRuleChainAndDeleteFile() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openImportRuleChainView();
@@ -82,8 +89,10 @@ public class CreateRuleChainImportTest extends AbstractDriverBaseTest {
Assert.assertTrue(ruleChainsPage.entityIsNotPresent(IMPORT_RULE_CHAIN_FILE_NAME));
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Import rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Import txt file")
public void importTxtFile() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openImportRuleChainView();
@@ -93,15 +102,17 @@ public class CreateRuleChainImportTest extends AbstractDriverBaseTest {
Assert.assertTrue(ruleChainsPage.importingFile(EMPTY_IMPORT_MESSAGE).isDisplayed());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Import rule chain")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Import rule chain")
public void importRuleChainAndSave() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openImportRuleChainView();
ruleChainsPage.browseFile().sendKeys(absolutePathToFileImportRuleChain);
ruleChainsPage.importBrowseFileBtn().click();
- openRuleChainPage.doneBtn().click();
- openRuleChainPage.waitUntilDoneBtnDisable();
+ WebElement doneBtn = openRuleChainPage.doneBtn();
+ doneBtn.click();
ruleChainName = IMPORT_RULE_CHAIN_NAME;
sideBarMenuView.ruleChainsBtn().click();
@@ -109,8 +120,10 @@ public class CreateRuleChainImportTest extends AbstractDriverBaseTest {
Assert.assertTrue(ruleChainsPage.entity(IMPORT_RULE_CHAIN_NAME).isDisplayed());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Import rule chain")
@Test(priority = 40, groups = "smoke")
- @Description
+ @Description("Import rule chain with same name")
public void importRuleChainAndSaveWithSameName() {
String ruleChainName = IMPORT_RULE_CHAIN_NAME;
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
@@ -120,8 +133,8 @@ public class CreateRuleChainImportTest extends AbstractDriverBaseTest {
ruleChainsPage.openImportRuleChainView();
ruleChainsPage.browseFile().sendKeys(absolutePathToFileImportRuleChain);
ruleChainsPage.importBrowseFileBtn().click();
- openRuleChainPage.doneBtn().click();
- openRuleChainPage.waitUntilDoneBtnDisable();
+ WebElement doneBtn = openRuleChainPage.doneBtn();
+ doneBtn.click();
sideBarMenuView.ruleChainsBtn().click();
boolean entityNotNull = ruleChainsPage.entity(ruleChainName) != null;
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/CreateRuleChainTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/CreateRuleChainTest.java
index 4e1ec60f10..e8bdaff9da 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/CreateRuleChainTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/CreateRuleChainTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -53,8 +55,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Create rule chain")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Add rule chain after specifying the name (text/numbers /special characters)")
public void createRuleChain() {
String ruleChainName = ENTITY_NAME + random();
@@ -70,8 +74,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
Assert.assertTrue(ruleChainsPage.entity(ruleChainName).isDisplayed());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Create rule chain")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Add rule chain after specifying the name and description (text/numbers /special characters)")
public void createRuleChainWithDescription() {
String ruleChainName = ENTITY_NAME + random();
@@ -89,8 +95,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
Assert.assertEquals(ruleChainsPage.descriptionEntityView().getAttribute("value"), ruleChainName);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Create rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Add rule chain without the name")
public void createRuleChainWithoutName() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openCreateRuleChainView();
@@ -98,8 +106,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
Assert.assertFalse(ruleChainsPage.addBtnV().isEnabled());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Create rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Create rule chain only with spase in name")
public void createRuleChainWithOnlySpace() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.openCreateRuleChainView();
@@ -113,8 +123,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
Assert.assertTrue(ruleChainsPage.addEntityView().isDisplayed());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Create rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Create a rule chain with the same name")
public void createRuleChainWithSameName() {
String ruleChainName = ENTITY_NAME + random();
testRestClient.postRuleChain(EntityPrototypes.defaultRuleChainPrototype(ruleChainName));
@@ -138,8 +150,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
entityIsDisplayed.forEach(Assert::assertTrue);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Create rule chain")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Add rule chain after specifying the name (text/numbers /special characters) without refresh")
public void createRuleChainWithoutRefresh() {
String ruleChainName = ENTITY_NAME + random();
@@ -153,8 +167,10 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
Assert.assertTrue(ruleChainsPage.entity(ruleChainName).isDisplayed());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Create rule chain")
@Test(priority = 40, groups = "smoke")
- @Description
+ @Description("Go to rule chain documentation page")
public void documentation() {
String urlPath = "docs/user-guide/ui/rule-chains/";
@@ -163,6 +179,6 @@ public class CreateRuleChainTest extends AbstractDriverBaseTest {
ruleChainsPage.detailsBtn(ruleChainsPage.getRuleChainName()).click();
ruleChainsPage.goToHelpPage();
- Assert.assertTrue(urlContains(urlPath));
+ Assert.assertTrue(urlContains(urlPath), "URL contains " + urlPath);
}
}
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/DeleteRuleChainTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/DeleteRuleChainTest.java
index 078a807185..e1f27d7bab 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/DeleteRuleChainTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/DeleteRuleChainTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -41,8 +43,10 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
ruleChainsPage = new RuleChainsPageHelper(driver);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete rule chain")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove the rule chain by clicking on the trash icon in the right side of rule chain")
public void removeRuleChainByRightSideBtn() {
String ruleChainName = ENTITY_NAME + random();
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
@@ -54,8 +58,10 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
Assert.assertTrue(ruleChainsPage.entityIsNotPresent(deletedRuleChain));
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove rule chain by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
public void removeSelectedRuleChain() {
String ruleChainName = ENTITY_NAME + random();
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
@@ -67,8 +73,10 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
Assert.assertTrue(ruleChainsPage.entityIsNotPresent(deletedRuleChain));
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the rule chain by clicking on the 'Delete rule chain' btn in the entity view")
public void removeFromRuleChainView() {
String ruleChainName = ENTITY_NAME + random();
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
@@ -76,39 +84,46 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.detailsBtn(ENTITY_NAME).click();
String deletedRuleChain = ruleChainsPage.deleteRuleChainFromView(ruleChainName);
- ruleChainsPage.refreshBtn().click();
+ jsClick(ruleChainsPage.refreshBtn());
Assert.assertTrue(ruleChainsPage.entityIsNotPresent(deletedRuleChain));
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the root rule chain by clicking on the trash icon in the right side of rule chain")
public void removeRootRuleChain() {
sideBarMenuView.ruleChainsBtn().click();
Assert.assertFalse(ruleChainsPage.deleteBtn(ROOT_RULE_CHAIN_NAME).isEnabled());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove root rule chain by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
public void removeSelectedRootRuleChain() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.assertCheckBoxIsNotDisplayed(ROOT_RULE_CHAIN_NAME);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the root rule chain by clicking on the 'Delete rule chain' btn in the entity view")
public void removeFromRootRuleChainView() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.detailsBtn(ROOT_RULE_CHAIN_NAME).click();
- ruleChainsPage.deleteBtnFromView();
Assert.assertTrue(ruleChainsPage.deleteBtnInRootRuleChainIsNotDisplayed());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete rule chain")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove the rule chain with device profile by clicking on the trash icon in the right side of rule chain")
public void removeProfileRuleChainByRightSideBtn() {
String deletedRuleChain = "Thermostat";
@@ -124,8 +139,10 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
Assert.assertEquals(ruleChainsPage.warningMessage().getText(), DELETE_RULE_CHAIN_WITH_PROFILE_MESSAGE);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the rule chain with device profile by mark in the checkbox and then click on the trash can icon in the menu that appears at the top")
public void removeSelectedProfileRuleChain() {
sideBarMenuView.ruleChainsBtn().click();
String deletedRuleChain = ruleChainsPage.deleteSelected("Thermostat");
@@ -138,14 +155,16 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
Assert.assertEquals(ruleChainsPage.warningMessage().getText(), DELETE_RULE_CHAIN_WITH_PROFILE_MESSAGE);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the rule chain with device profile by clicking on the 'Delete rule chain' btn in the entity view")
public void removeFromProfileRuleChainView() {
String deletedRuleChain = "Thermostat";
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.detailsBtn(deletedRuleChain).click();
- ruleChainsPage.deleteBtnFromView().click();
+ jsClick(ruleChainsPage.deleteBtnFromView());
ruleChainsPage.warningPopUpYesBtn().click();
Assert.assertNotNull(ruleChainsPage.entity(deletedRuleChain));
@@ -154,8 +173,10 @@ public class DeleteRuleChainTest extends AbstractDriverBaseTest {
Assert.assertEquals(ruleChainsPage.warningMessage().getText(), DELETE_RULE_CHAIN_WITH_PROFILE_MESSAGE);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete rule chain")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Remove the rule chain by clicking on the trash icon in the right side of rule chain without refresh")
public void removeRuleChainByRightSideBtnWithoutRefresh() {
String ruleChainName = ENTITY_NAME + random();
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/DeleteSeveralRuleChainsTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/DeleteSeveralRuleChainsTest.java
index 612efee64c..068fbbf71b 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/DeleteSeveralRuleChainsTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/DeleteSeveralRuleChainsTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -41,24 +43,28 @@ public class DeleteSeveralRuleChainsTest extends AbstractDriverBaseTest {
ruleChainsPage = new RuleChainsPageHelper(driver);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete several rule chains")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove several rule chains by mark in the checkbox and then click on the trash can icon in the menu " +
+ "that appears at the top")
public void canDeleteSeveralRuleChainsByTopBtn() {
String ruleChainName = ENTITY_NAME + random();
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName + 1));
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
sideBarMenuView.ruleChainsBtn().click();
- ruleChainsPage.clickOnCheckBoxes(2);
- ruleChainsPage.deleteSelectedBtn().click();
- ruleChainsPage.warningPopUpYesBtn().click();
+ ruleChainsPage.deleteSelected(2);
ruleChainsPage.refreshBtn().click();
Assert.assertTrue(ruleChainsPage.ruleChainsIsNotPresent(ruleChainName));
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete several rule chains")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Remove several rule chains by mark all the rule chains on the page by clicking in the topmost checkbox" +
+ " and then clicking on the trash icon in the menu that appears")
public void selectAllRuleChain() {
String ruleChainName = ENTITY_NAME + random();
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName + 1));
@@ -66,15 +72,18 @@ public class DeleteSeveralRuleChainsTest extends AbstractDriverBaseTest {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.selectAllCheckBox().click();
- ruleChainsPage.deleteSelectedBtn().click();
+ jsClick(ruleChainsPage.deleteSelectedBtn());
ruleChainsPage.warningPopUpYesBtn().click();
ruleChainsPage.refreshBtn().click();
Assert.assertTrue(ruleChainsPage.ruleChainsIsNotPresent(ruleChainName));
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete several rule chains")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the root rule chain by mark in the checkbox and then click on the trash can icon in the menu " +
+ "that appears at the top")
public void removeRootRuleChain() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.selectAllCheckBox().click();
@@ -82,8 +91,11 @@ public class DeleteSeveralRuleChainsTest extends AbstractDriverBaseTest {
Assert.assertFalse(ruleChainsPage.deleteBtn(ROOT_RULE_CHAIN_NAME).isEnabled());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete several rule chains")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Remove the root rule chain by mark all the rule chains on the page by clicking in the topmost checkbox" +
+ " and then clicking on the trash icon in the menu that appears")
public void removeSelectedRootRuleChain() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.selectAllCheckBox().click();
@@ -91,17 +103,18 @@ public class DeleteSeveralRuleChainsTest extends AbstractDriverBaseTest {
ruleChainsPage.assertCheckBoxIsNotDisplayed(ROOT_RULE_CHAIN_NAME);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Delete several rule chains")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Remove several rule chains by mark in the checkbox and then click on the trash can icon in the menu " +
+ "that appears at the top without refresh")
public void deleteSeveralRuleChainsByTopBtnWithoutRefresh() {
String ruleChainName = ENTITY_NAME + random();
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName + 1));
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
sideBarMenuView.ruleChainsBtn().click();
- ruleChainsPage.clickOnCheckBoxes(2);
- ruleChainsPage.deleteSelectedBtn().click();
- ruleChainsPage.warningPopUpYesBtn().click();
+ ruleChainsPage.deleteSelected(2);
Assert.assertTrue(ruleChainsPage.ruleChainsIsNotPresent(ruleChainName));
}
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/MakeRuleChainRootTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/MakeRuleChainRootTest.java
index 7ad3fad982..cf252ea22a 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/MakeRuleChainRootTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/MakeRuleChainRootTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -42,8 +44,10 @@ public class MakeRuleChainRootTest extends AbstractDriverBaseTest {
testRestClient.setRootRuleChain(getRuleChainByName("Root Rule Chain").getId());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Make rule chain root")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Make rule chain root by clicking on the 'Make rule chain root' icon in the right corner")
public void makeRuleChainRootByRightCornerBtn() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.setRuleChainNameWithoutRoot(0);
@@ -54,8 +58,10 @@ public class MakeRuleChainRootTest extends AbstractDriverBaseTest {
Assert.assertTrue(ruleChainsPage.rootCheckBoxEnable(ruleChain).isDisplayed());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Make rule chain root")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Make rule chain root by clicking on the 'Make rule chain root' button in the entity view")
public void makeRuleChainRootFromView() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.setRuleChainNameWithoutRoot(0);
@@ -68,14 +74,16 @@ public class MakeRuleChainRootTest extends AbstractDriverBaseTest {
Assert.assertTrue(ruleChainsPage.rootCheckBoxEnable(ruleChain).isDisplayed());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Make rule chain root")
@Test(priority = 30, groups = "smoke")
- @Description
+ @Description("Make multiple root rule chains (only one rule chain can be root)")
public void multiplyRoot() {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.setRuleChainNameWithoutRoot(0);
String ruleChain = ruleChainsPage.getRuleChainName();
ruleChainsPage.detailsBtn(ruleChain).click();
- ruleChainsPage.makeRootFromViewBtn().click();
+ jsClick(ruleChainsPage.makeRootFromViewBtn());
ruleChainsPage.warningPopUpYesBtn().click();
ruleChainsPage.closeEntityViewBtn().click();
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/OpenRuleChainTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/OpenRuleChainTest.java
index 05c59b0d7d..220b718ae8 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/OpenRuleChainTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/OpenRuleChainTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -53,8 +55,10 @@ public class OpenRuleChainTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Open rule chain")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Open the rule chain by clicking on its name")
public void openRuleChainByRightCornerBtn() {
String ruleChainName = ENTITY_NAME + random();
testRestClient.postRuleChain(EntityPrototypes.defaultRuleChainPrototype(ruleChainName));
@@ -70,8 +74,10 @@ public class OpenRuleChainTest extends AbstractDriverBaseTest {
Assert.assertEquals(ruleChainName, openRuleChainPage.getHeadName());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Open rule chain")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Open the rule chain by clicking on the 'Open rule chain' button in the entity view")
public void openRuleChainByViewBtn() {
String ruleChainName = ENTITY_NAME + random();
testRestClient.postRuleChain(EntityPrototypes.defaultRuleChainPrototype(ruleChainName));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/RuleChainEditMenuTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/RuleChainEditMenuTest.java
index 144ca0e836..5b380221b6 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/RuleChainEditMenuTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/RuleChainEditMenuTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -54,8 +56,10 @@ public class RuleChainEditMenuTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Edit rule chain")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Change name by edit menu")
public void changeName() {
String newRuleChainName = "Changed" + getRandomNumber();
String ruleChainName = ENTITY_NAME + random();
@@ -77,8 +81,10 @@ public class RuleChainEditMenuTest extends AbstractDriverBaseTest {
Assert.assertEquals(newRuleChainName, nameAfter);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Edit rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Delete name and save")
public void deleteName() {
String ruleChainName = ENTITY_NAME + random();
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
@@ -92,8 +98,10 @@ public class RuleChainEditMenuTest extends AbstractDriverBaseTest {
Assert.assertFalse(ruleChainsPage.doneBtnEditViewVisible().isEnabled());
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Edit rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Save only with space")
public void saveOnlyWithSpace() {
String ruleChainName = ENTITY_NAME +random();
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
@@ -110,8 +118,10 @@ public class RuleChainEditMenuTest extends AbstractDriverBaseTest {
Assert.assertEquals(ruleChainsPage.warningMessage().getText(), EMPTY_RULE_CHAIN_MESSAGE);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Edit rule chain")
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "editMenuDescription")
- @Description
+ @Description("Write the description and save the changes/Change the description and save the changes/Delete the description and save the changes")
public void editDescription(String description, String newDescription, String finalDescription) {
String name = ENTITY_NAME + random();
testRestClient.postRuleChain(EntityPrototypes.defaultRuleChainPrototype(name, description));
@@ -127,8 +137,10 @@ public class RuleChainEditMenuTest extends AbstractDriverBaseTest {
Assert.assertEquals(ruleChainsPage.getDescription(), finalDescription);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Edit rule chain")
@Test(priority = 20, groups = "smoke")
- @Description
+ @Description("Enable debug mode/Disable debug mode")
public void debugMode() {
String ruleChainName = ENTITY_NAME + random();
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SearchRuleChainTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SearchRuleChainTest.java
index 29c5b21556..b34f59d420 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SearchRuleChainTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SearchRuleChainTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -39,8 +41,10 @@ public class SearchRuleChainTest extends AbstractDriverBaseTest {
ruleChainsPage = new RuleChainsPageHelper(driver);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Search rule chain")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "ruleChainNameForSearchByFirstAndSecondWord")
- @Description
+ @Description("Search rule chain by first word in the name/Search rule chain by second word in the name")
public void searchFirstWord(String namePath) {
sideBarMenuView.ruleChainsBtn().click();
ruleChainsPage.searchEntity(namePath);
@@ -49,8 +53,10 @@ public class SearchRuleChainTest extends AbstractDriverBaseTest {
Assert.assertTrue(ruleChainsPage.getRuleChainName().contains(namePath));
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Search rule chain")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSearchBySymbolAndNumber")
- @Description
+ @Description("Search rule chain by symbol in the name/Search rule chain by number in the name")
public void searchNumber(String name, String namePath) {
testRestClient.postRuleChain(defaultRuleChainPrototype(name));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SortByNameTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SortByNameTest.java
index 84cd1028e8..3a5f02d61d 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SortByNameTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SortByNameTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -49,8 +51,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Sort rule chain by name")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
- @Description
+ @Description("Sort rule chain 'UP'")
public void specialCharacterUp(String ruleChainName) {
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
this.ruleChainName = ruleChainName;
@@ -62,8 +66,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
Assert.assertEquals(ruleChainsPage.getRuleChainName(), ruleChainName);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Sort rule chain by name")
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
- @Description
+ @Description("Sort rule chain 'UP'")
public void allSortUp(String ruleChain, String ruleChainSymbol, String ruleChainNumber) {
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainSymbol));
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChain));
@@ -87,8 +93,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
Assert.assertEquals(thirdRuleChain, ruleChain);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Sort rule chain by name")
@Test(priority = 10, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForSort")
- @Description
+ @Description("Sort rule chain 'DOWN'")
public void specialCharacterDown(String ruleChainName) {
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainName));
this.ruleChainName = ruleChainName;
@@ -100,8 +108,10 @@ public class SortByNameTest extends AbstractDriverBaseTest {
Assert.assertEquals(ruleChainsPage.getRuleChainName(), ruleChainName);
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Sort rule chain by name")
@Test(priority = 20, groups = "smoke", dataProviderClass = DataProviderCredential.class, dataProvider = "nameForAllSort")
- @Description
+ @Description("Sort rule chain 'DOWN'")
public void allSortDown(String ruleChain, String ruleChainSymbol, String ruleChainNumber) {
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChainSymbol));
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChain));
diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SortByTimeTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SortByTimeTest.java
index 4654654fb5..6c8a912526 100644
--- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SortByTimeTest.java
+++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/tests/ruleChainsSmoke/SortByTimeTest.java
@@ -16,6 +16,8 @@
package org.thingsboard.server.msa.ui.tests.ruleChainsSmoke;
import io.qameta.allure.Description;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -49,8 +51,10 @@ public class SortByTimeTest extends AbstractDriverBaseTest {
}
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Sort rule chain by time")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Sort rule chain 'DOWN'")
public void sortByTimeDown() {
String ruleChain = ENTITY_NAME;
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChain));
@@ -65,8 +69,10 @@ public class SortByTimeTest extends AbstractDriverBaseTest {
Assert.assertNotNull(ruleChainsPage.createdTimeEntity(ruleChain, lastCreated));
}
+ @Epic("Rule chains smoke tests")
+ @Feature("Sort rule chain by time")
@Test(priority = 10, groups = "smoke")
- @Description
+ @Description("Sort rule chain 'UP'")
public void sortByTimeUp() {
String ruleChain = ENTITY_NAME;
testRestClient.postRuleChain(defaultRuleChainPrototype(ruleChain));
diff --git a/pom.xml b/pom.xml
index 49f30df835..adc1d9906d 100755
--- a/pom.xml
+++ b/pom.xml
@@ -67,6 +67,7 @@
2.13.4
2.13.4.2
1.3.4
+ 4.2.1
2.2.6
3.0.0
2.0.0-M5
@@ -826,6 +827,7 @@
**/apache/cassandra/io/**
.run/**
**/NetworkReceive.java
+ **/lwm2m-registry/**
JAVADOC_STYLE
@@ -1429,6 +1431,11 @@
classmate
${fasterxml-classmate.version}
+
+ com.auth0
+ java-jwt
+ ${auth0-jwt.version}
+
com.github.fge
json-schema-validator
diff --git a/rest-client/pom.xml b/rest-client/pom.xml
index cb85c2134e..1bf93e4dc4 100644
--- a/rest-client/pom.xml
+++ b/rest-client/pom.xml
@@ -47,6 +47,10 @@
org.thingsboard.common
util
+
+ com.auth0
+ java-jwt
+
diff --git a/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java b/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java
index c2c0a6d794..8dcdb86eab 100644
--- a/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java
+++ b/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java
@@ -15,6 +15,7 @@
*/
package org.thingsboard.rest.client;
+import com.auth0.jwt.JWT;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -28,9 +29,6 @@ import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
-import org.springframework.http.client.ClientHttpRequestExecution;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
-import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.support.HttpRequestWrapper;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
@@ -161,7 +159,6 @@ import org.thingsboard.server.common.data.widget.WidgetTypeInfo;
import org.thingsboard.server.common.data.widget.WidgetsBundle;
import java.io.Closeable;
-import java.io.IOException;
import java.net.URI;
import java.util.Collections;
import java.util.HashMap;
@@ -171,6 +168,7 @@ import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static org.thingsboard.server.common.data.StringUtils.isEmpty;
@@ -178,16 +176,24 @@ import static org.thingsboard.server.common.data.StringUtils.isEmpty;
/**
* @author Andrew Shvayka
*/
-public class RestClient implements ClientHttpRequestInterceptor, Closeable {
+public class RestClient implements Closeable {
private static final String JWT_TOKEN_HEADER_PARAM = "X-Authorization";
+ private static final long AVG_REQUEST_TIMEOUT = TimeUnit.SECONDS.toMillis(30);
+ protected static final String ACTIVATE_TOKEN_REGEX = "/api/noauth/activate?activateToken=";
+
+ private final ObjectMapper objectMapper = new ObjectMapper();
+ private final ExecutorService service = ThingsBoardExecutors.newWorkStealingPool(10, getClass());
protected final RestTemplate restTemplate;
+ protected final RestTemplate loginRestTemplate;
protected final String baseURL;
- private String token;
- private String refreshToken;
- private final ObjectMapper objectMapper = new ObjectMapper();
- private ExecutorService service = ThingsBoardExecutors.newWorkStealingPool(10, getClass());
- protected static final String ACTIVATE_TOKEN_REGEX = "/api/noauth/activate?activateToken=";
+ private String username;
+ private String password;
+ private String mainToken;
+ private String refreshToken;
+ private long mainTokenExpTs;
+ private long refreshTokenExpTs;
+ private long clientServerTimeDiff;
public RestClient(String baseURL) {
this(new RestTemplate(), baseURL);
@@ -195,23 +201,25 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
public RestClient(RestTemplate restTemplate, String baseURL) {
this.restTemplate = restTemplate;
+ this.loginRestTemplate = new RestTemplate(restTemplate.getRequestFactory());
this.baseURL = baseURL;
- }
-
- @Override
- public ClientHttpResponse intercept(HttpRequest request, byte[] bytes, ClientHttpRequestExecution execution) throws IOException {
- HttpRequest wrapper = new HttpRequestWrapper(request);
- wrapper.getHeaders().set(JWT_TOKEN_HEADER_PARAM, "Bearer " + token);
- ClientHttpResponse response = execution.execute(wrapper, bytes);
- if (response.getStatusCode() == HttpStatus.UNAUTHORIZED) {
- synchronized (this) {
- restTemplate.getInterceptors().remove(this);
- refreshToken();
- wrapper.getHeaders().set(JWT_TOKEN_HEADER_PARAM, "Bearer " + token);
- return execution.execute(wrapper, bytes);
+ this.restTemplate.getInterceptors().add((request, bytes, execution) -> {
+ HttpRequest wrapper = new HttpRequestWrapper(request);
+ long calculatedTs = System.currentTimeMillis() + clientServerTimeDiff + AVG_REQUEST_TIMEOUT;
+ if (calculatedTs > mainTokenExpTs) {
+ synchronized (RestClient.this) {
+ if (calculatedTs > mainTokenExpTs) {
+ if (calculatedTs < refreshTokenExpTs) {
+ refreshToken();
+ } else {
+ doLogin();
+ }
+ }
+ }
}
- }
- return response;
+ wrapper.getHeaders().set(JWT_TOKEN_HEADER_PARAM, "Bearer " + mainToken);
+ return execution.execute(wrapper, bytes);
+ });
}
public RestTemplate getRestTemplate() {
@@ -219,7 +227,7 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
}
public String getToken() {
- return token;
+ return mainToken;
}
public String getRefreshToken() {
@@ -229,22 +237,32 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
public void refreshToken() {
Map refreshTokenRequest = new HashMap<>();
refreshTokenRequest.put("refreshToken", refreshToken);
- ResponseEntity tokenInfo = restTemplate.postForEntity(baseURL + "/api/auth/token", refreshTokenRequest, JsonNode.class);
- setTokenInfo(tokenInfo.getBody());
+ long ts = System.currentTimeMillis();
+ ResponseEntity tokenInfo = loginRestTemplate.postForEntity(baseURL + "/api/auth/token", refreshTokenRequest, JsonNode.class);
+ setTokenInfo(ts, tokenInfo.getBody());
}
public void login(String username, String password) {
+ this.username = username;
+ this.password = password;
+ doLogin();
+ }
+
+ private void doLogin() {
+ long ts = System.currentTimeMillis();
Map loginRequest = new HashMap<>();
loginRequest.put("username", username);
loginRequest.put("password", password);
- ResponseEntity tokenInfo = restTemplate.postForEntity(baseURL + "/api/auth/login", loginRequest, JsonNode.class);
- setTokenInfo(tokenInfo.getBody());
+ ResponseEntity tokenInfo = loginRestTemplate.postForEntity(baseURL + "/api/auth/login", loginRequest, JsonNode.class);
+ setTokenInfo(ts, tokenInfo.getBody());
}
- private void setTokenInfo(JsonNode tokenInfo) {
- this.token = tokenInfo.get("token").asText();
+ private synchronized void setTokenInfo(long ts, JsonNode tokenInfo) {
+ this.mainToken = tokenInfo.get("token").asText();
this.refreshToken = tokenInfo.get("refreshToken").asText();
- restTemplate.getInterceptors().add(this);
+ this.mainTokenExpTs = JWT.decode(this.mainToken).getExpiresAtAsInstant().toEpochMilli();
+ this.refreshTokenExpTs = JWT.decode(refreshToken).getExpiresAtAsInstant().toEpochMilli();
+ this.clientServerTimeDiff = JWT.decode(this.mainToken).getIssuedAtAsInstant().toEpochMilli() - ts;
}
public Optional getAdminSettings(String key) {
@@ -3553,9 +3571,7 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
@Override
public void close() {
- if (service != null) {
- service.shutdown();
- }
+ service.shutdown();
}
}
diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/action/TbLogNode.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/action/TbLogNode.java
index 851d285e0e..6c3d80dade 100644
--- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/action/TbLogNode.java
+++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/action/TbLogNode.java
@@ -32,6 +32,8 @@ import org.thingsboard.server.common.data.plugin.ComponentType;
import org.thingsboard.server.common.data.script.ScriptLanguage;
import org.thingsboard.server.common.msg.TbMsg;
+import java.util.Objects;
+
@Slf4j
@RuleNode(
type = ComponentType.ACTION,
@@ -54,8 +56,12 @@ public class TbLogNode implements TbNode {
@Override
public void init(TbContext ctx, TbNodeConfiguration configuration) throws TbNodeException {
this.config = TbNodeUtils.convert(configuration, TbLogNodeConfiguration.class);
- this.standard = new TbLogNodeConfiguration().defaultConfiguration().getJsScript().equals(config.getJsScript());
- this.scriptEngine = this.standard ? null : ctx.createScriptEngine(config.getScriptLang(),
+ this.standard = isStandard(config);
+ this.scriptEngine = this.standard ? null : createScriptEngine(ctx, config);
+ }
+
+ ScriptEngine createScriptEngine(TbContext ctx, TbLogNodeConfiguration config) {
+ return ctx.createScriptEngine(config.getScriptLang(),
ScriptLanguage.TBEL.equals(config.getScriptLang()) ? config.getTbelScript() : config.getJsScript());
}
@@ -83,6 +89,18 @@ public class TbLogNode implements TbNode {
}, MoreExecutors.directExecutor()); //usually js responses runs on js callback executor
}
+ boolean isStandard(TbLogNodeConfiguration conf) {
+ Objects.requireNonNull(conf, "node config is null");
+ final TbLogNodeConfiguration defaultConfig = new TbLogNodeConfiguration().defaultConfiguration();
+ switch (conf.getScriptLang()) {
+ case JS: return defaultConfig.getJsScript().equals(conf.getJsScript());
+ case TBEL: return defaultConfig.getTbelScript().equals(conf.getTbelScript());
+ default:
+ log.warn("No rule to define isStandard script for script language [{}], assuming that is non-standard", conf.getScriptLang());
+ return false;
+ }
+ }
+
void logStandard(TbContext ctx, TbMsg msg) {
log.info(toLogMessage(msg));
ctx.tellSuccess(msg);
diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/action/TbLogNodeTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/action/TbLogNodeTest.java
index 0df5921d4d..21e99af819 100644
--- a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/action/TbLogNodeTest.java
+++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/action/TbLogNodeTest.java
@@ -17,14 +17,29 @@ package org.thingsboard.rule.engine.action;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.EnumSource;
+import org.thingsboard.common.util.JacksonUtil;
+import org.thingsboard.rule.engine.api.TbContext;
+import org.thingsboard.rule.engine.api.TbNodeConfiguration;
+import org.thingsboard.rule.engine.api.TbNodeException;
import org.thingsboard.server.common.data.id.TenantId;
+import org.thingsboard.server.common.data.script.ScriptLanguage;
import org.thingsboard.server.common.msg.TbMsg;
import org.thingsboard.server.common.msg.TbMsgMetaData;
import java.util.Collections;
import java.util.Map;
+import java.util.UUID;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
@Slf4j
public class TbLogNodeTest {
@@ -61,6 +76,7 @@ public class TbLogNodeTest {
"Incoming metadata:\n" +
"{}");
}
+
@Test
void givenNullDataMsg_whenToLog_thenReturnString() {
TbLogNode node = new TbLogNode();
@@ -77,4 +93,50 @@ public class TbLogNodeTest {
"{}");
}
+ @ParameterizedTest
+ @EnumSource(ScriptLanguage.class)
+ void givenDefaultConfig_whenIsStandardForEachScriptLanguage_thenTrue(ScriptLanguage scriptLanguage) throws TbNodeException {
+
+ TbLogNodeConfiguration config = new TbLogNodeConfiguration().defaultConfiguration();
+ config.setScriptLang(scriptLanguage);
+ TbLogNode node = spy(new TbLogNode());
+ TbNodeConfiguration tbNodeConfiguration = new TbNodeConfiguration(JacksonUtil.valueToTree(config));
+ TbContext ctx = mock(TbContext.class);
+ node.init(ctx, tbNodeConfiguration);
+
+ assertThat(node.isStandard(config)).as("Script is standard for language " + scriptLanguage).isTrue();
+ verify(node, never()).createScriptEngine(any(), any());
+ verify(ctx, never()).createScriptEngine(any(), anyString());
+
+ }
+
+ @Test
+ void givenScriptEngineEnum_whenNewAdded_thenFailed() {
+ assertThat(ScriptLanguage.values().length).as("only two ScriptLanguage supported").isEqualTo(2);
+ }
+
+ @Test
+ void givenScriptEngineLangJs_whenCreateScriptEngine_thenSupplyJsScript(){
+ TbLogNodeConfiguration configJs = new TbLogNodeConfiguration().defaultConfiguration();
+ configJs.setScriptLang(ScriptLanguage.JS);
+ configJs.setJsScript(configJs.getJsScript() + " // This is JS script " + UUID.randomUUID());
+ TbLogNode node = new TbLogNode();
+ TbContext ctx = mock(TbContext.class);
+ node.createScriptEngine(ctx, configJs);
+ verify(ctx).createScriptEngine(ScriptLanguage.JS, configJs.getJsScript());
+ verifyNoMoreInteractions(ctx);
+ }
+
+ @Test
+ void givenScriptEngineLangTbel_whenCreateScriptEngine_thenSupplyTbelScript(){
+ TbLogNodeConfiguration configTbel = new TbLogNodeConfiguration().defaultConfiguration();
+ configTbel.setScriptLang(ScriptLanguage.TBEL);
+ configTbel.setTbelScript(configTbel.getTbelScript() + " // This is TBEL script " + UUID.randomUUID());
+ TbLogNode node = new TbLogNode();
+ TbContext ctx = mock(TbContext.class);
+ node.createScriptEngine(ctx, configTbel);
+ verify(ctx).createScriptEngine(ScriptLanguage.TBEL, configTbel.getTbelScript());
+ verifyNoMoreInteractions(ctx);
+ }
+
}
diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/metadata/TbGetTelemetryNodeTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/metadata/TbGetTelemetryNodeTest.java
index 3d8652a7a0..bd761a084c 100644
--- a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/metadata/TbGetTelemetryNodeTest.java
+++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/metadata/TbGetTelemetryNodeTest.java
@@ -18,6 +18,7 @@ package org.thingsboard.rule.engine.metadata;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Before;
import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.rule.engine.api.TbContext;
import org.thingsboard.rule.engine.api.TbNodeConfiguration;
@@ -70,14 +71,18 @@ public class TbGetTelemetryNodeTest {
}
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void givenAggregationWhiteSpace_whenParseAggregation_thenException() {
- node.parseAggregationConfig(" ");
+ Assertions.assertThrows(IllegalArgumentException.class, () -> {
+ node.parseAggregationConfig(" ");
+ });
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void givenAggregationIncorrect_whenParseAggregation_thenException() {
- node.parseAggregationConfig("TOP");
+ Assertions.assertThrows(IllegalArgumentException.class, () -> {
+ node.parseAggregationConfig("TOP");
+ });
}
}