Merge branch 'modzeleg' into developer
This commit is contained in:
@@ -34,7 +34,7 @@ public class MockController {
|
|||||||
* @return confirmation and 200 OK
|
* @return confirmation and 200 OK
|
||||||
*/
|
*/
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@PutMapping("/")
|
@PutMapping
|
||||||
public ResponseEntity<String> updateMessage(@RequestBody String body){
|
public ResponseEntity<String> updateMessage(@RequestBody String body){
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
MockedMessageDto message = mapper.readValue(body, MockedMessageDto.class);
|
MockedMessageDto message = mapper.readValue(body, MockedMessageDto.class);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import javax.validation.ConstraintViolationException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
//TODO: Is it really necessary?
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom exception handler for {@link ConstraintViolationException}
|
* Custom exception handler for {@link ConstraintViolationException}
|
||||||
|
|||||||
@@ -30,15 +30,6 @@ public class MockedMessageDto implements Serializable, Comparable<MockedMessageD
|
|||||||
@HttpCode
|
@HttpCode
|
||||||
private Integer httpStatus;
|
private Integer httpStatus;
|
||||||
|
|
||||||
// TODO: Remove if no use
|
|
||||||
public MockedMessageDto(UUID clientUUID) {
|
|
||||||
this.clientUUID = clientUUID;
|
|
||||||
}
|
|
||||||
public MockedMessageDto(UUID clientUUID, Map<String,String> httpHeaders) {
|
|
||||||
this.clientUUID = clientUUID;
|
|
||||||
this.httpHeaders = httpHeaders;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(MockedMessageDto message) {
|
public int compareTo(MockedMessageDto message) {
|
||||||
return this.mockedResponseId > message.getMockedResponseId() ? 1 : -1;
|
return this.mockedResponseId > message.getMockedResponseId() ? 1 : -1;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import java.util.stream.Stream;
|
|||||||
public class HttpCodeValidation implements ConstraintValidator<HttpCode, Integer> {
|
public class HttpCodeValidation implements ConstraintValidator<HttpCode, Integer> {
|
||||||
private Set<Integer> allowedValues;
|
private Set<Integer> allowedValues;
|
||||||
|
|
||||||
//TODO: Find use of targetEnum
|
|
||||||
/**
|
/**
|
||||||
* Initializes {@link #allowedValues} with possible http status values.
|
* Initializes {@link #allowedValues} with possible http status values.
|
||||||
* @param targetEnum HttpCode context
|
* @param targetEnum HttpCode context
|
||||||
@@ -29,7 +28,6 @@ public class HttpCodeValidation implements ConstraintValidator<HttpCode, Integer
|
|||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Find use of ConstraintValidatorContext
|
|
||||||
/**
|
/**
|
||||||
* @param integer value of {@link MockedMessageDto#getHttpStatus()} or {@link MockedMessage#getHttpStatus()}
|
* @param integer value of {@link MockedMessageDto#getHttpStatus()} or {@link MockedMessage#getHttpStatus()}
|
||||||
* @param context context for validation
|
* @param context context for validation
|
||||||
|
|||||||
@@ -63,12 +63,10 @@ public class EventRepositoryImpl implements EventRepository {
|
|||||||
private List<Event> parseEvents(List<String> eventStrings) {
|
private List<Event> parseEvents(List<String> eventStrings) {
|
||||||
List<Event> events = new ArrayList<>();
|
List<Event> events = new ArrayList<>();
|
||||||
for (String eventString : eventStrings) {
|
for (String eventString : eventStrings) {
|
||||||
|
eventString = eventString.replaceAll("\\R", "");
|
||||||
try {
|
try {
|
||||||
eventString = eventString.replaceAll("\\R", "");
|
|
||||||
events.add(objectMapper.readValue(eventString, Event.class));
|
events.add(objectMapper.readValue(eventString, Event.class));
|
||||||
JSONObject jsonObject = new JSONObject(eventString);
|
} catch (JsonProcessingException e) {
|
||||||
|
|
||||||
} catch (JsonProcessingException | JSONException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,4 @@ public interface MockedResponseRepository extends CrudRepository<MockedMessage,
|
|||||||
* @return list of {@link com.release11.klaus.model.MockedMessage}
|
* @return list of {@link com.release11.klaus.model.MockedMessage}
|
||||||
*/
|
*/
|
||||||
List<MockedMessage> findAllByClientUUID(UUID clientUUID);
|
List<MockedMessage> findAllByClientUUID(UUID clientUUID);
|
||||||
// TODO: Remove if no use
|
|
||||||
MockedMessage getByCompositePrimaryKey(String compositePrimaryKey);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import java.util.UUID;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service for {@link com.release11.klaus.controller.KlausController} and {@link com.release11.klaus.controller.MockController}
|
* Service for {@link com.release11.klaus.controller.MockController} and {@link com.release11.klaus.controller.MockController}
|
||||||
* Allows for performing CRUD operations on {@link MockedMessageDto}
|
* Allows for performing CRUD operations on {@link MockedMessageDto}
|
||||||
* @author Rafał Żukowicz
|
* @author Rafał Żukowicz
|
||||||
* @author Gabriel Modzelewski
|
* @author Gabriel Modzelewski
|
||||||
@@ -59,7 +59,6 @@ public class KlausServiceImpl implements KlausService {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: check logic
|
|
||||||
/**
|
/**
|
||||||
* Returns {@link MockedMessageDto} of given id and key-uuid. If message doesn't then empty message is returned
|
* Returns {@link MockedMessageDto} of given id and key-uuid. If message doesn't then empty message is returned
|
||||||
* @param clientUUID the key-uuid of given set of messages
|
* @param clientUUID the key-uuid of given set of messages
|
||||||
@@ -84,7 +83,6 @@ public class KlausServiceImpl implements KlausService {
|
|||||||
return mockedMessageDto;
|
return mockedMessageDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove code of no use
|
|
||||||
/**
|
/**
|
||||||
* Allows to modify mocked message. If message of given id and key-uuid doesn't exist a new entry is created
|
* Allows to modify mocked message. If message of given id and key-uuid doesn't exist a new entry is created
|
||||||
* @param mockedMessageDto message to be saved
|
* @param mockedMessageDto message to be saved
|
||||||
@@ -94,9 +92,6 @@ public class KlausServiceImpl implements KlausService {
|
|||||||
@Override
|
@Override
|
||||||
public ResponseEntity<String> setMockedResponse(MockedMessageDto mockedMessageDto) {
|
public ResponseEntity<String> setMockedResponse(MockedMessageDto mockedMessageDto) {
|
||||||
mockedResponseRepository.save(mockedMessageMapper.mockedMessageDtoToMockedMessage(mockedMessageDto));
|
mockedResponseRepository.save(mockedMessageMapper.mockedMessageDtoToMockedMessage(mockedMessageDto));
|
||||||
String s = objectMapper.writeValueAsString(mockedMessageDto);
|
|
||||||
String s1 = mockedMessageDto.toString();
|
|
||||||
String s2 = String.valueOf(mockedMessageDto);
|
|
||||||
log.info(mockedMessageDto.toString().replaceAll("\"", "\\\\\""));
|
log.info(mockedMessageDto.toString().replaceAll("\"", "\\\\\""));
|
||||||
return new ResponseEntity<>("MockedResponse has been setup successfully!", new HttpHeaders(),
|
return new ResponseEntity<>("MockedResponse has been setup successfully!", new HttpHeaders(),
|
||||||
HttpStatus.ACCEPTED);
|
HttpStatus.ACCEPTED);
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.release11.klaus.utilis;
|
|
||||||
|
|
||||||
import com.release11.klaus.model.MockedMessageDto;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
//TODO: is it really necessary? kekw
|
|
||||||
@Configuration
|
|
||||||
public class ObjectConfig {
|
|
||||||
@Bean
|
|
||||||
public MockedMessageDto globalMessageDto(){
|
|
||||||
return new MockedMessageDto();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,7 @@ import redis.clients.jedis.Jedis;
|
|||||||
import redis.clients.jedis.JedisPool;
|
import redis.clients.jedis.JedisPool;
|
||||||
import redis.clients.jedis.Protocol;
|
import redis.clients.jedis.Protocol;
|
||||||
|
|
||||||
//TODO: The check? Check if any of the following methods might be removed...
|
//TODO: Add javadoc
|
||||||
public class RedisAppender extends UnsynchronizedAppenderBase<ILoggingEvent> {
|
public class RedisAppender extends UnsynchronizedAppenderBase<ILoggingEvent> {
|
||||||
|
|
||||||
JedisPool pool;
|
JedisPool pool;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import org.slf4j.MDC;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
//TODO: Check if constructor might be safely removed. It's static class tho
|
|
||||||
/**
|
/**
|
||||||
* This static class has one purpose and one purpose only. It logs data about incomming requests.
|
* This static class has one purpose and one purpose only. It logs data about incomming requests.
|
||||||
* The data from logs is received via {@link com.release11.klaus.repository.EventRepositoryImpl}
|
* The data from logs is received via {@link com.release11.klaus.repository.EventRepositoryImpl}
|
||||||
@@ -12,8 +11,6 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public final class TrackingClient {
|
public final class TrackingClient {
|
||||||
|
|
||||||
private TrackingClient(){}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs data inside the given map
|
* Logs data inside the given map
|
||||||
* @param businessKeysMap map containing all the information about incomming request
|
* @param businessKeysMap map containing all the information about incomming request
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user