Merge branch 'modzeleg' into developer
This commit is contained in:
@@ -34,7 +34,7 @@ public class MockController {
|
||||
* @return confirmation and 200 OK
|
||||
*/
|
||||
@SneakyThrows
|
||||
@PutMapping("/")
|
||||
@PutMapping
|
||||
public ResponseEntity<String> updateMessage(@RequestBody String body){
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
MockedMessageDto message = mapper.readValue(body, MockedMessageDto.class);
|
||||
|
||||
@@ -10,7 +10,6 @@ import javax.validation.ConstraintViolationException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
//TODO: Is it really necessary?
|
||||
|
||||
/**
|
||||
* Custom exception handler for {@link ConstraintViolationException}
|
||||
|
||||
@@ -30,15 +30,6 @@ public class MockedMessageDto implements Serializable, Comparable<MockedMessageD
|
||||
@HttpCode
|
||||
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
|
||||
public int compareTo(MockedMessageDto message) {
|
||||
return this.mockedResponseId > message.getMockedResponseId() ? 1 : -1;
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.util.stream.Stream;
|
||||
public class HttpCodeValidation implements ConstraintValidator<HttpCode, Integer> {
|
||||
private Set<Integer> allowedValues;
|
||||
|
||||
//TODO: Find use of targetEnum
|
||||
/**
|
||||
* Initializes {@link #allowedValues} with possible http status values.
|
||||
* @param targetEnum HttpCode context
|
||||
@@ -29,7 +28,6 @@ public class HttpCodeValidation implements ConstraintValidator<HttpCode, Integer
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
//TODO: Find use of ConstraintValidatorContext
|
||||
/**
|
||||
* @param integer value of {@link MockedMessageDto#getHttpStatus()} or {@link MockedMessage#getHttpStatus()}
|
||||
* @param context context for validation
|
||||
|
||||
@@ -63,12 +63,10 @@ public class EventRepositoryImpl implements EventRepository {
|
||||
private List<Event> parseEvents(List<String> eventStrings) {
|
||||
List<Event> events = new ArrayList<>();
|
||||
for (String eventString : eventStrings) {
|
||||
eventString = eventString.replaceAll("\\R", "");
|
||||
try {
|
||||
eventString = eventString.replaceAll("\\R", "");
|
||||
events.add(objectMapper.readValue(eventString, Event.class));
|
||||
JSONObject jsonObject = new JSONObject(eventString);
|
||||
|
||||
} catch (JsonProcessingException | JSONException e) {
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,4 @@ public interface MockedResponseRepository extends CrudRepository<MockedMessage,
|
||||
* @return list of {@link com.release11.klaus.model.MockedMessage}
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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}
|
||||
* @author Rafał Żukowicz
|
||||
* @author Gabriel Modzelewski
|
||||
@@ -59,7 +59,6 @@ public class KlausServiceImpl implements KlausService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// TODO: check logic
|
||||
/**
|
||||
* 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
|
||||
@@ -84,7 +83,6 @@ public class KlausServiceImpl implements KlausService {
|
||||
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
|
||||
* @param mockedMessageDto message to be saved
|
||||
@@ -94,9 +92,6 @@ public class KlausServiceImpl implements KlausService {
|
||||
@Override
|
||||
public ResponseEntity<String> setMockedResponse(MockedMessageDto 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("\"", "\\\\\""));
|
||||
return new ResponseEntity<>("MockedResponse has been setup successfully!", new HttpHeaders(),
|
||||
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.Protocol;
|
||||
|
||||
//TODO: The check? Check if any of the following methods might be removed...
|
||||
//TODO: Add javadoc
|
||||
public class RedisAppender extends UnsynchronizedAppenderBase<ILoggingEvent> {
|
||||
|
||||
JedisPool pool;
|
||||
|
||||
@@ -4,7 +4,6 @@ import org.slf4j.MDC;
|
||||
|
||||
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.
|
||||
* 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 {
|
||||
|
||||
private TrackingClient(){}
|
||||
|
||||
/**
|
||||
* Logs data inside the given map
|
||||
* @param businessKeysMap map containing all the information about incomming request
|
||||
|
||||
Reference in New Issue
Block a user