diff --git a/agama/engine/src/test/resources/flows/io.jans.agama.test.auth.uidOnly b/agama/engine/src/test/resources/flows/io.jans.agama.test.auth.uidOnly new file mode 100644 index 00000000000..6397e9d13f3 --- /dev/null +++ b/agama/engine/src/test/resources/flows/io.jans.agama.test.auth.uidOnly @@ -0,0 +1,10 @@ +//This flow is based on the "hello world" flow found in Agama docs (quick-start quide) +Flow io.jans.agama.test.auth.uidOnly + Basepath "hello" + Inputs uid + +in = { name: uid } +RRF "index.ftlh" in + +Log "Done!" +Finish uid diff --git a/agama/engine/src/test/resources/flows/io.jans.agama.test.math b/agama/engine/src/test/resources/flows/io.jans.agama.test.math new file mode 100644 index 00000000000..22df7423929 --- /dev/null +++ b/agama/engine/src/test/resources/flows/io.jans.agama.test.math @@ -0,0 +1,54 @@ +//This flow is used to test some Java calls. It does not make use of idiomatic Agama. There is no UI either here +Flow io.jans.agama.test.math + Basepath "" + Inputs numbers //A non-empty list of positive integers + +// 1. Find the smallest +small = Call java.util.Collections#min numbers +Log "min element is" small + + +// 2. Concat them all in a string +strings = [ ] +Iterate over numbers using n + i = strings.length + strings[i] = Call java.lang.Integer#toString n + +cat = Call java.lang.String#join "" strings +Log "concatenation is" cat + + +// 3. Sumation (with Repeat) +s = 0 +Repeat numbers.length times max + i = idx[0] + s = Call java.lang.Math#addExact s numbers[i] + +Log "sumation is" s + + +// 4. Find if they are mutually relatively prime (no integer divides them all) +When numbers.length is 1 or small is 1 + Finish true + +divisor = 1 +small = Call java.lang.Math#decrementExact small + +Repeat small times max + divisor = Call java.lang.Math#incrementExact divisor + k = 0 + + //Try to divide the numbers by 2, 3, ... small+1 + Iterate over numbers using n + modulus = Call java.lang.Math#floorMod n divisor + Quit When modulus is 0 + k = Call java.lang.Math#incrementExact k + + Quit When k is numbers.length + +When k is numbers.length + Log "% are relative primes" numbers +Otherwise + Log "All numbers can be divided by" divisor + +Finish true diff --git a/agama/engine/src/test/resources/flows/io.jans.agama.test.showConfig b/agama/engine/src/test/resources/flows/io.jans.agama.test.showConfig new file mode 100644 index 00000000000..616d4dcf80c --- /dev/null +++ b/agama/engine/src/test/resources/flows/io.jans.agama.test.showConfig @@ -0,0 +1,8 @@ +Flow io.jans.agama.test.showConfig + Basepath "" + Timeout 10 seconds + Configs conf + +RRF "printConfigs.ftlh" conf + +Finish false \ No newline at end of file diff --git a/agama/engine/src/test/resources/flows/org.gluu.flow1 b/agama/engine/src/test/resources/flows/org.gluu.flow1 new file mode 100644 index 00000000000..206628a0085 --- /dev/null +++ b/agama/engine/src/test/resources/flows/org.gluu.flow1 @@ -0,0 +1,11 @@ +//This flow appeared originally in the demos of the authentication-trees project +Flow org.gluu.flow1 + Basepath "f1" + +data = RRF "index.ftl" + +data = Trigger org.gluu.flow2 data.secret[0] + +Log "@debug Subflow finished successfully?" data.success + +Finish data diff --git a/agama/engine/src/test/resources/flows/org.gluu.flow2 b/agama/engine/src/test/resources/flows/org.gluu.flow2 new file mode 100644 index 00000000000..e3bac09e4dd --- /dev/null +++ b/agama/engine/src/test/resources/flows/org.gluu.flow2 @@ -0,0 +1,14 @@ +//This flow appeared originally in the demos of the authentication-trees project +Flow org.gluu.flow2 + Basepath "f1" + Inputs val + +x = {value: val} +data = RRF "index2.ftl" x + +When data.something is "" + Log "There was a missing value" + ret = { success: false, error: "You forgot something!" } + Finish ret +Otherwise + Finish true diff --git a/agama/engine/src/test/resources/flows/org.gluu.flow3 b/agama/engine/src/test/resources/flows/org.gluu.flow3 new file mode 100644 index 00000000000..24d7e8e06c9 --- /dev/null +++ b/agama/engine/src/test/resources/flows/org.gluu.flow3 @@ -0,0 +1,7 @@ +Flow org.gluu.flow3 + Basepath "me" + +obj = Trigger org.gluu.flow1 + Override templates "f1/index.ftl" "myindex.ftlh" + +Finish obj diff --git a/agama/engine/src/test/resources/templates/custom/printConfigs.ftlh b/agama/engine/src/test/resources/templates/custom/printConfigs.ftlh new file mode 100644 index 00000000000..5193bcbe4c9 --- /dev/null +++ b/agama/engine/src/test/resources/templates/custom/printConfigs.ftlh @@ -0,0 +1,14 @@ + + +
+ +<#!-- rendering this page crashes if neither joke nor phrase are defined --> +${joke} +
${phrase} + +
+ + + diff --git a/agama/engine/src/test/resources/templates/f1/index.ftl b/agama/engine/src/test/resources/templates/f1/index.ftl new file mode 100644 index 00000000000..4ada4213bd3 --- /dev/null +++ b/agama/engine/src/test/resources/templates/f1/index.ftl @@ -0,0 +1,14 @@ +<#ftl output_format="HTML"> + + + +Hi I'm Flow 1!
+ + + + + diff --git a/agama/engine/src/test/resources/templates/f1/index2.ftl b/agama/engine/src/test/resources/templates/f1/index2.ftl new file mode 100644 index 00000000000..3befc0da296 --- /dev/null +++ b/agama/engine/src/test/resources/templates/f1/index2.ftl @@ -0,0 +1,15 @@ +<#ftl output_format="HTML"> + + + +Hi I'm Flow 2!
+${value!""}
+ + + + + diff --git a/agama/engine/src/test/resources/templates/hello/index.ftlh b/agama/engine/src/test/resources/templates/hello/index.ftlh new file mode 100644 index 00000000000..e700dcb637e --- /dev/null +++ b/agama/engine/src/test/resources/templates/hello/index.ftlh @@ -0,0 +1,11 @@ + + + +Hi ${name}
+ + + + + diff --git a/agama/engine/src/test/resources/templates/login.ftlh b/agama/engine/src/test/resources/templates/login.ftlh new file mode 100644 index 00000000000..5f8559a5db7 --- /dev/null +++ b/agama/engine/src/test/resources/templates/login.ftlh @@ -0,0 +1,59 @@ + + + + + + + + + + +Welcome
+ + <#if !(success!true)> +${msgs["login.errorMessage"]}
+ #if> + + +Hi I'm Flow 3!
+ + + + +