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
package io.lenar.examples.spring.start; | |
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; | |
import org.springframework.boot.test.context.SpringBootTest; | |
@SpringBootTest(classes = TestNGWithSpringApplication.class) | |
public class BaseIT extends AbstractTestNGSpringContextTests { | |
// Common methods, variables and constants | |
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
sudo mount -t vboxsf hostfolder guestFolder |
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
import java.util.Date; | |
import java.util.HashMap; | |
import java.util.Map; | |
import org.aspectj.lang.ProceedingJoinPoint; | |
import org.aspectj.lang.annotation.Around; | |
import org.aspectj.lang.annotation.Aspect; | |
import org.aspectj.lang.reflect.MethodSignature; | |
import org.springframework.stereotype.Component; | |
import org.testng.Reporter; |
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
@SpringBootTest(classes = TestNGWithSpringApplication.class) | |
public class BookServiceClientExampleIT extends AbstractTestNGSpringContextTests { | |
@Autowired | |
BookServiceClient client; | |
@Test | |
public void createUpdateDeleteScenarioTest() throws IOException { | |
Book createdBook = client.createBook(new Book("Title", "Author")).dto(); | |
String id = createdBook.getId(); |
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
public class Response { | |
private ResponseStatus status; | |
public Response(HttpResponse httpResponse) { | |
this.status = new ResponseStatus(httpResponse); | |
} | |
public ResponseStatus getStatus() { | |
return status; | |
} |
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
import java.io.IOException; | |
import io.lenar.examples.spring.clients.response.BookResponse; | |
import io.lenar.examples.spring.clients.response.BooksResponse; | |
import io.lenar.examples.spring.clients.response.Response; | |
import io.lenar.examples.spring.http.HttpClient; | |
import io.lenar.examples.spring.model.Book; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.stereotype.Component; |
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
import java.io.IOException; | |
import java.nio.charset.StandardCharsets; | |
import java.util.Arrays; | |
import java.util.List; | |
import io.lenar.examples.spring.TestNGWithSpringApplication; | |
import io.lenar.examples.spring.http.HttpClient; | |
import io.lenar.examples.spring.model.Book; | |
import org.apache.commons.io.IOUtils; |
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
import java.io.IOException; | |
import java.nio.charset.StandardCharsets; | |
import org.apache.http.Header; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.client.methods.HttpDelete; | |
import org.apache.http.client.methods.HttpGet; | |
import org.apache.http.client.methods.HttpPost; | |
import org.apache.http.client.methods.HttpPut; | |
import org.apache.http.entity.StringEntity; |
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
@Listeners(value = ConditionalSkipTestAnalyzer.class) | |
public class ExampleConditionalSkippingTest { | |
@NonProduction | |
@Test | |
public void test1() { } | |
@ProductionOnly | |
@Test | |
public void test2() { } | |
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
String url = "https://www.some-web-service/api/endpoint"; | |
HttpGet get = new HttpGet(url); | |
Header headers[] = { new BasicHeader("Accept", "application/json")}; | |
get.setHeaders(headers); | |
CloseableHttpClient client = HttpClients.custom().build(); | |
HttpResponse response = client.execute(get); |