changing index.html and adding Etrack
This commit is contained in:
@@ -12,11 +12,11 @@ public class KlausApplication {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//TODO Jenkins
|
||||
//TODO history logs
|
||||
//TODO
|
||||
//TODO history logs; for log indexing - create custom log appender for Redis - in case etrack would be too slow
|
||||
//TODO JedisPool jedisPool = new JedisPool(jedisPoolConfig, redisHost, redisPort, timeout, redisPassword)
|
||||
//TODO JedisPool optimalization https://partners-intl.aliyun.com/help/doc-detail/98726.htm
|
||||
// loging and security
|
||||
// tracking clients activity
|
||||
// use a centralized logging collection tool like logstash
|
||||
// logging, security, account creation
|
||||
// tracking clients activity, admin panel
|
||||
// use a centralized logging collection tool like logstash for admin panel
|
||||
//TODO split into separate microservices
|
||||
@@ -10,6 +10,7 @@ import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
|
||||
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -21,6 +22,15 @@ public class RedisConfig {
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
@Bean
|
||||
JedisPool jedisPool(){
|
||||
//TODO JedisPool jedisPool = new JedisPool(jedisPoolConfig, redisHost, redisPort, timeout, redisPassword)
|
||||
//TODO JedisPool optimalization https://partners-intl.aliyun.com/help/doc-detail/98726.htm
|
||||
final JedisPool pool = new JedisPool(environment.getProperty("redis.host"),
|
||||
Integer.parseInt(environment.getProperty("redis.port")));
|
||||
return pool;
|
||||
}
|
||||
|
||||
@Bean
|
||||
JedisConnectionFactory jedisConnectionFactory() {
|
||||
RedisStandaloneConfiguration redisStandaloneConfiguration =
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.release11.klaus.controller;
|
||||
|
||||
import com.release11.klaus.model.EventRequestDto;
|
||||
import com.release11.klaus.utilis.BusinessKey;
|
||||
import com.release11.klaus.utilis.TrackingClient;
|
||||
import com.release11.klaus.model.MockedResponseDto;
|
||||
@@ -13,6 +14,9 @@ import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@@ -25,8 +29,7 @@ public class KlausMvcController {
|
||||
private final KlausService klausService;
|
||||
|
||||
@GetMapping("/login")
|
||||
public String login(Model model) {
|
||||
model.addAttribute("clientUUID", UUID.randomUUID());
|
||||
public String login() {
|
||||
return "login";
|
||||
}
|
||||
|
||||
@@ -78,5 +81,17 @@ public class KlausMvcController {
|
||||
|
||||
}
|
||||
|
||||
@ModelAttribute("clientUUID")
|
||||
public UUID clientUUID(){
|
||||
return UUID.randomUUID();
|
||||
}
|
||||
|
||||
@ModelAttribute("eventsDto")
|
||||
public EventRequestDto eventsDto(){
|
||||
return EventRequestDto.builder()
|
||||
.localDateTimeFrom(LocalDateTime.of(LocalDate.now(), LocalTime.MIN))
|
||||
.localDateTimeTo(LocalDateTime.of(LocalDate.now().plusDays(1), LocalTime.MIDNIGHT))
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,9 +3,11 @@ package com.release11.klaus.repository;
|
||||
import com.release11.klaus.model.MockedResponseDto;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Repository
|
||||
@Transactional
|
||||
public interface MockedResponseRepository extends CrudRepository<MockedResponseDto, String>{
|
||||
}
|
||||
|
||||
@@ -4,9 +4,11 @@ import com.release11.klaus.model.MockedResponseDto;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
public interface KlausService {
|
||||
ResponseEntity<String> getMockedResponse(UUID clientUUID, int mockedResponseId);
|
||||
ResponseEntity<String> setMockedResponse(MockedResponseDto mockedResponseDto);
|
||||
|
||||
@@ -36,6 +36,7 @@ public class KlausServiceImpl implements KlausService {
|
||||
@Override
|
||||
public ResponseEntity<String> setMockedResponse(MockedResponseDto mockedResponseDto) {
|
||||
mockedResponseRepository.save(mockedResponseDto);
|
||||
|
||||
log.info("KlausServiceImpl, operation setMockedResponse, mockedResponseDto {} ", mockedResponseDto.toString());
|
||||
return new ResponseEntity<>("MockedResponse has been setup successfully!", new HttpHeaders(),
|
||||
HttpStatus.ACCEPTED);
|
||||
|
||||
@@ -10,7 +10,7 @@ public final class TrackingClient {
|
||||
|
||||
public static void setBusinessKeys(Map<BusinessKey, String> businessKeysMap){
|
||||
for (Map.Entry<BusinessKey, String> entry : businessKeysMap.entrySet()) {
|
||||
MDC.put(entry.getKey().getReasonPhrase(), entry.getValue());
|
||||
MDC.put(entry.getKey().toString(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user