io.dropwizard.testing.junit5.DropwizardAppExtension Java Examples
The following examples show how to use
io.dropwizard.testing.junit5.DropwizardAppExtension.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SundialBundleITBase.java From dropwizard-sundial with Apache License 2.0 | 6 votes |
public static int readTimerCount(DropwizardAppExtension<TestConfiguration> app, Client client, String timerName) { Response response = client.target( String.format( "http://localhost:%d/%s/metrics", app.getAdminPort(), app.getEnvironment().getAdminContext().getContextPath() )) .request() .get(); assertThat(response.getStatus()).isEqualTo(200); JsonNode body = response.readEntity(JsonNode.class); if (!body.get("timers").has(timerName)) { return 0; } return body.get("timers").get(timerName).get("count").intValue(); }
Example #2
Source File: SundialBundleITBase.java From dropwizard-sundial with Apache License 2.0 | 5 votes |
public static DropwizardAppExtension<TestConfiguration> buildApp( String configFile, final Before before ) { return new DropwizardAppExtension<TestConfiguration>( new DropwizardTestSupport<TestConfiguration>( TestApp.class, ResourceHelpers.resourceFilePath(configFile) ) { @Override public void before() throws Exception { super.before(); before.before(getEnvironment()); } } ); }
Example #3
Source File: SundialBundleITBase.java From dropwizard-sundial with Apache License 2.0 | 5 votes |
public static void startJob(DropwizardAppExtension<TestConfiguration> app, Client client, String jobName) { Response response = client.target( String.format( "http://localhost:%d/%s/tasks/startjob?JOB_NAME=%s", app.getAdminPort(), app.getEnvironment().getAdminContext().getContextPath(), jobName )) .request() .post(Entity.text("")); assertThat(response.getStatus()).isEqualTo(200); }
Example #4
Source File: SundialBundleITBase.java From dropwizard-sundial with Apache License 2.0 | 5 votes |
public static boolean stopJob(DropwizardAppExtension<TestConfiguration> app, Client client, String jobName) { Response response = client.target( String.format( "http://localhost:%d/%s/tasks/stopjob?JOB_NAME=%s", app.getAdminPort(), app.getEnvironment().getAdminContext().getContextPath(), jobName )) .request() .post(Entity.text("")); return response.getStatus() == 200; }