Search in sources :

Example 6 with RunSeparately

use of org.glassfish.jersey.test.util.runner.RunSeparately in project jersey by jersey.

the class HelloWorldTest method testLoggingFilterClientInstance.

@Test
@RunSeparately
public void testLoggingFilterClientInstance() {
    Client client = client();
    client.register(new CustomLoggingFilter()).property("foo", "bar");
    CustomLoggingFilter.preFilterCalled = CustomLoggingFilter.postFilterCalled = 0;
    String s = target().path(App.ROOT_PATH).request().get(String.class);
    assertEquals(HelloWorldResource.CLICHED_MESSAGE, s);
    assertEquals(1, CustomLoggingFilter.preFilterCalled);
    assertEquals(1, CustomLoggingFilter.postFilterCalled);
}
Also used : Client(javax.ws.rs.client.Client) JerseyTest(org.glassfish.jersey.test.JerseyTest) Test(org.junit.Test) RunSeparately(org.glassfish.jersey.test.util.runner.RunSeparately)

Example 7 with RunSeparately

use of org.glassfish.jersey.test.util.runner.RunSeparately in project jersey by jersey.

the class HelloWorldTest method testLoggingFilterClientClass.

@Test
@RunSeparately
public void testLoggingFilterClientClass() {
    Client client = client();
    client.register(CustomLoggingFilter.class).property("foo", "bar");
    CustomLoggingFilter.preFilterCalled = CustomLoggingFilter.postFilterCalled = 0;
    String s = target().path(App.ROOT_PATH).request().get(String.class);
    assertEquals(HelloWorldResource.CLICHED_MESSAGE, s);
    assertEquals(1, CustomLoggingFilter.preFilterCalled);
    assertEquals(1, CustomLoggingFilter.postFilterCalled);
}
Also used : Client(javax.ws.rs.client.Client) JerseyTest(org.glassfish.jersey.test.JerseyTest) Test(org.junit.Test) RunSeparately(org.glassfish.jersey.test.util.runner.RunSeparately)

Example 8 with RunSeparately

use of org.glassfish.jersey.test.util.runner.RunSeparately in project jersey by jersey.

the class HelloWorldTest method testConfigurationUpdate.

@Test
@RunSeparately
public void testConfigurationUpdate() {
    Client client1 = client();
    client1.register(CustomLoggingFilter.class).property("foo", "bar");
    Client client = ClientBuilder.newClient(client1.getConfiguration());
    CustomLoggingFilter.preFilterCalled = CustomLoggingFilter.postFilterCalled = 0;
    String s = target().path(App.ROOT_PATH).request().get(String.class);
    assertEquals(HelloWorldResource.CLICHED_MESSAGE, s);
    assertEquals(1, CustomLoggingFilter.preFilterCalled);
    assertEquals(1, CustomLoggingFilter.postFilterCalled);
}
Also used : Client(javax.ws.rs.client.Client) JerseyTest(org.glassfish.jersey.test.JerseyTest) Test(org.junit.Test) RunSeparately(org.glassfish.jersey.test.util.runner.RunSeparately)

Example 9 with RunSeparately

use of org.glassfish.jersey.test.util.runner.RunSeparately in project jersey by jersey.

the class HelloWorldTest method testLoggingFilterTargetInstance.

@Test
@RunSeparately
public void testLoggingFilterTargetInstance() {
    WebTarget target = target().path(App.ROOT_PATH);
    target.register(new CustomLoggingFilter()).property("foo", "bar");
    CustomLoggingFilter.preFilterCalled = CustomLoggingFilter.postFilterCalled = 0;
    String s = target.request().get(String.class);
    assertEquals(HelloWorldResource.CLICHED_MESSAGE, s);
    assertEquals(1, CustomLoggingFilter.preFilterCalled);
    assertEquals(1, CustomLoggingFilter.postFilterCalled);
}
Also used : WebTarget(javax.ws.rs.client.WebTarget) JerseyTest(org.glassfish.jersey.test.JerseyTest) Test(org.junit.Test) RunSeparately(org.glassfish.jersey.test.util.runner.RunSeparately)

Example 10 with RunSeparately

use of org.glassfish.jersey.test.util.runner.RunSeparately in project jersey by jersey.

the class HelloWorldTest method testLoggingFilterClientClass.

@Test
@RunSeparately
public void testLoggingFilterClientClass() {
    Client client = client();
    client.register(CustomLoggingFilter.class).property("foo", "bar");
    CustomLoggingFilter.preFilterCalled = CustomLoggingFilter.postFilterCalled = 0;
    String s = target().path(App.ROOT_PATH).request().get(String.class);
    assertEquals(HelloWorldResource.CLICHED_MESSAGE, s);
    assertEquals(1, CustomLoggingFilter.preFilterCalled);
    assertEquals(1, CustomLoggingFilter.postFilterCalled);
}
Also used : Client(javax.ws.rs.client.Client) Test(org.junit.Test) JerseyTest(org.glassfish.jersey.test.JerseyTest) RunSeparately(org.glassfish.jersey.test.util.runner.RunSeparately)

Aggregations

JerseyTest (org.glassfish.jersey.test.JerseyTest)10 RunSeparately (org.glassfish.jersey.test.util.runner.RunSeparately)10 Test (org.junit.Test)10 Client (javax.ws.rs.client.Client)6 WebTarget (javax.ws.rs.client.WebTarget)4