-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1026e87
commit 8097866
Showing
6 changed files
with
131 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/com/myeg/springBootDemo/controller/Employee.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.myeg.springBootDemo.controller; | ||
|
||
public class Employee { | ||
|
||
private String id; | ||
private String name; | ||
private String age; | ||
|
||
|
||
|
||
public Employee(String id, String name, String age) { | ||
super(); | ||
this.id = id; | ||
this.name = name; | ||
this.age = age; | ||
} | ||
public String getId() { | ||
return id; | ||
} | ||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
public String getName() { | ||
return name; | ||
} | ||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
public String getAge() { | ||
return age; | ||
} | ||
public void setAge(String age) { | ||
this.age = age; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
src/test/java/com/myeg/springBootDemo/SpringBootDemoApplicationTests.java
This file was deleted.
Oops, something went wrong.
63 changes: 63 additions & 0 deletions
63
src/test/java/com/myeg/springBootDemo/SpringRestClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.myeg.springBootDemo; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.springframework.core.ParameterizedTypeReference; | ||
///import org.apache.commons.codec.binary.Base64; | ||
import org.springframework.http.HttpEntity; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.HttpMethod; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
import com.myeg.springBootDemo.controller.StockMasterDto; | ||
|
||
public class SpringRestClient { | ||
|
||
public static final String REST_SERVICE_URI = "http://172.17.100.200:32087/getData"; | ||
|
||
|
||
private static HttpHeaders getHeaders(){ | ||
HttpHeaders headers = new HttpHeaders(); | ||
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); | ||
return headers; | ||
} | ||
|
||
|
||
/* | ||
* Send a GET request to get a specific user. | ||
*/ | ||
private static void getUser(){ | ||
// Assert.notNull(tokenInfo, "Authenticate first please......"); | ||
System.out.println("\nTesting getUser API----------"); | ||
RestTemplate restTemplate = new RestTemplate(); | ||
// HttpEntity<String> request = new HttpEntity<String>(); | ||
HttpEntity<String> request = new HttpEntity<String>(getHeaders()); | ||
// ResponseEntity<List<StockMasterDto>> response = (<List<StockMasterDto>>)restTemplate.exchange(REST_SERVICE_URI, HttpMethod.GET,request,StockMasterDto.class); | ||
ResponseEntity<List<StockMasterDto>> restEntity = restTemplate.exchange( | ||
REST_SERVICE_URI, HttpMethod.GET,request ,new ParameterizedTypeReference<List<StockMasterDto>>() { | ||
}); | ||
List<StockMasterDto> inventoryVarianceBeforeClosing = restEntity.getBody(); | ||
System.out.println(inventoryVarianceBeforeClosing); | ||
} | ||
|
||
/* | ||
* Send a POST request to create a new user. | ||
*/ | ||
|
||
/* | ||
* Send a DELETE request to delete a specific user. | ||
*/ | ||
|
||
|
||
public static void main(String args[]){ | ||
|
||
for (int i=0;i<=10000;i++) | ||
{ | ||
getUser(); | ||
} | ||
|
||
} | ||
} |