Search in sources :

Example 6 with OneFilteringSubEntity

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

the class JsonEntityFilteringOnPropertiesTest method testOneEntityFilteringOnProperties.

@Test
public void testOneEntityFilteringOnProperties() throws Exception {
    final OneFilteringOnPropertiesEntity entity = target("OneFilteringEntity").request().get(OneFilteringOnPropertiesEntity.class);
    // OneFilteringOnPropertiesEntity
    assertThat(entity.field, is(80));
    assertThat(entity.accessorTransient, is("propertyproperty"));
    assertThat(entity.getProperty(), is("property"));
    // FilteredClassEntity
    final FilteredClassEntity filtered = entity.getFiltered();
    assertThat(filtered, notNullValue());
    assertThat(filtered.field, is(0));
    assertThat(filtered.getProperty(), nullValue());
    // DefaultFilteringSubEntity
    assertThat(entity.getDefaultEntities(), notNullValue());
    assertThat(entity.getDefaultEntities().size(), is(1));
    final DefaultFilteringSubEntity defaultFilteringSubEntity = entity.getDefaultEntities().get(0);
    assertThat(defaultFilteringSubEntity.field, is(true));
    assertThat(defaultFilteringSubEntity.getProperty(), is(20L));
    // OneFilteringSubEntity
    assertThat(entity.getSubEntities(), notNullValue());
    assertThat(entity.getSubEntities().size(), is(1));
    final OneFilteringSubEntity oneFilteringSubEntity = entity.getSubEntities().get(0);
    assertThat(oneFilteringSubEntity.field1, is(20));
    assertThat(oneFilteringSubEntity.field2, is(30));
    assertThat(oneFilteringSubEntity.getProperty1(), is("property1"));
    assertThat(oneFilteringSubEntity.getProperty2(), is("property2"));
}
Also used : FilteredClassEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.FilteredClassEntity) DefaultFilteringSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.DefaultFilteringSubEntity) OneFilteringOnPropertiesEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringOnPropertiesEntity) OneFilteringSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringSubEntity) JerseyTest(org.glassfish.jersey.test.JerseyTest) Test(org.junit.Test)

Example 7 with OneFilteringSubEntity

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

the class JsonEntityFilteringOnPropertiesTest method testManyFilteringsEntityPrimaryView.

@Test
public void testManyFilteringsEntityPrimaryView() throws Exception {
    final ManyFilteringsOnPropertiesEntity entity = target("ManyFilteringsEntityPrimaryView").request().get(ManyFilteringsOnPropertiesEntity.class);
    // ManyFilteringsOnPropertiesEntity
    assertThat(entity.field, is(90));
    assertThat(entity.accessorTransient, is("propertyproperty"));
    assertThat(entity.getProperty(), is("property"));
    // FilteredClassEntity
    final FilteredClassEntity filtered = entity.filtered;
    assertThat(filtered, notNullValue());
    assertThat(filtered.field, is(0));
    assertThat(filtered.getProperty(), nullValue());
    // DefaultFilteringSubEntity
    assertThat(entity.defaultEntities, notNullValue());
    assertThat(entity.defaultEntities.size(), is(1));
    final DefaultFilteringSubEntity defaultFilteringSubEntity = entity.defaultEntities.get(0);
    assertThat(defaultFilteringSubEntity.field, is(true));
    assertThat(defaultFilteringSubEntity.getProperty(), is(20L));
    // OneFilteringSubEntity
    assertThat(entity.oneEntities, notNullValue());
    assertThat(entity.oneEntities.size(), is(1));
    final OneFilteringSubEntity oneFilteringSubEntity = entity.oneEntities.get(0);
    assertThat(oneFilteringSubEntity.field1, is(20));
    assertThat(oneFilteringSubEntity.field2, is(30));
    assertThat(oneFilteringSubEntity.getProperty1(), is("property1"));
    assertThat(oneFilteringSubEntity.getProperty2(), is("property2"));
    // ManyFilteringsSubEntity
    assertThat(entity.manyEntities, nullValue());
}
Also used : FilteredClassEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.FilteredClassEntity) DefaultFilteringSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.DefaultFilteringSubEntity) ManyFilteringsOnPropertiesEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsOnPropertiesEntity) OneFilteringSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringSubEntity) JerseyTest(org.glassfish.jersey.test.JerseyTest) Test(org.junit.Test)

Example 8 with OneFilteringSubEntity

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

the class JsonEntityFilteringOnPropertiesTest method testManyFilteringsEntityManyViews.

