List of usage examples for com.liferay.portal.json JSONFactoryImpl JSONFactoryImpl
public JSONFactoryImpl()
From source file:com.liferay.wiki.editor.configuration.internal.WikiAttachmentEditorConfigContributorTest.java
License:Open Source License
@Before public void setUp() { MockitoAnnotations.initMocks(this); JSONFactoryUtil jsonFactoryUtil = new JSONFactoryUtil(); jsonFactoryUtil.setJSONFactory(new JSONFactoryImpl()); LanguageUtil languageUtil = new LanguageUtil(); languageUtil.setLanguage(new LanguageImpl()); _requestBackedPortletURLFactory = mock(RequestBackedPortletURLFactory.class); when(_requestBackedPortletURLFactory.createActionURL(WikiPortletKeys.WIKI)) .thenReturn(mock(LiferayPortletURL.class)); PortletURL itemSelectorPortletURL = mock(PortletURL.class); when(itemSelectorPortletURL.toString()) .thenReturn("itemSelectorPortletURLWithWikiImageUrlAndUploadSelectionViews"); when(_itemSelector.getItemSelectorURL(Mockito.any(RequestBackedPortletURLFactory.class), Mockito.anyString(), Mockito.any(ItemSelectorCriterion.class), Mockito.any(ItemSelectorCriterion.class), Mockito.any(ItemSelectorCriterion.class), Mockito.any(ItemSelectorCriterion.class))).thenReturn(itemSelectorPortletURL); _inputEditorTaglibAttributes.put("liferay-ui:input-editor:name", "testEditor"); }
From source file:com.liferay.wiki.editor.configuration.internal.WikiAttachmentImageCreoleEditorConfigContributorTest.java
License:Open Source License
@Before public void setUp() { MockitoAnnotations.initMocks(this); JSONFactoryUtil jsonFactoryUtil = new JSONFactoryUtil(); jsonFactoryUtil.setJSONFactory(new JSONFactoryImpl()); LanguageUtil languageUtil = new LanguageUtil(); languageUtil.setLanguage(new LanguageImpl()); _requestBackedPortletURLFactory = mock(RequestBackedPortletURLFactory.class); when(_requestBackedPortletURLFactory.createActionURL(WikiPortletKeys.WIKI)) .thenReturn(mock(LiferayPortletURL.class)); _inputEditorTaglibAttributes.put("liferay-ui:input-editor:name", "testEditor"); }
From source file:com.liferay.wiki.editor.configuration.internal.WikiLinksCKEditorCreoleEditorConfigContributorTest.java
License:Open Source License
@Before public void setUp() { MockitoAnnotations.initMocks(this); JSONFactoryUtil jsonFactoryUtil = new JSONFactoryUtil(); jsonFactoryUtil.setJSONFactory(new JSONFactoryImpl()); _requestBackedPortletURLFactory = mock(RequestBackedPortletURLFactory.class); when(_requestBackedPortletURLFactory.createActionURL(WikiPortletKeys.WIKI)) .thenReturn(mock(LiferayPortletURL.class)); _inputEditorTaglibAttributes.put("liferay-ui:input-editor:name", "testEditor"); PortletURL oneTabItemSelectorPortletURL = mock(PortletURL.class); when(oneTabItemSelectorPortletURL.toString()).thenReturn("oneTabItemSelectorPortletURL"); when(_itemSelector.getItemSelectorURL(Matchers.any(RequestBackedPortletURLFactory.class), Matchers.anyString(), Matchers.any(ItemSelectorCriterion.class))) .thenReturn(oneTabItemSelectorPortletURL); PortletURL twoTabsItemSelectorPortletURL = mock(PortletURL.class); when(twoTabsItemSelectorPortletURL.toString()).thenReturn("twoTabsItemSelectorPortletURL"); when(_itemSelector.getItemSelectorURL(Matchers.any(RequestBackedPortletURLFactory.class), Matchers.anyString(), Matchers.any(ItemSelectorCriterion.class), Matchers.any(ItemSelectorCriterion.class))).thenReturn(twoTabsItemSelectorPortletURL); _wikiLinksCKEditorCreoleEditorConfigContributor = new WikiLinksCKEditorCreoleEditorConfigContributor(); Whitebox.setInternalState(_wikiLinksCKEditorCreoleEditorConfigContributor, "itemSelector", _itemSelector); }
From source file:com.liferay.wiki.editor.configuration.internal.WikiLinksCKEditorEditorConfigContributorTest.java
License:Open Source License
@Before public void setUp() { MockitoAnnotations.initMocks(this); JSONFactoryUtil jsonFactoryUtil = new JSONFactoryUtil(); jsonFactoryUtil.setJSONFactory(new JSONFactoryImpl()); _requestBackedPortletURLFactory = mock(RequestBackedPortletURLFactory.class); when(_requestBackedPortletURLFactory.createActionURL(WikiPortletKeys.WIKI)) .thenReturn(mock(LiferayPortletURL.class)); _inputEditorTaglibAttributes.put("liferay-ui:input-editor:name", "testEditor"); PortletURL oneTabItemSelectorPortletURL = mock(PortletURL.class); when(oneTabItemSelectorPortletURL.toString()).thenReturn("oneTabItemSelectorPortletURL"); when(_itemSelector.getItemSelectorURL(Matchers.any(RequestBackedPortletURLFactory.class), Matchers.anyString(), Matchers.any(ItemSelectorCriterion.class))) .thenReturn(oneTabItemSelectorPortletURL); PortletURL twoTabsItemSelectorPortletURL = mock(PortletURL.class); when(twoTabsItemSelectorPortletURL.toString()).thenReturn("twoTabsItemSelectorPortletURL"); when(_itemSelector.getItemSelectorURL(Matchers.any(RequestBackedPortletURLFactory.class), Matchers.anyString(), Matchers.any(ItemSelectorCriterion.class), Matchers.any(ItemSelectorCriterion.class))).thenReturn(twoTabsItemSelectorPortletURL); _wikiLinksCKEditorEditorConfigContributor = new WikiLinksCKEditorConfigContributor(); Whitebox.setInternalState(_wikiLinksCKEditorEditorConfigContributor, "itemSelector", _itemSelector); }
From source file:it.infn.ct.indigo.futuregateway.portlet.action.FGAddAppMVCActionCommandTest.java
License:Apache License
/** * Prepare the environment.//from w ww. jav a 2 s .c om * @throws Exception In case of a problem to replicate Liferay context */ @Before public final void setUp() throws Exception { JSONFactoryUtil jsonFactoryUtil = new JSONFactoryUtil(); jsonFactoryUtil.setJSONFactory(new JSONFactoryImpl()); PortalUtil pu = new PortalUtil(); pu.setPortal(portalImpl); Mockito.when(themeDisplay.getCompanyId()).thenReturn(0L); Mockito.when(themeDisplay.getUserId()).thenReturn(0L); Mockito.when(themeDisplay.getLayout()).thenReturn(layout); Mockito.when(layout.isTypeControlPanel()).thenReturn(true); Mockito.when(actionRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG)).thenReturn(portletConfig); Mockito.when(portletConfig.getInitParameter("add-process-action-success-action")).thenReturn("true"); Mockito.when(actionRequest.getAttribute(WebKeys.THEME_DISPLAY)).thenReturn(themeDisplay); Mockito.when(actionRequest.getParameter("redirect")).thenReturn(null); Mockito.when(portalImpl.getUploadPortletRequest(Mockito.any(PortletRequest.class))) .thenReturn(uploadRequest); Mockito.when(portalImpl.getHttpServletRequest(Mockito.any(PortletRequest.class))).thenReturn(httpRequest); Mockito.when(portalImpl.getOriginalServletRequest(Mockito.any(HttpServletRequest.class))) .thenReturn(httpRequest); Mockito.when(liferayRequest.getPortletName()).thenReturn(""); Mockito.when(portalImpl.getLiferayPortletRequest(Mockito.any(PortletRequest.class))) .thenReturn(liferayRequest); }
From source file:it.infn.ct.indigo.futuregateway.portlet.action.FGAddInfraMVCActionCommandTest.java
License:Apache License
/** * Prepare the environment.//w w w .j a v a2 s . c om * @throws Exception In case of a problem to replicate Liferay context */ @Before public final void setUp() throws Exception { JSONFactoryUtil jsonFactoryUtil = new JSONFactoryUtil(); jsonFactoryUtil.setJSONFactory(new JSONFactoryImpl()); PortalUtil pu = new PortalUtil(); pu.setPortal(portalImpl); Mockito.when(themeDisplay.getCompanyId()).thenReturn(0L); Mockito.when(themeDisplay.getUserId()).thenReturn(0L); Mockito.when(themeDisplay.getLayout()).thenReturn(layout); Mockito.when(layout.isTypeControlPanel()).thenReturn(true); Mockito.when(actionRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG)).thenReturn(portletConfig); Mockito.when(portletConfig.getInitParameter("add-process-action-success-action")).thenReturn("true"); Mockito.when(actionRequest.getAttribute(WebKeys.THEME_DISPLAY)).thenReturn(themeDisplay); Mockito.when(actionRequest.getParameter("redirect")).thenReturn(null); Mockito.when(portalImpl.getHttpServletRequest(Mockito.any(PortletRequest.class))).thenReturn(httpRequest); Mockito.when(portalImpl.getOriginalServletRequest(Mockito.any(HttpServletRequest.class))) .thenReturn(httpRequest); Mockito.when(liferayRequest.getPortletName()).thenReturn(""); Mockito.when(portalImpl.getLiferayPortletRequest(Mockito.any(PortletRequest.class))) .thenReturn(liferayRequest); }
From source file:it.infn.ct.indigo.futuregateway.server.FGServerManagerTest.java
License:Apache License
/** * Prepare the environment.// w w w. jav a 2 s .c om * Create some component normally generated by OSGi * @throws Exception If the expando service field cannot be replaced */ @Before public final void setUp() throws Exception { JSONFactoryUtil jsonFactoryUtil = new JSONFactoryUtil(); jsonFactoryUtil.setJSONFactory(new JSONFactoryImpl()); Mockito.when(expandoValueService.getData(Mockito.anyLong(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyLong(), Mockito.anyString())).thenReturn("http://"); Field expandoVS = FGServerManager.class.getDeclaredField("expandoValueService"); expandoVS.setAccessible(true); expandoVS.set(fgsm, expandoValueService); }