+\r
+ NsaApiDb<NsaSimpleApiKey> fApiKeyDb = new NsaApiDb<NsaSimpleApiKey>() {\r
+\r
+ Set<String> keys = new HashSet<>(Arrays.asList("testkey", "admin"));\r
+\r
+ @Override\r
+ public NsaSimpleApiKey createApiKey(String arg0, String arg1)\r
+ throws com.att.nsa.security.db.NsaApiDb.KeyExistsException, ConfigDbException {\r
+ // TODO Auto-generated method stub\r
+ return new NsaSimpleApiKey(arg0, arg1);\r
+ }\r
+\r
+ @Override\r
+ public boolean deleteApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {\r
+ // TODO Auto-generated method stub\r
+ return false;\r
+ }\r
+\r
+ @Override\r
+ public boolean deleteApiKey(String arg0) throws ConfigDbException {\r
+ // TODO Auto-generated method stub\r
+ return false;\r
+ }\r
+\r
+ @Override\r
+ public Map<String, NsaSimpleApiKey> loadAllKeyRecords() throws ConfigDbException {\r
+ Map<String, NsaSimpleApiKey> map = new HashMap<String, NsaSimpleApiKey>();\r
+ map.put("testkey", new NsaSimpleApiKey("testkey", "password"));\r
+ map.put("admin", new NsaSimpleApiKey("admin", "password"));\r
+\r
+ return map;\r
+ }\r
+\r
+ @Override\r
+ public Set<String> loadAllKeys() throws ConfigDbException {\r
+ // TODO Auto-generated method stub\r
+\r
+ return keys;\r
+ }\r
+\r
+ @Override\r
+ public NsaSimpleApiKey loadApiKey(String arg0) throws ConfigDbException {\r
+ if (!keys.contains(arg0)) {\r
+ return null;\r
+ }\r
+ return new NsaSimpleApiKey(arg0, "password");\r
+ }\r
+\r
+ @Override\r
+ public void saveApiKey(NsaSimpleApiKey arg0) throws ConfigDbException {\r
+ // TODO Auto-generated method stub\r
+\r
+ }\r
+ };\r
+\r