-
Notifications
You must be signed in to change notification settings - Fork 103
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
448eb2d
commit a1a341b
Showing
18 changed files
with
194 additions
and
64 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
15 changes: 0 additions & 15 deletions
15
src/functional-test/java/io/github/azagniotov/stubby4j/PortTestUtils.java
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
54 changes: 54 additions & 0 deletions
54
src/functional-test/java/io/github/azagniotov/stubby4j/client/StubbyClientYamlessTest.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,54 @@ | ||
package io.github.azagniotov.stubby4j.client; | ||
|
||
import io.github.azagniotov.stubby4j.utils.NetworkPortUtils; | ||
import io.github.azagniotov.stubby4j.utils.StringUtils; | ||
import org.eclipse.jetty.http.HttpStatus; | ||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
import java.io.InputStream; | ||
|
||
import static com.google.common.truth.Truth.assertThat; | ||
|
||
|
||
public class StubbyClientYamlessTest { | ||
|
||
private static final String ADDRESS_TO_BIND = "127.0.0.1"; | ||
private static final int STUBS_PORT = NetworkPortUtils.findAvailableTcpPort(); | ||
private static final int STUBS_TLS_PORT = NetworkPortUtils.findAvailableTcpPort(); | ||
private static final int ADMIN_PORT = NetworkPortUtils.findAvailableTcpPort(); | ||
|
||
private static final StubbyClient STUBBY_CLIENT = new StubbyClient(); | ||
|
||
@BeforeClass | ||
public static void beforeClass() throws Exception { | ||
|
||
// For example, passing additional command line args. But, they are not needed for this specific test | ||
final String[] additionalFlags = new String[]{"--debug"}; | ||
|
||
final InputStream resourceAsStream = StubbyClientYamlessTest.class.getResourceAsStream("/yaml/standalone-stub.yaml"); | ||
final String stubsYamlConfigurationData = StringUtils.inputStreamToString(resourceAsStream); | ||
|
||
STUBBY_CLIENT.startJettyYamless(stubsYamlConfigurationData, | ||
STUBS_PORT, | ||
STUBS_TLS_PORT, | ||
ADMIN_PORT, | ||
ADDRESS_TO_BIND, | ||
additionalFlags); | ||
} | ||
|
||
@AfterClass | ||
public static void afterClass() throws Exception { | ||
STUBBY_CLIENT.stopJetty(); | ||
} | ||
|
||
@Test | ||
public void shouldStartStubby4jUsingStubbyClientByCallingYamlessAPI() throws Exception { | ||
final String uri = "/standalone/stub/uri"; | ||
final StubbyResponse stubbyResponse = STUBBY_CLIENT.doGetOverSsl(ADDRESS_TO_BIND, uri, STUBS_TLS_PORT); | ||
|
||
assertThat(stubbyResponse.body()).isEqualTo("This is working!"); | ||
assertThat(stubbyResponse.statusCode()).isEqualTo(HttpStatus.OK_200); | ||
} | ||
} |
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,9 @@ | ||
- request: | ||
method: GET | ||
url: /standalone/stub/uri | ||
|
||
response: | ||
status: 200 | ||
body: This is working! | ||
headers: | ||
content-type: application/json |
Oops, something went wrong.