Search in sources :

Example 6 with OneFilteringOnClassEntity

use of org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringOnClassEntity in project jersey by jersey.

the class JsonEntityFilteringOnClassTest method testOneEntityFilteringOnClassDefaultView.

@Test
public void testOneEntityFilteringOnClassDefaultView() throws Exception {
    final OneFilteringOnClassEntity entity = target("OneFilteringEntityDefaultView").request().get(OneFilteringOnClassEntity.class);
    // OneFilteringOnClassEntity
    assertThat(entity.field, is(0));
    assertThat(entity.accessorTransient, nullValue());
    assertThat(entity.getProperty(), nullValue());
    // FilteredClassEntity
    final FilteredClassEntity filtered = entity.getFiltered();
    assertThat(filtered, nullValue());
    // DefaultFilteringSubEntity
    assertThat(entity.getDefaultEntities(), nullValue());
    // OneFilteringSubEntity
    assertThat(entity.getSubEntities(), nullValue());
}
Also used : FilteredClassEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.FilteredClassEntity) OneFilteringOnClassEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringOnClassEntity) JerseyTest(org.glassfish.jersey.test.JerseyTest) Test(org.junit.Test)

Example 7 with OneFilteringOnClassEntity

use of org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringOnClassEntity in project jersey by jersey.

the class JsonEntityFilteringClientTest method testEntityAnnotationsPrimaryView.

@Test
public void testEntityAnnotationsPrimaryView() throws Exception {
    final OneFilteringOnClassEntity entity = target().request().post(Entity.entity(OneFilteringOnClassEntity.INSTANCE, MediaType.APPLICATION_JSON_TYPE, new Annotation[] { PrimaryDetailedView.Factory.get() }), OneFilteringOnClassEntity.class);
    _testPrimaryViewEntity(entity);
}
Also used : Annotation(java.lang.annotation.Annotation) OneFilteringOnClassEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringOnClassEntity) JerseyTest(org.glassfish.jersey.test.JerseyTest) Test(org.junit.Test)

Example 8 with OneFilteringOnClassEntity

use of org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringOnClassEntity in project jersey by jersey.

the class EntityFilteringClientTest method testInvalidConfiguration.

@Test
public void testInvalidConfiguration() throws Exception {
    final ClientConfig config = new ClientConfig().property(EntityFilteringFeature.ENTITY_FILTERING_SCOPE, "invalid_value");
    configureClient(config);
    final String fields = ClientBuilder.newClient(config).target(getBaseUri()).request().post(Entity.entity(new OneFilteringOnClassEntity(), ENTITY_FILTERING), String.class);
    assertThat(fields, equalTo(""));
}
Also used : ClientConfig(org.glassfish.jersey.client.ClientConfig) OneFilteringOnClassEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringOnClassEntity) Test(org.junit.Test)

Example 9 with OneFilteringOnClassEntity

use of org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringOnClassEntity in project jersey by jersey.

the class EntityFilteringClientTest method testConfiguration.

private void testConfiguration(final String expected, final Annotation... annotations) {
    final ClientConfig config = new ClientConfig().property(EntityFilteringFeature.ENTITY_FILTERING_SCOPE, annotations.length == 1 ? annotations[0] : annotations);
    configureClient(config);
    final String fields = ClientBuilder.newClient(config).target(getBaseUri()).request().post(Entity.entity(new OneFilteringOnClassEntity(), ENTITY_FILTERING), String.class);
    assertSameFields(fields, expected);
}
Also used : ClientConfig(org.glassfish.jersey.client.ClientConfig) OneFilteringOnClassEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringOnClassEntity)

Aggregations

OneFilteringOnClassEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringOnClassEntity)9 Test (org.junit.Test)8 JerseyTest (org.glassfish.jersey.test.JerseyTest)7 Annotation (java.lang.annotation.Annotation)3 ClientConfig (org.glassfish.jersey.client.ClientConfig)3 FilteredClassEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.FilteredClassEntity)3 DefaultFilteringScope (org.glassfish.jersey.tests.e2e.entity.filtering.DefaultFilteringScope)1 DefaultFilteringSubEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.DefaultFilteringSubEntity)1 OneFilteringSubEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringSubEntity)1