diff --git a/.idea/dictionaries/lomba.xml b/.idea/dictionaries/lomba.xml index f9c6062..e270558 100644 --- a/.idea/dictionaries/lomba.xml +++ b/.idea/dictionaries/lomba.xml @@ -1,6 +1,7 @@ + logstashes workdir diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 5c48745..57dfba8 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -19,8 +19,30 @@ - - Mocked response id: - - Id Error - - - Mocked response body: - - Body Error - - - Mocked response http code status: - - HttpStatus Error - - - Provide mocked response headers: - Add a new header +

In order to set mockup response. Please send the response, that you want to receive, on: +
http://localhost:8097/klaus/v1/set/ clientUUID should be here/{mockedResponseId}?httpStatus=200 +
+ +
+
+
+
+
You can also simply fill and submit the below form: + +
+ - + + + + + + + + + + + + + + + + + + + + + + + +
Mocked response id:Id Error
Mocked response body:Body Error
Mocked response http code status:HttpStatus Error
Provide mocked response headers:Add a new header + + + + +
+
Media type:
- - - - Media type: - - - - - - -
- -

Mock has been saved

+ + + + + + +
+

Mock has been saved

+
+
+ + +

+
+
+
+
+ Your mocked requests: +
+larum ispum srutum tutum +
+
+
+

- -

In order to use the mocked response in your integration tests or simply +
+
In order to use the mocked response in your integration tests or simply get your mocked response please send a request to
http://localhost:8097/klaus/v1/get/clientUUID should be here/{mockedResponseId} +
You will receive the same body and headers as you sent them in the step 1.
-

You will receive the same body and headers as you sent them in the step 1.
-

You can also use the form below:
-
- -

- - -
+
+
+
To see your activity history use the form below +
+ +

+ + localDateTimeFrom Error +

+ + localDateTimeTo Error +
+

...

+
+ +
+

diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index 0cf2a2a..5bf521d 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -4,6 +4,7 @@ Login +

Please move to the next step with your own client UUID:
@@ -12,7 +13,6 @@ -

