forked from ctco/cukes
-
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
241b998
commit ec70e05
Showing
6 changed files
with
136 additions
and
43 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
19 changes: 19 additions & 0 deletions
19
cukes-rest-sample/src/main/java/lv/ctco/cukesrest/healthcheck/CustomHeadersResource.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,19 @@ | ||
package lv.ctco.cukesrest.healthcheck; | ||
|
||
import javax.ws.rs.*; | ||
import javax.ws.rs.core.*; | ||
|
||
@Path(CustomHeadersResource.API) | ||
@Consumes(MediaType.APPLICATION_JSON) | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public class CustomHeadersResource { | ||
|
||
protected static final String API = "/customHeaders"; | ||
|
||
@GET | ||
public Response headers() { | ||
return Response.ok() | ||
.header("Custom-Header", "2000000000000") | ||
.build(); | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
cukes-rest/src/main/java/lv/ctco/cukesrest/api/AwaitSteps.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,79 @@ | ||
package lv.ctco.cukesrest.api; | ||
|
||
import com.google.inject.*; | ||
import cucumber.api.java.en.*; | ||
import lv.ctco.cukesrest.internal.*; | ||
import lv.ctco.cukesrest.internal.helpers.*; | ||
|
||
@Singleton | ||
public class AwaitSteps { | ||
|
||
@Inject | ||
RequestSpecificationFacade facade; | ||
|
||
@Given("^should wait at most (\\d+) ([^ ]+) with interval (\\d+) ([^ ]+) until status code (\\d+)$") | ||
public void should_wait_at_most_until_status_code_with_interval | ||
(int atMostTime, String atMostUnit, | ||
int intervalTime, String intervalUnit, | ||
int statusCode) { | ||
facade.shouldWaitWithIntervalUntilStatusCodeReceived( | ||
Time.of(atMostTime, atMostUnit), | ||
Time.of(intervalTime, intervalUnit), | ||
statusCode); | ||
} | ||
|
||
@Given("^should wait at most (\\d+) ([^ ]+) with interval (\\d+) ([^ ]+) until status code (\\d+) or fail with \"([^\"]+)\"$") | ||
public void should_wait_at_most_until_status_code_with_interval_or_fail_with | ||
(int atMostTime, String atMostUnit, | ||
int intervalTime, String intervalUnit, | ||
int statusCode, int failStatusCode) { | ||
facade.shouldWaitWithIntervalUntilStatusCodeReceived( | ||
Time.of(atMostTime, atMostUnit), | ||
Time.of(intervalTime, intervalUnit), | ||
statusCode, failStatusCode); | ||
} | ||
|
||
@Given("^should wait at most (\\d+) ([^ ]+) with interval (\\d+) ([^ ]+) until property \"([^\"]+)\" equal to \"([^\"]+)\"$") | ||
public void should_wait_at_most_until_property_equals_with_interval | ||
(int atMostTime, String atMostUnit, | ||
int intervalTime, String intervalUnit, | ||
String property, String value) { | ||
facade.shouldWaitWithIntervalUntilPropertyEqualToValue( | ||
Time.of(atMostTime, atMostUnit), | ||
Time.of(intervalTime, intervalUnit), | ||
property, value); | ||
} | ||
|
||
@Given("^should wait at most (\\d+) ([^ ]+) with interval (\\d+) ([^ ]+) until property \"([^\"]+)\" equal to \"([^\"]+)\" or fail with \"([^\"]+)\"$") | ||
public void should_wait_at_most_until_property_equals_with_interval_or_fail_with | ||
(int atMostTime, String atMostUnit, | ||
int intervalTime, String intervalUnit, | ||
String property, String value, String failValue) { | ||
facade.shouldWaitWithIntervalUntilPropertyEqualToValue( | ||
Time.of(atMostTime, atMostUnit), | ||
Time.of(intervalTime, intervalUnit), | ||
property, value, failValue); | ||
} | ||
|
||
@Given("^should wait at most (\\d+) ([^ ]+) with interval (\\d+) ([^ ]+) until header \"([^\"]+)\" equal to \"([^\"]+)\"$") | ||
public void should_wait_at_most_until_header_equals_with_interval | ||
(int atMostTime, String atMostUnit, | ||
int intervalTime, String intervalUnit, | ||
String property, String value) { | ||
facade.shouldWaitWithIntervalUntilHeaderEqualToValue( | ||
Time.of(atMostTime, atMostUnit), | ||
Time.of(intervalTime, intervalUnit), | ||
property, value); | ||
} | ||
|
||
@Given("^should wait at most (\\d+) ([^ ]+) with interval (\\d+) ([^ ]+) until header \"([^\"]+)\" equal to \"([^\"]+)\" or fail with \"([^\"]+)\"$") | ||
public void should_wait_at_most_until_header_equals_with_interval_or_fail_with | ||
(int atMostTime, String atMostUnit, | ||
int intervalTime, String intervalUnit, | ||
String property, String value, String failValue) { | ||
facade.shouldWaitWithIntervalUntilHeaderEqualToValue( | ||
Time.of(atMostTime, atMostUnit), | ||
Time.of(intervalTime, intervalUnit), | ||
property, value, failValue); | ||
} | ||
} |
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