MockedMessageDto received in json
This commit is contained in:
17
.idea/workspace.xml
generated
17
.idea/workspace.xml
generated
@@ -20,9 +20,12 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="458cde88-df3d-44bc-9d57-a33823e2f1a6" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/release11/klaus/model/TestModel.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/release11/klaus/model/MockedMessageDtoTest.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/resources/static/json/mockedmessagedto.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/release11/klaus/controller/KlausController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/release11/klaus/controller/KlausController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/release11/klaus/model/MockedMessageDto.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/release11/klaus/model/MockedMessageDto.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/release11/klaus/model/TestModel.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/release11/klaus/model/TestModel.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -304,7 +307,7 @@
|
||||
<workItem from="1611126794919" duration="19626000" />
|
||||
<workItem from="1611573268679" duration="3971000" />
|
||||
<workItem from="1611659140629" duration="2109000" />
|
||||
<workItem from="1611757446709" duration="3012000" />
|
||||
<workItem from="1611757446709" duration="4935000" />
|
||||
</task>
|
||||
<task id="LOCAL-00077" summary="testing jenkins docker">
|
||||
<created>1601453886631</created>
|
||||
@@ -704,10 +707,10 @@
|
||||
<screen x="0" y="0" width="1920" height="1160" />
|
||||
</state>
|
||||
<state x="728" y="318" key="#New_Docker_Connection/0.0.1920.1160@0.0.1920.1160" timestamp="1611137360647" />
|
||||
<state x="304" y="221" width="1559" height="718" key="#Plugins" timestamp="1609858834859">
|
||||
<state x="304" y="221" width="1559" height="718" key="#Plugins" timestamp="1611762413069">
|
||||
<screen x="0" y="0" width="1920" height="1160" />
|
||||
</state>
|
||||
<state x="304" y="221" width="1559" height="718" key="#Plugins/0.0.1920.1160@0.0.1920.1160" timestamp="1609858834859" />
|
||||
<state x="304" y="221" width="1559" height="718" key="#Plugins/0.0.1920.1160@0.0.1920.1160" timestamp="1611762413069" />
|
||||
<state x="2479" y="105" width="1092" height="762" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1604747761014">
|
||||
<screen x="1920" y="0" width="1920" height="1040" />
|
||||
</state>
|
||||
@@ -842,18 +845,18 @@
|
||||
<screen x="0" y="0" width="1920" height="1160" />
|
||||
</state>
|
||||
<state x="752" y="441" key="scopes/0.0.1920.1160@0.0.1920.1160" timestamp="1611136062867" />
|
||||
<state x="539" y="204" width="840" height="955" key="search.everywhere.popup" timestamp="1609858975773">
|
||||
<state x="539" y="204" width="840" height="955" key="search.everywhere.popup" timestamp="1611762400755">
|
||||
<screen x="0" y="0" width="1920" height="1160" />
|
||||
</state>
|
||||
<state x="2459" y="204" width="840" height="955" key="search.everywhere.popup/0.0.1536.824/1920.0.1920.1160@1920.0.1920.1160" timestamp="1603984139797" />
|
||||
<state x="539" y="204" width="840" height="955" key="search.everywhere.popup/0.0.1920.1160@0.0.1920.1160" timestamp="1609858975773" />
|
||||
<state x="539" y="204" width="840" height="955" key="search.everywhere.popup/0.0.1920.1160@0.0.1920.1160" timestamp="1611762400755" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/release11/klaus/controller/KlausController.java</url>
|
||||
<line>72</line>
|
||||
<line>100</line>
|
||||
<option name="timeStamp" value="36" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.release11.klaus.controller;
|
||||
|
||||
|
||||
import com.release11.klaus.model.MockedMessageDto;
|
||||
import com.release11.klaus.model.MockedMessageDtoTest;
|
||||
import com.release11.klaus.model.TestModel;
|
||||
import com.release11.klaus.service.KlausService;
|
||||
import com.release11.klaus.utilis.BusinessKey;
|
||||
@@ -15,6 +16,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -29,22 +31,48 @@ import java.util.*;
|
||||
public class KlausController {
|
||||
|
||||
private final KlausService klausService;
|
||||
// MockedMessageDto msg = MockedMessageDto.builder()
|
||||
// .clientUUID(UUID.randomUUID())
|
||||
// .httpStatus(200)
|
||||
// .mediaType("text/xml")
|
||||
// .messageBody("Hello world")
|
||||
// .mockedResponseId(1)
|
||||
// .httpHeaders(new HashMap<>())
|
||||
// .build();
|
||||
MockedMessageDto msg = MockedMessageDto.builder()
|
||||
.clientUUID(UUID.randomUUID())
|
||||
.httpStatus(200)
|
||||
.mediaType("text/xml")
|
||||
.messageBody("Hello world")
|
||||
.mockedResponseId(1)
|
||||
.httpHeaders(new HashMap<>())
|
||||
.build();
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping(value = "klaus/v1/get/test")
|
||||
public TestModel getTestMessage(){
|
||||
@GetMapping(value = "klaus/v1/get/test/test")
|
||||
public TestModel getTestTest(){
|
||||
TestModel testModel = new TestModel();
|
||||
return testModel;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping(value = "klaus/v1/get/test/msgtest")
|
||||
public MockedMessageDtoTest getTestMessageTest(){
|
||||
MockedMessageDtoTest msg = new MockedMessageDtoTest();
|
||||
return msg;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping(value = "klaus/v1/get/test/msg")
|
||||
public MockedMessageDto getTestMessage(){
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("Keep-Alive", "timeout=60");
|
||||
headers.put("Connection", "keep-alive");
|
||||
headers.put("Date", LocalDateTime.now().toString());
|
||||
MockedMessageDto msg = MockedMessageDto.builder()
|
||||
.clientUUID(UUID.randomUUID())
|
||||
.httpStatus(200)
|
||||
.mediaType("text/xml")
|
||||
.messageBody("Hello world")
|
||||
.mockedResponseId(1)
|
||||
.httpHeaders(headers)
|
||||
.build();
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping(value = "klaus/v1/delete/{clientUUID}/{mockedResponseId}")
|
||||
public ResponseEntity<String> deleteMockedResponse(@PathVariable UUID clientUUID,
|
||||
@PathVariable int mockedResponseId){
|
||||
|
||||
@@ -5,6 +5,7 @@ import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Positive;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -18,7 +19,7 @@ import java.util.UUID;
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MockedMessageDto {
|
||||
public class MockedMessageDto implements Serializable {
|
||||
private UUID clientUUID;
|
||||
@NotNull
|
||||
@Positive
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.release11.klaus.model;
|
||||
|
||||
import com.release11.klaus.model.constraints.HttpCode;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Positive;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* it appears that instance of this class contains info about mocked response
|
||||
* To which UUID it is bound, whats its id, the list of headers, type of content and message body,
|
||||
* as well as status it has to return.
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MockedMessageDtoTest implements Serializable {
|
||||
// private UUID clientUUID;
|
||||
@NotNull
|
||||
@Positive
|
||||
private Integer mockedResponseId = 1;
|
||||
private String mediaType = "media";
|
||||
private String messageBody = "clean body";
|
||||
// private Map<String, String> httpHeaders;
|
||||
@HttpCode
|
||||
private Integer httpStatus = 200;
|
||||
|
||||
// public MockedMessageDtoTest(UUID clientUUID) {
|
||||
// this.clientUUID = clientUUID;
|
||||
// }
|
||||
// public MockedMessageDtoTest(UUID clientUUID, Map<String,String> httpHeaders) {
|
||||
// this.clientUUID = clientUUID;
|
||||
// this.httpHeaders = httpHeaders;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -2,10 +2,8 @@ package com.release11.klaus.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@JsonPropertyOrder({ "name", "lastname" })
|
||||
public class TestModel implements Serializable {
|
||||
public class TestModel {
|
||||
private String name = "Jason";
|
||||
private String lastname = "Born";
|
||||
|
||||
|
||||
12
src/main/resources/static/json/mockedmessagedto.json
Normal file
12
src/main/resources/static/json/mockedmessagedto.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"clientUUID": "acc39106-f351-46bb-b81b-31b860af3e56",
|
||||
"mockedResponseId": 1,
|
||||
"mediaType": "text/xml",
|
||||
"messageBody": "Hello world",
|
||||
"httpHeaders": {
|
||||
"Keep-Alive": "timeout=60",
|
||||
"Connection": "keep-alive",
|
||||
"Date": "2021-01-27T15:45:05.892356"
|
||||
},
|
||||
"httpStatus": 200
|
||||
}
|
||||
Reference in New Issue
Block a user