@Test public void testGetAndSetAndRemoveToken() { FakeGadgetToken t = new FakeGadgetToken(); ConsumerInfo consumer = new ConsumerInfo(null, null, null); t.setAppUrl("http://localhost:8080/samplecontainer/examples/oauth.xml"); t.setViewerId("viewer-one"); assertNull(store.getTokenInfo(t, consumer, "", "")); TokenInfo info = new TokenInfo("token", "secret", null, 0); store.setTokenInfo(t, consumer, "service", "token", info); info = store.getTokenInfo(t, consumer, "service", "token"); assertEquals("token", info.getAccessToken()); assertEquals("secret", info.getTokenSecret()); FakeGadgetToken t2 = new FakeGadgetToken(); t2.setAppUrl("http://localhost:8080/samplecontainer/examples/oauth.xml"); t2.setViewerId("viewer-two"); assertNull(store.getTokenInfo(t2, consumer, "service", "token")); store.removeToken(t, consumer, "service", "token"); assertNull(store.getTokenInfo(t, consumer, "service", "token")); }
@Test public void testGetAndSetAndRemoveToken() { FakeGadgetToken t = new FakeGadgetToken(); ConsumerInfo consumer = new ConsumerInfo(null, null, null); t.setAppUrl("http://localhost:8080/gadgets/oauth.xml"); t.setViewerId("viewer-one"); assertNull(store.getTokenInfo(t, consumer, "", "")); TokenInfo info = new TokenInfo("token", "secret", null, 0); store.setTokenInfo(t, consumer, "service", "token", info); info = store.getTokenInfo(t, consumer, "service", "token"); assertEquals("token", info.getAccessToken()); assertEquals("secret", info.getTokenSecret()); FakeGadgetToken t2 = new FakeGadgetToken(); t2.setAppUrl("http://localhost:8080/gadgets/oauth.xml"); t2.setViewerId("viewer-two"); assertNull(store.getTokenInfo(t2, consumer, "service", "token")); store.removeToken(t, consumer, "service", "token"); assertNull(store.getTokenInfo(t, consumer, "service", "token")); }
@Test public void testGetAndSetAndRemoveToken() { FakeGadgetToken t = new FakeGadgetToken(); ConsumerInfo consumer = new ConsumerInfo(null, null, null); t.setAppUrl("http://localhost:8080/gadgets/oauth.xml"); t.setViewerId("viewer-one"); assertNull(store.getTokenInfo(t, consumer, "", "")); TokenInfo info = new TokenInfo("token", "secret", null, 0); store.setTokenInfo(t, consumer, "service", "token", info); info = store.getTokenInfo(t, consumer, "service", "token"); assertEquals("token", info.getAccessToken()); assertEquals("secret", info.getTokenSecret()); FakeGadgetToken t2 = new FakeGadgetToken(); t2.setAppUrl("http://localhost:8080/gadgets/oauth.xml"); t2.setViewerId("viewer-two"); assertNull(store.getTokenInfo(t2, consumer, "service", "token")); store.removeToken(t, consumer, "service", "token"); assertNull(store.getTokenInfo(t, consumer, "service", "token")); }