@Test
public void testManyFilteringsEntityManyViews() throws Exception {
    final ManyFilteringsOnPropertiesEntity entity = target("ManyFilteringsEntityManyViews").request().get(ManyFilteringsOnPropertiesEntity.class);
    // ManyFilteringsOnPropertiesEntity
    assertThat(entity.field, is(90));
    assertThat(entity.accessorTransient, is("propertyproperty"));
    assertThat(entity.getProperty(), is("property"));
    // FilteredClassEntity
    final FilteredClassEntity filtered = entity.filtered;
    assertThat(filtered, notNullValue());
    assertThat(filtered.field, is(0));
    assertThat(filtered.getProperty(), nullValue());
    // DefaultFilteringSubEntity
    assertThat(entity.defaultEntities, notNullValue());
    assertThat(entity.defaultEntities.size(), is(1));
    final DefaultFilteringSubEntity defaultFilteringSubEntity = entity.defaultEntities.get(0);
    assertThat(defaultFilteringSubEntity.field, is(true));
    assertThat(defaultFilteringSubEntity.getProperty(), is(20L));
    // OneFilteringSubEntity
    assertThat(entity.oneEntities, notNullValue());
    assertThat(entity.oneEntities.size(), is(1));
    final OneFilteringSubEntity oneFilteringSubEntity = entity.oneEntities.get(0);
    assertThat(oneFilteringSubEntity.field1, is(20));
    assertThat(oneFilteringSubEntity.field2, is(30));
    assertThat(oneFilteringSubEntity.getProperty1(), is("property1"));
    assertThat(oneFilteringSubEntity.getProperty2(), is("property2"));
    // ManyFilteringsSubEntity
    assertThat(entity.manyEntities, notNullValue());
    assertThat(entity.manyEntities.size(), is(1));
    final ManyFilteringsSubEntity manyFilteringsSubEntity = entity.manyEntities.get(0);
    assertThat(manyFilteringsSubEntity.field1, is(60));
    assertThat(manyFilteringsSubEntity.field2, is(70));
    assertThat(manyFilteringsSubEntity.getProperty1(), is("property1"));
    assertThat(manyFilteringsSubEntity.getProperty2(), is("property2"));
}
Also used : FilteredClassEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.FilteredClassEntity) DefaultFilteringSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.DefaultFilteringSubEntity) ManyFilteringsOnPropertiesEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsOnPropertiesEntity) OneFilteringSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringSubEntity) ManyFilteringsSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsSubEntity) JerseyTest(org.glassfish.jersey.test.JerseyTest) Test(org.junit.Test)

Example 9 with OneFilteringSubEntity

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

the class JsonEntityFilteringServerTest method _testEntity.

private static void _testEntity(final ManyFilteringsOnClassEntity entity) {
    // ManyFilteringsOnClassEntity
    assertThat(entity.field, is(50));
    assertThat(entity.accessorTransient, is("propertyproperty"));
    assertThat(entity.getProperty(), is("property"));
    // FilteredClassEntity
    final FilteredClassEntity filtered = entity.filtered;
    assertThat(filtered, notNullValue());
    assertThat(filtered.field, is(0));
    assertThat(filtered.getProperty(), nullValue());
    // DefaultFilteringSubEntity
    assertThat(entity.defaultEntities, notNullValue());
    assertThat(entity.defaultEntities.size(), is(1));
    final DefaultFilteringSubEntity defaultFilteringSubEntity = entity.defaultEntities.get(0);
    assertThat(defaultFilteringSubEntity.field, is(true));
    assertThat(defaultFilteringSubEntity.getProperty(), is(20L));
    // OneFilteringSubEntity
    assertThat(entity.oneEntities, notNullValue());
    assertThat(entity.oneEntities.size(), is(1));
    final OneFilteringSubEntity oneFilteringSubEntity = entity.oneEntities.get(0);
    assertThat(oneFilteringSubEntity.field1, is(20));
    assertThat(oneFilteringSubEntity.field2, is(30));
    assertThat(oneFilteringSubEntity.getProperty1(), is("property1"));
    assertThat(oneFilteringSubEntity.getProperty2(), is("property2"));
    // ManyFilteringsSubEntity
    assertThat(entity.manyEntities, notNullValue());
    assertThat(entity.manyEntities.size(), is(1));
    final ManyFilteringsSubEntity manyFilteringsSubEntity = entity.manyEntities.get(0);
    assertThat(manyFilteringsSubEntity.field1, is(60));
    assertThat(manyFilteringsSubEntity.field2, is(0));
    assertThat(manyFilteringsSubEntity.getProperty1(), is("property1"));
    assertThat(manyFilteringsSubEntity.getProperty2(), nullValue());
}
Also used : FilteredClassEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.FilteredClassEntity) DefaultFilteringSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.DefaultFilteringSubEntity) OneFilteringSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringSubEntity) ManyFilteringsSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsSubEntity)

