public void testGetCurrentEntryPoint_withBranding() { RWTFactory.getEntryPointManager().registerByName("foo", entryPointFactory); // register a branding with the default servlet name ("rap") RWTFactory.getBrandingManager().register(new TestBranding("rap", null, "foo")); IEntryPoint result = EntryPointUtil.getCurrentEntryPoint(); verify(entryPointFactory).create(); assertSame(entryPoint, result); }
public void testStartupRequestWithParameter() throws Exception { RWTFactory.getEntryPointManager().registerByPath("/rap", DefaultEntryPoint.class, null); Fixture.fakeNewGetRequest(); Fixture.fakeRequestParam("param", "value"); RWTFactory.getServiceManager().getHandler().service(); Fixture.fakeNewRequest(); Fixture.fakeRequestParam("param", null); Fixture.fakeRequestParam(RequestParams.RWT_INITIALIZE, "true"); RWTFactory.getServiceManager().getHandler().service(); assertEquals("value", ContextProvider.getRequest().getParameter("param")); }
public void testGetCurrentEntryPoint_servletPathOverridesBranding() { RWTFactory.getEntryPointManager().registerByName("foo", entryPointFactory); RWTFactory.getBrandingManager().register(new TestBranding("rap", null, "foo")); IEntryPoint entryPointByPath = mockEntryPoint(); IEntryPointFactory entryPointFactoryByPath = mockEntryPointFactory(entryPointByPath); RWTFactory.getEntryPointManager().registerByPath("/rap", entryPointFactoryByPath, null); IEntryPoint result = EntryPointUtil.getCurrentEntryPoint(); // Servlet path takes precedence over branding verify(entryPointFactory, times(0)).create(); verify(entryPointFactoryByPath).create(); assertSame(entryPointByPath, result); }
public void testGetCurrentEntryPoint_parameterOverridesServletPath() { RWTFactory.getEntryPointManager().registerByName("foo", entryPointFactory); IEntryPoint entryPointByPath = mockEntryPoint(); IEntryPointFactory entryPointFactoryByPath = mockEntryPointFactory(entryPointByPath); RWTFactory.getEntryPointManager().registerByPath("/bar", entryPointFactoryByPath, null); fakeServletPath("/bar"); Fixture.fakeRequestParam(RequestParams.STARTUP, "foo"); IEntryPoint result = EntryPointUtil.getCurrentEntryPoint(); // Request parameter takes precedence over servlet path verify(entryPointFactoryByPath, times(0)).create(); verify(entryPointFactory).create(); assertSame(entryPoint, result); }
public void testGetCurrentEntryPointProperties_withDefaultEntryPoint() { RWTFactory.getEntryPointManager().registerByName(EntryPointUtil.DEFAULT, entryPointFactory); Map<String, String> properties = EntryPointUtil.getCurrentEntryPointProperties(); assertTrue(properties.isEmpty()); }
public static Color createColor(QxColor color) { Color result = null; if (color.alpha != 0f) { result = RWTFactory.getResourceFactory().getColor(color.red, color.green, color.blue); } return result; }
public void testGetCurrentEntryPoint_withDefaultEntryPoint() { RWTFactory.getEntryPointManager().registerByName(EntryPointUtil.DEFAULT, entryPointFactory); IEntryPoint result = EntryPointUtil.getCurrentEntryPoint(); verify(entryPointFactory).create(); assertSame(entryPoint, result); }
public void testGetCurrentEntryPointParameter_withStartupParameter() { RWTFactory.getEntryPointManager().registerByName("foo", entryPointFactory); Fixture.fakeRequestParam(RequestParams.STARTUP, "foo"); Map<String, String> properties = EntryPointUtil.getCurrentEntryPointProperties(); assertTrue(properties.isEmpty()); }
public void testGetCurrentEntryPoint_withServletPath() { RWTFactory.getEntryPointManager().registerByPath("/foo", entryPointFactory, null); fakeServletPath("/foo"); IEntryPoint result = EntryPointUtil.getCurrentEntryPoint(); verify(entryPointFactory).create(); assertSame(entryPoint, result); }
public void testGetCurrentEntryPoint_withStartupParameter() { RWTFactory.getEntryPointManager().registerByName("foo", entryPointFactory); Fixture.fakeRequestParam(RequestParams.STARTUP, "foo"); IEntryPoint result = EntryPointUtil.getCurrentEntryPoint(); verify(entryPointFactory).create(); assertSame(entryPoint, result); }
public void testGetCurrentEntryPointProperties_withServletPath() { Map<String, String> parameters = new HashMap<String, String>(); parameters.put("test", "true"); RWTFactory.getEntryPointManager().registerByPath("/foo", entryPointFactory, parameters); fakeServletPath("/foo"); Map<String, String> properties = EntryPointUtil.getCurrentEntryPointProperties(); assertEquals("true", properties.get("test")); }