@Test
public void testInit() throws Exception {
FakeGadgetToken t = new FakeGadgetToken();
t.setAppUrl("http://localhost:8080/gadgets/files/samplecontainer/examples/oauth.xml");
OAuthServiceProvider provider = new OAuthServiceProvider("req", "authorize", "access");
ConsumerInfo consumerInfo = store.getConsumerKeyAndSecret(t, "", provider);
OAuthConsumer consumer = consumerInfo.getConsumer();
assertEquals("gadgetConsumer", consumer.consumerKey);
assertEquals("gadgetSecret", consumer.consumerSecret);
assertEquals("HMAC-SHA1", consumer.getProperty("oauth_signature_method"));
assertEquals(provider, consumer.serviceProvider);
assertNull(consumerInfo.getKeyName());
assertEquals("default callback", consumerInfo.getCallbackUrl());
t.setAppUrl("http://rsagadget/test.xml");
consumerInfo = store.getConsumerKeyAndSecret(t, "", provider);
consumer = consumerInfo.getConsumer();
assertEquals("rsaconsumer", consumer.consumerKey);
assertNull(consumer.consumerSecret);
assertEquals("RSA-SHA1", consumer.getProperty("oauth_signature_method"));
assertEquals(provider, consumer.serviceProvider);
assertEquals("rsaprivate", consumer.getProperty(RSA_SHA1.PRIVATE_KEY));
assertNull(consumerInfo.getKeyName());
assertEquals("callback", consumerInfo.getCallbackUrl());
}