// Check instance id format
assertEquals("web/BannerPortlet", storage_.getId(banner1.getState()));
// Update site prefs
PortletPreferences sitePrefs = new PortletPreferences();
sitePrefs.setWindowId("portal#test:/web/BannerPortlet/banner");
sitePrefs.setPreferences(new ArrayList<Preference>(Collections.singleton(new Preference())));
sitePrefs.getPreferences().get(0).setName("template");
sitePrefs.getPreferences().get(0).getValues().add("bar");
storage_.save(sitePrefs);
// Check that page prefs have not changed
pagePrefs = storage_.load(instanceId, ApplicationType.PORTLET);
assertEquals(new PortletBuilder().add("template", "par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl")
.build(), pagePrefs);
// Update page prefs
pagePrefs.setValue("template", "foo");
storage_.save(instanceId, pagePrefs);
// Check that page prefs have changed
pagePrefs = storage_.load(instanceId, ApplicationType.PORTLET);
assertEquals(new PortletBuilder().add("template", "foo").build(), pagePrefs);
// Check that site prefs have not changed
sitePrefs = storage_.getPortletPreferences("portal#test:/web/BannerPortlet/banner");
assertEquals("bar", sitePrefs.getPreferences().get(0).getValues().get(0));
// Now check the container
Container container = (Container)clone.getChildren().get(1);
assertEquals(2, container.getChildren().size());