use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class TestTagUtils method testString_getActionMappingURL_String_PageContext.
public void testString_getActionMappingURL_String_PageContext() {
ActionConfig actionConfig = new ActionConfig();
actionConfig.setParameter("/foo");
moduleConfig.addActionConfig(actionConfig);
request.setAttribute(Globals.MODULE_KEY, moduleConfig);
request.setPathElements("/myapp", "/foo.do", null, null);
assertEquals("Check path /foo", tagutils.getActionMappingURL("/foo", pageContext), "/myapp/foo");
}
use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class TestTagUtils method testComputeURLCharacterEncodingAction.
public void testComputeURLCharacterEncodingAction() {
ActionConfig actionConfig = new ActionConfig();
actionConfig.setName("baz");
actionConfig.setPath("/baz");
moduleConfig.addActionConfig(actionConfig);
request.setPathElements("/myapp", "/foo.do", null, null);
Map map = new HashMap();
map.put("foo1", "bar1");
map.put("foo2", "bar2");
String url = null;
try {
url = tagutils.computeURL(pageContext, null, null, null, "baz", null, map, "anchor", false);
} catch (MalformedURLException e) {
fail("MalformedURLException: " + e);
}
assertNotNull("url present", url);
assertTrue("url value", url.equals("/myapp/baz?foo1=bar1&foo2=bar2#anchor") || url.equals("/myapp/baz?foo2=bar2&foo1=bar1#anchor"));
}
use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class TestTagUtils method testString_getActionMappingURL_String_String_PageContext_boolean6.
// use servlet mapping (path mapping)
// -- using "/" as mapping
public void testString_getActionMappingURL_String_String_PageContext_boolean6() {
pageContext.getServletContext().setAttribute(Globals.SERVLET_KEY, "/");
ActionConfig actionConfig = new ActionConfig();
actionConfig.setParameter("/foo");
moduleConfig.addActionConfig(actionConfig);
request.setAttribute(Globals.MODULE_KEY, moduleConfig);
request.setPathElements("/mycontext", "/baz", null, null);
assertEquals("Check path /foo", tagutils.getActionMappingURL("/", pageContext), "/mycontext/");
}
use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class TestTagUtils method testString_getActionMappingURL_String_String_PageContext_boolean2.
// use servlet mapping (extension mapping)
// -- with params
public void testString_getActionMappingURL_String_String_PageContext_boolean2() {
pageContext.getServletContext().setAttribute(Globals.SERVLET_KEY, "*.do");
ActionConfig actionConfig = new ActionConfig();
actionConfig.setParameter("/foo");
moduleConfig.addActionConfig(actionConfig);
request.setAttribute(Globals.MODULE_KEY, moduleConfig);
request.setPathElements("/myapp", "/baz.do?foo=bar", null, null);
assertEquals("Check path /foo", tagutils.getActionMappingURL("/foo?foo=bar", pageContext), "/myapp/foo.do?foo=bar");
}
use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class TestTagUtils method testString_getActionMappingURL_String_String_PageContext_boolean4.
// use servlet mapping (path mapping)
public void testString_getActionMappingURL_String_String_PageContext_boolean4() {
pageContext.getServletContext().setAttribute(Globals.SERVLET_KEY, "/myapp/*");
ActionConfig actionConfig = new ActionConfig();
actionConfig.setParameter("/foo");
moduleConfig.addActionConfig(actionConfig);
request.setAttribute(Globals.MODULE_KEY, moduleConfig);
request.setPathElements("/mycontext", "/baz", null, null);
assertEquals("Check path /foo", tagutils.getActionMappingURL("/foo", pageContext), "/mycontext/myapp/foo");
}
Aggregations