@Test public void featureConfigurationInjected() throws Exception { String gadgetXml = "<Module><ModulePrefs title=''>" + " <Require feature='foo'/>" + "</ModulePrefs>" + "<Content type='html'/>" + "</Module>"; Gadget gadget = makeGadgetWithSpec(gadgetXml); expectFeatureCalls(gadget, ImmutableList.of(inline("foo", "dbg")), ImmutableSet.<String>of(), ImmutableList.<FeatureResource>of()); config.data.put(FEATURES_KEY, ImmutableMap.of("foo", "blah")); String rewritten = rewrite(gadget, ""); JSONObject json = getConfigJson(rewritten); assertEquals("blah", json.get("foo")); }
@Test public void featureConfigurationInjected() throws Exception { String gadgetXml = "<Module><ModulePrefs title=''>" + " <Require feature='foo'/>" + "</ModulePrefs>" + "<Content type='html'/>" + "</Module>"; Gadget gadget = makeGadgetWithSpec(gadgetXml); expectFeatureCalls(gadget, ImmutableList.of(inline("foo", "dbg")), ImmutableSet.<String>of(), ImmutableList.<FeatureResource>of()); config.data.put(FEATURES_KEY, ImmutableMap.of("foo", "blah")); String rewritten = rewrite(gadget, ""); JSONObject json = getConfigJson(rewritten); assertEquals("blah", json.get("foo")); }
@Test public void featureConfigurationInjected() throws Exception { String gadgetXml = "<Module><ModulePrefs title=''>" + " <Require feature='foo'/>" + "</ModulePrefs>" + "<Content type='html'/>" + "</Module>"; Gadget gadget = makeGadgetWithSpec(gadgetXml); expectFeatureCalls(gadget, ImmutableList.of(inline("foo", "dbg")), ImmutableSet.<String>of(), ImmutableList.<FeatureResource>of()); config.data.put(FEATURES_KEY, ImmutableMap.of("foo", "blah")); String rewritten = rewrite(gadget, ""); JSONObject json = getConfigJson(rewritten); assertEquals("blah", json.get("foo")); }
JSONObject json = getConfigJson(rewritten); assertEquals("blah", json.get("foo"));
JSONObject json = getConfigJson(rewritten); assertEquals("blah", json.get("foo"));
JSONObject json = getConfigJson(rewritten); assertEquals("blah", json.get("foo"));
JSONObject json = getConfigJson(rewritten); assertEquals("blah", json.get("foo")); assertEquals("baz", json.get("bar"));
JSONObject json = getConfigJson(rewritten); assertEquals("blah", json.get("foo")); assertEquals("baz", json.get("bar"));
JSONObject json = getConfigJson(rewritten); assertEquals("blah", json.get("foo")); assertEquals("baz", json.get("bar"));
JSONObject json = getConfigJson(rewritten);
JSONObject json = getConfigJson(rewritten);