Skip to content

Commit

Permalink
[Vega] Fixed #148 when routes contains digits at end
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas PIEDELOUP committed Oct 28, 2019
1 parent e8e0d33 commit 2d12530
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion vertigo-core/src/main/java/io/vertigo/util/StringUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private static String constToCamelCase(final String str, final boolean first2Upp
if (c == '_') {
if (digit != null
&& digit
&& Character.isDigit(str.charAt(i + 1))) {
&& i + 1 < length && Character.isDigit(str.charAt(i + 1))) {
result.append('_');
}
digit = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public void testCaseTransform() {
assertEquals("TAdresseAdr", StringUtil.constToUpperCamelCase("T_ADRESSE_ADR"));
assertEquals("x2Yyy", StringUtil.constToLowerCamelCase("X_2_YYY"));
assertEquals("X2Yyy", StringUtil.constToUpperCamelCase("X_2_YYY"));
assertEquals("TAdresseAdr10", StringUtil.constToUpperCamelCase("T_ADRESSE_ADR_10"));
assertEquals("TAdresseAdr10", StringUtil.constToUpperCamelCase("T_ADRESSE_ADR_10_"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void testCatalogOrder() {
.body("get(" + i++ + ")", Matchers.equalTo("Get /test/downloadFile (class java.lang.Integer :Query:id) -> VFile"))
.body("get(" + i++ + ")", Matchers.equalTo("Get /test/downloadFileContentType (class java.lang.Integer :Query:id) -> VFile"))
.body("get(" + i++ + ")", Matchers.equalTo("Get /test/downloadNotModifiedFile (class java.lang.Integer :Query:id, class java.util.Date :Header:If-Modified-Since, interface javax.servlet.http.HttpServletResponse :Implicit:Response) -> VFile"))
.body("get(" + i++ + ")", Matchers.equalTo("Get /test/dtList10/{id} (long :Path:id) -> class io.vertigo.dynamo.domain.model.DtList<Contact>"))
.body("get(" + i++ + ")", Matchers.equalTo("Get /test/dtListMeta () -> class io.vertigo.dynamo.domain.model.DtList<Contact>"))
.body("get(" + i++ + ")", Matchers.equalTo("Get /test/dtListMetaAsList () -> interface java.util.List<Contact>"))
.body("get(" + i++ + ")", Matchers.equalTo("Get /test/export/pdf/ () -> VFile"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,15 @@ public DtList<Contact> loadListMeta() {
return result;
}

@GET("/dtList10/{id}")
public DtList<Contact> loadListDigitInRoute(@PathParam("id") final long conId) {
final DtList<Contact> result = new DtList<>(Contact.class);
for (final Contact contact : contactDao.getList()) {
result.add(contact);
}
return (DtList<Contact>) result.subList(0, 10);
}

@GET("/dtListMetaAsList")
public List<Contact> loadListMetaAsList() {
return loadListMeta();
Expand Down

0 comments on commit 2d12530

Please sign in to comment.