Map<PipelinedData, Node> pipelineNodes = parsePipelinedData(gadget, doc);
Map<PipelinedData, Node> pipelineNodes = parsePipelinedData(gadget, doc);
Map<PipelinedData, Node> pipelineNodes = parsePipelinedData(gadget, doc);
@Test /** Test that os:DataRequest is parsed correctly */ public void parseOfDataRequest() throws Exception { final String contentWithDataRequest = "<script xmlns:os=\"http://ns.opensocial.org/2008/markup\" type=\"text/os-data\">" + " <os:DataRequest key=\"me\" method=\"people.get\" userId=\"canonical\"/>" + "</script>"; setupGadget(getGadgetXml(contentWithDataRequest)); Map<PipelinedData, ? extends Object> pipelines = rewriter.parsePipelinedData(gadget, content.getDocument()); assertEquals(1, pipelines.size()); PipelinedData pipeline = pipelines.keySet().iterator().next(); PipelinedData.Batch batch = pipeline.getBatch(Expressions.forTesting(), new RootELResolver()); Map<String, PipelinedData.BatchItem> preloads = batch.getPreloads(); assertTrue(preloads.containsKey("me")); assertEquals(PipelinedData.BatchType.SOCIAL, preloads.get("me").getType()); JsonAssert.assertObjectEquals( "{params: {userId: 'canonical'}, method: 'people.get', id: 'me'}", preloads.get("me").getData()); }
@Test /** Test that os:DataRequest is parsed correctly */ public void parseOfDataRequest() throws Exception { final String contentWithDataRequest = "<script xmlns:os=\"http://ns.opensocial.org/2008/markup\" type=\"text/os-data\">" + " <os:DataRequest key=\"me\" method=\"people.get\" userId=\"canonical\"/>" + "</script>"; setupGadget(getGadgetXml(contentWithDataRequest)); Map<PipelinedData, ? extends Object> pipelines = rewriter.parsePipelinedData(gadget, content.getDocument()); assertEquals(1, pipelines.size()); PipelinedData pipeline = pipelines.keySet().iterator().next(); PipelinedData.Batch batch = pipeline.getBatch(Expressions.forTesting(), new RootELResolver()); Map<String, PipelinedData.BatchItem> preloads = batch.getPreloads(); assertTrue(preloads.containsKey("me")); assertEquals(PipelinedData.BatchType.SOCIAL, preloads.get("me").getType()); JsonAssert.assertObjectEquals( "{params: {userId: 'canonical'}, method: 'people.get', id: 'me'}", preloads.get("me").getData()); }
@Test /** Test that os:DataRequest is parsed correctly */ public void parseOfDataRequest() throws Exception { final String contentWithDataRequest = "<script xmlns:os=\"http://ns.opensocial.org/2008/markup\" type=\"text/os-data\">" + " <os:DataRequest key=\"me\" method=\"people.get\" userId=\"canonical\"/>" + "</script>"; setupGadget(getGadgetXml(contentWithDataRequest)); Map<PipelinedData, ? extends Object> pipelines = rewriter.parsePipelinedData(gadget, content.getDocument()); assertEquals(1, pipelines.size()); PipelinedData pipeline = pipelines.keySet().iterator().next(); PipelinedData.Batch batch = pipeline.getBatch(Expressions.forTesting(), new RootELResolver()); Map<String, PipelinedData.BatchItem> preloads = batch.getPreloads(); assertTrue(preloads.containsKey("me")); assertEquals(PipelinedData.BatchType.SOCIAL, preloads.get("me").getType()); JsonAssert.assertObjectEquals( "{params: {userId: 'canonical'}, method: 'people.get', id: 'me'}", preloads.get("me").getData()); }