use of org.springframework.ide.vscode.commons.boot.app.cli.requestmappings.Boot1xRequestMapping in project sts4 by spring-projects.
the class SpringBootApp method parseRequestMappingsJson.
public static Collection<RequestMapping> parseRequestMappingsJson(String json, String bootVersion) {
JSONObject obj = new JSONObject(json);
if (bootVersion.equals("2.x")) {
return RequestMappingsParser20.parse(obj);
} else {
// 1.x
List<RequestMapping> result = new ArrayList<>();
Iterator<String> keys = obj.keys();
while (keys.hasNext()) {
String rawKey = keys.next();
JSONObject value = obj.getJSONObject(rawKey);
result.add(new Boot1xRequestMapping(rawKey, value));
}
return result;
}
}
use of org.springframework.ide.vscode.commons.boot.app.cli.requestmappings.Boot1xRequestMapping in project sts4 by spring-projects.
the class Boot1xRequestMappingTest method testSplitPathSimpleCaseWithEmptyOr.
@Test
public void testSplitPathSimpleCaseWithEmptyOr() {
AbstractRequestMapping rm = new Boot1xRequestMapping("/superpath/mypath || ", null);
String[] splitPath = rm.getSplitPath();
assertEquals(1, splitPath.length);
assertEquals("/superpath/mypath", splitPath[0]);
}
use of org.springframework.ide.vscode.commons.boot.app.cli.requestmappings.Boot1xRequestMapping in project sts4 by spring-projects.
the class Boot1xRequestMappingTest method testSplitPathSimpleCase.
@Test
public void testSplitPathSimpleCase() {
AbstractRequestMapping rm = new Boot1xRequestMapping("{[/superpath/mypath || mypath.json]}", null);
String[] splitPath = rm.getSplitPath();
assertEquals(2, splitPath.length);
assertEquals("/superpath/mypath", splitPath[0]);
assertEquals("/mypath.json", splitPath[1]);
}
use of org.springframework.ide.vscode.commons.boot.app.cli.requestmappings.Boot1xRequestMapping in project sts4 by spring-projects.
the class Boot1xRequestMappingTest method testSplitPathWithoutDuplicate.
@Test
public void testSplitPathWithoutDuplicate() {
AbstractRequestMapping rm = new Boot1xRequestMapping("/superpath", null);
String[] splitPath = rm.getSplitPath();
assertEquals(1, splitPath.length);
assertEquals("/superpath", splitPath[0]);
}
use of org.springframework.ide.vscode.commons.boot.app.cli.requestmappings.Boot1xRequestMapping in project sts4 by spring-projects.
the class Boot1xRequestMappingTest method testSplitPathMultipleCases.
@Test
public void testSplitPathMultipleCases() {
AbstractRequestMapping rm = new Boot1xRequestMapping("{[/superpath/mypath || mypath.json || somethingelse.what]}", null);
String[] splitPath = rm.getSplitPath();
assertEquals(3, splitPath.length);
assertEquals("/superpath/mypath", splitPath[0]);
assertEquals("/mypath.json", splitPath[1]);
assertEquals("/somethingelse.what", splitPath[2]);
}
Aggregations