Search in sources :

Example 1 with MaskMap

use of com.linkedin.data.schema.MaskMap in project rest.li by linkedin.

the class TestMaskMap method testNestedFields.

@Test
public void testNestedFields() {
    MaskMap mask = RecordTest.createMask().withRecordField(nestedMask -> nestedMask.withLocation().withOptionalLocation());
    MaskTree tree = MaskCreator.createPositiveMask(PathSpecSet.of(RecordTest.fields().recordField().location(), RecordTest.fields().recordField().optionalLocation()));
    Assert.assertEquals(mask.getDataMap(), tree.getDataMap());
}
Also used : MaskTree(com.linkedin.data.transform.filter.request.MaskTree) MaskMap(com.linkedin.data.schema.MaskMap) Test(org.testng.annotations.Test)

Example 2 with MaskMap

use of com.linkedin.data.schema.MaskMap in project rest.li by linkedin.

the class TestMaskMap method testArrayFieldNestedProjectionWithAttributes.

@Test
public void testArrayFieldNestedProjectionWithAttributes() {
    MaskMap mask = ArrayTest.createMask().withRecordArray(arrayMask -> arrayMask.withItems(RecordBar.ProjectionMask::withLocation), 5, 10);
    MaskTree tree = MaskCreator.createPositiveMask(PathSpecSet.of(ArrayTest.fields().recordArray(5, 10), ArrayTest.fields().recordArray().items().location()));
    Assert.assertEquals(mask.getDataMap(), tree.getDataMap());
}
Also used : MaskTree(com.linkedin.data.transform.filter.request.MaskTree) MaskMap(com.linkedin.data.schema.MaskMap) Test(org.testng.annotations.Test)

Example 3 with MaskMap

use of com.linkedin.data.schema.MaskMap in project rest.li by linkedin.

the class TestMaskMap method testPrimitiveFields.

@Test
public void testPrimitiveFields() {
    MaskMap mask = RecordTest.createMask().withBooleanField().withDoubleField().withEnumField().withFloatField();
    MaskTree tree = MaskCreator.createPositiveMask(PathSpecSet.of(RecordTest.fields().booleanField(), RecordTest.fields().doubleField(), RecordTest.fields().enumField(), RecordTest.fields().floatField()));
    Assert.assertEquals(mask.getDataMap(), tree.getDataMap());
}
Also used : MaskTree(com.linkedin.data.transform.filter.request.MaskTree) MaskMap(com.linkedin.data.schema.MaskMap) Test(org.testng.annotations.Test)

Example 4 with MaskMap

use of com.linkedin.data.schema.MaskMap in project rest.li by linkedin.

the class TestMaskMap method testComplexFields.

@Test
public void testComplexFields() {
    MaskMap mask = RecordTest.createMask().withRecordField().withRecordInlineField();
    MaskTree tree = MaskCreator.createPositiveMask(PathSpecSet.of(RecordTest.fields().recordField(), RecordTest.fields().recordInlineField()));
    Assert.assertEquals(mask.getDataMap(), tree.getDataMap());
}
Also used : MaskTree(com.linkedin.data.transform.filter.request.MaskTree) MaskMap(com.linkedin.data.schema.MaskMap) Test(org.testng.annotations.Test)

Example 5 with MaskMap

use of com.linkedin.data.schema.MaskMap in project rest.li by linkedin.

the class TestMaskMap method testArrayFieldRangeAttributes.

@Test
public void testArrayFieldRangeAttributes() {
    MaskMap mask = RecordTest.createMask().withArrayField(10, 15);
    MaskTree tree = MaskCreator.createPositiveMask(PathSpecSet.of(RecordTest.fields().arrayField(10, 15)));
    Assert.assertEquals(mask.getDataMap(), tree.getDataMap());
}
Also used : MaskTree(com.linkedin.data.transform.filter.request.MaskTree) MaskMap(com.linkedin.data.schema.MaskMap) Test(org.testng.annotations.Test)

Aggregations

MaskMap (com.linkedin.data.schema.MaskMap)14 Test (org.testng.annotations.Test)14 MaskTree (com.linkedin.data.transform.filter.request.MaskTree)13 DataMap (com.linkedin.data.DataMap)1 PathSpecSet (com.linkedin.data.schema.PathSpecSet)1 MaskCreator (com.linkedin.data.transform.filter.request.MaskCreator)1 UriBuilder (com.linkedin.jersey.api.uri.UriBuilder)1 WithCustomRecord (com.linkedin.pegasus.generator.test.idl.records.WithCustomRecord)1 CustomRecord (com.linkedin.pegasus.generator.test.pdl.fixtures.CustomRecord)1 HashMap (java.util.HashMap)1 Assert (org.testng.Assert)1