Search in sources :

Example 1 with RunSeparately

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

the class HelloWorldTest method testLoggingFilterTargetClass.

@Test
@RunSeparately
public void testLoggingFilterTargetClass() {
    WebTarget target = target().path(App.ROOT_PATH);
    target.register(CustomLoggingFilter.class).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 2 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 3 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 4 with RunSeparately

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

the class HelloWorldTest method testLoggingFilterTargetClass.

@Test
@RunSeparately
public void testLoggingFilterTargetClass() {
    WebTarget target = target().path(App.ROOT_PATH);
    target.register(CustomLoggingFilter.class).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) Test(org.junit.Test) JerseyTest(org.glassfish.jersey.test.JerseyTest) RunSeparately(org.glassfish.jersey.test.util.runner.RunSeparately)

Example 5 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) 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