Spring Framework MockPortletContext - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework MockPortletContext class.

This code example shows how to use the following methods:
 
	private ConfigurablePortletApplicationContext pac; 
 
	@Override 
	public void setUp() throws Exception { 
		MockPortletContext portletContext = new MockPortletContext(); 
		pac = new XmlPortletApplicationContext(); 
		pac.setPortletContext(portletContext); 
		pac.setConfigLocations(new String[] {CONF}); 
		pac.refresh(); 
	} 
 
	public void testPortletModeView() throws Exception { 
		HandlerMapping hm = (HandlerMapping)pac.getBean("handlerMapping"); 
 
		MockPortletRequest request = new MockPortletRequest(); 
		request.setPortletMode(PortletMode.VIEW); 
 
		Object handler = hm.getHandler(request).getHandler(); 
		assertEquals(pac.getBean("viewHandler"), handler); 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
	private ConfigurablePortletApplicationContext pac;
 
	@Override 
	public void setUp() throws Exception {
		MockPortletContext portletContext = new MockPortletContext();
		pac = new XmlPortletApplicationContext();
		pac.setPortletContext(portletContext);
		pac.setConfigLocations(new String[] {CONF});
		pac.refresh();
	} 
 
	public void testParameterMapping() throws Exception {
		HandlerMapping hm = (HandlerMapping)pac.getBean("handlerMapping");
 
		MockPortletRequest addRequest = new MockPortletRequest();
		addRequest.addParameter("action", "add");
 
		MockPortletRequest removeRequest = new MockPortletRequest();
		removeRequest.addParameter("action", "remove");
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
	private ConfigurablePortletApplicationContext pac; 
 
	@Override 
	public void setUp() throws Exception { 
		MockPortletContext portletContext = new MockPortletContext(); 
		pac = new XmlPortletApplicationContext(); 
		pac.setPortletContext(portletContext); 
		pac.setConfigLocations(new String[] {CONF}); 
		pac.refresh(); 
	} 
 
	public void testPortletModeViewWithParameter() throws Exception { 
		HandlerMapping hm = (HandlerMapping)pac.getBean("handlerMapping"); 
 
		MockPortletRequest addRequest = new MockPortletRequest(); 
		addRequest.setPortletMode(PortletMode.VIEW); 
		addRequest.setParameter("action", "add"); 
 
		MockPortletRequest removeRequest = new MockPortletRequest(); 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:removeAttribute
 
	private MockPortletContext context;
 
	protected void setUp() throws Exception {
		super.setUp(); 
		context = new MockPortletContext();
		// a fresh MockPortletContext seems to already contain an element; 
		// that's confusing, so we remove it 
		context.removeAttribute("javax.servlet.context.tempdir");
		tested = new PortletContextMap(context);
		tested.put("SomeKey", "SomeValue");
	} 
 
	protected void tearDown() throws Exception {
		super.tearDown(); 
		context = null;
		tested = null;
	} 
 
	public void testIsEmpty() { 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 * @author Mark Fisher 
 */ 
public class PortletContextAwareProcessorTests extends TestCase { 
 
	public void testPortletContextAwareWithPortletContext() { 
		PortletContext portletContext = new MockPortletContext(); 
		PortletContextAwareProcessor processor = new PortletContextAwareProcessor(portletContext); 
		PortletContextAwareBean bean = new PortletContextAwareBean(); 
		assertNull(bean.getPortletContext()); 
		processor.postProcessBeforeInitialization(bean, "testBean"); 
		assertNotNull("PortletContext should have been set", bean.getPortletContext()); 
		assertEquals(portletContext, bean.getPortletContext()); 
	} 
 
	public void testPortletContextAwareWithPortletConfig() { 
		PortletContext portletContext = new MockPortletContext(); 
		PortletConfig portletConfig = new MockPortletConfig(portletContext); 
		PortletContextAwareProcessor processor = new PortletContextAwareProcessor(portletConfig); 
		PortletContextAwareBean bean = new PortletContextAwareBean(); 
		assertNull(bean.getPortletContext()); 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	private MockRenderResponse renderResponse;
 
	private PortletExternalContext renderContext;
 
	protected void setUp() { 
		portletContext = new MockPortletContext();
		request = new MockActionRequest();
		response = new MockActionResponse();
		context = new PortletExternalContext(portletContext, request, response);
		renderRequest = new MockRenderRequest();
		renderResponse = new MockRenderResponse();
		renderContext = new PortletExternalContext(portletContext, renderRequest, renderResponse);
	} 
 
	public void testGetContextPath() { 
		request.setContextPath("/foo");
		assertEquals("/foo", request.getContextPath());
	} 
 
	public void testRequestParameters() { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 * @author Mark Fisher 
 */ 
public class GenericPortletBeanTests extends TestCase { 
 
	public void testInitParameterSet() throws Exception { 
		PortletContext portletContext = new MockPortletContext(); 
		MockPortletConfig portletConfig = new MockPortletConfig(portletContext); 
		String testValue = "testValue"; 
		portletConfig.addInitParameter("testParam", testValue); 
		TestPortletBean portletBean = new TestPortletBean(); 
		assertNull(portletBean.getTestParam()); 
		portletBean.init(portletConfig); 
		assertNotNull(portletBean.getTestParam()); 
		assertEquals(testValue, portletBean.getTestParam()); 
	} 
 
	public void testInitParameterNotSet() throws Exception { 
		PortletContext portletContext = new MockPortletContext(); 
		MockPortletConfig portletConfig = new MockPortletConfig(portletContext); 
		TestPortletBean portletBean = new TestPortletBean(); 
5
CodeRank
Experience pair programming with AI  Get Codota for Java