You can also register new UUID. *some logic to register UUID*:
clientUUID should be here
diff --git a/src/test/java/com/release11/klaus/controller/KlausControllerTest.java b/src/test/java/com/release11/klaus/controller/KlausControllerTest.java index 93067ae..7fdf046 100644 --- a/src/test/java/com/release11/klaus/controller/KlausControllerTest.java +++ b/src/test/java/com/release11/klaus/controller/KlausControllerTest.java @@ -1,11 +1,23 @@ package com.release11.klaus.controller; +import org.apache.tomcat.jni.Local; import org.junit.jupiter.api.Test; +import java.time.LocalDate; +import java.time.Month; +import java.time.Period; + class KlausControllerTest { @Test void getMockedResponse() { + LocalDate localDate = LocalDate.now(); + LocalDate localDate1 = LocalDate.now(); + + System.out.println(localDate.compareTo(localDate1)); + System.out.println(localDate1); + Period period = Period.between(localDate, localDate1); + System.out.println(period); } @Test diff --git a/src/test/java/com/release11/klaus/controller/KlausMvcControllerTest.java b/src/test/java/com/release11/klaus/controller/KlausMvcControllerTest.java index 9176313..d387dbf 100644 --- a/src/test/java/com/release11/klaus/controller/KlausMvcControllerTest.java +++ b/src/test/java/com/release11/klaus/controller/KlausMvcControllerTest.java @@ -1,8 +1,11 @@ package com.release11.klaus.controller; +import com.release11.klaus.model.Event; +import com.release11.klaus.model.EventRequestDto; import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; +import java.time.LocalDateTime; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -15,5 +18,8 @@ class KlausMvcControllerTest { @Test void showHome() { + EventRequestDto eventRequestDto = EventRequestDto.builder(). + localDateTimeTo(LocalDateTime.now()).build(); + System.out.println(eventRequestDto); } } diff --git a/src/test/java/com/release11/klaus/repository/MockedResponseRedisRepositoryTest.java b/src/test/java/com/release11/klaus/repository/MockedResponseRedisRepositoryTest.java index ae2590c..b5b0c37 100644 --- a/src/test/java/com/release11/klaus/repository/MockedResponseRedisRepositoryTest.java +++ b/src/test/java/com/release11/klaus/repository/MockedResponseRedisRepositoryTest.java @@ -1,21 +1,57 @@ package com.release11.klaus.repository; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.release11.klaus.model.Event; +import com.release11.klaus.utilis.BusinessKey; import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @SpringBootTest class MockedResponseRedisRepositoryTest { + @Autowired + ObjectMapper objectMapper; + @Test - void getMockedResponse() { + void getMockedResponse() throws JsonProcessingException { + Map businessKeys = new HashMap<>(); + String[] businessKeys1 = {"fdsa", "Dsa", "dsa"}; + businessKeys.put(BusinessKey.CLIENT_UUID, "xxx"); + businessKeys.put(BusinessKey.INTERFACE_NAME, "interfaceName"); + businessKeys.put(BusinessKey.MESSAGE_ID, "2323"); + Event event = Event.builder() + .dateTimeStamp(LocalDateTime.now()) + .businessKeys(businessKeys1) + .message("hello") + .level("INFO") + .thread("main") + .build(); + String eventString = objectMapper.writeValueAsString(event); + System.out.println(eventString); + + + String ddd = "{\"dateTimeStamp\" : \"2020-09-04T15:31:48\", \"businessKeys\":[\"INTERFACE_NAME:setMockedResponse\", \"CLIENT_UUID:436c4774-038f-4540-9c18-2691ca9b53d4\", \"MESSAGE_ID:1\"],\"thread\":\"http-nio-8097-exec-6\",\"level\":\"INFO \", \"message\":\"MockedResponseDto(compositePrimaryKey=null, clientUUID=436c4774-038f-4540-9c18-2691ca9b53d4, mockedResponseId=1, mediaType=application/xml, messageBody=body, httpHeaders=null, httpStatus=200)\" dsads}das"; + objectMapper.readValue(eventString, Event.class); } @Test void setMockedResponse() { -// System.out.println("Before Test, clearing Redis"); -// JedisPool pool = new JedisPool("localhost"); -// redis = pool.getResource(); -// redis.ltrim(key, 1, 0); + + List stringList = new ArrayList<>(); + stringList.add("ddddd"); + stringList.add("www"); + + stringList.stream().filter(s -> s.length() > 3).forEach(System.out::println); } diff --git a/target/classes/application.properties b/target/classes/application.properties index cf3346e..10662de 100644 --- a/target/classes/application.properties +++ b/target/classes/application.properties @@ -1,4 +1,4 @@ -server.port = 8098 +server.port = 8097 spring.output.ansi.enabled = always #logging.file.name=/var/log/klaus/ diff --git a/target/classes/com/release11/klaus/config/RedisConfig.class b/target/classes/com/release11/klaus/config/RedisConfig.class index d31cfd7..5c68923 100644 Binary files a/target/classes/com/release11/klaus/config/RedisConfig.class and b/target/classes/com/release11/klaus/config/RedisConfig.class differ diff --git a/target/classes/com/release11/klaus/controller/KlausMvcController.class b/target/classes/com/release11/klaus/controller/KlausMvcController.class index 6750086..cecab38 100644 Binary files a/target/classes/com/release11/klaus/controller/KlausMvcController.class and b/target/classes/com/release11/klaus/controller/KlausMvcController.class differ diff --git a/target/classes/com/release11/klaus/repository/MockedResponseRepository.class b/target/classes/com/release11/klaus/repository/MockedResponseRepository.class index 2dd2b32..48dbfe6 100644 Binary files a/target/classes/com/release11/klaus/repository/MockedResponseRepository.class and b/target/classes/com/release11/klaus/repository/MockedResponseRepository.class differ diff --git a/target/classes/com/release11/klaus/service/KlausService.class b/target/classes/com/release11/klaus/service/KlausService.class index 5e201b7..c6ee094 100644 Binary files a/target/classes/com/release11/klaus/service/KlausService.class and b/target/classes/com/release11/klaus/service/KlausService.class differ diff --git a/target/classes/com/release11/klaus/service/KlausServiceImpl.class b/target/classes/com/release11/klaus/service/KlausServiceImpl.class index 391d5f4..0875895 100644 Binary files a/target/classes/com/release11/klaus/service/KlausServiceImpl.class and b/target/classes/com/release11/klaus/service/KlausServiceImpl.class differ diff --git a/target/classes/com/release11/klaus/utilis/TrackingClient.class b/target/classes/com/release11/klaus/utilis/TrackingClient.class index 99271ce..df8eb0e 100644 Binary files a/target/classes/com/release11/klaus/utilis/TrackingClient.class and b/target/classes/com/release11/klaus/utilis/TrackingClient.class differ diff --git a/target/classes/logback.xml b/target/classes/logback.xml index 476fda0..a6c3385 100644 --- a/target/classes/logback.xml +++ b/target/classes/logback.xml @@ -2,14 +2,14 @@ - + localhost 6379 logstash - {"date" : "%d{yyyy-MM-dd}", "timestamp":"%d{HH:mm:ss}", "businessKeys": ["interfaceName": "%X{interfaceName}", "clientUUID": "%X{clientUUID}", "messageId": "%X{messageId}"],"thread":"%t","level":"%-5level", "message":"%msg"}%n + {"dateTimeStamp" : "%d{yyyy-MM-dd}T%d{HH:mm:ss}", "businessKeys":["INTERFACE_NAME:%X{INTERFACE_NAME}", "CLIENT_UUID:%X{CLIENT_UUID}", "MESSAGE_ID:%X{MESSAGE_ID}"],"thread":"%t","level":"%-5level", "message":"%msg"}%n diff --git a/target/classes/static/js/main.js b/target/classes/static/js/main.js index 3e322d2..fb9c395 100644 --- a/target/classes/static/js/main.js +++ b/target/classes/static/js/main.js @@ -1,4 +1,3 @@ - function httpGet() { var clientUUID = document.getElementById("getClientUUID").value; diff --git a/target/classes/templates/index.html b/target/classes/templates/index.html index 5fedb2a..e2bb4f1 100644 --- a/target/classes/templates/index.html +++ b/target/classes/templates/index.html @@ -3,76 +3,115 @@ Title - + +
-

In order to set mockup response. Please send the response, that you want to receive, on: -
http://localhost:8097/klaus/v1/set/ clientUUID should be here/{mockedResponseId}?httpStatus=200 -
or simply fill and submit the below form:
-
- sayHi('John'); -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mocked response id:Id Error
Mocked response body:Body Error
Mocked response http code status:HttpStatus Error
Provide mocked response headers:Add a new header +

In order to set mockup response. Please send the response, that you want to receive, on: +
http://localhost:8097/klaus/v1/set/ clientUUID should be here/{mockedResponseId}?httpStatus=200 +
+ +
+
+
+
+
You can also simply fill and submit the below form: + + + - + + + + + + + + + + + + + + + + + + + + + + + +
Mocked response id:Id Error
Mocked response body:Body Error
Mocked response http code status:HttpStatus Error
Provide mocked response headers:Add a new header + + + + +
+
Media type:
-
Media type:
-
- -

Mock has been saved

+ + + + + + +
+

Mock has been saved

+
+
+ + +

+
+
+
+
+ Your mocked requests: +
+larum ispum srutum tutum +
+ + +
- -

In order to use the mocked response in your integration tests or simply +
+
In order to use the mocked response in your integration tests or simply get your mocked response please send a request to
http://localhost:8097/klaus/v1/get/clientUUID should be here/{mockedResponseId} +
You will receive the same body and headers as you sent them in the step 1.
-

You will receive the same body and headers as you sent them in the step 1.
-

You can also use the form below:
-
- -

- - -
+
+
+
To see your activity history use the form below +
+ +

+ + localDateTimeFrom Error +

+ + localDateTimeTo Error +
+

...

+
+ +
+

diff --git a/target/classes/templates/login.html b/target/classes/templates/login.html index 0cf2a2a..5bf521d 100644 --- a/target/classes/templates/login.html +++ b/target/classes/templates/login.html @@ -4,6 +4,7 @@ Login +

Please move to the next step with your own client UUID:
@@ -12,7 +13,6 @@ -

You can also register new UUID. *some logic to register UUID*:
clientUUID should be here
diff --git a/target/test-classes/com/release11/klaus/controller/KlausControllerTest.class b/target/test-classes/com/release11/klaus/controller/KlausControllerTest.class index a28b572..ceebf24 100644 Binary files a/target/test-classes/com/release11/klaus/controller/KlausControllerTest.class and b/target/test-classes/com/release11/klaus/controller/KlausControllerTest.class differ diff --git a/target/test-classes/com/release11/klaus/controller/KlausMvcControllerTest.class b/target/test-classes/com/release11/klaus/controller/KlausMvcControllerTest.class index 0c2f016..4e9e2b8 100644 Binary files a/target/test-classes/com/release11/klaus/controller/KlausMvcControllerTest.class and b/target/test-classes/com/release11/klaus/controller/KlausMvcControllerTest.class differ diff --git a/target/test-classes/com/release11/klaus/repository/MockedResponseRedisRepositoryTest.class b/target/test-classes/com/release11/klaus/repository/MockedResponseRedisRepositoryTest.class index 0d0b038..655bf88 100644 Binary files a/target/test-classes/com/release11/klaus/repository/MockedResponseRedisRepositoryTest.class and b/target/test-classes/com/release11/klaus/repository/MockedResponseRedisRepositoryTest.class differ