WikiAttachmentImageCreoleEditorConfigContributor extends BaseWikiAttachmentImageEditorConfigContributor { @Reference(unbind = "-") protected void setItemSelector(ItemSelector itemSelector) { _itemSelector = itemSelector; }    }
@Test public void testItemSelectorURLWhenNotAllowBrowseAndNullWikiPage() throws Exception { setAllowBrowseDocuments(false); setWikiPageResourcePrimKey(0); JSONObject originalJSONObject = getJSONObjectWithDefaultItemSelectorURL(); JSONObject jsonObject = JSONFactoryUtil.createJSONObject( originalJSONObject.toJSONString()); WikiAttachmentImageCreoleEditorConfigContributor wikiAttachmentImageCreoleEditorConfigContributor = new WikiAttachmentImageCreoleEditorConfigContributor(); wikiAttachmentImageCreoleEditorConfigContributor.setItemSelector( _itemSelector); wikiAttachmentImageCreoleEditorConfigContributor. populateConfigJSONObject( jsonObject, _inputEditorTaglibAttributes, null, null); JSONObject expectedJSONObject = JSONFactoryUtil.createJSONObject( originalJSONObject.toJSONString()); expectedJSONObject.put("removePlugins", "plugin1"); JSONAssert.assertEquals( expectedJSONObject.toJSONString(), jsonObject.toJSONString(), true); }
@Test public void testItemSelectorURLWhenNotAllowBrowseAndValidWikiPage() throws Exception { setAllowBrowseDocuments(false); setWikiPageResourcePrimKey(1); JSONObject originalJSONObject = getJSONObjectWithDefaultItemSelectorURL(); JSONObject jsonObject = JSONFactoryUtil.createJSONObject( originalJSONObject.toJSONString()); WikiAttachmentImageCreoleEditorConfigContributor wikiAttachmentImageCreoleEditorConfigContributor = new WikiAttachmentImageCreoleEditorConfigContributor(); wikiAttachmentImageCreoleEditorConfigContributor.setItemSelector( _itemSelector); wikiAttachmentImageCreoleEditorConfigContributor. populateConfigJSONObject( jsonObject, _inputEditorTaglibAttributes, null, null); JSONObject expectedJSONObject = JSONFactoryUtil.createJSONObject( originalJSONObject.toJSONString()); expectedJSONObject.put("removePlugins", "plugin1"); JSONAssert.assertEquals( expectedJSONObject.toJSONString(), jsonObject.toJSONString(), true); }