Skip to content

Commit

Permalink
[#noissue] Fix quickstart test app
Browse files Browse the repository at this point in the history
  • Loading branch information
donghun-cho committed Jan 3, 2025
1 parent 362f726 commit 4eb6a07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;

Expand Down Expand Up @@ -44,7 +45,7 @@ private void initApiMappings() {
}

String controllerName = handlerMethodBeanClazz.getSimpleName();
Set<String> mappedRequests = requestMappingInfo.getPatternsCondition().getPatterns();
Set<String> mappedRequests = requestMappingInfo.getPatternValues();

SortedSet<RequestMappedUri> alreadyMappedRequests = this.apiMappings.get(controllerName);
if (alreadyMappedRequests == null) {
Expand All @@ -68,9 +69,9 @@ private Set<RequestMappedUri> createRequestMappedApis(HandlerMethod handlerMetho
}

@GetMapping(value = {"/", "/index.html", "/apis"})
public String apis(Model model) {
public ModelAndView apis(Model model) {
model.addAttribute("apiMappings", this.apiMappings);
return "apis";
return new ModelAndView("apis.html", model.asMap());
}

public static class RequestMappedUri {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public Map<String, Object> getCurrentTimestamp() {
}

@RequestMapping("/testUserInputRequestAttribute")
@Description("Test user input request attribute \"pinpoint.metric.uri-template\"= \"/userInput\".")
public Map<String, Object> testUserInputAttribute(HttpServletRequest request) {
Map<String, Object> map = new HashMap<>();
map.put("message", "test user input attribute");
Expand Down Expand Up @@ -65,7 +66,7 @@ public Map<String, Object> sleep7() throws InterruptedException {
}

@RequestMapping("/randomResponseTime/**")
@Description("Waits for random time and then returns")
@Description("Waits for a random time (0s ~ 10s), then has a (20%) chance to fail.")
public Map<String, Object> randomResponseTime() throws InterruptedException {
double a = Math.random() * 10000;
double fail = Math.random() * 10;
Expand All @@ -82,6 +83,7 @@ public Map<String, Object> randomResponseTime() throws InterruptedException {
}

@RequestMapping("/fails")
@Description("Call that fails with an RuntimeException.")
public void fails() throws Exception {
throw new RuntimeException();
}
Expand Down

0 comments on commit 4eb6a07

Please sign in to comment.