aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/UserRestrictionWhiteListTest.java
diff options
context:
space:
mode:
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.java130
1 files changed, 130 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..3cd9d9476
--- /dev/null
+++ b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/UserRestrictionWhiteListTest.java
@@ -0,0 +1,130 @@
+package at.gv.egovernment.moa.id.config.auth.data;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+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");
+
+ }
+
+
+}