@Before public void setUp() throws Exception { servlet = new DataServiceServlet(); req = mockControl.createMock(HttpServletRequest.class); res = mockControl.createMock(HttpServletResponse.class); jsonConverter = mockControl.createMock(BeanJsonConverter.class); xmlConverter = mockControl.createMock(BeanConverter.class); atomConverter = mockControl.createMock(BeanConverter.class); containerConfig = mockControl.createMock(ContainerConfig.class); EasyMock.expect(jsonConverter.getContentType()).andReturn( ContentTypes.OUTPUT_JSON_CONTENT_TYPE).anyTimes(); EasyMock.expect(xmlConverter.getContentType()).andReturn( ContentTypes.OUTPUT_XML_CONTENT_TYPE).anyTimes(); EasyMock.expect(atomConverter.getContentType()).andReturn( ContentTypes.OUTPUT_ATOM_CONTENT_TYPE).anyTimes(); HandlerRegistry registry = new DefaultHandlerRegistry(null, jsonConverter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(Sets.<Object>newHashSet(new TestHandler())); servlet.setHandlerRegistry(registry); servlet.setContainerConfig(containerConfig); servlet.setJSONPAllowed(true); servlet.setBeanConverters(jsonConverter, xmlConverter, atomConverter); }
@Before public void setUp() throws Exception { servlet = new JsonRpcServlet(); req = mockControl.createMock(HttpServletRequest.class); res = mockControl.createMock(HttpServletResponse.class); containerConfig = mockControl.createMock(ContainerConfig.class); multipartFormParser = mockControl.createMock(MultipartFormParser.class); EasyMock.expect(multipartFormParser.isMultipartContent(req)).andStubReturn(false); servlet.setMultipartFormParser(multipartFormParser); BeanJsonConverter converter = new BeanJsonConverter(Guice.createInjector()); HandlerRegistry registry = new DefaultHandlerRegistry(null, null, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(Collections.<Object>singleton(handler)); servlet.setHandlerRegistry(registry); servlet.setBeanConverters(converter, null, null); servlet.setContainerConfig(containerConfig); servlet.setJSONPAllowed(true); handler.setMock(new TestHandler() { @Override public Object get(RequestItem req) { return ImmutableMap.of("foo", "bar"); } }); }
@Before public void setUp() throws Exception { servlet = new JsonRpcServlet(); req = mockControl.createMock(HttpServletRequest.class); res = mockControl.createMock(HttpServletResponse.class); containerConfig = mockControl.createMock(ContainerConfig.class); multipartFormParser = mockControl.createMock(MultipartFormParser.class); EasyMock.expect(multipartFormParser.isMultipartContent(req)).andStubReturn(false); servlet.setMultipartFormParser(multipartFormParser); BeanJsonConverter converter = new BeanJsonConverter(Guice.createInjector()); HandlerRegistry registry = new DefaultHandlerRegistry(null, null, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(Collections.<Object>singleton(handler)); servlet.setHandlerRegistry(registry); servlet.setBeanConverters(converter, null, null); servlet.setContainerConfig(containerConfig); servlet.setJSONPAllowed(true); handler.setMock(new TestHandler() { @Override public Object get(RequestItem req) { return ImmutableMap.of("foo", "bar"); } }); }
@Before public void setUp() throws Exception { servlet = new JsonRpcServlet(); req = mockControl.createMock(HttpServletRequest.class); res = mockControl.createMock(HttpServletResponse.class); containerConfig = mockControl.createMock(ContainerConfig.class); multipartFormParser = mockControl.createMock(MultipartFormParser.class); EasyMock.expect(multipartFormParser.isMultipartContent(req)).andStubReturn(false); servlet.setMultipartFormParser(multipartFormParser); BeanJsonConverter converter = new BeanJsonConverter(Guice.createInjector()); HandlerRegistry registry = new DefaultHandlerRegistry(null, null, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(Collections.<Object>singleton(handler)); servlet.setHandlerRegistry(registry); servlet.setBeanConverters(converter, null, null); servlet.setContainerConfig(containerConfig); handler.setMock(new TestHandler() { @Override public Object get(RequestItem req) { return ImmutableMap.of("foo", "bar"); } }); }
@Before public void setUp() throws Exception { servlet = new DataServiceServlet(); req = mockControl.createMock(HttpServletRequest.class); res = mockControl.createMock(HttpServletResponse.class); jsonConverter = mockControl.createMock(BeanJsonConverter.class); xmlConverter = mockControl.createMock(BeanConverter.class); atomConverter = mockControl.createMock(BeanConverter.class); containerConfig = mockControl.createMock(ContainerConfig.class); EasyMock.expect(jsonConverter.getContentType()).andReturn( ContentTypes.OUTPUT_JSON_CONTENT_TYPE).anyTimes(); EasyMock.expect(xmlConverter.getContentType()).andReturn( ContentTypes.OUTPUT_XML_CONTENT_TYPE).anyTimes(); EasyMock.expect(atomConverter.getContentType()).andReturn( ContentTypes.OUTPUT_ATOM_CONTENT_TYPE).anyTimes(); HandlerRegistry registry = new DefaultHandlerRegistry(null, jsonConverter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(Sets.<Object>newHashSet(new TestHandler())); servlet.setHandlerRegistry(registry); servlet.setContainerConfig(containerConfig); servlet.setBeanConverters(jsonConverter, xmlConverter, atomConverter); }
@Before public void setUp() throws Exception { servlet = new DataServiceServlet(); req = mockControl.createMock(HttpServletRequest.class); res = mockControl.createMock(HttpServletResponse.class); jsonConverter = mockControl.createMock(BeanJsonConverter.class); xmlConverter = mockControl.createMock(BeanConverter.class); atomConverter = mockControl.createMock(BeanConverter.class); containerConfig = mockControl.createMock(ContainerConfig.class); EasyMock.expect(jsonConverter.getContentType()).andReturn( ContentTypes.OUTPUT_JSON_CONTENT_TYPE).anyTimes(); EasyMock.expect(xmlConverter.getContentType()).andReturn( ContentTypes.OUTPUT_XML_CONTENT_TYPE).anyTimes(); EasyMock.expect(atomConverter.getContentType()).andReturn( ContentTypes.OUTPUT_ATOM_CONTENT_TYPE).anyTimes(); HandlerRegistry registry = new DefaultHandlerRegistry(null, jsonConverter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(Sets.<Object>newHashSet(new TestHandler())); servlet.setHandlerRegistry(registry); servlet.setContainerConfig(containerConfig); servlet.setBeanConverters(jsonConverter, xmlConverter, atomConverter); }
@Before public void setUp() throws Exception { token = new FakeGadgetToken(); converter = new BeanJsonConverter(Guice.createInjector()); mediaService = mock(MediaItemService.class); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.container': ['default']," + "'gadgets.features':{opensocial:" + "{supportedFields: {mediaItem: ['id', 'language', 'title']}}" + "}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); handler = new MediaItemHandler(mediaService, containerConfig, new CollectionOptionsFactory()); registry = new DefaultHandlerRegistry(null, converter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(ImmutableSet.<Object>of(handler)); request = new SocialRequestItem( Maps.<String, String[]>newHashMap(), token, converter, converter); }
@Before public void setUp() throws Exception { token = new FakeGadgetToken(); converter = new BeanJsonConverter(Guice.createInjector()); mediaService = mock(MediaItemService.class); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.container': ['default']," + "'gadgets.features':{opensocial:" + "{supportedFields: {mediaItem: ['id', 'language', 'title']}}" + "}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); handler = new MediaItemHandler(mediaService, containerConfig, new CollectionOptionsFactory()); registry = new DefaultHandlerRegistry(null, converter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(ImmutableSet.<Object>of(handler)); request = new SocialRequestItem( Maps.<String, String[]>newHashMap(), token, converter, converter); }
@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.container': ['default']," + "'gadgets.features':{opensocial:" + "{supportedFields: {activity: ['id', 'title']}}" + "}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); handler = new ActivityHandler(activityService, containerConfig, new CollectionOptionsFactory()); 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)); }
@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)); }
@Before public void setUp() throws Exception { token = new FakeGadgetToken(); converter = mock(BeanJsonConverter.class); personService = mock(PersonService.class); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.container': ['default']," + "'gadgets.features':{opensocial:" + "{supportedFields: {person: ['id', {name: 'familyName'}]}}" + "}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); handler = new PersonHandler(personService, containerConfig, new CollectionOptionsFactory()); registry = new DefaultHandlerRegistry(null, converter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(ImmutableSet.<Object>of(handler)); }
@Before public void setUp() throws Exception { token = new FakeGadgetToken(); converter = mock(BeanJsonConverter.class); albumService = mock(AlbumService.class); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.container': ['default']," + "'gadgets.features':{opensocial:" + "{supportedFields: {album: ['id', 'title', 'location']}}" + "}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); handler = new AlbumHandler(albumService, containerConfig, new CollectionOptionsFactory()); 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); activityService = mock(ActivityService.class); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.container': ['default']," + "'gadgets.features':{opensocial:" + "{supportedFields: {activity: ['id', 'title']}}" + "}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); handler = new ActivityHandler(activityService, containerConfig, new CollectionOptionsFactory()); registry = new DefaultHandlerRegistry(null, converter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(ImmutableSet.<Object>of(handler)); }
@Before public void setUp() throws Exception { token = new FakeGadgetToken(); converter = mock(BeanJsonConverter.class); personService = mock(PersonService.class); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.container': ['default']," + "'gadgets.features':{opensocial:" + "{supportedFields: {person: ['id', {name: 'familyName'}]}}" + "}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); handler = new PersonHandler(personService, containerConfig, new CollectionOptionsFactory()); 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); 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(); converter = mock(BeanJsonConverter.class); albumService = mock(AlbumService.class); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.container': ['default']," + "'gadgets.features':{opensocial:" + "{supportedFields: {album: ['id', 'title', 'location']}}" + "}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); handler = new AlbumHandler(albumService, containerConfig, new CollectionOptionsFactory()); registry = new DefaultHandlerRegistry(null, converter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(ImmutableSet.<Object>of(handler)); }
@Before public void setUp() throws Exception { token = new FakeGadgetToken(); converter = mock(BeanJsonConverter.class); albumService = mock(AlbumService.class); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.features':{opensocial:" + "{supportedFields: {album: ['id', 'title', 'location']}}" + "}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); handler = new AlbumHandler(albumService, containerConfig); registry = new DefaultHandlerRegistry(null, converter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(ImmutableSet.<Object>of(handler)); }
@Before public void setUp() throws Exception { token = new FakeGadgetToken(); converter = mock(BeanJsonConverter.class); mediaService = mock(MediaItemService.class); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.features':{opensocial:" + "{supportedFields: {mediaItem: ['id', 'language', 'title']}}" + "}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); handler = new MediaItemHandler(mediaService, containerConfig); registry = new DefaultHandlerRegistry(null, converter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(ImmutableSet.<Object>of(handler)); }
@Before public void setUp() throws Exception { token = new FakeGadgetToken(); converter = mock(BeanJsonConverter.class); personService = mock(PersonService.class); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.features':{opensocial:" + "{supportedFields: {person: ['id', {name: 'familyName'}]}}" + "}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); handler = new PersonHandler(personService, containerConfig); registry = new DefaultHandlerRegistry(null, converter, new HandlerExecutionListener.NoOpHandler()); registry.addHandlers(ImmutableSet.<Object>of(handler)); }