Example 10 with OneFilteringSubEntity

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

the class JsonEntityFilteringClientTest method testEntityAnnotationsOverConfiguration.

@Test
public void testEntityAnnotationsOverConfiguration() throws Exception {
    final ClientConfig config = new ClientConfig().property(EntityFilteringFeature.ENTITY_FILTERING_SCOPE, SecondaryDetailedView.Factory.get());
    configureClient(config);
    final ManyFilteringsOnClassEntity entity = ClientBuilder.newClient(config).target(getBaseUri()).request().post(Entity.entity(ManyFilteringsOnClassEntity.INSTANCE, MediaType.APPLICATION_JSON_TYPE, new Annotation[] { PrimaryDetailedView.Factory.get() }), ManyFilteringsOnClassEntity.class);
    // ManyFilteringsOnClassEntity
    assertThat(entity.field, is(50));
    assertThat(entity.accessorTransient, is("propertyproperty"));
    assertThat(entity.getProperty(), is("property"));
    // FilteredClassEntity
    final FilteredClassEntity filtered = entity.filtered;
    assertThat(filtered, notNullValue());
    assertThat(filtered.field, is(0));
    assertThat(filtered.getProperty(), nullValue());
    // DefaultFilteringSubEntity
    assertThat(entity.defaultEntities, notNullValue());
    assertThat(entity.defaultEntities.size(), is(1));
    final DefaultFilteringSubEntity defaultFilteringSubEntity = entity.defaultEntities.get(0);
    assertThat(defaultFilteringSubEntity.field, is(true));
    assertThat(defaultFilteringSubEntity.getProperty(), is(20L));
    // OneFilteringSubEntity
    assertThat(entity.oneEntities, notNullValue());
    assertThat(entity.oneEntities.size(), is(1));
    final OneFilteringSubEntity oneFilteringSubEntity = entity.oneEntities.get(0);
    assertThat(oneFilteringSubEntity.field1, is(20));
    assertThat(oneFilteringSubEntity.field2, is(30));
    assertThat(oneFilteringSubEntity.getProperty1(), is("property1"));
    assertThat(oneFilteringSubEntity.getProperty2(), is("property2"));
    // ManyFilteringsSubEntity
    assertThat(entity.manyEntities, notNullValue());
    assertThat(entity.manyEntities.size(), is(1));
    final ManyFilteringsSubEntity manyFilteringsSubEntity = entity.manyEntities.get(0);
    assertThat(manyFilteringsSubEntity.field1, is(60));
    assertThat(manyFilteringsSubEntity.field2, is(0));
    assertThat(manyFilteringsSubEntity.getProperty1(), is("property1"));
    assertThat(manyFilteringsSubEntity.getProperty2(), nullValue());
}
Also used : FilteredClassEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.FilteredClassEntity) DefaultFilteringSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.DefaultFilteringSubEntity) ManyFilteringsOnClassEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsOnClassEntity) ClientConfig(org.glassfish.jersey.client.ClientConfig) OneFilteringSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringSubEntity) Annotation(java.lang.annotation.Annotation) ManyFilteringsSubEntity(org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsSubEntity) JerseyTest(org.glassfish.jersey.test.JerseyTest) Test(org.junit.Test)

Aggregations

FilteredClassEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.FilteredClassEntity)11 OneFilteringSubEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringSubEntity)11 DefaultFilteringSubEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.DefaultFilteringSubEntity)10 JerseyTest (org.glassfish.jersey.test.JerseyTest)9 Test (org.junit.Test)9 ManyFilteringsSubEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsSubEntity)7 ManyFilteringsOnClassEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsOnClassEntity)4 ManyFilteringsOnPropertiesEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.ManyFilteringsOnPropertiesEntity)3 Annotation (java.lang.annotation.Annotation)1 ClientConfig (org.glassfish.jersey.client.ClientConfig)1 OneFilteringOnClassEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringOnClassEntity)1 OneFilteringOnPropertiesEntity (org.glassfish.jersey.tests.e2e.entity.filtering.domain.OneFilteringOnPropertiesEntity)1