@Test public void testMultipleRegisters() { ShuffleSecretManager secretManager = new ShuffleSecretManager(); secretManager.registerApp(app1, pw1); assertEquals(pw1, secretManager.getSecretKey(app1)); secretManager.registerApp(app2, ByteBuffer.wrap(pw2.getBytes())); assertEquals(pw2, secretManager.getSecretKey(app2)); // now update the password for the apps and make sure it takes affect secretManager.registerApp(app1, pw1update); assertEquals(pw1update, secretManager.getSecretKey(app1)); secretManager.registerApp(app2, ByteBuffer.wrap(pw2update.getBytes())); assertEquals(pw2update, secretManager.getSecretKey(app2)); secretManager.unregisterApp(app1); assertNull(secretManager.getSecretKey(app1)); assertEquals(pw2update, secretManager.getSecretKey(app2)); secretManager.unregisterApp(app2); assertNull(secretManager.getSecretKey(app2)); assertNull(secretManager.getSecretKey(app1)); } }
@Test public void testMultipleRegisters() { ShuffleSecretManager secretManager = new ShuffleSecretManager(); secretManager.registerApp(app1, pw1); assertEquals(pw1, secretManager.getSecretKey(app1)); secretManager.registerApp(app2, ByteBuffer.wrap(pw2.getBytes())); assertEquals(pw2, secretManager.getSecretKey(app2)); // now update the password for the apps and make sure it takes affect secretManager.registerApp(app1, pw1update); assertEquals(pw1update, secretManager.getSecretKey(app1)); secretManager.registerApp(app2, ByteBuffer.wrap(pw2update.getBytes())); assertEquals(pw2update, secretManager.getSecretKey(app2)); secretManager.unregisterApp(app1); assertNull(secretManager.getSecretKey(app1)); assertEquals(pw2update, secretManager.getSecretKey(app2)); secretManager.unregisterApp(app2); assertNull(secretManager.getSecretKey(app2)); assertNull(secretManager.getSecretKey(app1)); } }
@Test public void testMultipleRegisters() { ShuffleSecretManager secretManager = new ShuffleSecretManager(); secretManager.registerApp(app1, pw1); assertEquals(pw1, secretManager.getSecretKey(app1)); secretManager.registerApp(app2, ByteBuffer.wrap(pw2.getBytes())); assertEquals(pw2, secretManager.getSecretKey(app2)); // now update the password for the apps and make sure it takes affect secretManager.registerApp(app1, pw1update); assertEquals(pw1update, secretManager.getSecretKey(app1)); secretManager.registerApp(app2, ByteBuffer.wrap(pw2update.getBytes())); assertEquals(pw2update, secretManager.getSecretKey(app2)); secretManager.unregisterApp(app1); assertNull(secretManager.getSecretKey(app1)); assertEquals(pw2update, secretManager.getSecretKey(app2)); secretManager.unregisterApp(app2); assertNull(secretManager.getSecretKey(app2)); assertNull(secretManager.getSecretKey(app1)); } }