Author: julien_viet
Date: 2010-09-02 08:55:51 -0400 (Thu, 02 Sep 2010)
New Revision: 4027
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/ControllerContext.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/protocol/ProcessResponse.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/AbstractTestController.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java
Log:
remov need for multivalued value
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/ControllerContext.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/ControllerContext.java 2010-09-02
09:33:23 UTC (rev 4026)
+++
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/ControllerContext.java 2010-09-02
12:55:51 UTC (rev 4027)
@@ -40,21 +40,21 @@
final String path;
/** The current parameters. */
- final Map<QualifiedName, String[]> parameters;
+ final Map<QualifiedName, String> parameters;
public ControllerContext(String path)
{
this.path = path;
- this.parameters = new HashMap<QualifiedName, String[]>();
+ this.parameters = new HashMap<QualifiedName, String>();
}
- public ControllerContext(String path, Map<QualifiedName, String[]> parameters)
+ public ControllerContext(String path, Map<QualifiedName, String> parameters)
{
this.path = path;
this.parameters = parameters;
}
- public Map<QualifiedName, String[]> getParameters()
+ public Map<QualifiedName, String> getParameters()
{
return parameters;
}
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java 2010-09-02
09:33:23 UTC (rev 4026)
+++
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/ControllerRefMetaData.java 2010-09-02
12:55:51 UTC (rev 4027)
@@ -32,28 +32,25 @@
{
/** . */
- private final Map<QualifiedName, String[]> parameters;
+ private final Map<QualifiedName, String> parameters;
public ControllerRefMetaData()
{
- this.parameters = new HashMap<QualifiedName, String[]>();
+ this.parameters = new HashMap<QualifiedName, String>();
}
- public ControllerRefMetaData addParameter(QualifiedName name, String first, String...
rest)
+ public ControllerRefMetaData addParameter(QualifiedName name, String value)
{
- String[] value = new String[1 + rest.length];
- value[0] = first;
- System.arraycopy(rest, 0, value, 1, rest.length);
parameters.put(name, value);
return this;
}
- public ControllerRefMetaData addParameter(String name, String first, String... rest)
+ public ControllerRefMetaData addParameter(String name, String value)
{
- return addParameter(new QualifiedName(name), first, rest);
+ return addParameter(new QualifiedName(name), value);
}
- public Map<QualifiedName, String[]> getParameters()
+ public Map<QualifiedName, String> getParameters()
{
return parameters;
}
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/protocol/ProcessResponse.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/protocol/ProcessResponse.java 2010-09-02
09:33:23 UTC (rev 4026)
+++
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/protocol/ProcessResponse.java 2010-09-02
12:55:51 UTC (rev 4027)
@@ -35,24 +35,24 @@
private final String path;
/** . */
- private final Map<QualifiedName, String[]> parameters;
+ private final Map<QualifiedName, String> parameters;
public ProcessResponse()
{
- this(null, Collections.<QualifiedName, String[]>emptyMap());
+ this(null, Collections.<QualifiedName, String>emptyMap());
}
public ProcessResponse(String path)
{
- this(path, Collections.<QualifiedName, String[]>emptyMap());
+ this(path, Collections.<QualifiedName, String>emptyMap());
}
- public ProcessResponse(Map<QualifiedName, String[]> parameters)
+ public ProcessResponse(Map<QualifiedName, String> parameters)
{
this(null, parameters);
}
- public ProcessResponse(String path, Map<QualifiedName, String[]> parameters)
+ public ProcessResponse(String path, Map<QualifiedName, String> parameters)
{
if (parameters == null)
{
@@ -67,7 +67,7 @@
return path;
}
- public Map<QualifiedName, String[]> getParameters()
+ public Map<QualifiedName, String> getParameters()
{
return parameters;
}
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-02
09:33:23 UTC (rev 4026)
+++
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-09-02
12:55:51 UTC (rev 4027)
@@ -24,7 +24,6 @@
import org.exoplatform.web.controller.protocol.ProcessResponse;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -54,7 +53,7 @@
final List<PatternRoute> patternRoutes;
/** . */
- final Map<QualifiedName, String[]> routeParameters;
+ final Map<QualifiedName, String> routeParameters;
protected Route(Route parent)
{
@@ -68,7 +67,7 @@
this.terminal = false;
this.simpleRoutes = new LinkedHashMap<String, SimpleRoute>();
this.patternRoutes = new ArrayList<PatternRoute>();
- this.routeParameters = new HashMap<QualifiedName, String[]>();
+ this.routeParameters = new HashMap<QualifiedName, String>();
}
Route()
@@ -77,14 +76,14 @@
this.terminal = false;
this.simpleRoutes = new LinkedHashMap<String, SimpleRoute>();
this.patternRoutes = new ArrayList<PatternRoute>();
- this.routeParameters = new HashMap<QualifiedName, String[]>();
+ this.routeParameters = new HashMap<QualifiedName, String>();
}
/**
* Ok, so this is not the fastest way to do it, but for now it's OK, it's what
is needed, we'll find
* a way to optimize it later with some precompilation.
*/
- final String render(Map<QualifiedName, String[]> blah)
+ final String render(Map<QualifiedName, String> blah)
{
Route r = find(blah);
if (r == null)
@@ -106,7 +105,7 @@
}
}
- private void render(Map<QualifiedName, String[]> blah, StringBuilder sb)
+ private void render(Map<QualifiedName, String> blah, StringBuilder sb)
{
if (parent != null)
{
@@ -127,31 +126,31 @@
while (i < pr.parameterNames.size())
{
sb.append(pr.chunks.get(i));
- String[] value = blah.get(pr.parameterNames.get(i));
- sb.append(value[0]);
+ String value = blah.get(pr.parameterNames.get(i));
+ sb.append(value);
i++;
}
sb.append(pr.chunks.get(i));
}
}
- final Route find(Map<QualifiedName, String[]> blah)
+ final Route find(Map<QualifiedName, String> blah)
{
// Remove what is matched
- Map<QualifiedName, String[]> abc = new HashMap<QualifiedName,
String[]>(blah);
+ Map<QualifiedName, String> abc = new HashMap<QualifiedName,
String>(blah);
// Match first the static parameteters
- for (Map.Entry<QualifiedName, String[]> a : routeParameters.entrySet())
+ for (Map.Entry<QualifiedName, String> a : routeParameters.entrySet())
{
- String[] s = blah.get(a.getKey());
- if (s == null || !Arrays.equals(a.getValue(), s))
+ String s = blah.get(a.getKey());
+ if (a.getValue().equals(s))
{
- return null;
+ abc.remove(a.getKey());
}
else
{
- abc.remove(a.getKey());
+ return null;
}
}
@@ -162,14 +161,14 @@
for (int i = 0;i < prt.parameterNames.size();i++)
{
QualifiedName qd = prt.parameterNames.get(i);
- String[] s = blah.get(qd);
- if (s == null || !prt.parameterPatterns.get(i).matcher(s[0]).matches())
+ String s = blah.get(qd);
+ if (s != null && prt.parameterPatterns.get(i).matcher(s).matches())
{
- return null;
+ abc.remove(qd);
}
else
{
- abc.remove(qd);
+ return null;
}
}
}
@@ -236,7 +235,7 @@
Route route = simpleRoutes.get(segment);
if (route != null)
{
- Map<QualifiedName, String[]> parameters = context.getParameters();
+ Map<QualifiedName, String> parameters = context.getParameters();
// Determine next path
String nextPath;
@@ -272,11 +271,11 @@
if (matcher.find())
{
// Update parameters
- Map<QualifiedName, String[]> parameters = new
HashMap<QualifiedName, String[]>(context.getParameters());
+ Map<QualifiedName, String> parameters = new
HashMap<QualifiedName, String>(context.getParameters());
int group = 1;
for (QualifiedName parameterName : route.parameterNames)
{
- parameters.put(parameterName, new String[]{matcher.group(group++)});
+ parameters.put(parameterName, matcher.group(group++));
}
// Build next controller context
@@ -311,7 +310,7 @@
{
if (routeParameters.size() > 0)
{
- for (Map.Entry<QualifiedName, String[]> entry :
routeParameters.entrySet())
+ for (Map.Entry<QualifiedName, String> entry :
routeParameters.entrySet())
{
if (!ret.getParameters().containsKey(entry.getKey()))
{
@@ -332,7 +331,7 @@
final Route append(
String path,
- Map<QualifiedName, String[]> parameters)
+ Map<QualifiedName, String> parameters)
{
Route route = append(path);
route.terminal = true;
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-02
09:33:23 UTC (rev 4026)
+++
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Router.java 2010-09-02
12:55:51 UTC (rev 4027)
@@ -54,9 +54,9 @@
this.root = root;
}
- public String render(Map<QualifiedName, String[]> blah)
+ public String render(Map<QualifiedName, String> parameters)
{
- return root.render(blah);
+ return root.render(parameters);
}
public ControllerResponse process(ControllerContext controllerContext) throws
IOException
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/AbstractTestController.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/AbstractTestController.java 2010-09-02
09:33:23 UTC (rev 4026)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/AbstractTestController.java 2010-09-02
12:55:51 UTC (rev 4027)
@@ -36,7 +36,7 @@
public abstract class AbstractTestController extends TestCase
{
- public void assertProcessResponse(String path, Map<QualifiedName, String[]>
parameters, ControllerResponse response)
+ public void assertProcessResponse(String path, Map<QualifiedName, String>
parameters, ControllerResponse response)
{
assertNotNull("Was not expecting a null response", response);
assertEquals(ProcessResponse.class, response.getClass());
@@ -47,23 +47,23 @@
public void assertProcessResponse(ControllerResponse response)
{
- assertProcessResponse(null, Collections.<QualifiedName, String[]>emptyMap(),
response);
+ assertProcessResponse(null, Collections.<QualifiedName, String>emptyMap(),
response);
}
public void assertProcessResponse(String path, ControllerResponse response)
{
- assertProcessResponse(path, Collections.<QualifiedName, String[]>emptyMap(),
response);
+ assertProcessResponse(path, Collections.<QualifiedName, String>emptyMap(),
response);
}
- public void assertProcessResponse(Map<QualifiedName, String[]> parameters,
ControllerResponse response)
+ public void assertProcessResponse(Map<QualifiedName, String> parameters,
ControllerResponse response)
{
assertProcessResponse(null, parameters, response);
}
- public void assertEquals(Map<QualifiedName, String[]> expectedParameters,
Map<QualifiedName, String[]> parameters)
+ public void assertEquals(Map<QualifiedName, String> expectedParameters,
Map<QualifiedName, String> parameters)
{
Assert.assertEquals(expectedParameters.keySet(), parameters.keySet());
- for (Map.Entry<QualifiedName, String[]> expectedEntry :
expectedParameters.entrySet())
+ for (Map.Entry<QualifiedName, String> expectedEntry :
expectedParameters.entrySet())
{
Assert.assertEquals(Arrays.asList(expectedEntry.getValue()),
Arrays.asList(parameters.get(expectedEntry.getKey())));
}
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java 2010-09-02
09:33:23 UTC (rev 4026)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java 2010-09-02
12:55:51 UTC (rev 4027)
@@ -43,7 +43,7 @@
assertNull(router.process(new ControllerContext("")));
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(),
router.process(new ControllerContext("/")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(),
router.process(new ControllerContext("/")));
//
assertNull(router.process(new ControllerContext("/a")));
@@ -59,7 +59,7 @@
Router router = new Router(routerMD);
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(),
router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(),
router.process(new ControllerContext("/a")));
//
assertNull(router.process(new ControllerContext("a")));
@@ -68,7 +68,7 @@
assertNull(router.process(new ControllerContext("a/")));
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(),
router.process(new ControllerContext("/a/")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(),
router.process(new ControllerContext("/a/")));
//
assertNull(router.process(new ControllerContext("")));
@@ -96,10 +96,10 @@
assertNull(router.process(new ControllerContext("a/b")));
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(),
router.process(new ControllerContext("/a/b")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(),
router.process(new ControllerContext("/a/b")));
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(),
router.process(new ControllerContext("/a/b/")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(),
router.process(new ControllerContext("/a/b/")));
//
assertNull(router.process(new ControllerContext("a/b/")));
@@ -125,7 +125,7 @@
RouterMetaData routerMD = new RouterMetaData();
routerMD.addRoute("/{p}", new ControllerRefMetaData());
Router router = new Router(routerMD);
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
new String[]{"a"}), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
"a"), router.process(new ControllerContext("/a")));
}
public void testParameterPropagationToDescendants() throws Exception
@@ -134,7 +134,7 @@
routerMD.addRoute("/", new
ControllerRefMetaData().addParameter("p", "a"));
routerMD.addRoute("/a", new ControllerRefMetaData());
Router router = new Router(routerMD);
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
new String[]{"a"}), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
"a"), router.process(new ControllerContext("/a")));
}
public void testWildcardPattern() throws Exception
@@ -144,16 +144,16 @@
Router router = new Router(routerMD);
//
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
new String[]{""}), router.process(new ControllerContext("/")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
""), router.process(new ControllerContext("/")));
//
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
new String[]{"a"}), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
"a"), router.process(new ControllerContext("/a")));
//
assertNull(router.process(new ControllerContext("a")));
//
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
new String[]{"a/b"}), router.process(new ControllerContext("/a/b")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
"a/b"), router.process(new ControllerContext("/a/b")));
}
public void testSimplePattern() throws Exception
@@ -163,7 +163,7 @@
Router router = new Router(routerMD);
//
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
new String[]{"a"}), router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
"a"), router.process(new ControllerContext("/a")));
//
assertNull(router.process(new ControllerContext("a")));
@@ -186,12 +186,12 @@
assertNull(router.process(new ControllerContext("a")));
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(),
router.process(new ControllerContext("/a")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(),
router.process(new ControllerContext("/a")));
//
- assertProcessResponse(Collections.<QualifiedName, String[]>emptyMap(),
router.process(new ControllerContext("/a/")));
+ assertProcessResponse(Collections.<QualifiedName, String>emptyMap(),
router.process(new ControllerContext("/a/")));
//
- assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
new String[]{"a"}), router.process(new ControllerContext("/a/b")));
+ assertProcessResponse(Collections.singletonMap(new QualifiedName("p"),
"a"), router.process(new ControllerContext("/a/b")));
}
}
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-09-02
09:33:23 UTC (rev 4026)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-09-02
12:55:51 UTC (rev 4027)
@@ -60,11 +60,11 @@
public void testPrivateClassic() throws Exception
{
- Map<QualifiedName, String[]> expectedParameters = new
HashMap<QualifiedName, String[]>();
- expectedParameters.put(new QualifiedName("gtn", "controller"),
new String[]{"site"});
- expectedParameters.put(new QualifiedName("gtn", "sitename"),
new String[]{"classic"});
- expectedParameters.put(new QualifiedName("gtn", "sitetype"),
new String[]{"portal"});
- expectedParameters.put(new QualifiedName("gtn", "path"), new
String[]{""});
+ Map<QualifiedName, String> expectedParameters = new HashMap<QualifiedName,
String>();
+ expectedParameters.put(new QualifiedName("gtn", "controller"),
"site");
+ expectedParameters.put(new QualifiedName("gtn", "sitename"),
"classic");
+ expectedParameters.put(new QualifiedName("gtn", "sitetype"),
"portal");
+ expectedParameters.put(new QualifiedName("gtn", "path"),
"");
//
assertProcessResponse(expectedParameters, router.process(new
ControllerContext("/private/classic")));
@@ -74,11 +74,11 @@
public void testPrivateClassicSlash() throws Exception
{
router.process(new ControllerContext("/private/classic/"));
- Map<QualifiedName, String[]> expectedParameters = new
HashMap<QualifiedName, String[]>();
- expectedParameters.put(new QualifiedName("gtn", "controller"),
new String[]{"site"});
- expectedParameters.put(new QualifiedName("gtn", "sitename"),
new String[]{"classic"});
- expectedParameters.put(new QualifiedName("gtn", "sitetype"),
new String[]{"portal"});
- expectedParameters.put(new QualifiedName("gtn", "path"), new
String[]{"/"});
+ Map<QualifiedName, String> expectedParameters = new HashMap<QualifiedName,
String>();
+ expectedParameters.put(new QualifiedName("gtn", "controller"),
"site");
+ expectedParameters.put(new QualifiedName("gtn", "sitename"),
"classic");
+ expectedParameters.put(new QualifiedName("gtn", "sitetype"),
"portal");
+ expectedParameters.put(new QualifiedName("gtn", "path"),
"/");
//
assertProcessResponse(expectedParameters, router.process(new
ControllerContext("/private/classic/")));
@@ -87,11 +87,11 @@
public void testPrivateClassicHome() throws Exception
{
- Map<QualifiedName, String[]> expectedParameters = new
HashMap<QualifiedName, String[]>();
- expectedParameters.put(new QualifiedName("gtn", "controller"),
new String[]{"site"});
- expectedParameters.put(new QualifiedName("gtn", "sitename"),
new String[]{"classic"});
- expectedParameters.put(new QualifiedName("gtn", "sitetype"),
new String[]{"portal"});
- expectedParameters.put(new QualifiedName("gtn", "path"), new
String[]{"/home"});
+ Map<QualifiedName, String> expectedParameters = new HashMap<QualifiedName,
String>();
+ expectedParameters.put(new QualifiedName("gtn", "controller"),
"site");
+ expectedParameters.put(new QualifiedName("gtn", "sitename"),
"classic");
+ expectedParameters.put(new QualifiedName("gtn", "sitetype"),
"portal");
+ expectedParameters.put(new QualifiedName("gtn", "path"),
"/home");
//
assertProcessResponse(expectedParameters, router.process(new
ControllerContext("/private/classic/home")));
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java 2010-09-02
09:33:23 UTC (rev 4026)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java 2010-09-02
12:55:51 UTC (rev 4027)
@@ -39,7 +39,7 @@
Router router = new Router(routerMD);
//
- assertEquals("/", router.render(Collections.<QualifiedName,
String[]>emptyMap()));
+ assertEquals("/", router.render(Collections.<QualifiedName,
String>emptyMap()));
}
public void testA() throws Exception
@@ -49,7 +49,7 @@
Router router = new Router(routerMD);
//
- assertEquals("/a", router.render(Collections.<QualifiedName,
String[]>emptyMap()));
+ assertEquals("/a", router.render(Collections.<QualifiedName,
String>emptyMap()));
}
public void testAB() throws Exception
@@ -59,7 +59,7 @@
Router router = new Router( routerMD);
//
- assertEquals("/a/b", router.render(Collections.<QualifiedName,
String[]>emptyMap()));
+ assertEquals("/a/b", router.render(Collections.<QualifiedName,
String>emptyMap()));
}
public void testParameter() throws Exception
@@ -69,8 +69,8 @@
Router router = new Router(routerMD);
//
- assertEquals("/a", router.render(Collections.singletonMap(new
QualifiedName("p"), new String[]{"a"})));
- assertNull(router.render(Collections.<QualifiedName, String[]>emptyMap()));
+ assertEquals("/a", router.render(Collections.singletonMap(new
QualifiedName("p"), "a")));
+ assertNull(router.render(Collections.<QualifiedName, String>emptyMap()));
}
public void testWildcardPattern() throws Exception
@@ -80,13 +80,13 @@
Router router = new Router(routerMD);
//
- assertEquals("/", router.render(Collections.singletonMap(new
QualifiedName("p"), new String[]{""})));
+ assertEquals("/", router.render(Collections.singletonMap(new
QualifiedName("p"), "")));
//
- assertEquals("/a", router.render(Collections.singletonMap(new
QualifiedName("p"), new String[]{"a"})));
+ assertEquals("/a", router.render(Collections.singletonMap(new
QualifiedName("p"), "a")));
//
- assertEquals("/a/b", router.render(Collections.singletonMap(new
QualifiedName("p"), new String[]{"a/b"})));
+ assertEquals("/a/b", router.render(Collections.singletonMap(new
QualifiedName("p"), "a/b")));
}
public void testSimplePattern() throws Exception
@@ -96,10 +96,10 @@
Router router = new Router(routerMD);
//
- assertEquals("/a", router.render(Collections.singletonMap(new
QualifiedName("p"), new String[]{"a"})));
+ assertEquals("/a", router.render(Collections.singletonMap(new
QualifiedName("p"), "a")));
//
- assertNull(router.render(Collections.singletonMap(new QualifiedName("p"),
new String[]{"ab"})));
+ assertNull(router.render(Collections.singletonMap(new QualifiedName("p"),
"ab")));
}
public void testPrecedence() throws Exception
@@ -110,9 +110,9 @@
Router router = new Router(routerMD);
//
- assertEquals("/a", router.render(Collections.<QualifiedName,
String[]>emptyMap()));
+ assertEquals("/a", router.render(Collections.<QualifiedName,
String>emptyMap()));
//
- assertEquals("/a/b", router.render(Collections.singletonMap(new
QualifiedName("p"), new String[]{"a"})));
+ assertEquals("/a/b", router.render(Collections.singletonMap(new
QualifiedName("p"), "a")));
}
}