T156 Removed thymeleaf and eureka. Html moved to static
This commit is contained in:
		| @@ -1,9 +0,0 @@ | ||||
| package com.release11.klaus.config; | ||||
|  | ||||
| import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | ||||
| import org.springframework.context.annotation.Configuration; | ||||
|  | ||||
| @Configuration | ||||
| @EnableDiscoveryClient | ||||
| public class LocalDiscovery { | ||||
| } | ||||
| @@ -1,27 +0,0 @@ | ||||
| package com.release11.klaus.config; | ||||
|  | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.Configuration; | ||||
| import springfox.documentation.builders.RequestHandlerSelectors; | ||||
| import springfox.documentation.spi.DocumentationType; | ||||
| import springfox.documentation.spring.web.plugins.Docket; | ||||
| import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||||
|  | ||||
| import static springfox.documentation.builders.PathSelectors.regex; | ||||
|  | ||||
| /** | ||||
|  * Points to swagger version and package containing controller classes | ||||
|  */ | ||||
| @Configuration | ||||
| @EnableSwagger2 | ||||
| public class SwaggerConfig { | ||||
|     @Bean | ||||
|     public Docket productApi() { | ||||
|         return new Docket(DocumentationType.SWAGGER_2).select() | ||||
|                 .apis(RequestHandlerSelectors.basePackage("com.release11.klaus.controller")) | ||||
|                 .paths(regex("/klaus/v1.*")) | ||||
|                 .build(); | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -24,7 +24,7 @@ import java.util.UUID; | ||||
|  */ | ||||
| @Slf4j | ||||
| @Controller | ||||
| @RequestMapping | ||||
| @RequestMapping(path = "/event") | ||||
| @AllArgsConstructor | ||||
| public class EventController { | ||||
|  | ||||
| @@ -32,44 +32,44 @@ public class EventController { | ||||
|     private final List<Event> eventList = new LinkedList<>(); | ||||
|  | ||||
|  | ||||
|     @GetMapping("/etrack/{uuid}") | ||||
|     public String showEtrack(@Valid EventRequestDto eventRequestDto, @PathVariable UUID uuid, final Model model, | ||||
|                              BindingResult bindingResult){ | ||||
|         model.addAttribute("clientUUID", uuid); | ||||
|         model.addAttribute("eventRequestDto", eventRequestDto); | ||||
|         return "etrack"; | ||||
|     } | ||||
|  | ||||
|     @PostMapping("/etrack/{uuid}") | ||||
|     public String getLogs(@Valid EventRequestDto eventRequestDto, final Model model, BindingResult bindingResult, | ||||
|                           @PathVariable UUID uuid){ | ||||
|         model.addAttribute("clientUUID", uuid); | ||||
|         populateModelWithLists(model, eventRequestDto, true); | ||||
|         return "etrack"; | ||||
|     } | ||||
|  | ||||
|     private void populateModelWithLists(Model model, EventRequestDto eventRequestDto, boolean updateList){ | ||||
|         if (updateList){ | ||||
|             eventList.clear(); | ||||
|             eventList.addAll(etrackService.getEventsByDateTimeAndBusinessKeys(eventRequestDto)); | ||||
|         } | ||||
|         model.addAttribute("eventList", eventList); | ||||
|     } | ||||
|  | ||||
|     @ModelAttribute("eventRequestDto") | ||||
|     public EventRequestDto eventRequestDto() { | ||||
|         return EventRequestDto.builder() | ||||
|                 .mockedResponseId(1) | ||||
|                 .localDateTimeFrom(LocalDateTime.of(LocalDate.now(), LocalTime.MIN)) | ||||
|                 .localDateTimeTo(LocalDateTime.of(LocalDate.now().plusDays(1), LocalTime.MIDNIGHT)) | ||||
|                 .build(); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     @ModelAttribute("eventList") | ||||
|     public List<Event> eventList() { | ||||
|         return eventList; | ||||
|     } | ||||
| //    @GetMapping("/etrack/{uuid}") | ||||
| //    public String showEtrack(@Valid EventRequestDto eventRequestDto, @PathVariable UUID uuid, final Model model, | ||||
| //                             BindingResult bindingResult){ | ||||
| //        model.addAttribute("clientUUID", uuid); | ||||
| //        model.addAttribute("eventRequestDto", eventRequestDto); | ||||
| //        return "etrack"; | ||||
| //    } | ||||
| // | ||||
| //    @PostMapping("/etrack/{uuid}") | ||||
| //    public String getLogs(@Valid EventRequestDto eventRequestDto, final Model model, BindingResult bindingResult, | ||||
| //                          @PathVariable UUID uuid){ | ||||
| //        model.addAttribute("clientUUID", uuid); | ||||
| //        populateModelWithLists(model, eventRequestDto, true); | ||||
| //        return "etrack"; | ||||
| //    } | ||||
| // | ||||
| //    private void populateModelWithLists(Model model, EventRequestDto eventRequestDto, boolean updateList){ | ||||
| //        if (updateList){ | ||||
| //            eventList.clear(); | ||||
| //            eventList.addAll(etrackService.getEventsByDateTimeAndBusinessKeys(eventRequestDto)); | ||||
| //        } | ||||
| //        model.addAttribute("eventList", eventList); | ||||
| //    } | ||||
| // | ||||
| //    @ModelAttribute("eventRequestDto") | ||||
| //    public EventRequestDto eventRequestDto() { | ||||
| //        return EventRequestDto.builder() | ||||
| //                .mockedResponseId(1) | ||||
| //                .localDateTimeFrom(LocalDateTime.of(LocalDate.now(), LocalTime.MIN)) | ||||
| //                .localDateTimeTo(LocalDateTime.of(LocalDate.now().plusDays(1), LocalTime.MIDNIGHT)) | ||||
| //                .build(); | ||||
| //    } | ||||
| // | ||||
| // | ||||
| //    @ModelAttribute("eventList") | ||||
| //    public List<Event> eventList() { | ||||
| //        return eventList; | ||||
| //    } | ||||
|  | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -27,7 +27,7 @@ import java.util.UUID; | ||||
|  * A class responds to generated message uri's requests. | ||||
|  * It deletes or fetches the requested message | ||||
|  */ | ||||
| @Controller("/") | ||||
| @Controller("/klaus/v1") | ||||
| @Slf4j | ||||
| //@Profile({"DEV", "default"}) | ||||
| @AllArgsConstructor | ||||
| @@ -36,7 +36,7 @@ public class KlausController { | ||||
|     private final KlausService klausService; | ||||
|  | ||||
|  | ||||
|     @DeleteMapping(value = "klaus/v1/delete/{clientUUID}/{mockedResponseId}") | ||||
|     @DeleteMapping(value = "/delete/{clientUUID}/{mockedResponseId}") | ||||
|     public ResponseEntity<String> deleteMockedResponse(@PathVariable UUID clientUUID, | ||||
|                                                        @PathVariable int mockedResponseId){ | ||||
|         TrackingClient.setBusinessKeys(Map.of(BusinessKey.INTERFACE_NAME, "deleteMockedResponse", | ||||
| @@ -46,7 +46,7 @@ public class KlausController { | ||||
|         return new ResponseEntity<>("message has been deleted", HttpStatus.OK); | ||||
|     } | ||||
|  | ||||
|     @GetMapping(value = "klaus/v1/getAll/{clientUUID}") | ||||
|     @GetMapping(value = "/getAll/{clientUUID}") | ||||
|     public ResponseEntity<String> getAllMockedResponses(@PathVariable UUID clientUUID){ | ||||
|         TrackingClient.setBusinessKeys(Map.of(BusinessKey.INTERFACE_NAME, "getAllMockedResponse", | ||||
|                 BusinessKey.CLIENT_UUID, String.valueOf(clientUUID))); | ||||
| @@ -54,7 +54,7 @@ public class KlausController { | ||||
|         return new ResponseEntity<>(mockedMessages.toString(), HttpStatus.OK); | ||||
|     } | ||||
|  | ||||
|     @RequestMapping(value = "klaus/v1/get/{clientUUID}/{mockedResponseId}") | ||||
|     @RequestMapping(value = "/get/{clientUUID}/{mockedResponseId}") | ||||
|     public ResponseEntity getMockedResponse(RequestEntity<String> requestEntity, | ||||
|                                             @PathVariable UUID clientUUID, | ||||
|                                             @PathVariable int mockedResponseId) { | ||||
|   | ||||
| @@ -10,6 +10,7 @@ import org.springframework.http.MediaType; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.stereotype.Controller; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import org.springframework.web.servlet.ModelAndView; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
| import java.util.*; | ||||
| @@ -28,12 +29,17 @@ public class MockController { | ||||
|      * @return | ||||
|      */ | ||||
|     @SneakyThrows | ||||
|     @GetMapping({"/","/mock"}) | ||||
|     public String showHome(){ | ||||
|         return "mock"; | ||||
|     @GetMapping | ||||
|     public ModelAndView showHome(){ | ||||
|         ModelAndView mov = new ModelAndView(); | ||||
|         mov.setViewName("html/mock"); | ||||
|         System.out.println("Trying to return view"); | ||||
|         return mov; | ||||
|     } | ||||
|  | ||||
| //    TODO: Remove object mapper | ||||
|     @SneakyThrows | ||||
|     @ResponseBody | ||||
|     @PutMapping("/mock/json") | ||||
|     public ResponseEntity<String> updateMessage(@RequestBody String body){ | ||||
|         ObjectMapper mapper = new ObjectMapper(); | ||||
|   | ||||
| @@ -1,13 +1,7 @@ | ||||
| #environment: | ||||
| server.port = 8097 | ||||
| spring.application.name = klaus | ||||
| eureka.client.service-url.defaultZone=http://netflix:eureka@eureka:8761/eureka/ | ||||
| spring.cloud.config.discovery.service-id = klaus-config-service | ||||
| #spring.cloud.config.fail-fast=true | ||||
| #spring.cloud.config.username = SpringConfigUsername | ||||
| #spring.cloud.config.password = SpringConfigPassword | ||||
| #logging: | ||||
| spring.output.ansi.enabled = always | ||||
| spring.mvc.view.suffix=.html | ||||
| logging.level.root=INFO | ||||
| logging.level.org.springframework.web=INFO | ||||
| logging.level.com.release11=INFO | ||||
|   | ||||
| @@ -1,14 +0,0 @@ | ||||
| spring: | ||||
|   profiles: | ||||
|     active: DEV | ||||
|   application: | ||||
|     name: klaus | ||||
|   cloud: | ||||
|     spring: | ||||
|       cloud: | ||||
|         config: | ||||
|           uri: http://localhost:8888 | ||||
|           retry: | ||||
|             max-attempts: 20 | ||||
|             max-interval: 15000 | ||||
|             initial-interval: 10000 | ||||
		Reference in New Issue
	
	Block a user