public void append(Appendable buf, Object pojo) throws IOException { buf.append(convertToString(pojo)); } }
public String convertToString(Object pojo) { return convertToXml(pojo); }
@Before public void abstractLargeRestfulBefore() throws Exception { Injector injector = Guice.createInjector(new SocialApiTestsGuiceModule()); servlet = new DataServiceServlet(); HandlerRegistry dispatcher = injector.getInstance(HandlerRegistry.class); dispatcher.addHandlers(injector.getInstance(Key.get(new TypeLiteral<Set<Object>>(){}, Names.named("org.apache.shindig.handlers")))); servlet.setHandlerRegistry(dispatcher); ContainerConfig containerConfig = EasyMock.createMock(ContainerConfig.class); EasyMock.expect(containerConfig.<String>getList(null, "gadgets.parentOrigins")).andReturn(Collections.<String>singletonList("*")).anyTimes(); EasyMock.replay(containerConfig); servlet.setContainerConfig(containerConfig); servlet.setBeanConverters(new BeanJsonConverter(injector), new BeanXStreamConverter(new XStream081Configuration(injector)), new BeanXStreamAtomConverter(new XStream081Configuration(injector))); res = EasyMock.createMock(HttpServletResponse.class); NamespaceContext ns = new SimpleNamespaceContext(ImmutableMap.of("", "http://ns.opensocial.org/2008/opensocial")); XMLUnit.setXpathNamespaceContext(ns); xp = XMLUnit.newXpathEngine(); }
@Test public void testPerson1() throws Exception { String xml = loadXML("testxml/person1.xml"); beanXmlConverter.convertToObject(xml, Person.class); }
@Before public void abstractLargeRestfulBefore() throws Exception { injector = Guice.createInjector(new SocialApiTestsGuiceModule()); servlet = new DataServiceServlet(); HandlerRegistry dispatcher = injector.getInstance(HandlerRegistry.class); dispatcher.addHandlers(injector.getInstance(Key.get(new TypeLiteral<Set<Object>>(){}, Names.named("org.apache.shindig.handlers")))); servlet.setHandlerRegistry(dispatcher); ContainerConfig containerConfig = EasyMock.createMock(ContainerConfig.class); EasyMock.expect(containerConfig.<String>getList(null, "gadgets.parentOrigins")).andReturn(Collections.<String>singletonList("*")).anyTimes(); EasyMock.replay(containerConfig); servlet.setContainerConfig(containerConfig); servlet.setJSONPAllowed(true); servlet.setBeanConverters(new BeanJsonConverter(injector), new BeanXStreamConverter(new XStream081Configuration(injector)), new BeanXStreamAtomConverter(new XStream081Configuration(injector))); res = EasyMock.createMock(HttpServletResponse.class); NamespaceContext ns = new SimpleNamespaceContext(ImmutableMap.of("", "http://ns.opensocial.org/2008/opensocial")); XMLUnit.setXpathNamespaceContext(ns); xp = XMLUnit.newXpathEngine(); }
@Test public void testActivity1() throws Exception { String xml = loadXML("testxml/activity1.xml"); beanXmlConverter.convertToObject(xml, Activity.class); }
public void append(Appendable buf, Object pojo) throws IOException { buf.append(convertToString(pojo)); } }
@Before public void abstractLargeRestfulBefore() throws Exception { injector = Guice.createInjector(new SocialApiTestsGuiceModule()); servlet = new DataServiceServlet(); HandlerRegistry dispatcher = injector.getInstance(HandlerRegistry.class); dispatcher.addHandlers(injector.getInstance(Key.get(new TypeLiteral<Set<Object>>(){}, Names.named("org.apache.shindig.handlers")))); servlet.setHandlerRegistry(dispatcher); ContainerConfig containerConfig = EasyMock.createMock(ContainerConfig.class); EasyMock.expect(containerConfig.<String>getList(null, "gadgets.parentOrigins")).andReturn(Collections.<String>singletonList("*")).anyTimes(); EasyMock.replay(containerConfig); servlet.setContainerConfig(containerConfig); servlet.setJSONPAllowed(true); servlet.setBeanConverters(new BeanJsonConverter(injector), new BeanXStreamConverter(new XStream081Configuration(injector)), new BeanXStreamAtomConverter(new XStream081Configuration(injector))); res = EasyMock.createMock(HttpServletResponse.class); NamespaceContext ns = new SimpleNamespaceContext(ImmutableMap.of("", "http://ns.opensocial.org/2008/opensocial")); XMLUnit.setXpathNamespaceContext(ns); xp = XMLUnit.newXpathEngine(); }
@Test public void testAppdata1() throws Exception { String xml = loadXML("testxml/appdata1.xml"); beanXmlConverter.convertToObject(xml, Map.class); }
public String convertToString(Object pojo) { return convertToXml(pojo); }
public void append(Appendable buf, Object pojo) throws IOException { buf.append(convertToString(pojo)); } }
/** * Gets the data service servlet. * * @param injector the injector * * @return the data service servlet */ public static DataServiceServlet getDataServiceServlet(Injector injector) { // Set data service servlet again to use JPA guice dependencies DataServiceServlet servlet = new DataServiceServlet(); HandlerRegistry registry = injector.getInstance(HandlerRegistry.class); registry.addHandlers( ImmutableSet.<Object>of(ActivityHandler.class, AppDataHandler.class, PersonHandler.class, MessageHandler.class)); servlet.setHandlerRegistry(registry); servlet.setBeanConverters(new BeanJsonConverter(injector), new BeanXStreamConverter(new XStream081Configuration(injector)), new BeanXStreamAtomConverter(new XStream081Configuration(injector))); ContainerConfig containerConfig = EasyMock.createMock(ContainerConfig.class); EasyMock.expect(containerConfig.<String>getList(null, "gadgets.parentOrigins")).andReturn(Collections.<String>singletonList("*")).anyTimes(); EasyMock.replay(containerConfig); servlet.setContainerConfig(containerConfig); return servlet; }
@Test public void testPerson1() throws Exception { String xml = loadXML("testxml/person1.xml"); beanXmlConverter.convertToObject(xml, Person.class); }
public String convertToString(Object pojo) { return convertToXml(pojo); }
public void append(Appendable buf, Object pojo) throws IOException { buf.append(convertToString(pojo)); } }
@Before public void setUp() throws Exception { Injector injector = Guice.createInjector(new SocialApiTestsGuiceModule()); johnDoe = new PersonImpl("johnDoeId", "Johnny", new NameImpl("John Doe")); johnDoe.setPhoneNumbers(Lists.<ListField> newArrayList(new ListFieldImpl( "home", "+33H000000000"), new ListFieldImpl("mobile", "+33M000000000"), new ListFieldImpl("work", "+33W000000000"))); johnDoe.setAddresses(Lists.<Address> newArrayList(new AddressImpl( "My home address"))); johnDoe.setEmails(Lists.<ListField> newArrayList(new ListFieldImpl("work", "john.doe@work.bar"), new ListFieldImpl("home", "john.doe@home.bar"))); activity = new ActivityImpl("activityId", johnDoe.getId()); activity.setUrl("http://foo.com/"); activity.setMediaItems(Lists.<MediaItem> newArrayList(new MediaItemImpl( "image/jpg", MediaItem.Type.IMAGE, "http://foo.bar"))); beanXmlConverter = new BeanXStreamConverter(new XStream081Configuration(injector)); }
@Test public void testPerson1() throws Exception { String xml = loadXML("testxml/person1.xml"); beanXmlConverter.convertToObject(xml, Person.class); }
public String convertToString(Object pojo) { return convertToXml(pojo); }
public void append(Appendable buf, Object pojo) throws IOException { buf.append(convertToString(pojo)); } }
@Before public void setUp() throws Exception { Injector injector = Guice.createInjector(new SocialApiTestsGuiceModule()); johnDoe = new PersonImpl("johnDoeId", "Johnny", new NameImpl("John Doe")); johnDoe.setPhoneNumbers(Lists.<ListField> newArrayList(new ListFieldImpl( "home", "+33H000000000"), new ListFieldImpl("mobile", "+33M000000000"), new ListFieldImpl("work", "+33W000000000"))); johnDoe.setAddresses(Lists.<Address> newArrayList(new AddressImpl( "My home address"))); johnDoe.setEmails(Lists.<ListField> newArrayList(new ListFieldImpl("work", "john.doe@work.bar"), new ListFieldImpl("home", "john.doe@home.bar"))); activity = new ActivityImpl("activityId", johnDoe.getId()); activity.setUrl("http://foo.com/"); activity.setMediaItems(Lists.<MediaItem> newArrayList(new MediaItemImpl( "image/jpg", MediaItem.Type.IMAGE, "http://foo.bar"))); beanXmlConverter = new BeanXStreamConverter(new XStream081Configuration(injector)); }