Skip to content

Commit d28211b

Browse files
committed
fix: update after CodeRabbit review
1 parent 18f0766 commit d28211b

4 files changed

Lines changed: 28 additions & 7 deletions

File tree

steve-api/src/test/java/de/rwth/idsg/steve/web/api/OcppTagsRestControllerTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,9 @@ public void test12() throws Exception {
326326
.contentType(MediaType.APPLICATION_JSON)))
327327
.hasStatusOk();
328328

329-
verify(ocppTagsService).updateOcppTag(form);
329+
var captor = ArgumentCaptor.forClass(OcppTagForm.class);
330+
verify(ocppTagsService).updateOcppTag(captor.capture());
331+
assertThat(captor.getValue()).usingRecursiveComparison().isEqualTo(form);
330332
}
331333

332334
@Test

steve-ui-jsp/src/main/java/de/rwth/idsg/steve/web/controller/RootRedirectController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
package de.rwth.idsg.steve.web.controller;
2020

2121
import org.springframework.stereotype.Controller;
22-
import org.springframework.web.bind.annotation.GetMapping;
2322
import org.springframework.web.bind.annotation.RequestMapping;
23+
import org.springframework.web.bind.annotation.RequestMethod;
2424

2525
/**
2626
* @author Sevket Goekay <sevketgokay@gmail.com>
@@ -30,7 +30,7 @@
3030
@RequestMapping("/")
3131
public class RootRedirectController {
3232

33-
@GetMapping
33+
@RequestMapping(method = {RequestMethod.GET, RequestMethod.HEAD})
3434
public String redirectToManager() {
3535
return "redirect:/manager";
3636
}

steve/src/main/java/de/rwth/idsg/steve/Application.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@
3636
@Slf4j
3737
public class Application {
3838

39+
private final SteveConfiguration config;
40+
private final LogFileRetriever logFileRetriever;
3941
private final JettyServer server;
4042

4143
public Application(SteveConfiguration config, LogFileRetriever logFileRetriever) {
44+
this.config = config;
45+
this.logFileRetriever = logFileRetriever;
4246
this.server = new JettyServer(config);
43-
WebConfig.config = config;
44-
WebConfig.logFileRetriever = logFileRetriever;
47+
4548
}
4649

4750
public static void main(String[] args) throws Exception {
@@ -83,6 +86,7 @@ public static void main(String[] args) throws Exception {
8386
}
8487

8588
public void start() throws Exception {
89+
WebConfig.initialize(config, logFileRetriever);
8690
server.start();
8791
}
8892

@@ -92,5 +96,6 @@ public void join() throws Exception {
9296

9397
public void stop() throws Exception {
9498
server.stop();
99+
WebConfig.clear();
95100
}
96101
}

steve/src/main/java/de/rwth/idsg/steve/config/WebConfig.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,22 @@
4747
@RequiredArgsConstructor
4848
public class WebConfig implements WebApplicationInitializer {
4949

50-
public static SteveConfiguration config;
51-
public static LogFileRetriever logFileRetriever;
50+
// TEMP workaround before spring boot migration
51+
private static SteveConfiguration config;
52+
private static LogFileRetriever logFileRetriever;
53+
54+
public static synchronized void initialize(SteveConfiguration cfg, LogFileRetriever retriever) {
55+
if (config != null || logFileRetriever != null) {
56+
throw new IllegalStateException("WebConfig already initialized");
57+
}
58+
config = cfg;
59+
logFileRetriever = retriever;
60+
}
61+
62+
public static void clear() {
63+
config = null;
64+
logFileRetriever = null;
65+
}
5266

5367
@Override
5468
public void onStartup(ServletContext servletContext) throws ServletException {

0 commit comments

Comments
 (0)