aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/UserRestrictionWhiteListTest.java
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2018-06-12 06:25:48 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2018-06-12 06:25:48 +0200
commitcb8ae73a6196813c3c749e4396977e5e1e3304b9 (patch)
treeb64f62e9c6997f1d5dab209d30373f5d0ade0305 /id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/UserRestrictionWhiteListTest.java
parentb53d2f387282b731ea72806ec7d410a1c27a878d (diff)
parentea49cd41d7ae571f8156f7b2ac02c9e2a6f86ca6 (diff)
downloadmoa-id-spss-cb8ae73a6196813c3c749e4396977e5e1e3304b9.tar.gz
moa-id-spss-cb8ae73a6196813c3c749e4396977e5e1e3304b9.tar.bz2
moa-id-spss-cb8ae73a6196813c3c749e4396977e5e1e3304b9.zip
Merge branch 'eIDAS_node_2.0_tests' of gitlab.iaik.tugraz.at:egiz/moa-idspss into eIDAS_node_2.0_tests
Diffstat (limited to 'id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/UserRestrictionWhiteListTest.java')
-rw-r--r--id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/UserRestrictionWhiteListTest.java136
1 files changed, 136 insertions, 0 deletions
diff --git a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/UserRestrictionWhiteListTest.java b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/UserRestrictionWhiteListTest.java
new file mode 100644
index 000000000..71956990e
--- /dev/null
+++ b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/UserRestrictionWhiteListTest.java
@@ -0,0 +1,136 @@
+package at.gv.egovernment.moa.id.config.auth.data;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.opensaml.xml.ConfigurationException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("/SpringTest-context_basic_user_whitelist.xml")
+public class UserRestrictionWhiteListTest {
+
+ @Autowired(required=true) UserWhitelistStore whitelistStore;
+
+ private static String bPK_1 = "/7eNkLgqP71U8dBwa0lSI8/2EFY=";
+ private static String bPK_2 = "gr88V4oH5KLlurBCcCAbKJNMF18=";
+ private static String bPK_3 = "0Fq3KqgYTbK8MsxymLe7tbuXhpA=";
+ private static String bPK_4 = "JWiLzwktCITGg+ztRKEAwWloSNM=";
+
+ private static String bPK_5 = "JWiLzwktCIXXX+ztRKEAwWloSNM=";
+ private static String bPK_6 = "WtHxBxLqOThNU9YF8fzXXXcZLBs=";
+
+ @Test
+ public void checkNumberOfEntries() throws Exception {
+ if (whitelistStore.getNumberOfEntries() != 12)
+ throw new Exception("Number of entries not valid");
+
+ }
+
+
+ @Test
+ public void checkEntry_1() throws Exception {
+ String bPK = bPK_1;
+ if (!whitelistStore.isUserbPKInWhitelist(bPK))
+ throw new Exception("bPK: " + bPK + " is NOT found in whitelist");
+
+ }
+
+ @Test
+ public void checkEntryDynamic_1() throws Exception {
+ String bPK = bPK_1;
+ if (!whitelistStore.isUserbPKInWhitelistDynamic(bPK, true))
+ throw new Exception("bPK: " + bPK + " is NOT found in whitelist");
+
+ }
+
+ @Test
+ public void checkEntry_2() throws Exception {
+ String bPK = bPK_2;
+ if (!whitelistStore.isUserbPKInWhitelist(bPK))
+ throw new Exception("bPK: " + bPK + " is NOT found in whitelist");
+
+ }
+
+ @Test
+ public void checkEntryDynamic_2() throws Exception {
+ String bPK = bPK_2;
+ if (!whitelistStore.isUserbPKInWhitelistDynamic(bPK, true))
+ throw new Exception("bPK: " + bPK + " is NOT found in whitelist");
+
+ }
+
+
+ @Test
+ public void checkEntry_3() throws Exception {
+ String bPK = bPK_3;
+ if (!whitelistStore.isUserbPKInWhitelist(bPK))
+ throw new Exception("bPK: " + bPK + " is NOT found in whitelist");
+
+ }
+
+ @Test
+ public void checkEntryDynamic_3() throws Exception {
+ String bPK = bPK_3;
+ if (!whitelistStore.isUserbPKInWhitelistDynamic(bPK, true))
+ throw new Exception("bPK: " + bPK + " is NOT found in whitelist");
+
+ }
+
+ @Test
+ public void checkEntry_4() throws Exception {
+ String bPK = bPK_4;
+ if (!whitelistStore.isUserbPKInWhitelist(bPK))
+ throw new Exception("bPK: " + bPK + " is NOT found in whitelist");
+
+ }
+
+ @Test
+ public void checkEntryDynamic_4() throws Exception {
+ String bPK = bPK_4;
+ if (!whitelistStore.isUserbPKInWhitelistDynamic(bPK, true))
+ throw new Exception("bPK: " + bPK + " is NOT found in whitelist");
+
+ }
+
+ @Test
+ public void checkEntry_5() throws Exception {
+ String bPK = bPK_5;
+ if (whitelistStore.isUserbPKInWhitelist(bPK))
+ throw new Exception("bPK: " + bPK + " is NOT found in whitelist");
+
+ }
+
+ @Test
+ public void checkEntryDynamic_5() throws Exception {
+ String bPK = bPK_5;
+ if (whitelistStore.isUserbPKInWhitelistDynamic(bPK, true))
+ throw new Exception("bPK: " + bPK + " is NOT found in whitelist");
+
+ }
+
+ @Test
+ public void checkEntry_6() throws Exception {
+ String bPK = bPK_6;
+ if (whitelistStore.isUserbPKInWhitelist(bPK))
+ throw new Exception("bPK: " + bPK + " is NOT found in whitelist");
+
+ }
+
+ @Test
+ public void checkEntryDynamic_6() throws Exception {
+ String bPK = bPK_6;
+ if (whitelistStore.isUserbPKInWhitelistDynamic(bPK, true))
+ throw new Exception("bPK: " + bPK + " is NOT found in whitelist");
+
+ }
+
+
+}