From 55c5ed4850b054bc0a145e96d0adc69a2a52d5a4 Mon Sep 17 00:00:00 2001 From: pcagbu Date: Sat, 3 Aug 2024 17:05:17 +0000 Subject: [PATCH 1/2] Refactoring out deprecated projection calls --- .../java/datawave/util/flag/IngestConfig.java | 2 + .../query/function/DocumentProjection.java | 22 ---------- .../predicate/EventDataQueryFieldFilter.java | 24 ----------- .../query/predicate/KeyProjection.java | 28 +----------- .../datawave/query/predicate/Projection.java | 40 ----------------- .../function/DocumentProjectionTest.java | 43 ++++++------------- .../query/predicate/KeyProjectionTest.java | 35 +-------------- .../query/predicate/ProjectionTest.java | 41 +++--------------- 8 files changed, 25 insertions(+), 210 deletions(-) diff --git a/warehouse/ingest-core/src/test/java/datawave/util/flag/IngestConfig.java b/warehouse/ingest-core/src/test/java/datawave/util/flag/IngestConfig.java index 930da10884..44661de643 100644 --- a/warehouse/ingest-core/src/test/java/datawave/util/flag/IngestConfig.java +++ b/warehouse/ingest-core/src/test/java/datawave/util/flag/IngestConfig.java @@ -70,8 +70,10 @@ static void create(final String fName) throws IOException { throw new IllegalArgumentException("configuration file does not exist (" + f.getAbsolutePath() + ")"); } + @SuppressWarnings("deprecation") final JsonParser parser = new JsonParser(); try (final Reader rdr = new FileReader(fName)) { + @SuppressWarnings("deprecation") final JsonElement json = parser.parse(rdr); final IngestConfig val = gson.fromJson(json.toString(), IngestConfig.class); cfg.set(val); diff --git a/warehouse/query-core/src/main/java/datawave/query/function/DocumentProjection.java b/warehouse/query-core/src/main/java/datawave/query/function/DocumentProjection.java index e676eb118b..80c7ac5d90 100644 --- a/warehouse/query-core/src/main/java/datawave/query/function/DocumentProjection.java +++ b/warehouse/query-core/src/main/java/datawave/query/function/DocumentProjection.java @@ -37,18 +37,6 @@ public class DocumentProjection implements DocumentPermutation { */ private boolean trackSizes = true; - @Deprecated - public DocumentProjection() { - this(false, false); - } - - @Deprecated - public DocumentProjection(boolean includeGroupingContext, boolean reducedResponse) { - this.includeGroupingContext = includeGroupingContext; - this.reducedResponse = reducedResponse; - this.projection = new Projection(); - } - public DocumentProjection(boolean includeGroupingContext, boolean reducedResponse, boolean trackSizes, Set projections, Projection.ProjectionType projectionType) { this.includeGroupingContext = includeGroupingContext; @@ -77,16 +65,6 @@ public DocumentProjection(boolean includeGroupingContext, boolean isReducedRespo this.projection = projection; } - @Deprecated - public void setIncludes(Set includes) { - this.projection.setIncludes(includes); - } - - @Deprecated - public void setExcludes(Set excludes) { - this.projection.setExcludes(excludes); - } - public Projection getProjection() { return projection; } diff --git a/warehouse/query-core/src/main/java/datawave/query/predicate/EventDataQueryFieldFilter.java b/warehouse/query-core/src/main/java/datawave/query/predicate/EventDataQueryFieldFilter.java index 29d19c50bc..2de74dbfb1 100644 --- a/warehouse/query-core/src/main/java/datawave/query/predicate/EventDataQueryFieldFilter.java +++ b/warehouse/query-core/src/main/java/datawave/query/predicate/EventDataQueryFieldFilter.java @@ -141,28 +141,4 @@ public EventDataQueryFilter clone() { return new EventDataQueryFieldFilter(this); } - /** - * Configure the delegate {@link Projection} with the fields to exclude - * - * @param excludes - * the set of fields to exclude - * @deprecated This method is deprecated and should no longer be used. - */ - @Deprecated - public void setExcludes(Set excludes) { - this.keyProjection.setExcludes(excludes); - } - - /** - * Set the delegate {@link Projection} with the fields to include - * - * @param includedFields - * the sorted set of fields to include - * @deprecated This method is deprecated and should no longer be used. - */ - @Deprecated - public void setIncludes(Set includedFields) { - this.keyProjection.setIncludes(includedFields); - } - } diff --git a/warehouse/query-core/src/main/java/datawave/query/predicate/KeyProjection.java b/warehouse/query-core/src/main/java/datawave/query/predicate/KeyProjection.java index e1e7ea21a4..dc1611613c 100644 --- a/warehouse/query-core/src/main/java/datawave/query/predicate/KeyProjection.java +++ b/warehouse/query-core/src/main/java/datawave/query/predicate/KeyProjection.java @@ -5,6 +5,8 @@ import org.apache.accumulo.core.data.Key; +import com.google.common.collect.Sets; + import datawave.query.data.parsers.DatawaveKey; import datawave.query.jexl.JexlASTHelper; @@ -25,32 +27,6 @@ public KeyProjection(KeyProjection other) { projection = other.getProjection(); } - @Deprecated - public KeyProjection() { - projection = new Projection(); - } - - /** - * Set the delegate {@link Projection} with the fields to include - * - * @param includes - * a set of fields to retain - */ - @Deprecated - public void setIncludes(Set includes) { - projection.setIncludes(includes); - } - - /** - * Set the delegate {@link Projection} with the fields to exclude - * - * @param excludes - * a set of fields to exclude - */ - public void setExcludes(Set excludes) { - projection.setExcludes(excludes); - } - @Deprecated public Projection getProjection() { return projection; diff --git a/warehouse/query-core/src/main/java/datawave/query/predicate/Projection.java b/warehouse/query-core/src/main/java/datawave/query/predicate/Projection.java index 576dbd8347..ad2717f51a 100644 --- a/warehouse/query-core/src/main/java/datawave/query/predicate/Projection.java +++ b/warehouse/query-core/src/main/java/datawave/query/predicate/Projection.java @@ -20,46 +20,6 @@ public final class Projection implements Predicate { private boolean initialized; - - @Deprecated - public void setIncludes(Set includes) { - if (this.initialized) { - throw new RuntimeException("This Projection instance was already initialized"); - } - - // do not make a copy of the incoming include fields. It could be a UniversalSet - this.projections = includes; - this.initialized = true; - type = ProjectionType.INCLUDES; - } - - @Deprecated - public void setExcludes(Set excludes) { - if (this.initialized) { - throw new RuntimeException("This Projection instance was already initialized"); - } - - this.projections = Sets.newHashSet(excludes); - this.initialized = true; - type = ProjectionType.EXCLUDES; - } - - @Deprecated - public Set getIncludes() { - return Collections.unmodifiableSet(this.projections); - } - - @Deprecated - public Set getExcludes() { - return Collections.unmodifiableSet(this.projections); - } - - /* Explicit constructor needed now that the new constructor was added */ - @Deprecated - public Projection() { - this.initialized = false; - } - private Set projections; private ProjectionType type; diff --git a/warehouse/query-core/src/test/java/datawave/query/function/DocumentProjectionTest.java b/warehouse/query-core/src/test/java/datawave/query/function/DocumentProjectionTest.java index b95188f640..d5c8b5afbc 100644 --- a/warehouse/query-core/src/test/java/datawave/query/function/DocumentProjectionTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/function/DocumentProjectionTest.java @@ -20,6 +20,7 @@ import datawave.query.attributes.Content; import datawave.query.attributes.Document; import datawave.query.attributes.Numeric; +import datawave.query.predicate.KeyProjection; import datawave.query.predicate.Projection; public class DocumentProjectionTest { @@ -60,8 +61,7 @@ public void setup() { @Test public void testIncludesSingleFieldDeprecated() { Set includes = Sets.newHashSet("OTHERS"); - DocumentProjection projection = new DocumentProjection(); - projection.setIncludes(includes); + DocumentProjection projection = new DocumentProjection(includes, Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -82,8 +82,7 @@ public void testIncludesSingleField() { @Test public void testIncludesTwoFieldsDeprecated() { Set includes = Sets.newHashSet("FOO", "ID"); - DocumentProjection projection = new DocumentProjection(); - projection.setIncludes(includes); + DocumentProjection projection = new DocumentProjection(includes, Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -103,9 +102,7 @@ public void testIncludesTwoFields() { @Deprecated @Test public void testIncludesNoFieldsSpecifiedDeprecated() { - DocumentProjection projection = new DocumentProjection(); - projection.setIncludes(Collections.emptySet()); - + DocumentProjection projection = new DocumentProjection(Collections.emptySet(), Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); assertEquals(0, result.getValue().size()); @@ -124,8 +121,7 @@ public void testIncludesNoFieldsSpecified() { @Test public void testIncludesAllFieldsDeprecated() { Set includes = Sets.newHashSet("FOO", "ID", "PRIMES", "PRIME", "CHILDREN"); - DocumentProjection projection = new DocumentProjection(); - projection.setIncludes(includes); + DocumentProjection projection = new DocumentProjection(includes, Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -146,8 +142,7 @@ public void testIncludesAllFields() { @Test public void testIncludesAllFieldsExceptNestedDocumentFieldsDeprecated() { Set includes = Sets.newHashSet("FOO", "ID", "PRIME"); - DocumentProjection projection = new DocumentProjection(); - projection.setIncludes(includes); + DocumentProjection projection = new DocumentProjection(includes, Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -170,8 +165,7 @@ public void testIncludesAllFieldsExceptNestedDocumentFields() { @Test public void testExcludeSingleFieldDeprecated() { Set excludes = Sets.newHashSet("ID"); - DocumentProjection projection = new DocumentProjection(); - projection.setExcludes(excludes); + DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -192,8 +186,7 @@ public void testExcludeSingleField() { @Test public void testExcludeChildDocumentFieldDeprecated() { Set excludes = Sets.newHashSet("CHILDREN"); - DocumentProjection projection = new DocumentProjection(); - projection.setExcludes(excludes); + DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -214,8 +207,7 @@ public void testExcludeChildDocumentField() { @Test public void testExcludeAllFieldsDeprecated() { Set excludes = Sets.newHashSet("FOO", "ID", "PRIMES", "PRIME", "CHILDREN"); - DocumentProjection projection = new DocumentProjection(); - projection.setExcludes(excludes); + DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -236,8 +228,7 @@ public void testExcludeAllFields() { @Test public void testExcludeNestedFieldDeprecated() { Set excludes = Sets.newHashSet("PRIME"); - DocumentProjection projection = new DocumentProjection(); - projection.setExcludes(excludes); + DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -258,8 +249,7 @@ public void testExcludeNestedField() { @Test public void testConfirmFieldExcludedDeprecated() { Set excludes = Sets.newHashSet("PRIMES"); - DocumentProjection projection = new DocumentProjection(); - projection.setExcludes(excludes); + DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -282,8 +272,7 @@ public void testConfirmFieldExcluded() { @Test public void testConfirmGroupingContextDeprecated() { Set excludes = Sets.newHashSet("FOO"); - DocumentProjection projection = new DocumentProjection(); - projection.setExcludes(excludes); + DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -306,9 +295,7 @@ public void testConfirmGroupingContext() { @Test public void testIncludesExampleCaseDepricated() { Document d = buildExampleDocument(); - - DocumentProjection projection = new DocumentProjection(); - projection.setIncludes(Collections.singleton("NAME")); + DocumentProjection projection = new DocumentProjection(Sets.newHashSet("NAME"), Projection.ProjectionType.INCLUDES); assertEquals(6, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -332,9 +319,7 @@ public void testIncludesExampleCase() { @Test public void testExcludesExampleCaseDeprecated() { Document d = buildExampleDocument(); - - DocumentProjection projection = new DocumentProjection(); - projection.setExcludes(Collections.singleton("NAME")); + DocumentProjection projection = new DocumentProjection(Collections.singleton("NAME"), Projection.ProjectionType.EXCLUDES); assertEquals(6, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); diff --git a/warehouse/query-core/src/test/java/datawave/query/predicate/KeyProjectionTest.java b/warehouse/query-core/src/test/java/datawave/query/predicate/KeyProjectionTest.java index 8750f69c56..405d80d919 100644 --- a/warehouse/query-core/src/test/java/datawave/query/predicate/KeyProjectionTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/predicate/KeyProjectionTest.java @@ -39,15 +39,6 @@ public void setup() { eventData.add(Maps.immutableEntry(new Key("20200314_1", "datatype\0uid", "FIELD_Z\0value_z"), "data")); } - @Deprecated - @Test(expected = RuntimeException.class) - public void testNoConfigurationDeprecated() { - KeyProjection projection = new KeyProjection(); - - Iterator> iter = fiData.iterator(); - assertTrue(projection.apply(iter.next())); - } - @Test(expected = RuntimeException.class) public void testNoConfiguration() { KeyProjection projection = new KeyProjection(null); @@ -56,26 +47,6 @@ public void testNoConfiguration() { assertTrue(projection.apply(iter.next())); } - @Test(expected = RuntimeException.class) - public void testTooMuchConfiguration() { - KeyProjection projection = new KeyProjection(); - projection.setIncludes(Sets.newHashSet("FIELD_A", "FIELD_B")); - projection.setExcludes(Sets.newHashSet("FIELD_X", "FIELD_Y")); - - Iterator> iter = fiData.iterator(); - assertTrue(projection.apply(iter.next())); - } - - @Test(expected = RuntimeException.class) - public void testTooMuchOfTheSameConfiguration() { - KeyProjection projection = new KeyProjection(); - projection.setExcludes(Sets.newHashSet("FIELD_X", "FIELD_Y")); - projection.setExcludes(Sets.newHashSet("FIELD_X", "FIELD_Y")); - - Iterator> iter = fiData.iterator(); - assertTrue(projection.apply(iter.next())); - } - @Test public void testIncludes() { KeyProjection projection = new KeyProjection(Sets.newHashSet("FIELD_A", "FIELD_B"), Projection.ProjectionType.INCLUDES); @@ -134,8 +105,7 @@ public void testExcludes() { @Deprecated @Test public void testIncludesDeprecated() { - KeyProjection projection = new KeyProjection(); - projection.setIncludes(Sets.newHashSet("FIELD_A", "FIELD_B")); + KeyProjection projection = new KeyProjection(Sets.newHashSet("FIELD_A", "FIELD_B"), Projection.ProjectionType.INCLUDES); assertTrue(projection.getProjection().isUseIncludes()); assertFalse(projection.getProjection().isUseExcludes()); @@ -164,8 +134,7 @@ public void testIncludesDeprecated() { @Deprecated @Test public void testExcludesDepricated() { - KeyProjection projection = new KeyProjection(); - projection.setExcludes(Sets.newHashSet("FIELD_X", "FIELD_Y")); + KeyProjection projection = new KeyProjection(Sets.newHashSet("FIELD_X", "FIELD_Y"), Projection.ProjectionType.EXCLUDES); assertFalse(projection.getProjection().isUseIncludes()); assertTrue(projection.getProjection().isUseExcludes()); diff --git a/warehouse/query-core/src/test/java/datawave/query/predicate/ProjectionTest.java b/warehouse/query-core/src/test/java/datawave/query/predicate/ProjectionTest.java index d67c7ec36d..661a6cec60 100644 --- a/warehouse/query-core/src/test/java/datawave/query/predicate/ProjectionTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/predicate/ProjectionTest.java @@ -9,43 +9,16 @@ public class ProjectionTest { - @Deprecated - @Test(expected = RuntimeException.class) - public void testNoConfigurationDepricated() { - Projection projection = new Projection(); - assertTrue(projection.apply("FIELD_A")); - } - @Test(expected = RuntimeException.class) public void testNoConfiguration() { Projection projection = new Projection(null, Projection.ProjectionType.INCLUDES); assertTrue(projection.apply("FIELD_A")); } - @Deprecated - @Test(expected = RuntimeException.class) - public void testTooMuchConfiguration() { - Projection projection = new Projection(); - projection.setIncludes(Sets.newHashSet("FIELD_A", "FIELD_B")); - projection.setExcludes(Sets.newHashSet("FIELD_X", "FIELD_Y")); - assertTrue(projection.apply("FIELD_A")); - } - - @Deprecated - @Test(expected = RuntimeException.class) - public void testTooMuchOfTheSameConfiguration() { - Projection projection = new Projection(); - projection.setIncludes(Sets.newHashSet("FIELD_A", "FIELD_B")); - projection.setIncludes(Sets.newHashSet("FIELD_A", "FIELD_B")); - assertTrue(projection.apply("FIELD_A")); - } - @Deprecated @Test public void testIncludesDepricated() { - Projection projection = new Projection(); - projection.setIncludes(Sets.newHashSet("FIELD_A", "FIELD_B")); - + Projection projection = new Projection(Sets.newHashSet("FIELD_A", "FIELD_B"), Projection.ProjectionType.INCLUDES); assertTrue(projection.isUseIncludes()); assertFalse(projection.isUseExcludes()); @@ -75,8 +48,7 @@ public void testIncludes() { @Deprecated @Test public void testIncludesWithGroupingContextDeprecated() { - Projection projection = new Projection(); - projection.setIncludes(Sets.newHashSet("FIELD_A", "FIELD_B")); + Projection projection = new Projection(Sets.newHashSet("FIELD_A", "FIELD_B"), Projection.ProjectionType.INCLUDES); assertTrue(projection.isUseIncludes()); assertFalse(projection.isUseExcludes()); @@ -107,8 +79,7 @@ public void testIncludesWithGroupingContext() { @Deprecated @Test public void testExcludesDeprecated() { - Projection projection = new Projection(); - projection.setExcludes(Sets.newHashSet("FIELD_X", "FIELD_Y")); + Projection projection = new Projection(Sets.newHashSet("FIELD_X", "FIELD_Y"), Projection.ProjectionType.EXCLUDES); assertFalse(projection.isUseIncludes()); assertTrue(projection.isUseExcludes()); @@ -139,8 +110,7 @@ public void testExcludes() { @Deprecated @Test public void testExcludesWithGroupingContextDeprecated() { - Projection projection = new Projection(); - projection.setExcludes(Sets.newHashSet("FIELD_X", "FIELD_Y")); + Projection projection = new Projection(Sets.newHashSet("FIELD_X", "FIELD_Y"), Projection.ProjectionType.EXCLUDES); assertFalse(projection.isUseIncludes()); assertTrue(projection.isUseExcludes()); @@ -171,8 +141,7 @@ public void testExcludesWithGroupingContext() { @Deprecated @Test public void testTheAbsurdDeprecated() { - Projection projection = new Projection(); - projection.setIncludes(Sets.newHashSet("PREFIX")); + Projection projection = new Projection(Sets.newHashSet("PREFIX"), Projection.ProjectionType.INCLUDES); assertTrue(projection.apply("$PREFIX.SUFFIX01.SUFFIX.02")); } From 012eeed3676caf2eb951cb721b44b5e2ffebc33b Mon Sep 17 00:00:00 2001 From: pcagbu Date: Sun, 4 Aug 2024 17:50:54 +0000 Subject: [PATCH 2/2] More refactors on unit tests, docprojection --- .../query/predicate/KeyProjection.java | 2 - .../function/DocumentProjectionTest.java | 71 +++++++------------ .../query/predicate/KeyProjectionTest.java | 4 +- .../query/predicate/ProjectionTest.java | 5 -- 4 files changed, 27 insertions(+), 55 deletions(-) diff --git a/warehouse/query-core/src/main/java/datawave/query/predicate/KeyProjection.java b/warehouse/query-core/src/main/java/datawave/query/predicate/KeyProjection.java index dc1611613c..8e8f2e2c38 100644 --- a/warehouse/query-core/src/main/java/datawave/query/predicate/KeyProjection.java +++ b/warehouse/query-core/src/main/java/datawave/query/predicate/KeyProjection.java @@ -5,8 +5,6 @@ import org.apache.accumulo.core.data.Key; -import com.google.common.collect.Sets; - import datawave.query.data.parsers.DatawaveKey; import datawave.query.jexl.JexlASTHelper; diff --git a/warehouse/query-core/src/test/java/datawave/query/function/DocumentProjectionTest.java b/warehouse/query-core/src/test/java/datawave/query/function/DocumentProjectionTest.java index d5c8b5afbc..306dce9221 100644 --- a/warehouse/query-core/src/test/java/datawave/query/function/DocumentProjectionTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/function/DocumentProjectionTest.java @@ -57,11 +57,10 @@ public void setup() { d.put("OTHERS", others); // others' attributes have grouping context } - @Deprecated @Test public void testIncludesSingleFieldDeprecated() { Set includes = Sets.newHashSet("OTHERS"); - DocumentProjection projection = new DocumentProjection(includes, Projection.ProjectionType.INCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, includes, Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -71,18 +70,17 @@ public void testIncludesSingleFieldDeprecated() { @Test public void testIncludesSingleField() { Set includes = Sets.newHashSet("OTHERS"); - DocumentProjection projection = new DocumentProjection(includes, Projection.ProjectionType.INCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, includes, Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); assertEquals(4, result.getValue().size()); } - @Deprecated @Test public void testIncludesTwoFieldsDeprecated() { Set includes = Sets.newHashSet("FOO", "ID"); - DocumentProjection projection = new DocumentProjection(includes, Projection.ProjectionType.INCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, includes, Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -92,17 +90,16 @@ public void testIncludesTwoFieldsDeprecated() { @Test public void testIncludesTwoFields() { Set includes = Sets.newHashSet("FOO", "ID"); - DocumentProjection projection = new DocumentProjection(includes, Projection.ProjectionType.INCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, includes, Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); assertEquals(6, result.getValue().size()); } - @Deprecated @Test public void testIncludesNoFieldsSpecifiedDeprecated() { - DocumentProjection projection = new DocumentProjection(Collections.emptySet(), Projection.ProjectionType.INCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, Collections.emptySet(), Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); assertEquals(0, result.getValue().size()); @@ -110,18 +107,16 @@ public void testIncludesNoFieldsSpecifiedDeprecated() { @Test public void testIncludesNoFieldsSpecified() { - DocumentProjection projection = new DocumentProjection(Collections.emptySet(), Projection.ProjectionType.INCLUDES); - + DocumentProjection projection = new DocumentProjection(false, false, true, Collections.emptySet(), Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); assertEquals(0, result.getValue().size()); } - @Deprecated @Test public void testIncludesAllFieldsDeprecated() { Set includes = Sets.newHashSet("FOO", "ID", "PRIMES", "PRIME", "CHILDREN"); - DocumentProjection projection = new DocumentProjection(includes, Projection.ProjectionType.INCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, includes, Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -131,19 +126,17 @@ public void testIncludesAllFieldsDeprecated() { @Test public void testIncludesAllFields() { Set includes = Sets.newHashSet("FOO", "ID", "PRIMES", "PRIME", "CHILDREN"); - DocumentProjection projection = new DocumentProjection(includes, Projection.ProjectionType.INCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, includes, Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); assertEquals(11, result.getValue().size()); } - @Deprecated @Test public void testIncludesAllFieldsExceptNestedDocumentFieldsDeprecated() { Set includes = Sets.newHashSet("FOO", "ID", "PRIME"); - DocumentProjection projection = new DocumentProjection(includes, Projection.ProjectionType.INCLUDES); - + DocumentProjection projection = new DocumentProjection(false, false, true, includes, Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); assertEquals(11, result.getValue().size()); @@ -154,18 +147,16 @@ public void testIncludesAllFieldsExceptNestedDocumentFieldsDeprecated() { @Test public void testIncludesAllFieldsExceptNestedDocumentFields() { Set includes = Sets.newHashSet("FOO", "ID", "PRIME"); - DocumentProjection projection = new DocumentProjection(includes, Projection.ProjectionType.INCLUDES); - + DocumentProjection projection = new DocumentProjection(false, false, true, includes, Projection.ProjectionType.INCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); assertEquals(11, result.getValue().size()); } - @Deprecated @Test public void testExcludeSingleFieldDeprecated() { Set excludes = Sets.newHashSet("ID"); - DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -175,18 +166,16 @@ public void testExcludeSingleFieldDeprecated() { @Test public void testExcludeSingleField() { Set excludes = Sets.newHashSet("ID"); - DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); - + DocumentProjection projection = new DocumentProjection(false, false, true, excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); assertEquals(8, result.getValue().size()); } - @Deprecated @Test public void testExcludeChildDocumentFieldDeprecated() { Set excludes = Sets.newHashSet("CHILDREN"); - DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -196,18 +185,17 @@ public void testExcludeChildDocumentFieldDeprecated() { @Test public void testExcludeChildDocumentField() { Set excludes = Sets.newHashSet("CHILDREN"); - DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); assertEquals(11, result.getValue().size()); } - @Deprecated @Test public void testExcludeAllFieldsDeprecated() { Set excludes = Sets.newHashSet("FOO", "ID", "PRIMES", "PRIME", "CHILDREN"); - DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -217,18 +205,17 @@ public void testExcludeAllFieldsDeprecated() { @Test public void testExcludeAllFields() { Set excludes = Sets.newHashSet("FOO", "ID", "PRIMES", "PRIME", "CHILDREN"); - DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); assertEquals(0, result.getValue().size()); } - @Deprecated @Test public void testExcludeNestedFieldDeprecated() { Set excludes = Sets.newHashSet("PRIME"); - DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -238,18 +225,17 @@ public void testExcludeNestedFieldDeprecated() { @Test public void testExcludeNestedField() { Set excludes = Sets.newHashSet("PRIME"); - DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); assertEquals(6, result.getValue().size()); } - @Deprecated @Test public void testConfirmFieldExcludedDeprecated() { Set excludes = Sets.newHashSet("PRIMES"); - DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -260,7 +246,7 @@ public void testConfirmFieldExcludedDeprecated() { @Test public void testConfirmFieldExcluded() { Set excludes = Sets.newHashSet("PRIMES"); - DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -268,11 +254,10 @@ public void testConfirmFieldExcluded() { assertFalse(result.getValue().containsKey("PRIMES")); // key no longer exists } - @Deprecated @Test public void testConfirmGroupingContextDeprecated() { Set excludes = Sets.newHashSet("FOO"); - DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -283,7 +268,7 @@ public void testConfirmGroupingContextDeprecated() { @Test public void testConfirmGroupingContext() { Set excludes = Sets.newHashSet("FOO"); - DocumentProjection projection = new DocumentProjection(excludes, Projection.ProjectionType.EXCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, excludes, Projection.ProjectionType.EXCLUDES); assertEquals(11, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -291,11 +276,10 @@ public void testConfirmGroupingContext() { assertFalse(result.getValue().containsKey("FOO")); // key no longer exists } - @Deprecated @Test public void testIncludesExampleCaseDepricated() { Document d = buildExampleDocument(); - DocumentProjection projection = new DocumentProjection(Sets.newHashSet("NAME"), Projection.ProjectionType.INCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, Sets.newHashSet("NAME"), Projection.ProjectionType.INCLUDES); assertEquals(6, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -306,8 +290,7 @@ public void testIncludesExampleCaseDepricated() { @Test public void testIncludesExampleCase() { Document d = buildExampleDocument(); - - DocumentProjection projection = new DocumentProjection(Collections.singleton("NAME"), Projection.ProjectionType.INCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, Sets.newHashSet("NAME"), Projection.ProjectionType.INCLUDES); assertEquals(6, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -315,11 +298,10 @@ public void testIncludesExampleCase() { assertTrue(result.getValue().containsKey("NAME")); } - @Deprecated @Test public void testExcludesExampleCaseDeprecated() { Document d = buildExampleDocument(); - DocumentProjection projection = new DocumentProjection(Collections.singleton("NAME"), Projection.ProjectionType.EXCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, Sets.newHashSet("NAME"), Projection.ProjectionType.EXCLUDES); assertEquals(6, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); @@ -330,8 +312,7 @@ public void testExcludesExampleCaseDeprecated() { @Test public void testExcludesExampleCase() { Document d = buildExampleDocument(); - - DocumentProjection projection = new DocumentProjection(Collections.singleton("NAME"), Projection.ProjectionType.EXCLUDES); + DocumentProjection projection = new DocumentProjection(false, false, true, Sets.newHashSet("NAME"), Projection.ProjectionType.EXCLUDES); assertEquals(6, d.size()); Map.Entry result = projection.apply(Maps.immutableEntry(new Key(), d)); diff --git a/warehouse/query-core/src/test/java/datawave/query/predicate/KeyProjectionTest.java b/warehouse/query-core/src/test/java/datawave/query/predicate/KeyProjectionTest.java index 405d80d919..8976e53911 100644 --- a/warehouse/query-core/src/test/java/datawave/query/predicate/KeyProjectionTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/predicate/KeyProjectionTest.java @@ -102,7 +102,6 @@ public void testExcludes() { assertTrue(projection.apply(iter.next())); // FIELD_Z } - @Deprecated @Test public void testIncludesDeprecated() { KeyProjection projection = new KeyProjection(Sets.newHashSet("FIELD_A", "FIELD_B"), Projection.ProjectionType.INCLUDES); @@ -131,9 +130,8 @@ public void testIncludesDeprecated() { assertFalse(projection.apply(iter.next())); // FIELD_Z } - @Deprecated @Test - public void testExcludesDepricated() { + public void testExcludesDeprecated() { KeyProjection projection = new KeyProjection(Sets.newHashSet("FIELD_X", "FIELD_Y"), Projection.ProjectionType.EXCLUDES); assertFalse(projection.getProjection().isUseIncludes()); diff --git a/warehouse/query-core/src/test/java/datawave/query/predicate/ProjectionTest.java b/warehouse/query-core/src/test/java/datawave/query/predicate/ProjectionTest.java index 661a6cec60..201e64e149 100644 --- a/warehouse/query-core/src/test/java/datawave/query/predicate/ProjectionTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/predicate/ProjectionTest.java @@ -15,7 +15,6 @@ public void testNoConfiguration() { assertTrue(projection.apply("FIELD_A")); } - @Deprecated @Test public void testIncludesDepricated() { Projection projection = new Projection(Sets.newHashSet("FIELD_A", "FIELD_B"), Projection.ProjectionType.INCLUDES); @@ -45,7 +44,6 @@ public void testIncludes() { assertFalse(projection.apply("FIELD_Z")); } - @Deprecated @Test public void testIncludesWithGroupingContextDeprecated() { Projection projection = new Projection(Sets.newHashSet("FIELD_A", "FIELD_B"), Projection.ProjectionType.INCLUDES); @@ -76,7 +74,6 @@ public void testIncludesWithGroupingContext() { assertFalse(projection.apply("FIELD_Z")); } - @Deprecated @Test public void testExcludesDeprecated() { Projection projection = new Projection(Sets.newHashSet("FIELD_X", "FIELD_Y"), Projection.ProjectionType.EXCLUDES); @@ -107,7 +104,6 @@ public void testExcludes() { assertTrue(projection.apply("FIELD_Z")); } - @Deprecated @Test public void testExcludesWithGroupingContextDeprecated() { Projection projection = new Projection(Sets.newHashSet("FIELD_X", "FIELD_Y"), Projection.ProjectionType.EXCLUDES); @@ -138,7 +134,6 @@ public void testExcludesWithGroupingContext() { assertTrue(projection.apply("FIELD_Z")); } - @Deprecated @Test public void testTheAbsurdDeprecated() { Projection projection = new Projection(Sets.newHashSet("PREFIX"), Projection.ProjectionType.INCLUDES);