Skip to content

Commit

Permalink
#4 Formatting code
Browse files Browse the repository at this point in the history
  • Loading branch information
josdem committed Jul 27, 2023
1 parent c73476d commit df0c5f5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
7 changes: 3 additions & 4 deletions src/main/java/com/josdem/catcher/CatcherApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
@SpringBootApplication
public class CatcherApplication {

public static void main(String[] args) {
SpringApplication.run(CatcherApplication.class, args);
}

public static void main(String[] args) {
SpringApplication.run(CatcherApplication.class, args);
}
}
29 changes: 14 additions & 15 deletions src/main/java/com/josdem/catcher/controller/StatusController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.josdem.catcher.controller;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -9,27 +11,24 @@
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/catcher")
public class StatusController {

private final Map<String, String> memory = new ConcurrentHashMap<>();
private final Map<String, String> memory = new ConcurrentHashMap<>();

@PostMapping("/{key}/{value}")
public Mono<Void> storeStatus(@PathVariable String key, @PathVariable String value) {
log.info("Storing status with key: {} and value: {}", key, value);
memory.putIfAbsent(key, value);
return Mono.empty();
}
@PostMapping("/{key}/{value}")
public Mono<Void> storeStatus(@PathVariable String key, @PathVariable String value) {
log.info("Storing status with key: {} and value: {}", key, value);
memory.putIfAbsent(key, value);
return Mono.empty();
}

@GetMapping("/{key}")
public Mono<String> getStatus(@PathVariable String key) {
log.info("Getting status from key: {}", key);
return Mono.just(memory.get(key));
}
@GetMapping("/{key}")
public Mono<String> getStatus(@PathVariable String key) {
log.info("Getting status from key: {}", key);
return Mono.just(memory.get(key));
}
}
4 changes: 2 additions & 2 deletions src/test/java/com/josdem/catcher/CatcherApplicationTests.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.josdem.catcher;

import static org.junit.jupiter.api.Assertions.assertNotNull;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
Expand All @@ -8,8 +10,6 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;

import static org.junit.jupiter.api.Assertions.assertNotNull;

@Slf4j
@SpringBootTest
@RequiredArgsConstructor(onConstructor_ = @Autowired)
Expand Down

0 comments on commit df0c5f5

Please sign in to comment.