@Before public void setUp() throws Exception { FAKE_TOKEN.setAppId("12345"); FAKE_TOKEN.setOwnerId("someowner"); FAKE_TOKEN.setViewerId("someowner"); converter = new BeanJsonConverter(Guice.createInjector()); Map<String, String[]> optionalParameters = Maps.newHashMap(); String[] cvalue1 = {"cvalue1"}; String[] cvalue2 = {"cvalue2"}; optionalParameters.put("condition1",cvalue1); optionalParameters.put("condition2",cvalue2); request = new SocialRequestItem( optionalParameters, FAKE_TOKEN, converter, converter); }
@Before public void setUp() throws Exception { FAKE_TOKEN.setAppId("12345"); FAKE_TOKEN.setOwnerId("someowner"); FAKE_TOKEN.setViewerId("someowner"); converter = new BeanJsonConverter(Guice.createInjector()); request = new SocialRequestItem( Maps.<String, String[]>newHashMap(), FAKE_TOKEN, converter, converter); }
@Before public void setUp() throws Exception { FAKE_TOKEN.setAppId("12345"); FAKE_TOKEN.setOwnerId("someowner"); FAKE_TOKEN.setViewerId("someowner"); converter = new BeanJsonConverter(Guice.createInjector()); request = new SocialRequestItem( Maps.<String, String[]>newHashMap(), FAKE_TOKEN, converter, converter); }
@Before public void setUp() throws Exception { FAKE_TOKEN.setAppId("12345"); FAKE_TOKEN.setOwnerId("someowner"); FAKE_TOKEN.setViewerId("someowner"); converter = new BeanJsonConverter(Guice.createInjector()); request = new BaseRequestItem( Maps.<String,String[]>newHashMap(), FAKE_TOKEN, converter, converter); }
@Before public void setUp() throws Exception { FAKE_TOKEN.setAppId("12345"); FAKE_TOKEN.setOwnerId("someowner"); FAKE_TOKEN.setViewerId("someowner"); converter = new BeanJsonConverter(Guice.createInjector()); request = new BaseRequestItem( Maps.<String,String[]>newHashMap(), FAKE_TOKEN, converter, converter); }
@Before public void setUp() throws Exception { FAKE_TOKEN.setAppId("12345"); FAKE_TOKEN.setOwnerId("someowner"); FAKE_TOKEN.setViewerId("someowner"); converter = new BeanJsonConverter(Guice.createInjector()); request = new BaseRequestItem( Maps.<String,String[]>newHashMap(), FAKE_TOKEN, converter, converter); }
@Before public void setUp() throws Exception { FAKE_TOKEN.setAppId("12345"); FAKE_TOKEN.setOwnerId("someowner"); FAKE_TOKEN.setViewerId("someowner"); converter = new BeanJsonConverter(Guice.createInjector()); request = new BaseRequestItem( Maps.<String,String[]>newHashMap(), FAKE_TOKEN, converter, converter); }
@Before public void setUp() throws Exception { FAKE_TOKEN.setAppId("12345"); FAKE_TOKEN.setOwnerId("someowner"); FAKE_TOKEN.setViewerId("someowner"); converter = new BeanJsonConverter(Guice.createInjector()); request = new SocialRequestItem( Maps.<String, String[]>newHashMap(), FAKE_TOKEN, converter, converter); }
@Before public void setUp() throws Exception { FAKE_TOKEN.setAppId("12345"); FAKE_TOKEN.setOwnerId("someowner"); FAKE_TOKEN.setViewerId("someowner"); converter = new BeanJsonConverter(Guice.createInjector()); request = new BaseRequestItem( Maps.<String,String[]>newHashMap(), FAKE_TOKEN, converter, converter); }
@Test public void testFailInvalidateNoApp() throws Exception { String path = "/cache/invalidate"; RestHandler operation = registry.getRestHandler(path, "POST"); params.put(InvalidationHandler.KEYS_PARAM, new String[]{"http://www.example.org/gadget.xml"}); try { token.setAppId(""); token.setAppUrl(""); operation.execute(params, null, token, converter).get(); fail("Expected error"); } catch (ExecutionException ee) { assertTrue(ee.getCause() instanceof ProtocolException); } } }
@Test public void testFailInvalidateNoApp() throws Exception { String path = "/cache/invalidate"; RestHandler operation = registry.getRestHandler(path, "POST"); params.put(InvalidationHandler.KEYS_PARAM, new String[]{"http://www.example.org/gadget.xml"}); try { token.setAppId(""); token.setAppUrl(""); operation.execute(params, null, token, converter).get(); fail("Expected error"); } catch (ExecutionException ee) { assertTrue(ee.getCause() instanceof ProtocolException); } } }
@Test public void testFailInvalidateNoApp() throws Exception { String path = "/cache/invalidate"; RestHandler operation = registry.getRestHandler(path, "POST"); params.put(InvalidationHandler.KEYS_PARAM, new String[]{"http://www.example.org/gadget.xml"}); try { token.setAppId(""); token.setAppUrl(""); operation.execute(params, null, token, converter).get(); fail("Expected error"); } catch (ExecutionException ee) { assertTrue(ee.getCause() instanceof ProtocolException); } } }
public FakeGadgetToken(String appId, String appUrl, String domain, String ownerId, String trustedJson, String viewerId, String moduleId) { setAppId(appId); setAppUrl(appUrl); setDomain(domain); setOwnerId(ownerId); setTrustedJson(trustedJson); setViewerId(viewerId); if (moduleId != null) { setModuleId(Long.parseLong(moduleId)); } }
public FakeGadgetToken(String appId, String appUrl, String domain, String ownerId, String trustedJson, String viewerId, String moduleId) { setAppId(appId); setAppUrl(appUrl); setDomain(domain); setOwnerId(ownerId); setTrustedJson(trustedJson); setViewerId(viewerId); if (moduleId != null) { setModuleId(Long.parseLong(moduleId)); } }
public FakeGadgetToken(String appId, String appUrl, String domain, String ownerId, String trustedJson, String viewerId, String moduleId) { setAppId(appId); setAppUrl(appUrl); setDomain(domain); setOwnerId(ownerId); setTrustedJson(trustedJson); setViewerId(viewerId); if (moduleId != null) { setModuleId(Long.parseLong(moduleId)); } }
@Before public void setUp() throws Exception { token = new FakeGadgetToken(); token.setAppId("appId"); token.setViewerId("userX"); converter = mock(BeanJsonConverter.class); invalidationService = mock(InvalidationService.class); handler = new InvalidationHandler(invalidationService); registry = new DefaultHandlerRegistry(null, converter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(Sets.<Object>newHashSet(handler)); params = Maps.newHashMap(); }
@Before public void setUp() throws Exception { token = new FakeGadgetToken(); token.setAppId("appId"); token.setViewerId("userX"); converter = mock(BeanJsonConverter.class); invalidationService = mock(InvalidationService.class); handler = new InvalidationHandler(invalidationService); registry = new DefaultHandlerRegistry(null, converter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(Sets.<Object>newHashSet(handler)); params = Maps.newHashMap(); }
@Before public void setUp() throws Exception { token = new FakeGadgetToken(); token.setAppId("appId"); token.setViewerId("userX"); converter = mock(BeanJsonConverter.class); invalidationService = mock(InvalidationService.class); handler = new InvalidationHandler(invalidationService); registry = new DefaultHandlerRegistry(null, converter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(Sets.<Object>newHashSet(handler)); params = Maps.newHashMap(); }
@Before public void setUp() throws Exception { token = new FakeGadgetToken(); token.setAppId("appId"); converter = mock(BeanJsonConverter.class); activityService = mock(ActivityService.class); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.features':{opensocial:" + "{supportedFields: {activity: ['id', 'title']}}" + "}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); handler = new ActivityHandler(activityService, containerConfig); registry = new DefaultHandlerRegistry(null, converter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(ImmutableSet.<Object>of(handler)); }
@Before public void setUp() throws Exception { token = new FakeGadgetToken(); token.setAppId("appId"); converter = mock(BeanJsonConverter.class); service = mock(ActivityStreamService.class); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.container': ['default']," + "'gadgets.features':{opensocial:" + "{supportedFields: {activityEntry: ['id', 'title']}}" + "}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); handler = new ActivityStreamHandler(service, containerConfig, new CollectionOptionsFactory()); registry = new DefaultHandlerRegistry(null, converter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(ImmutableSet.<Object>of(handler)); }