diff --git a/common-test/pom.xml b/common-test/pom.xml index aed2f02afac..c340d1e48aa 100644 --- a/common-test/pom.xml +++ b/common-test/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-common-test ${project.artifactId} diff --git a/contrib/datawave-quickstart/docker/pom.xml b/contrib/datawave-quickstart/docker/pom.xml index 9f8deb95cae..de19a23c2d4 100644 --- a/contrib/datawave-quickstart/docker/pom.xml +++ b/contrib/datawave-quickstart/docker/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT ../../../pom.xml quickstart diff --git a/core/cached-results/pom.xml b/core/cached-results/pom.xml index 3c5468dc1e0..9c5dbd86f17 100644 --- a/core/cached-results/pom.xml +++ b/core/cached-results/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.core datawave-core-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-core-cached-results ${project.artifactId} diff --git a/core/common-util/pom.xml b/core/common-util/pom.xml index ad48976fdb2..f7ee5e356f3 100644 --- a/core/common-util/pom.xml +++ b/core/common-util/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.core datawave-core-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-core-common-util ${project.artifactId} diff --git a/core/common/pom.xml b/core/common/pom.xml index 1bb92e9882f..77522fd9a10 100644 --- a/core/common/pom.xml +++ b/core/common/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.core datawave-core-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-core-common ${project.artifactId} diff --git a/core/connection-pool/pom.xml b/core/connection-pool/pom.xml index f97d3cfffa6..9c3ed01fa4b 100644 --- a/core/connection-pool/pom.xml +++ b/core/connection-pool/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.core datawave-core-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-core-connection-pool ${project.artifactId} diff --git a/core/map-reduce/pom.xml b/core/map-reduce/pom.xml index 876458d9dcc..35454964475 100644 --- a/core/map-reduce/pom.xml +++ b/core/map-reduce/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.core datawave-core-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-core-map-reduce ${project.artifactId} diff --git a/core/modification/pom.xml b/core/modification/pom.xml index 59065b0ef3e..3f6e8cf6313 100644 --- a/core/modification/pom.xml +++ b/core/modification/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.core datawave-core-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-core-modification ${project.artifactId} diff --git a/core/pom.xml b/core/pom.xml index fdd534eb239..ebb7175043e 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT gov.nsa.datawave.core datawave-core-parent diff --git a/core/query/pom.xml b/core/query/pom.xml index 8de80a3ea7b..a80897693ac 100644 --- a/core/query/pom.xml +++ b/core/query/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.core datawave-core-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-core-query ${project.artifactId} diff --git a/core/query/src/main/java/datawave/core/query/configuration/GenericQueryConfiguration.java b/core/query/src/main/java/datawave/core/query/configuration/GenericQueryConfiguration.java index 9368856f9fb..18945b1f88a 100644 --- a/core/query/src/main/java/datawave/core/query/configuration/GenericQueryConfiguration.java +++ b/core/query/src/main/java/datawave/core/query/configuration/GenericQueryConfiguration.java @@ -123,7 +123,8 @@ public void copyFrom(GenericQueryConfiguration other) { this.setEndDate(other.getEndDate()); this.setMaxWork(other.getMaxWork()); this.setQueries(other.getQueries()); - this.setQueriesIter(other.getQueriesIter()); + // copying the query iterators can cause issues if the query is running. + // this.setQueriesIter(other.getQueriesIter()); this.setQueryString(other.getQueryString()); this.setTableName(other.getTableName()); this.setReduceResults(other.isReduceResults()); diff --git a/core/utils/pom.xml b/core/utils/pom.xml index d76a823f8b1..9cfbcece2c4 100644 --- a/core/utils/pom.xml +++ b/core/utils/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.core datawave-core-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT gov.nsa.datawave.core datawave-utils-parent diff --git a/docs/pom.xml b/docs/pom.xml index d26656e72f9..3bf8e7133e3 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-docs diff --git a/microservices/pom.xml b/microservices/pom.xml index e0c7bc2df7d..396af33b295 100644 --- a/microservices/pom.xml +++ b/microservices/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT gov.nsa.datawave.microservice datawave-microservice-build-parent diff --git a/microservices/services/pom.xml b/microservices/services/pom.xml index ce1d6a23e07..af7613a61dd 100644 --- a/microservices/services/pom.xml +++ b/microservices/services/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.microservice datawave-microservice-build-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-microservice-service-build-parent pom diff --git a/microservices/starters/pom.xml b/microservices/starters/pom.xml index 278e90f72f2..e59a2a4e49f 100644 --- a/microservices/starters/pom.xml +++ b/microservices/starters/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.microservice datawave-microservice-build-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-microservice-starter-build-parent pom diff --git a/pom.xml b/pom.xml index 85a25a86dc3..427a83d14d1 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 gov.nsa.datawave datawave-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT pom DataWave DataWave is a Java-based ingest and query framework that leverages Apache Accumulo to provide fast, secure access to your data. diff --git a/warehouse/accumulo-extensions/pom.xml b/warehouse/accumulo-extensions/pom.xml index 79b9907c579..e1d89cc4670 100644 --- a/warehouse/accumulo-extensions/pom.xml +++ b/warehouse/accumulo-extensions/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-accumulo-extensions ${project.artifactId} diff --git a/warehouse/age-off-utils/pom.xml b/warehouse/age-off-utils/pom.xml index 2cce42bf09e..38a8617dd33 100644 --- a/warehouse/age-off-utils/pom.xml +++ b/warehouse/age-off-utils/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-age-off-utils ${project.artifactId} diff --git a/warehouse/age-off/pom.xml b/warehouse/age-off/pom.xml index 3fa372757c5..64b5d313f9a 100644 --- a/warehouse/age-off/pom.xml +++ b/warehouse/age-off/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-age-off ${project.artifactId} diff --git a/warehouse/assemble/datawave/pom.xml b/warehouse/assemble/datawave/pom.xml index 09513e6be25..960c15ee07e 100644 --- a/warehouse/assemble/datawave/pom.xml +++ b/warehouse/assemble/datawave/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave assemble-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT assemble-datawave jar diff --git a/warehouse/assemble/pom.xml b/warehouse/assemble/pom.xml index 7fbff7856e1..3c8d9a3f099 100644 --- a/warehouse/assemble/pom.xml +++ b/warehouse/assemble/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT assemble-parent pom diff --git a/warehouse/assemble/webservice/pom.xml b/warehouse/assemble/webservice/pom.xml index 5a6454ce49d..968f755c53c 100644 --- a/warehouse/assemble/webservice/pom.xml +++ b/warehouse/assemble/webservice/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave assemble-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT assemble-webservice ${project.artifactId} diff --git a/warehouse/common/pom.xml b/warehouse/common/pom.xml index ac4fcff3d5e..8fe59a7c3cc 100644 --- a/warehouse/common/pom.xml +++ b/warehouse/common/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-common ${project.artifactId} diff --git a/warehouse/core/pom.xml b/warehouse/core/pom.xml index 7a3af33edfe..fabb7a2798b 100644 --- a/warehouse/core/pom.xml +++ b/warehouse/core/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-core jar diff --git a/warehouse/data-dictionary-core/pom.xml b/warehouse/data-dictionary-core/pom.xml index b30568a3704..38e16d610fc 100644 --- a/warehouse/data-dictionary-core/pom.xml +++ b/warehouse/data-dictionary-core/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-data-dictionary-core jar diff --git a/warehouse/edge-dictionary-core/pom.xml b/warehouse/edge-dictionary-core/pom.xml index 240afe88491..407f1e4272f 100644 --- a/warehouse/edge-dictionary-core/pom.xml +++ b/warehouse/edge-dictionary-core/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-edge-dictionary-core jar diff --git a/warehouse/edge-model-configuration-core/pom.xml b/warehouse/edge-model-configuration-core/pom.xml index eec0900bbf6..e86159dba4e 100644 --- a/warehouse/edge-model-configuration-core/pom.xml +++ b/warehouse/edge-model-configuration-core/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-edge-model-configuration-core jar diff --git a/warehouse/index-stats/pom.xml b/warehouse/index-stats/pom.xml index 94530eac1e9..6b6e9a6506a 100644 --- a/warehouse/index-stats/pom.xml +++ b/warehouse/index-stats/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-index-stats jar diff --git a/warehouse/ingest-configuration/pom.xml b/warehouse/ingest-configuration/pom.xml index 30fec3e9b41..e48c5861476 100644 --- a/warehouse/ingest-configuration/pom.xml +++ b/warehouse/ingest-configuration/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ingest-configuration diff --git a/warehouse/ingest-core/pom.xml b/warehouse/ingest-core/pom.xml index d5bdc58af93..90fb606c9be 100644 --- a/warehouse/ingest-core/pom.xml +++ b/warehouse/ingest-core/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ingest-core jar diff --git a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/job/MultiRFileOutputFormatterTest.java b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/job/MultiRFileOutputFormatterTest.java index 09c31d5e690..8c3cb74a65b 100644 --- a/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/job/MultiRFileOutputFormatterTest.java +++ b/warehouse/ingest-core/src/test/java/datawave/ingest/mapreduce/job/MultiRFileOutputFormatterTest.java @@ -32,12 +32,11 @@ import org.apache.hadoop.util.StringUtils; import org.apache.log4j.Level; import org.apache.log4j.Logger; -import org.easymock.EasyMock; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.powermock.api.easymock.PowerMock; +import org.mockito.Mockito; import datawave.ingest.data.config.ingest.AccumuloHelper; import datawave.util.TableName; @@ -75,44 +74,39 @@ protected Configuration createMockConfiguration() { MultiRFileOutputFormatterTest.mockedConfiguration.clear(); - Configuration mocked = PowerMock.createMock(Configuration.class); + Configuration mocked = Mockito.mock(Configuration.class); MultiRFileOutputFormatterTest.logger.info(String.format("createMockConfiguration: %d", mocked.hashCode())); - mocked.set(EasyMock.anyObject(String.class), EasyMock.anyObject(String.class)); - EasyMock.expectLastCall().andAnswer(() -> { + Mockito.doAnswer(invocationOnMock -> { - String key = (String) EasyMock.getCurrentArguments()[0]; - String value = (String) EasyMock.getCurrentArguments()[1]; + String key = (String) invocationOnMock.getArguments()[0]; + String value = (String) invocationOnMock.getArguments()[1]; MultiRFileOutputFormatterTest.mockedConfiguration.put(key, value); return null; - }).anyTimes(); + }).when(mocked).set(Mockito.any(String.class), Mockito.any(String.class)); - mocked.setStrings(EasyMock.anyObject(String.class), EasyMock.anyObject(String.class), EasyMock.anyObject(String.class)); - EasyMock.expectLastCall().andAnswer(() -> { + Mockito.doAnswer(invocationOnMock -> { + if (2 <= invocationOnMock.getArguments().length) { - if (2 <= EasyMock.getCurrentArguments().length) { - - String key = (String) EasyMock.getCurrentArguments()[0]; - String[] values = new String[EasyMock.getCurrentArguments().length - 1]; + String key = (String) invocationOnMock.getArguments()[0]; + String[] values = new String[invocationOnMock.getArguments().length - 1]; for (int index = 1; index <= values.length; index++) { - values[index - 1] = (String) EasyMock.getCurrentArguments()[index]; + values[index - 1] = (String) invocationOnMock.getArguments()[index]; } MultiRFileOutputFormatterTest.mockedConfiguration.put(key, StringUtils.arrayToString(values)); } return null; - }).anyTimes(); - - mocked.get(EasyMock.anyObject(String.class), EasyMock.anyObject(String.class)); - EasyMock.expectLastCall().andAnswer(() -> { + }).when(mocked).setStrings(Mockito.any(String.class), Mockito.any(String.class), Mockito.any(String.class)); - String key = (String) EasyMock.getCurrentArguments()[0]; - String value = (String) EasyMock.getCurrentArguments()[1]; + Mockito.doAnswer(invocationOnMock -> { + String key = (String) invocationOnMock.getArguments()[0]; + String value = (String) invocationOnMock.getArguments()[1]; if (MultiRFileOutputFormatterTest.mockedConfiguration.containsKey(key)) { @@ -120,9 +114,7 @@ protected Configuration createMockConfiguration() { } return value; - }).anyTimes(); - - PowerMock.replay(mocked); + }).when(mocked).get(Mockito.any(String.class), Mockito.any(String.class)); return mocked; } diff --git a/warehouse/ingest-csv/pom.xml b/warehouse/ingest-csv/pom.xml index 33d84206beb..15a79611354 100644 --- a/warehouse/ingest-csv/pom.xml +++ b/warehouse/ingest-csv/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ingest-csv jar diff --git a/warehouse/ingest-json/pom.xml b/warehouse/ingest-json/pom.xml index ea583e9b4b1..7353391f338 100644 --- a/warehouse/ingest-json/pom.xml +++ b/warehouse/ingest-json/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ingest-json jar diff --git a/warehouse/ingest-nyctlc/pom.xml b/warehouse/ingest-nyctlc/pom.xml index b3602a0b715..dd9b9acb171 100644 --- a/warehouse/ingest-nyctlc/pom.xml +++ b/warehouse/ingest-nyctlc/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ingest-nyctlc jar diff --git a/warehouse/ingest-scripts/pom.xml b/warehouse/ingest-scripts/pom.xml index 4d23413cbfe..325bff42ea4 100644 --- a/warehouse/ingest-scripts/pom.xml +++ b/warehouse/ingest-scripts/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ingest-scripts ${project.artifactId} diff --git a/warehouse/ingest-scripts/src/main/resources/bin/ingest/bulk-ingest.sh b/warehouse/ingest-scripts/src/main/resources/bin/ingest/bulk-ingest.sh index fe30703f428..7936e750c9c 100755 --- a/warehouse/ingest-scripts/src/main/resources/bin/ingest/bulk-ingest.sh +++ b/warehouse/ingest-scripts/src/main/resources/bin/ingest/bulk-ingest.sh @@ -72,9 +72,9 @@ export HADOOP_OPTS="-Dfile.encoding=UTF8 -Duser.timezone=GMT $HADOOP_INGEST_OPTS export CHILD_MAP_OPTS="-Xmx${BULK_CHILD_MAP_MAX_MEMORY_MB}m -XX:+UseConcMarkSweepGC -Dfile.encoding=UTF8 -Duser.timezone=GMT -XX:+UseNUMA $CHILD_INGEST_OPTS" export CHILD_REDUCE_OPTS="-Xmx${BULK_CHILD_REDUCE_MAX_MEMORY_MB}m -XX:+UseConcMarkSweepGC -Dfile.encoding=UTF8 -Duser.timezone=GMT -XX:+UseNUMA $CHILD_INGEST_OPTS" -echo $INGEST_HADOOP_HOME/bin/hadoop jar ${DATAWAVE_INGEST_CORE_JAR} datawave.ingest.mapreduce.job.IngestJob -jt $INGEST_JOBTRACKER_NODE $INPUT_FILES ${INGEST_CONFIG[@]} -cacheBaseDir $JOB_CACHE_DIR -cacheJars $LIBJARS -user $USERNAME -pass $PASSWORD -instance $WAREHOUSE_INSTANCE_NAME -zookeepers $WAREHOUSE_ZOOKEEPERS -workDir $WORKDIR -flagFileDir ${FLAG_DIR} -flagFilePattern '.*_(bulk)_.*\.flag' -srcHdfs $INGEST_HDFS_NAME_NODE -destHdfs $WAREHOUSE_HDFS_NAME_NODE -distCpConfDir $WAREHOUSE_HADOOP_CONF -mapred.map.child.java.opts=\"$CHILD_MAP_OPTS\" -mapred.reduce.child.java.opts=\"$CHILD_REDUCE_OPTS\" "${BATCHWRITER_OPTS}" $MAPRED_OPTS $EXTRA_OPTS +echo $INGEST_HADOOP_HOME/bin/hadoop jar ${DATAWAVE_INGEST_CORE_JAR} datawave.ingest.mapreduce.job.IngestJob -jt $INGEST_JOBTRACKER_NODE $INPUT_FILES ${INGEST_CONFIG[@]} -cacheBaseDir $JOB_CACHE_DIR -cacheJars $LIBJARS -user $USERNAME -pass $PASSWORD -instance $WAREHOUSE_INSTANCE_NAME -zookeepers $WAREHOUSE_ZOOKEEPERS -workDir $WORKDIR -flagFileDir ${FLAG_DIR} -flagFilePattern '.*_(bulk)_.*\.flag' -srcHdfs $INGEST_HDFS_NAME_NODE -destHdfs $WAREHOUSE_HDFS_NAME_NODE -distCpConfDir $WAREHOUSE_HADOOP_CONF -mapreduce.map.java.opts=\"$CHILD_MAP_OPTS\" -mapreduce.reduce.java.opts=\"$CHILD_REDUCE_OPTS\" "${BATCHWRITER_OPTS}" $MAPRED_OPTS $EXTRA_OPTS -$INGEST_HADOOP_HOME/bin/hadoop jar ${DATAWAVE_INGEST_CORE_JAR} datawave.ingest.mapreduce.job.IngestJob -jt $INGEST_JOBTRACKER_NODE $INPUT_FILES ${INGEST_CONFIG[@]} -cacheBaseDir $JOB_CACHE_DIR -cacheJars $LIBJARS -user $USERNAME -pass $PASSWORD -instance $WAREHOUSE_INSTANCE_NAME -zookeepers $WAREHOUSE_ZOOKEEPERS -workDir $WORKDIR -flagFileDir ${FLAG_DIR} -flagFilePattern '.*_(bulk)_.*\.flag' -srcHdfs $INGEST_HDFS_NAME_NODE -destHdfs $WAREHOUSE_HDFS_NAME_NODE -distCpConfDir $WAREHOUSE_HADOOP_CONF -mapred.map.child.java.opts="$CHILD_MAP_OPTS" -mapred.reduce.child.java.opts="$CHILD_REDUCE_OPTS" "${BATCHWRITER_OPTS}" $MAPRED_OPTS $EXTRA_OPTS +$INGEST_HADOOP_HOME/bin/hadoop jar ${DATAWAVE_INGEST_CORE_JAR} datawave.ingest.mapreduce.job.IngestJob -jt $INGEST_JOBTRACKER_NODE $INPUT_FILES ${INGEST_CONFIG[@]} -cacheBaseDir $JOB_CACHE_DIR -cacheJars $LIBJARS -user $USERNAME -pass $PASSWORD -instance $WAREHOUSE_INSTANCE_NAME -zookeepers $WAREHOUSE_ZOOKEEPERS -workDir $WORKDIR -flagFileDir ${FLAG_DIR} -flagFilePattern '.*_(bulk)_.*\.flag' -srcHdfs $INGEST_HDFS_NAME_NODE -destHdfs $WAREHOUSE_HDFS_NAME_NODE -distCpConfDir $WAREHOUSE_HADOOP_CONF -mapreduce.map.java.opts="$CHILD_MAP_OPTS" -mapreduce.reduce.java.opts="$CHILD_REDUCE_OPTS" "${BATCHWRITER_OPTS}" $MAPRED_OPTS $EXTRA_OPTS RETURN_CODE=$? diff --git a/warehouse/ingest-scripts/src/main/resources/bin/ingest/live-ingest.sh b/warehouse/ingest-scripts/src/main/resources/bin/ingest/live-ingest.sh index cf7d49007cd..738b4a12ad2 100755 --- a/warehouse/ingest-scripts/src/main/resources/bin/ingest/live-ingest.sh +++ b/warehouse/ingest-scripts/src/main/resources/bin/ingest/live-ingest.sh @@ -71,10 +71,10 @@ export CHILD_MAP_OPTS="-Xmx${LIVE_CHILD_MAP_MAX_MEMORY_MB}m -XX:+UseConcMarkSwee export CHILD_REDUCE_OPTS="-Xmx${LIVE_CHILD_REDUCE_MAX_MEMORY_MB}m -XX:+UseConcMarkSweepGC -Dfile.encoding=UTF8 -Duser.timezone=GMT -XX:+UseNUMA $CHILD_INGEST_OPTS" -echo $INGEST_HADOOP_HOME/bin/hadoop jar ${DATAWAVE_INGEST_CORE_JAR} datawave.ingest.mapreduce.job.IngestJob -jt $INGEST_JOBTRACKER_NODE $INPUT_FILES ${INGEST_CONFIG[@]} -cacheBaseDir $JOB_CACHE_DIR -cacheJars $LIBJARS -user $USERNAME -pass $PASSWORD -instance $WAREHOUSE_INSTANCE_NAME -zookeepers $WAREHOUSE_ZOOKEEPERS -workDir $WORKDIR -flagFileDir ${FLAG_DIR} -flagFilePattern '.*_live_.*\.flag' -mapred.map.child.java.opts=\"$CHILD_MAP_OPTS\" -mapred.reduce.child.java.opts=\"$CHILD_REDUCE_OPTS\" "${BATCHWRITER_OPTS}" $MAPRED_OPTS -outputMutations -mapOnly -srcHdfs $INGEST_HDFS_NAME_NODE -destHdfs $WAREHOUSE_HDFS_NAME_NODE $EXTRA_OPTS +echo $INGEST_HADOOP_HOME/bin/hadoop jar ${DATAWAVE_INGEST_CORE_JAR} datawave.ingest.mapreduce.job.IngestJob -jt $INGEST_JOBTRACKER_NODE $INPUT_FILES ${INGEST_CONFIG[@]} -cacheBaseDir $JOB_CACHE_DIR -cacheJars $LIBJARS -user $USERNAME -pass $PASSWORD -instance $WAREHOUSE_INSTANCE_NAME -zookeepers $WAREHOUSE_ZOOKEEPERS -workDir $WORKDIR -flagFileDir ${FLAG_DIR} -flagFilePattern '.*_live_.*\.flag' -mapreduce.map.java.opts=\"$CHILD_MAP_OPTS\" -mapreduce.reduce.java.opts=\"$CHILD_REDUCE_OPTS\" "${BATCHWRITER_OPTS}" $MAPRED_OPTS -outputMutations -mapOnly -srcHdfs $INGEST_HDFS_NAME_NODE -destHdfs $WAREHOUSE_HDFS_NAME_NODE $EXTRA_OPTS echo "For decreased latency, one can add the -mapOnly flag at the cost of possibly overcounting duplicate records" -$INGEST_HADOOP_HOME/bin/hadoop jar ${DATAWAVE_INGEST_CORE_JAR} datawave.ingest.mapreduce.job.IngestJob -jt $INGEST_JOBTRACKER_NODE $INPUT_FILES ${INGEST_CONFIG[@]} -cacheBaseDir $JOB_CACHE_DIR -cacheJars $LIBJARS -user $USERNAME -pass $PASSWORD -instance $WAREHOUSE_INSTANCE_NAME -zookeepers $WAREHOUSE_ZOOKEEPERS -workDir $WORKDIR -flagFileDir ${FLAG_DIR} -flagFilePattern '.*_live_.*\.flag' -mapred.map.child.java.opts="$CHILD_MAP_OPTS" -mapred.reduce.child.java.opts="$CHILD_REDUCE_OPTS" "${BATCHWRITER_OPTS}" $MAPRED_OPTS -outputMutations -mapOnly -srcHdfs $INGEST_HDFS_NAME_NODE -destHdfs $WAREHOUSE_HDFS_NAME_NODE $EXTRA_OPTS +$INGEST_HADOOP_HOME/bin/hadoop jar ${DATAWAVE_INGEST_CORE_JAR} datawave.ingest.mapreduce.job.IngestJob -jt $INGEST_JOBTRACKER_NODE $INPUT_FILES ${INGEST_CONFIG[@]} -cacheBaseDir $JOB_CACHE_DIR -cacheJars $LIBJARS -user $USERNAME -pass $PASSWORD -instance $WAREHOUSE_INSTANCE_NAME -zookeepers $WAREHOUSE_ZOOKEEPERS -workDir $WORKDIR -flagFileDir ${FLAG_DIR} -flagFilePattern '.*_live_.*\.flag' -mapreduce.map.java.opts="$CHILD_MAP_OPTS" -mapreduce.reduce.java.opts="$CHILD_REDUCE_OPTS" "${BATCHWRITER_OPTS}" $MAPRED_OPTS -outputMutations -mapOnly -srcHdfs $INGEST_HDFS_NAME_NODE -destHdfs $WAREHOUSE_HDFS_NAME_NODE $EXTRA_OPTS RETURN_CODE=$? diff --git a/warehouse/ingest-ssdeep/pom.xml b/warehouse/ingest-ssdeep/pom.xml index 1e686b70e66..6fd679cf767 100644 --- a/warehouse/ingest-ssdeep/pom.xml +++ b/warehouse/ingest-ssdeep/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ingest-ssdeep diff --git a/warehouse/ingest-wikipedia/pom.xml b/warehouse/ingest-wikipedia/pom.xml index cd8cf4d27d9..83d09f468bb 100644 --- a/warehouse/ingest-wikipedia/pom.xml +++ b/warehouse/ingest-wikipedia/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ingest-wikipedia jar diff --git a/warehouse/metrics-core/pom.xml b/warehouse/metrics-core/pom.xml index 5f627c3d433..136f22bbe6e 100644 --- a/warehouse/metrics-core/pom.xml +++ b/warehouse/metrics-core/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-metrics-core jar diff --git a/warehouse/ops-tools/config-compare/pom.xml b/warehouse/ops-tools/config-compare/pom.xml index f9f24ea391c..eefe49bf57d 100644 --- a/warehouse/ops-tools/config-compare/pom.xml +++ b/warehouse/ops-tools/config-compare/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-ops-tools-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ops-tools-config-compare diff --git a/warehouse/ops-tools/index-validation/pom.xml b/warehouse/ops-tools/index-validation/pom.xml index 774bb3efcfc..672d5f542a4 100644 --- a/warehouse/ops-tools/index-validation/pom.xml +++ b/warehouse/ops-tools/index-validation/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-ops-tools-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ops-tools-index-validation jar diff --git a/warehouse/ops-tools/pom.xml b/warehouse/ops-tools/pom.xml index 556bf2a169e..c8e99e19d46 100644 --- a/warehouse/ops-tools/pom.xml +++ b/warehouse/ops-tools/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ops-tools-parent pom diff --git a/warehouse/pom.xml b/warehouse/pom.xml index 24b87cf8de7..b7d8f73fa7d 100644 --- a/warehouse/pom.xml +++ b/warehouse/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-warehouse-parent pom diff --git a/warehouse/query-core/pom.xml b/warehouse/query-core/pom.xml index 8f357492a06..25be249ea0c 100644 --- a/warehouse/query-core/pom.xml +++ b/warehouse/query-core/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-query-core jar diff --git a/warehouse/query-core/src/main/java/datawave/query/QueryParameters.java b/warehouse/query-core/src/main/java/datawave/query/QueryParameters.java index 3add61588f3..c0e6577ca83 100644 --- a/warehouse/query-core/src/main/java/datawave/query/QueryParameters.java +++ b/warehouse/query-core/src/main/java/datawave/query/QueryParameters.java @@ -133,6 +133,11 @@ public class QueryParameters { */ public static final String CONTENT_VIEW_ALL = "content.view.all"; + /** + * Used by the ContentQueryLogic to determine if views should be decoded from base64 + */ + public static final String DECODE_VIEW = "content.view.decode"; + /** * Used to specify the class used to perform visibility interpretations into markings. */ diff --git a/warehouse/query-core/src/main/java/datawave/query/iterator/logic/SummaryCreator.java b/warehouse/query-core/src/main/java/datawave/query/iterator/logic/SummaryCreator.java index 7a7ec00d501..4c802b3b271 100644 --- a/warehouse/query-core/src/main/java/datawave/query/iterator/logic/SummaryCreator.java +++ b/warehouse/query-core/src/main/java/datawave/query/iterator/logic/SummaryCreator.java @@ -56,9 +56,9 @@ private static String getEndingWildcardSummary(String currentViewName, Map summaries = new HashMap<>(); for (Map.Entry entry : foundContent.entrySet()) { // first part is view, second part is if compressed still - String[] s = entry.getKey().split(Constants.COLON); - if (s[0].startsWith(currentViewName)) { - summaries.put(entry.getKey(), getSummaryForView(entry.getValue(), summarySize, Boolean.parseBoolean(s[1]))); + String[] temp = entry.getKey().split(Constants.COLON); + if (temp[0].startsWith(currentViewName)) { + summaries.put(temp[0], getSummaryForView(entry.getValue(), summarySize, Boolean.parseBoolean(temp[1]))); } } if (!summaries.isEmpty()) { @@ -76,9 +76,9 @@ private static String getEndingWildcardSummary(String currentViewName, Map foundContent, int summarySize) { for (Map.Entry entry : foundContent.entrySet()) { // first part is view, second part is if compressed still - String[] s = entry.getKey().split(Constants.COLON); - if (s[0].equals(currentViewName)) { - return currentViewName + ": " + getSummaryForView(entry.getValue(), summarySize, Boolean.parseBoolean(s[1])); + String[] temp = entry.getKey().split(Constants.COLON); + if (temp[0].equals(currentViewName)) { + return currentViewName + ": " + getSummaryForView(entry.getValue(), summarySize, Boolean.parseBoolean(temp[1])); } } return null; diff --git a/warehouse/query-core/src/main/java/datawave/query/tables/ShardQueryLogic.java b/warehouse/query-core/src/main/java/datawave/query/tables/ShardQueryLogic.java index e1bc36b19b3..e5c5548d970 100644 --- a/warehouse/query-core/src/main/java/datawave/query/tables/ShardQueryLogic.java +++ b/warehouse/query-core/src/main/java/datawave/query/tables/ShardQueryLogic.java @@ -1549,11 +1549,11 @@ public void setSummaryOptions(SummaryOptions summaryOptions) { getConfig().setSummaryOptions(summaryOptions); } - public String getSummaryIteratorClassName() { + public String getSummaryIterator() { return getConfig().getSummaryIterator().getName(); } - public void setSummaryIteratorClassName(String iteratorClass) { + public void setSummaryIterator(String iteratorClass) { try { getConfig().setSummaryIterator((Class>) Class.forName(iteratorClass)); } catch (Exception e) { diff --git a/warehouse/query-core/src/main/java/datawave/query/tables/content/ContentQueryLogic.java b/warehouse/query-core/src/main/java/datawave/query/tables/content/ContentQueryLogic.java index daff72b3f18..906406c4db3 100644 --- a/warehouse/query-core/src/main/java/datawave/query/tables/content/ContentQueryLogic.java +++ b/warehouse/query-core/src/main/java/datawave/query/tables/content/ContentQueryLogic.java @@ -63,6 +63,7 @@ public class ContentQueryLogic extends BaseQueryLogic> implemen private int queryThreads = 100; ScannerFactory scannerFactory; String viewName = null; + private boolean decodeView = false; private ContentQueryConfiguration config; @@ -123,6 +124,11 @@ public GenericQueryConfiguration initialize(final AccumuloClient client, final Q end = PARENT_ONLY; } + p = settings.findParameter(QueryParameters.DECODE_VIEW); + if ((null != p) && (null != p.getParameterValue())) { + this.decodeView = Boolean.parseBoolean(p.getParameterValue()); + } + // Configure ranges final Collection ranges = this.createRanges(settings, end); config.setRanges(ranges); @@ -249,7 +255,7 @@ public AccumuloConnectionFactory.Priority getConnectionPriority() { @Override public QueryLogicTransformer getTransformer(Query settings) { - return new ContentQueryTransformer(settings, this.markingFunctions, this.responseObjectFactory); + return new ContentQueryTransformer(settings, this.markingFunctions, this.responseObjectFactory, this.decodeView); } @Override diff --git a/warehouse/query-core/src/main/java/datawave/query/transformer/ContentQueryTransformer.java b/warehouse/query-core/src/main/java/datawave/query/transformer/ContentQueryTransformer.java index 204acf0294d..0295b4edf0f 100644 --- a/warehouse/query-core/src/main/java/datawave/query/transformer/ContentQueryTransformer.java +++ b/warehouse/query-core/src/main/java/datawave/query/transformer/ContentQueryTransformer.java @@ -32,12 +32,18 @@ public class ContentQueryTransformer extends BaseQueryLogicTransformer metadataIdMap; + protected final boolean decodeView; public ContentQueryTransformer(Query query, MarkingFunctions markingFunctions, ResponseObjectFactory responseObjectFactory) { + this(query, markingFunctions, responseObjectFactory, false); + } + + public ContentQueryTransformer(Query query, MarkingFunctions markingFunctions, ResponseObjectFactory responseObjectFactory, boolean decodeView) { super(markingFunctions); this.auths = new Authorizations(query.getQueryAuthorizations().split(",")); this.responseObjectFactory = responseObjectFactory; this.metadataIdMap = extractMetadadaIdMap(query); + this.decodeView = decodeView; } /** @@ -138,7 +144,13 @@ public EventBase transform(Entry entry) { field.setMarkings(ckv.getMarkings()); field.setName(ckv.getViewName()); field.setTimestamp(entry.getKey().getTimestamp()); - field.setValue(ckv.getContents()); + if (this.decodeView) { + // settings a String value causes the value not to be base64 encoded, see TypedValue + field.setValue(new String(ckv.getContents())); + } else { + // settings a byte value causes the value to be base64 encoded, see TypedValue + field.setValue(ckv.getContents()); + } List fields = new ArrayList<>(); fields.add(field); diff --git a/warehouse/query-core/src/test/java/datawave/query/iterator/FieldIndexOnlyQueryCompressedOptionsTest.java b/warehouse/query-core/src/test/java/datawave/query/iterator/FieldIndexOnlyQueryCompressedOptionsTest.java index e80801e4308..ecf26829929 100644 --- a/warehouse/query-core/src/test/java/datawave/query/iterator/FieldIndexOnlyQueryCompressedOptionsTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/iterator/FieldIndexOnlyQueryCompressedOptionsTest.java @@ -8,10 +8,10 @@ import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Range; -import org.easymock.EasyMock; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.mockito.Mockito; public class FieldIndexOnlyQueryCompressedOptionsTest { @@ -51,7 +51,7 @@ public void setup() { key2 = new Key("key_2"); testRange = new Range(key1, key2); - mockSeq = EasyMock.createMock(ByteSequence.class); + mockSeq = Mockito.mock(ByteSequence.class); byteSeq = new ArrayList(); byteSeq.add(mockSeq); diff --git a/warehouse/query-core/src/test/java/datawave/query/iterator/logic/ContentSummaryIteratorTest.java b/warehouse/query-core/src/test/java/datawave/query/iterator/logic/ContentSummaryIteratorTest.java index 876698d9f1a..cf427bbc260 100644 --- a/warehouse/query-core/src/test/java/datawave/query/iterator/logic/ContentSummaryIteratorTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/iterator/logic/ContentSummaryIteratorTest.java @@ -223,8 +223,7 @@ public void testMatchFoundWithTrailingRegex() throws IOException { Key topKey = iterator.getTopKey(); assertEquals(row, topKey.getRow()); assertEquals(new Text("pdf" + Constants.NULL + "111.222.333"), topKey.getColumnFamily()); - assertEquals(new Text("CONTENT31:true: test content wildcard matching one\nCONTENT32:true: test content wildcard matching two"), - topKey.getColumnQualifier()); + assertEquals(new Text("CONTENT31: test content wildcard matching one\nCONTENT32: test content wildcard matching two"), topKey.getColumnQualifier()); } @Test diff --git a/warehouse/query-core/src/test/java/datawave/query/jexl/DatawaveInterpreterTest.java b/warehouse/query-core/src/test/java/datawave/query/jexl/DatawaveInterpreterTest.java index c417dd19230..1a8bef746ab 100644 --- a/warehouse/query-core/src/test/java/datawave/query/jexl/DatawaveInterpreterTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/jexl/DatawaveInterpreterTest.java @@ -1,6 +1,5 @@ package datawave.query.jexl; -import static org.easymock.EasyMock.mock; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -19,9 +18,9 @@ import org.apache.commons.jexl3.internal.Engine; import org.apache.commons.jexl3.internal.Script; import org.apache.commons.jexl3.parser.JexlNodes; -import org.easymock.EasyMock; import org.junit.Ignore; import org.junit.Test; +import org.mockito.Mockito; import com.google.common.collect.Maps; @@ -74,16 +73,13 @@ public void largeOrListTest() { @Test public void invocationFails_alwaysThrowsException() { Engine engine = new DatawaveJexlEngine(); - JexlContext context = mock(JexlContext.class); + JexlContext context = Mockito.mock(JexlContext.class); JexlOptions opts = new JexlOptions(); opts.setStrict(false); opts.setSilent(false); DatawaveInterpreter interpreter = new DatawaveInterpreter(engine, opts, context, null); JexlException exception = new JexlException(JexlNodes.makeStringLiteral(), "Function failure"); - // Make mocks available. - EasyMock.replay(context); - // Capture the expected exception. Exception thrown = null; try { diff --git a/warehouse/query-core/src/test/java/datawave/query/jexl/lookups/BoundedRangeIndexLookupTest.java b/warehouse/query-core/src/test/java/datawave/query/jexl/lookups/BoundedRangeIndexLookupTest.java index df4dcd3b252..64f14db044a 100644 --- a/warehouse/query-core/src/test/java/datawave/query/jexl/lookups/BoundedRangeIndexLookupTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/jexl/lookups/BoundedRangeIndexLookupTest.java @@ -228,6 +228,13 @@ public void testInvalidDataTypeFilter() { test(lookup, "FIELD_A"); } + @Test + public void testWithNoBackingData() { + withDateRange("20240701", "20240709"); + BoundedRangeIndexLookup lookup = createLookup("FIELD_A", "absent-lower", "absent-upper"); + test(lookup, "FIELD_A"); + } + private void test(BoundedRangeIndexLookup lookup, String field) { lookup.submit(); @@ -305,7 +312,12 @@ public void largeRowInBoundedRangeTest() throws TableNotFoundException { assertEquals(10001, scanner.getSeekCount()); // with new iterator this is initial seek + one seek per unique row in the range // this represents data collapsed and sent back to the client by the WholeRowIterator assertEquals(0, scanner.getNextCount()); // no next cals with seeking filter - assertTrue(map.get("FOO").isThresholdExceeded()); + assertNotNull(map); + if (map.containsKey("FOO")) { + assertTrue(map.get("FOO").isThresholdExceeded()); + } else { + assertTrue(map.isEmpty()); + } verifyAll(); } } diff --git a/warehouse/query-core/src/test/java/datawave/query/jexl/visitors/ExecutableExpansionVisitorTest.java b/warehouse/query-core/src/test/java/datawave/query/jexl/visitors/ExecutableExpansionVisitorTest.java index c50cc0ae384..7c1e1a7aa2f 100644 --- a/warehouse/query-core/src/test/java/datawave/query/jexl/visitors/ExecutableExpansionVisitorTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/jexl/visitors/ExecutableExpansionVisitorTest.java @@ -33,7 +33,6 @@ import org.apache.commons.jexl3.parser.JexlNode; import org.apache.commons.jexl3.parser.ParserTreeConstants; import org.apache.log4j.Logger; -import org.easymock.EasyMock; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -45,6 +44,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; @@ -492,21 +492,17 @@ public void testMinimumExpansionParse() throws Exception { ASTJexlScript derefQueryTree = (ASTJexlScript) DereferencingVisitor.dereference(origQueryTree); for (ASTJexlScript queryTree : Arrays.asList(origQueryTree, derefQueryTree)) { - ShardQueryConfiguration config = EasyMock.createMock(ShardQueryConfiguration.class); - MetadataHelper helper = EasyMock.createMock(MetadataHelper.class); + ShardQueryConfiguration config = Mockito.mock(ShardQueryConfiguration.class); + MetadataHelper helper = Mockito.mock(MetadataHelper.class); HashSet indexedFields = new HashSet<>(); indexedFields.add("UUID"); indexedFields.add("QUOTE"); - EasyMock.expect(config.getIndexedFields()).andReturn(indexedFields).anyTimes(); - - EasyMock.replay(config, helper); + Mockito.doReturn(indexedFields).when(config).getIndexedFields(); ASTJexlScript newTree = ExecutableExpansionVisitor.expand(queryTree, config, helper); - EasyMock.verify(config, helper); - Assert.assertFalse(JexlStringBuildingVisitor.buildQuery(queryTree).equals(JexlStringBuildingVisitor.buildQuery(newTree))); String expected = "(QUOTE == 'kind' && UUID == 'capone') || ((filter:includeRegex(QUOTE, '.*kind.*') || BIRTH_DATE == '123') && UUID == 'capone')"; Assert.assertEquals(expected, JexlStringBuildingVisitor.buildQuery(newTree)); @@ -521,23 +517,19 @@ public void testArbitraryNodeExpansionFailNoFlatten() throws Exception { ASTJexlScript derefQueryTree = (ASTJexlScript) DereferencingVisitor.dereference(origQueryTree); for (ASTJexlScript queryTree : Arrays.asList(origQueryTree, derefQueryTree)) { - ShardQueryConfiguration config = EasyMock.createMock(ShardQueryConfiguration.class); - MetadataHelper helper = EasyMock.createMock(MetadataHelper.class); + ShardQueryConfiguration config = Mockito.mock(ShardQueryConfiguration.class); + MetadataHelper helper = Mockito.mock(MetadataHelper.class); HashSet indexedFields = new HashSet<>(); indexedFields.add("UUID"); indexedFields.add("QUOTE"); - EasyMock.expect(config.getIndexedFields()).andReturn(indexedFields).anyTimes(); - - EasyMock.replay(config, helper); + Mockito.doReturn(indexedFields).when(config).getIndexedFields(); // find an orNode in the tree ExecutableExpansionVisitor visitor = new ExecutableExpansionVisitor(config, helper); Object data = queryTree.jjtGetChild(0).childrenAccept(visitor, null); - EasyMock.verify(config, helper); - Assert.assertFalse(data instanceof ExecutableExpansionVisitor.ExpansionTracker); } } @@ -550,24 +542,20 @@ public void testArbitraryNodeExpansionFlatten() throws Exception { ASTJexlScript derefQueryTree = (ASTJexlScript) DereferencingVisitor.dereference(origQueryTree); for (ASTJexlScript queryTree : Arrays.asList(origQueryTree, derefQueryTree)) { - ShardQueryConfiguration config = EasyMock.createMock(ShardQueryConfiguration.class); - MetadataHelper helper = EasyMock.createMock(MetadataHelper.class); + ShardQueryConfiguration config = Mockito.mock(ShardQueryConfiguration.class); + MetadataHelper helper = Mockito.mock(MetadataHelper.class); HashSet indexedFields = new HashSet<>(); indexedFields.add("UUID"); indexedFields.add("QUOTE"); - EasyMock.expect(config.getIndexedFields()).andReturn(indexedFields).anyTimes(); - - EasyMock.replay(config, helper); + Mockito.doReturn(indexedFields).when(config).getIndexedFields(); // find an orNode in the tree ExecutableExpansionVisitor visitor = new ExecutableExpansionVisitor(config, helper); ASTJexlScript rebuilt = TreeFlatteningRebuildingVisitor.flatten(queryTree); rebuilt.jjtGetChild(0).jjtAccept(visitor, null); - EasyMock.verify(config, helper); - String expected = "(QUOTE == 'kind' && UUID == 'capone') || ((filter:includeRegex(QUOTE, '.*kind.*') || BIRTH_DATE == '123') && UUID == 'capone')"; Assert.assertEquals(expected, JexlStringBuildingVisitor.buildQuery(rebuilt)); } @@ -581,24 +569,20 @@ public void testNestedExpansionWithFailures() throws Exception { ASTJexlScript derefQueryTree = (ASTJexlScript) DereferencingVisitor.dereference(origQueryTree); for (ASTJexlScript queryTree : Arrays.asList(origQueryTree, derefQueryTree)) { - ShardQueryConfiguration config = EasyMock.createMock(ShardQueryConfiguration.class); - MetadataHelper helper = EasyMock.createMock(MetadataHelper.class); + ShardQueryConfiguration config = Mockito.mock(ShardQueryConfiguration.class); + MetadataHelper helper = Mockito.mock(MetadataHelper.class); HashSet indexedFields = new HashSet<>(); indexedFields.add("UUID"); indexedFields.add("QUOTE"); - EasyMock.expect(config.getIndexedFields()).andReturn(indexedFields).anyTimes(); - - EasyMock.replay(config, helper); + Mockito.doReturn(indexedFields).when(config).getIndexedFields(); // find an orNode in the tree ExecutableExpansionVisitor visitor = new ExecutableExpansionVisitor(config, helper); ASTJexlScript rebuilt = TreeFlatteningRebuildingVisitor.flatten(queryTree); rebuilt.jjtGetChild(0).jjtAccept(visitor, null); - EasyMock.verify(config, helper); - Assert.assertTrue(ExecutableDeterminationVisitor.isExecutable(rebuilt, config, helper)); String expected = "(QUOTE == 'kind' && UUID == 'A') || (BIRTH_DATE == '123' && QUOTE == 'kind' && !(filter:includeRegex(QUOTE, '.*unkind.*') || BIRTH_DATE == '555') && UUID == 'A') || (BIRTH_DATE == '234' && UUID == 'A')"; Assert.assertEquals(expected, JexlStringBuildingVisitor.buildQueryWithoutParse(rebuilt)); @@ -620,21 +604,17 @@ public void testExceededThresholdExpansionExternal() throws Exception { // overwrite the old UUID==capone with the ExceededThreshold marker queryTree.jjtGetChild(0).jjtAddChild(child, 0); - ShardQueryConfiguration config = EasyMock.createMock(ShardQueryConfiguration.class); - MetadataHelper helper = EasyMock.createMock(MetadataHelper.class); + ShardQueryConfiguration config = Mockito.mock(ShardQueryConfiguration.class); + MetadataHelper helper = Mockito.mock(MetadataHelper.class); HashSet indexedFields = new HashSet<>(); indexedFields.add("UUID"); indexedFields.add("QUOTE"); - EasyMock.expect(config.getIndexedFields()).andReturn(indexedFields).anyTimes(); - - EasyMock.replay(config, helper); + Mockito.doReturn(indexedFields).when(config).getIndexedFields(); ASTJexlScript newTree = ExecutableExpansionVisitor.expand(queryTree, config, helper); - EasyMock.verify(config, helper); - // included ExceededValueThresholdMarker before Assert.assertTrue(JexlStringBuildingVisitor.buildQuery(queryTree), JexlStringBuildingVisitor.buildQuery(queryTree).equals( "((_Value_ = true) && (UUID == 'capone')) && (filter:includeRegex(QUOTE, '.*kind.*') || QUOTE == 'kind' || BIRTH_DATE == '123')")); @@ -672,21 +652,17 @@ public void testExceededThresholdExpansionInternal() throws Exception { derefQueryTree.jjtGetChild(0).jjtGetChild(1).jjtAddChild(child, 1); for (ASTJexlScript queryTree : Arrays.asList(origQueryTree, derefQueryTree)) { - ShardQueryConfiguration config = EasyMock.createMock(ShardQueryConfiguration.class); - MetadataHelper helper = EasyMock.createMock(MetadataHelper.class); + ShardQueryConfiguration config = Mockito.mock(ShardQueryConfiguration.class); + MetadataHelper helper = Mockito.mock(MetadataHelper.class); HashSet indexedFields = new HashSet<>(); indexedFields.add("UUID"); indexedFields.add("QUOTE"); - EasyMock.expect(config.getIndexedFields()).andReturn(indexedFields).anyTimes(); - - EasyMock.replay(config, helper); + Mockito.doReturn(indexedFields).when(config).getIndexedFields(); ASTJexlScript newTree = ExecutableExpansionVisitor.expand(queryTree, config, helper); - EasyMock.verify(config, helper); - // included ExceededValueThresholdMarker before Assert.assertTrue(JexlStringBuildingVisitor.buildQuery(queryTree), JexlStringBuildingVisitor.buildQuery(queryTree) @@ -729,21 +705,17 @@ public void testExceededOrThresholdExpansion() throws Exception { derefQueryTree.jjtGetChild(0).jjtGetChild(1).jjtAddChild(child, 1); for (ASTJexlScript queryTree : Arrays.asList(origQueryTree, derefQueryTree)) { - ShardQueryConfiguration config = EasyMock.createMock(ShardQueryConfiguration.class); - MetadataHelper helper = EasyMock.createMock(MetadataHelper.class); + ShardQueryConfiguration config = Mockito.mock(ShardQueryConfiguration.class); + MetadataHelper helper = Mockito.mock(MetadataHelper.class); HashSet indexedFields = new HashSet<>(); indexedFields.add("UUID"); indexedFields.add("QUOTE"); - EasyMock.expect(config.getIndexedFields()).andReturn(indexedFields).anyTimes(); - - EasyMock.replay(config, helper); + Mockito.doReturn(indexedFields).when(config).getIndexedFields(); ASTJexlScript newTree = ExecutableExpansionVisitor.expand(queryTree, config, helper); - EasyMock.verify(config, helper); - String queryString = JexlStringBuildingVisitor.buildQuery(queryTree); String id = queryString.substring(queryString.indexOf("id = '") + 6, queryString.indexOf("') && (field")); @@ -776,21 +748,17 @@ public void testExceededOrThresholdCannotExpand() throws Exception { ASTJexlScript derefQueryTree = (ASTJexlScript) DereferencingVisitor.dereference(origQueryTree); for (ASTJexlScript queryTree : Arrays.asList(origQueryTree, derefQueryTree)) { - ShardQueryConfiguration config = EasyMock.createMock(ShardQueryConfiguration.class); - MetadataHelper helper = EasyMock.createMock(MetadataHelper.class); + ShardQueryConfiguration config = Mockito.mock(ShardQueryConfiguration.class); + MetadataHelper helper = Mockito.mock(MetadataHelper.class); HashSet indexedFields = new HashSet<>(); indexedFields.add("UUID"); indexedFields.add("QUOTE"); - EasyMock.expect(config.getIndexedFields()).andReturn(indexedFields).anyTimes(); - - EasyMock.replay(config, helper); + Mockito.doReturn(indexedFields).when(config).getIndexedFields(); ASTJexlScript newTree = ExecutableExpansionVisitor.expand(queryTree, config, helper); - EasyMock.verify(config, helper); - if (queryTree == origQueryTree) { // included ExceededValueThresholdMarker before Assert.assertTrue(JexlStringBuildingVisitor.buildQuery(queryTree), JexlStringBuildingVisitor.buildQuery(queryTree).equals( @@ -818,26 +786,23 @@ public void testDelayed() throws Exception { ASTJexlScript derefQueryTree = (ASTJexlScript) DereferencingVisitor.dereference(origQueryTree); for (ASTJexlScript queryTree : Arrays.asList(origQueryTree, derefQueryTree)) { - ShardQueryConfiguration config = EasyMock.createMock(ShardQueryConfiguration.class); - MetadataHelper helper = EasyMock.createMock(MetadataHelper.class); + ShardQueryConfiguration config = Mockito.mock(ShardQueryConfiguration.class); + MetadataHelper helper = Mockito.mock(MetadataHelper.class); HashSet indexedFields = new HashSet<>(); indexedFields.add("UUID"); indexedFields.add("QUOTE"); - EasyMock.expect(config.getIndexedFields()).andReturn(indexedFields).anyTimes(); + Mockito.doReturn(indexedFields).when(config).getIndexedFields(); Set dataTypes = new HashSet<>(); dataTypes.add("test"); Set nonEventFields = new HashSet<>(); nonEventFields.add("QUOTE"); - EasyMock.expect(config.getDatatypeFilter()).andReturn(dataTypes).anyTimes(); - EasyMock.expect(helper.getNonEventFields(dataTypes)).andReturn(nonEventFields).anyTimes(); - EasyMock.replay(config, helper); + Mockito.doReturn(dataTypes).when(config).getDatatypeFilter(); + Mockito.doReturn(nonEventFields).when(helper).getNonEventFields(dataTypes); ASTJexlScript newTree = ExecutableExpansionVisitor.expand(queryTree, config, helper); - EasyMock.verify(config, helper); - // included ExceededValueThresholdMarker before Assert.assertTrue(JexlStringBuildingVisitor.buildQuery(queryTree), JexlStringBuildingVisitor.buildQuery(queryTree) .equals("UUID == 'capone' && (QUOTE == 'kind' || " + "((_Delayed_ = true) && BIRTH_DATE == '123'))")); @@ -860,27 +825,24 @@ public void testDelayedDoubleExpansion() throws Exception { ASTJexlScript derefQueryTree = (ASTJexlScript) DereferencingVisitor.dereference(origQueryTree); for (ASTJexlScript queryTree : Arrays.asList(origQueryTree, derefQueryTree)) { - ShardQueryConfiguration config = EasyMock.createMock(ShardQueryConfiguration.class); - MetadataHelper helper = EasyMock.createMock(MetadataHelper.class); + ShardQueryConfiguration config = Mockito.mock(ShardQueryConfiguration.class); + MetadataHelper helper = Mockito.mock(MetadataHelper.class); HashSet indexedFields = new HashSet<>(); indexedFields.add("UUID"); indexedFields.add("QUOTE"); - EasyMock.expect(config.getIndexedFields()).andReturn(indexedFields).anyTimes(); + Mockito.doReturn(indexedFields).when(config).getIndexedFields(); Set dataTypes = new HashSet<>(); dataTypes.add("test"); // QUOTE being delayed creates a query that is non-executable we cannot delay a field which is nonEvent Set nonEventFields = new HashSet<>(); nonEventFields.add("QUOTE"); - EasyMock.expect(config.getDatatypeFilter()).andReturn(dataTypes).anyTimes(); - EasyMock.expect(helper.getNonEventFields(dataTypes)).andReturn(nonEventFields).anyTimes(); - EasyMock.replay(config, helper); + Mockito.doReturn(dataTypes).when(config).getDatatypeFilter(); + Mockito.doReturn(nonEventFields).when(helper).getNonEventFields(dataTypes); ASTJexlScript newTree = ExecutableExpansionVisitor.expand(queryTree, config, helper); - EasyMock.verify(config, helper); - // included ExceededValueThresholdMarker before Assert.assertTrue(JexlStringBuildingVisitor.buildQuery(queryTree), JexlStringBuildingVisitor.buildQuery(queryTree) .equals("UUID == 'capone' && (((_Delayed_ = true) && QUOTE == 'kind') || " + "((_Delayed_ = true) && BIRTH_DATE == '123'))")); @@ -913,21 +875,17 @@ public void testSingleOr() throws Exception { origOrNode.jjtGetParent().jjtAddChild(newOr, 0); newOr.jjtSetParent(origOrNode.jjtGetParent()); - ShardQueryConfiguration config = EasyMock.createMock(ShardQueryConfiguration.class); - MetadataHelper helper = EasyMock.createMock(MetadataHelper.class); + ShardQueryConfiguration config = Mockito.mock(ShardQueryConfiguration.class); + MetadataHelper helper = Mockito.mock(MetadataHelper.class); HashSet indexedFields = new HashSet<>(); indexedFields.add("UUID"); indexedFields.add("QUOTE"); - EasyMock.expect(config.getIndexedFields()).andReturn(indexedFields).anyTimes(); - - EasyMock.replay(config, helper); + Mockito.doReturn(indexedFields).when(config).getIndexedFields(); ASTJexlScript newTree = ExecutableExpansionVisitor.expand(queryTree, config, helper); - EasyMock.verify(config, helper); - // starts executable Assert.assertTrue(ExecutableDeterminationVisitor.isExecutable(queryTree, config, helper)); // what came out is executable @@ -960,21 +918,17 @@ public void testSingleOrNonExecutableCantFix() throws Exception { queryTree.jjtGetChild(0).jjtGetChild(1).jjtAddChild(newOr, 0); newOr.jjtSetParent(queryTree.jjtGetChild(0).jjtGetChild(1)); - ShardQueryConfiguration config = EasyMock.createMock(ShardQueryConfiguration.class); - MetadataHelper helper = EasyMock.createMock(MetadataHelper.class); + ShardQueryConfiguration config = Mockito.mock(ShardQueryConfiguration.class); + MetadataHelper helper = Mockito.mock(MetadataHelper.class); HashSet indexedFields = new HashSet<>(); indexedFields.add("UUID"); indexedFields.add("QUOTE"); - EasyMock.expect(config.getIndexedFields()).andReturn(indexedFields).anyTimes(); - - EasyMock.replay(config, helper); + Mockito.doReturn(indexedFields).when(config).getIndexedFields(); ASTJexlScript newTree = ExecutableExpansionVisitor.expand(queryTree, config, helper); - EasyMock.verify(config, helper); - // starts executable Assert.assertFalse(ExecutableDeterminationVisitor.isExecutable(queryTree, config, helper)); // what came out is executable @@ -996,21 +950,17 @@ public void testNoReferenceOrReferenceExpressions() throws Exception { // strip reference/referenceExpressions queryTree = TreeFlatteningRebuildingVisitor.flattenAll(queryTree); - ShardQueryConfiguration config = EasyMock.createMock(ShardQueryConfiguration.class); - MetadataHelper helper = EasyMock.createMock(MetadataHelper.class); + ShardQueryConfiguration config = Mockito.mock(ShardQueryConfiguration.class); + MetadataHelper helper = Mockito.mock(MetadataHelper.class); HashSet indexedFields = new HashSet<>(); indexedFields.add("UUID"); indexedFields.add("QUOTE"); - EasyMock.expect(config.getIndexedFields()).andReturn(indexedFields).anyTimes(); - - EasyMock.replay(config, helper); + Mockito.doReturn(indexedFields).when(config).getIndexedFields(); ASTJexlScript newTree = ExecutableExpansionVisitor.expand(queryTree, config, helper); - EasyMock.verify(config, helper); - // starts executable Assert.assertFalse(ExecutableDeterminationVisitor.isExecutable(queryTree, config, helper)); // what came out is executable diff --git a/warehouse/query-core/src/test/java/datawave/query/jexl/visitors/FixUnindexedNumericTermsTest.java b/warehouse/query-core/src/test/java/datawave/query/jexl/visitors/FixUnindexedNumericTermsTest.java index fa4e1734b50..76fc4bb16c7 100644 --- a/warehouse/query-core/src/test/java/datawave/query/jexl/visitors/FixUnindexedNumericTermsTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/jexl/visitors/FixUnindexedNumericTermsTest.java @@ -1,16 +1,14 @@ package datawave.query.jexl.visitors; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; import static org.junit.Assert.assertTrue; import org.apache.commons.jexl3.parser.ASTJexlScript; import org.apache.commons.jexl3.parser.JexlNode; import org.apache.commons.jexl3.parser.ParseException; import org.apache.log4j.Logger; -import org.easymock.EasyMock; import org.junit.Before; import org.junit.Test; +import org.mockito.Mockito; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; @@ -31,9 +29,9 @@ public class FixUnindexedNumericTermsTest { @Before public void setUp() throws Exception { datatypes = HashMultimap.create(); - config = EasyMock.mock(ShardQueryConfiguration.class); - expect(config.getQueryFieldsDatatypes()).andReturn(datatypes).anyTimes(); - replay(config); + + config = Mockito.mock(ShardQueryConfiguration.class); + Mockito.doReturn(datatypes).when(config).getQueryFieldsDatatypes(); } @Test diff --git a/warehouse/query-core/src/test/java/datawave/query/predicate/ChainableEventDataQueryFilterTest.java b/warehouse/query-core/src/test/java/datawave/query/predicate/ChainableEventDataQueryFilterTest.java index 810826245f1..2dfaa211bda 100644 --- a/warehouse/query-core/src/test/java/datawave/query/predicate/ChainableEventDataQueryFilterTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/predicate/ChainableEventDataQueryFilterTest.java @@ -5,10 +5,10 @@ import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Range; -import org.easymock.EasyMock; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.mockito.Mockito; import datawave.query.attributes.Document; @@ -22,161 +22,151 @@ public void setup() { @Test public void startNewDocumentTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key key = new Key(); mockFilter1.startNewDocument(key); mockFilter2.startNewDocument(key); - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).startNewDocument(key); + Mockito.verify(mockFilter2).startNewDocument(key); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); filter.startNewDocument(key); - EasyMock.verify(mockFilter1, mockFilter2); } @Test public void apply_successTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key key = new Key(); Map.Entry entry = new AbstractMap.SimpleEntry<>(key, ""); - EasyMock.expect(mockFilter1.apply(entry)).andReturn(true); - EasyMock.expect(mockFilter2.apply(entry)).andReturn(true); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(true).when(mockFilter1).apply(entry); + Mockito.doReturn(true).when(mockFilter2).apply(entry); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); boolean result = filter.apply(entry); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).apply(entry); + Mockito.verify(mockFilter2).apply(entry); Assert.assertTrue(result); } @Test public void apply_failFilter2Test() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key key = new Key(); Map.Entry entry = new AbstractMap.SimpleEntry<>(key, ""); - EasyMock.expect(mockFilter1.apply(entry)).andReturn(true); - EasyMock.expect(mockFilter2.apply(entry)).andReturn(false); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(true).when(mockFilter1).apply(entry); + Mockito.doReturn(false).when(mockFilter2).apply(entry); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); boolean result = filter.apply(entry); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).apply(entry); + Mockito.verify(mockFilter2).apply(entry); Assert.assertFalse(result); } @Test public void apply_failFilter1Test() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key key = new Key(); Map.Entry entry = new AbstractMap.SimpleEntry<>(key, ""); - EasyMock.expect(mockFilter1.apply(entry)).andReturn(false); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(false).when(mockFilter1).apply(entry); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); boolean result = filter.apply(entry); - EasyMock.verify(mockFilter1, mockFilter2); - Assert.assertFalse(result); } @Test public void keep_successTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key key = new Key(); - EasyMock.expect(mockFilter1.keep(key)).andReturn(true); - EasyMock.expect(mockFilter2.keep(key)).andReturn(true); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(true).when(mockFilter1).keep(key); + Mockito.doReturn(true).when(mockFilter2).keep(key); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); boolean result = filter.keep(key); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).keep(key); + Mockito.verify(mockFilter2).keep(key); Assert.assertTrue(result); } @Test public void keep_failFilter2Test() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key key = new Key(); - EasyMock.expect(mockFilter1.keep(key)).andReturn(true); - EasyMock.expect(mockFilter2.keep(key)).andReturn(false); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(true).when(mockFilter1).keep(key); + Mockito.doReturn(false).when(mockFilter2).keep(key); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); boolean result = filter.keep(key); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).keep(key); + Mockito.verify(mockFilter2).keep(key); Assert.assertFalse(result); } @Test public void keep_failFilter1Test() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key key = new Key(); - EasyMock.expect(mockFilter1.keep(key)).andReturn(false); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(false).when(mockFilter1).keep(key); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); boolean result = filter.keep(key); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).keep(key); Assert.assertFalse(result); } @Test public void getSeekRange_filter1InclusiveTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key current = new Key(); Key end = new Key(); @@ -184,17 +174,16 @@ public void getSeekRange_filter1InclusiveTest() { Range filter1Result = new Range(new Key("234"), true, new Key("999"), true); Range filter2Result = new Range(new Key("2"), true, new Key("9999"), true); - EasyMock.expect(mockFilter1.getSeekRange(current, end, true)).andReturn(filter1Result); - EasyMock.expect(mockFilter2.getSeekRange(current, end, true)).andReturn(filter2Result); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(filter1Result).when(mockFilter1).getSeekRange(current, end, true); + Mockito.doReturn(filter2Result).when(mockFilter2).getSeekRange(current, end, true); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); Range result = filter.getSeekRange(current, end, true); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).getSeekRange(current, end, true); + Mockito.verify(mockFilter2).getSeekRange(current, end, true); Assert.assertFalse(result == null); Assert.assertTrue(result.equals(filter1Result)); @@ -202,8 +191,8 @@ public void getSeekRange_filter1InclusiveTest() { @Test public void getSeekRange_filter1ExclusiveTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key current = new Key(); Key end = new Key(); @@ -211,17 +200,16 @@ public void getSeekRange_filter1ExclusiveTest() { Range filter1Result = new Range(new Key("234"), false, new Key("999"), false); Range filter2Result = new Range(new Key("2"), true, new Key("9999"), true); - EasyMock.expect(mockFilter1.getSeekRange(current, end, true)).andReturn(filter1Result); - EasyMock.expect(mockFilter2.getSeekRange(current, end, true)).andReturn(filter2Result); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(filter1Result).when(mockFilter1).getSeekRange(current, end, true); + Mockito.doReturn(filter2Result).when(mockFilter2).getSeekRange(current, end, true); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); Range result = filter.getSeekRange(current, end, true); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).getSeekRange(current, end, true); + Mockito.verify(mockFilter2).getSeekRange(current, end, true); Assert.assertFalse(result == null); Assert.assertTrue(result.equals(filter1Result)); @@ -229,8 +217,8 @@ public void getSeekRange_filter1ExclusiveTest() { @Test public void getSeekRange_filter2InclusiveTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key current = new Key(); Key end = new Key(); @@ -238,17 +226,16 @@ public void getSeekRange_filter2InclusiveTest() { Range filter1Result = new Range(new Key("2"), true, new Key("9999"), true); Range filter2Result = new Range(new Key("234"), true, new Key("999"), true); - EasyMock.expect(mockFilter1.getSeekRange(current, end, true)).andReturn(filter1Result); - EasyMock.expect(mockFilter2.getSeekRange(current, end, true)).andReturn(filter2Result); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(filter1Result).when(mockFilter1).getSeekRange(current, end, true); + Mockito.doReturn(filter2Result).when(mockFilter2).getSeekRange(current, end, true); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); Range result = filter.getSeekRange(current, end, true); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).getSeekRange(current, end, true); + Mockito.verify(mockFilter2).getSeekRange(current, end, true); Assert.assertFalse(result == null); Assert.assertTrue(result.equals(filter2Result)); @@ -256,8 +243,8 @@ public void getSeekRange_filter2InclusiveTest() { @Test public void getSeekRange_filter2ExclusiveTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key current = new Key(); Key end = new Key(); @@ -265,17 +252,16 @@ public void getSeekRange_filter2ExclusiveTest() { Range filter1Result = new Range(new Key("2"), true, new Key("9999"), true); Range filter2Result = new Range(new Key("234"), false, new Key("999"), false); - EasyMock.expect(mockFilter1.getSeekRange(current, end, true)).andReturn(filter1Result); - EasyMock.expect(mockFilter2.getSeekRange(current, end, true)).andReturn(filter2Result); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(filter1Result).when(mockFilter1).getSeekRange(current, end, true); + Mockito.doReturn(filter2Result).when(mockFilter2).getSeekRange(current, end, true); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); Range result = filter.getSeekRange(current, end, true); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).getSeekRange(current, end, true); + Mockito.verify(mockFilter2).getSeekRange(current, end, true); Assert.assertFalse(result == null); Assert.assertTrue(result.equals(filter2Result)); @@ -283,8 +269,8 @@ public void getSeekRange_filter2ExclusiveTest() { @Test public void getSeekRange_mixedTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key current = new Key(); Key end = new Key(); @@ -292,17 +278,16 @@ public void getSeekRange_mixedTest() { Range filter1Result = new Range(new Key("1"), false, new Key("9999"), true); Range filter2Result = new Range(new Key("1"), true, new Key("9999"), false); - EasyMock.expect(mockFilter1.getSeekRange(current, end, true)).andReturn(filter1Result); - EasyMock.expect(mockFilter2.getSeekRange(current, end, true)).andReturn(filter2Result); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(filter1Result).when(mockFilter1).getSeekRange(current, end, true); + Mockito.doReturn(filter2Result).when(mockFilter2).getSeekRange(current, end, true); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); Range result = filter.getSeekRange(current, end, true); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).getSeekRange(current, end, true); + Mockito.verify(mockFilter2).getSeekRange(current, end, true); Assert.assertFalse(result == null); Assert.assertTrue(result.getStartKey().getRow().toString().equals("1")); @@ -313,194 +298,189 @@ public void getSeekRange_mixedTest() { @Test public void getMaxNextCount_noneTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); - - EasyMock.expect(mockFilter1.getMaxNextCount()).andReturn(-1); - EasyMock.expect(mockFilter2.getMaxNextCount()).andReturn(-1); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(-1).when(mockFilter1).getMaxNextCount(); + Mockito.doReturn(-1).when(mockFilter2).getMaxNextCount(); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); int result = filter.getMaxNextCount(); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).getMaxNextCount(); + Mockito.verify(mockFilter2).getMaxNextCount(); Assert.assertTrue(result == -1); } @Test public void getMaxNextCount_filter1Test() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); - - EasyMock.expect(mockFilter1.getMaxNextCount()).andReturn(10); - EasyMock.expect(mockFilter2.getMaxNextCount()).andReturn(-1); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(10).when(mockFilter1).getMaxNextCount(); + Mockito.doReturn(-1).when(mockFilter2).getMaxNextCount(); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); int result = filter.getMaxNextCount(); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).getMaxNextCount(); + Mockito.verify(mockFilter2).getMaxNextCount(); Assert.assertTrue(result == 10); } @Test public void getMaxNextCount_filter2Test() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); - EasyMock.expect(mockFilter1.getMaxNextCount()).andReturn(-1); - EasyMock.expect(mockFilter2.getMaxNextCount()).andReturn(10); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(-1).when(mockFilter1).getMaxNextCount(); + Mockito.doReturn(10).when(mockFilter2).getMaxNextCount(); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); int result = filter.getMaxNextCount(); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).getMaxNextCount(); + Mockito.verify(mockFilter2).getMaxNextCount(); Assert.assertTrue(result == 10); } @Test public void getMaxNextCount_mixedTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); - - EasyMock.expect(mockFilter1.getMaxNextCount()).andReturn(15); - EasyMock.expect(mockFilter2.getMaxNextCount()).andReturn(8); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(15).when(mockFilter1).getMaxNextCount(); + Mockito.doReturn(8).when(mockFilter2).getMaxNextCount(); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); int result = filter.getMaxNextCount(); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).getMaxNextCount(); + Mockito.verify(mockFilter2).getMaxNextCount(); Assert.assertTrue(result == 8); } @Test public void getMaxNextCount_mixedReversedTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); - EasyMock.expect(mockFilter1.getMaxNextCount()).andReturn(8); - EasyMock.expect(mockFilter2.getMaxNextCount()).andReturn(15); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(8).when(mockFilter1).getMaxNextCount(); + Mockito.doReturn(15).when(mockFilter2).getMaxNextCount(); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); int result = filter.getMaxNextCount(); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).getMaxNextCount(); + Mockito.verify(mockFilter2).getMaxNextCount(); Assert.assertTrue(result == 8); } @Test public void transform_keepTrueTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key key = new Key(); - EasyMock.expect(mockFilter1.keep(key)).andReturn(true); - EasyMock.expect(mockFilter2.keep(key)).andReturn(true); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(true).when(mockFilter1).keep(key); + Mockito.doReturn(true).when(mockFilter2).keep(key); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); Key result = filter.transform(key); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).keep(key); + Mockito.verify(mockFilter2).keep(key); Assert.assertTrue(result == null); } @Test public void transform_keepFalseNoTransformTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key key = new Key(); - EasyMock.expect(mockFilter1.keep(key)).andReturn(false); - EasyMock.expect(mockFilter2.keep(key)).andReturn(false); - EasyMock.expect(mockFilter1.transform(key)).andReturn(null); - EasyMock.expect(mockFilter2.transform(key)).andReturn(null); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(false).when(mockFilter1).keep(key); + Mockito.doReturn(false).when(mockFilter2).keep(key); + Mockito.doReturn(null).when(mockFilter1).transform(key); + Mockito.doReturn(null).when(mockFilter2).transform(key); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); Key result = filter.transform(key); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).keep(key); + Mockito.verify(mockFilter2).keep(key); + Mockito.verify(mockFilter1).transform(key); + Mockito.verify(mockFilter2).transform(key); Assert.assertTrue(result == null); } @Test public void transform_keepFalseNoTransformFilter1Test() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key key = new Key(); Key key2 = new Key("123"); - EasyMock.expect(mockFilter1.keep(key)).andReturn(false); - EasyMock.expect(mockFilter2.keep(key)).andReturn(false); - EasyMock.expect(mockFilter1.transform(key)).andReturn(null); - EasyMock.expect(mockFilter2.transform(key)).andReturn(key2); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(false).when(mockFilter1).keep(key); + Mockito.doReturn(false).when(mockFilter2).keep(key); + Mockito.doReturn(null).when(mockFilter1).transform(key); + Mockito.doReturn(key2).when(mockFilter2).transform(key); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); Key result = filter.transform(key); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).keep(key); + Mockito.verify(mockFilter2).keep(key); + Mockito.verify(mockFilter1).transform(key); + Mockito.verify(mockFilter2).transform(key); Assert.assertTrue(result == key2); } @Test public void transform_keepFalseShortCircuitTest() { - EventDataQueryFilter mockFilter1 = EasyMock.createMock(EventDataQueryFilter.class); - EventDataQueryFilter mockFilter2 = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter1 = Mockito.mock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter2 = Mockito.mock(EventDataQueryFilter.class); Key key = new Key(); Key key2 = new Key("123"); - EasyMock.expect(mockFilter1.keep(key)).andReturn(false); - EasyMock.expect(mockFilter1.transform(key)).andReturn(key2); - - EasyMock.replay(mockFilter1, mockFilter2); + Mockito.doReturn(false).when(mockFilter1).keep(key); + Mockito.doReturn(key2).when(mockFilter2).transform(key); filter.addFilter(mockFilter1); filter.addFilter(mockFilter2); Key result = filter.transform(key); - EasyMock.verify(mockFilter1, mockFilter2); + Mockito.verify(mockFilter1).keep(key); + Mockito.verify(mockFilter2).transform(key); Assert.assertTrue(result == key2); } diff --git a/warehouse/query-core/src/test/java/datawave/query/tables/content/ContentQueryLogicTest.java b/warehouse/query-core/src/test/java/datawave/query/tables/content/ContentQueryLogicTest.java index d6d461c50e4..94d9d818579 100644 --- a/warehouse/query-core/src/test/java/datawave/query/tables/content/ContentQueryLogicTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/tables/content/ContentQueryLogicTest.java @@ -10,18 +10,29 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static org.powermock.api.easymock.PowerMock.expectLastCall; +import static org.powermock.api.easymock.PowerMock.replayAll; +import static org.powermock.api.easymock.PowerMock.verifyAll; +import java.util.AbstractMap; import java.util.Collections; +import java.util.Map; import java.util.Set; import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.BatchScanner; +import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.data.Key; +import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; +import org.apache.accumulo.core.security.ColumnVisibility; import org.apache.commons.collections4.iterators.TransformIterator; +import org.geotools.util.Base64; import org.junit.Before; import org.junit.Test; import org.powermock.api.easymock.PowerMock; +import org.powermock.api.easymock.annotation.Mock; import com.google.common.collect.Sets; @@ -29,10 +40,17 @@ import datawave.core.query.configuration.GenericQueryConfiguration; import datawave.core.query.logic.BaseQueryLogic; import datawave.core.query.logic.QueryLogicTransformer; +import datawave.core.query.result.event.DefaultResponseObjectFactory; +import datawave.marking.MarkingFunctions; import datawave.microservice.query.Query; +import datawave.microservice.query.QueryImpl; +import datawave.query.QueryParameters; import datawave.query.config.ContentQueryConfiguration; import datawave.query.tables.ScannerFactory; import datawave.webservice.query.exception.QueryException; +import datawave.webservice.query.result.event.DefaultField; +import datawave.webservice.query.result.event.EventBase; +import datawave.webservice.query.result.event.FieldBase; public class ContentQueryLogicTest { private ContentQueryLogic contentQueryLogic; @@ -40,7 +58,7 @@ public class ContentQueryLogicTest { private BatchScanner mockScanner; private GenericQueryConfiguration mockGenericConfig; private ContentQueryConfiguration mockContentConfig; - @org.powermock.api.easymock.annotation.Mock + @Mock Query query; @Before @@ -100,7 +118,7 @@ public void testConstructorCopy() throws Exception { int result1 = subject.getMaxPageSize(); long result2 = subject.getPageByteTrigger(); TransformIterator result3 = subject.getTransformIterator(this.query); - PowerMock.verifyAll(); + verifyAll(); // Verify results assertEquals("Incorrect max page size", 0, result1); @@ -138,6 +156,54 @@ public void testContainsDnWithAccess() { assertFalse(logic.containsDNWithAccess(Collections.emptySet())); } + @Test + public void testDecodeViewParam() throws Exception { + AccumuloClient mockClient = PowerMock.createMock(AccumuloClient.class); + MarkingFunctions mockMarkingFunctions = PowerMock.createMock(MarkingFunctions.class); + + ContentQueryLogic logic = new ContentQueryLogic(); + logic.setMarkingFunctions(mockMarkingFunctions); + logic.setResponseObjectFactory(new DefaultResponseObjectFactory()); + + Authorizations auths = new Authorizations("A"); + + Query settings = new QueryImpl(); + settings.setQuery("event:20241218_0/samplecsv/1.2.3"); + settings.addParameter(QueryParameters.DECODE_VIEW, "true"); + settings.setQueryAuthorizations("A"); + + Key dataKey = new Key("20241218_0", "d", "samplecsv" + '\u0000' + "1.2.3" + '\u0000' + "someView", "A"); + Value viewValue = new Value(Base64.encodeBytes("my happy message".getBytes())); + Map.Entry entry = new AbstractMap.SimpleImmutableEntry<>(dataKey, viewValue); + + mockMarkingFunctions.translateFromColumnVisibilityForAuths(new ColumnVisibility("A"), auths); + expectLastCall().andReturn(Map.of("A", "A")).anyTimes(); + + replayAll(); + + // test with decode view + logic.initialize(mockClient, settings, Set.of(auths)); + QueryLogicTransformer,EventBase> transformer = logic.getTransformer(settings); + EventBase base = transformer.transform(entry); + + assertEquals(1, base.getFields().size()); + DefaultField field = (DefaultField) base.getFields().get(0); + assertEquals("my happy message", field.getTypedValue().getValue()); + assertEquals("xs:string", field.getTypedValue().getType()); + + // test without decode view + settings.removeParameter(QueryParameters.DECODE_VIEW); + logic.initialize(mockClient, settings, Set.of(auths)); + transformer = logic.getTransformer(settings); + base = transformer.transform(entry); + + assertEquals(1, base.getFields().size()); + field = (DefaultField) base.getFields().get(0); + assertEquals("xs:base64Binary", field.getTypedValue().getType()); + + verifyAll(); + } + private class TestContentQuery extends ContentQueryLogic { // borrowed from TestBaseQueryLogic.java public TestContentQuery() { diff --git a/warehouse/query-core/src/test/java/datawave/query/tld/TLDFieldIndexAggregatorTest.java b/warehouse/query-core/src/test/java/datawave/query/tld/TLDFieldIndexAggregatorTest.java index 406b2fab205..2492d93cf21 100644 --- a/warehouse/query-core/src/test/java/datawave/query/tld/TLDFieldIndexAggregatorTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/tld/TLDFieldIndexAggregatorTest.java @@ -18,20 +18,16 @@ import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.iterators.SortedKeyValueIterator; import org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator; -import org.easymock.Capture; -import org.easymock.EasyMock; -import org.easymock.IAnswer; import org.junit.Before; import org.junit.Test; +import org.mockito.Mockito; import com.google.common.collect.Maps; -import datawave.data.type.NoOpType; import datawave.query.Constants; import datawave.query.attributes.Attribute; import datawave.query.attributes.AttributeFactory; import datawave.query.attributes.Document; -import datawave.query.jexl.functions.IdentityAggregator; import datawave.query.predicate.EventDataQueryFilter; import datawave.query.util.TypeMetadata; @@ -45,7 +41,7 @@ public void setup() { @Test public void apply_testAggregateFilter() throws IOException { - EventDataQueryFilter mockFilter = EasyMock.createMock(EventDataQueryFilter.class); + EventDataQueryFilter mockFilter = Mockito.mock(EventDataQueryFilter.class); TypeMetadata typeMetadata = new TypeMetadata(); AttributeFactory factory = new AttributeFactory(typeMetadata); @@ -75,9 +71,7 @@ public void apply_testAggregateFilter() throws IOException { treeMap.put(fi6, new Value()); treeMap.put(fi7, new Value()); - EasyMock.expect(mockFilter.keep(EasyMock.isA(Key.class))).andReturn(true); - - EasyMock.replay(mockFilter); + Mockito.doReturn(true).when(mockFilter).keep(Mockito.isA(Key.class)); SortedKeyValueIterator itr = new SortedMapIterator(treeMap); itr.seek(new Range(), null, true); @@ -85,7 +79,7 @@ public void apply_testAggregateFilter() throws IOException { Document doc = new Document(); aggregator.apply(itr, doc, factory); - EasyMock.verify(mockFilter); + Mockito.verify(mockFilter); // list of FIELD1 values to expect List expectedFieldValues = new ArrayList<>(); diff --git a/warehouse/query-core/src/test/java/datawave/query/util/SummaryTest.java b/warehouse/query-core/src/test/java/datawave/query/util/SummaryTest.java index 9d59f63b0e1..ee4281b1620 100644 --- a/warehouse/query-core/src/test/java/datawave/query/util/SummaryTest.java +++ b/warehouse/query-core/src/test/java/datawave/query/util/SummaryTest.java @@ -379,4 +379,20 @@ public void testOnlyWithNoOtherOptions() throws Exception { runTestQuery(queryString, format.parse("19000101"), format.parse("20240101"), extraParameters, goodResults, true); } + + @Test + public void testMultiView() throws Exception { + Map extraParameters = new HashMap<>(); + extraParameters.put("include.grouping.context", "true"); + extraParameters.put("return.fields", "CONTENT_SUMMARY"); + extraParameters.put("query.syntax", "LUCENE"); + + String queryString = "QUOTE:(farther) #SUMMARY(SIZE:50/VIEWS:CONTENT*/ONLY)"; + + // not sure why the timestamp and delete flag are present + Set goodResults = new HashSet<>(Set.of("CONTENT_SUMMARY:CONTENT: You can get much farther with a kind word and a gu" + + "\nCONTENT2: A lawyer and his briefcase can steal more than ten: : [] 9223372036854775807 false")); + + runTestQuery(queryString, format.parse("19000101"), format.parse("20240101"), extraParameters, goodResults, true); + } } diff --git a/warehouse/query-core/src/test/java/datawave/query/util/WiseGuysIngest.java b/warehouse/query-core/src/test/java/datawave/query/util/WiseGuysIngest.java index 115926276e6..154665145fb 100644 --- a/warehouse/query-core/src/test/java/datawave/query/util/WiseGuysIngest.java +++ b/warehouse/query-core/src/test/java/datawave/query/util/WiseGuysIngest.java @@ -773,6 +773,7 @@ public static void writeItAll(AccumuloClient client, WhatKindaRange range) throw addDColumn(datatype, corleoneUID, "CONTENT", "Im gonna make him an offer he cant refuse", bw); addDColumn(datatype, sopranoUID, "CONTENT", "If you can quote the rules then you can obey them", bw); addDColumn(datatype, caponeUID, "CONTENT", "You can get much farther with a kind word and a gun than you can with a kind word alone", bw); + addDColumn(datatype, caponeUID, "CONTENT2", "A lawyer and his briefcase can steal more than ten men with guns.", bw); } finally { if (null != bw) { bw.close(); diff --git a/warehouse/regression-testing/pom.xml b/warehouse/regression-testing/pom.xml index 20422009e01..1976f124cd7 100644 --- a/warehouse/regression-testing/pom.xml +++ b/warehouse/regression-testing/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-regression-testing ${project.artifactId} diff --git a/warehouse/ssdeep-common/pom.xml b/warehouse/ssdeep-common/pom.xml index 2f142715c37..419ac4a44a4 100644 --- a/warehouse/ssdeep-common/pom.xml +++ b/warehouse/ssdeep-common/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-warehouse-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ssdeep-common diff --git a/web-services/accumulo/pom.xml b/web-services/accumulo/pom.xml index 7d87388b234..d5105ed39dd 100644 --- a/web-services/accumulo/pom.xml +++ b/web-services/accumulo/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-accumulo ejb diff --git a/web-services/atom/pom.xml b/web-services/atom/pom.xml index 4fd79402460..ee9adc557d4 100644 --- a/web-services/atom/pom.xml +++ b/web-services/atom/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-atom ejb diff --git a/web-services/cached-results/pom.xml b/web-services/cached-results/pom.xml index be126e77781..1be0e6f460e 100644 --- a/web-services/cached-results/pom.xml +++ b/web-services/cached-results/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-cached-results ejb diff --git a/web-services/client/pom.xml b/web-services/client/pom.xml index 708f6fe2f28..b5c61ef65f7 100644 --- a/web-services/client/pom.xml +++ b/web-services/client/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-client jar diff --git a/web-services/common-util/pom.xml b/web-services/common-util/pom.xml index 36d59da2ccf..220de0a1cdd 100644 --- a/web-services/common-util/pom.xml +++ b/web-services/common-util/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-common-util jar diff --git a/web-services/common/pom.xml b/web-services/common/pom.xml index d9e74159848..dcf641c672a 100644 --- a/web-services/common/pom.xml +++ b/web-services/common/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-common ejb diff --git a/web-services/deploy/application/pom.xml b/web-services/deploy/application/pom.xml index e00456caed1..3902115f4b9 100644 --- a/web-services/deploy/application/pom.xml +++ b/web-services/deploy/application/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-deploy-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-deploy-application ear diff --git a/web-services/deploy/configuration/pom.xml b/web-services/deploy/configuration/pom.xml index fde2907113b..86c6b5604d1 100644 --- a/web-services/deploy/configuration/pom.xml +++ b/web-services/deploy/configuration/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-deploy-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-deploy-configuration jar diff --git a/web-services/deploy/docs/pom.xml b/web-services/deploy/docs/pom.xml index 585962b84a0..65cdbab6453 100644 --- a/web-services/deploy/docs/pom.xml +++ b/web-services/deploy/docs/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-deploy-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-deploy-docs war diff --git a/web-services/deploy/pom.xml b/web-services/deploy/pom.xml index 0aaf5ad9678..c39e8701963 100644 --- a/web-services/deploy/pom.xml +++ b/web-services/deploy/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT gov.nsa.datawave.webservices datawave-ws-deploy-parent diff --git a/web-services/deploy/spring-framework-integration/pom.xml b/web-services/deploy/spring-framework-integration/pom.xml index 7114083302f..837e3fa8dc7 100644 --- a/web-services/deploy/spring-framework-integration/pom.xml +++ b/web-services/deploy/spring-framework-integration/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-deploy-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT spring-framework-integration ${project.artifactId} diff --git a/web-services/dictionary/pom.xml b/web-services/dictionary/pom.xml index 72b5c0a8b5f..c26e60c41ca 100644 --- a/web-services/dictionary/pom.xml +++ b/web-services/dictionary/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-dictionary ejb diff --git a/web-services/examples/client-login/pom.xml b/web-services/examples/client-login/pom.xml index feefded262c..894dc78d8af 100644 --- a/web-services/examples/client-login/pom.xml +++ b/web-services/examples/client-login/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-examples-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-examples-client-login ejb diff --git a/web-services/examples/http-client/pom.xml b/web-services/examples/http-client/pom.xml index 83b8cd6679f..1e6d633a372 100644 --- a/web-services/examples/http-client/pom.xml +++ b/web-services/examples/http-client/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-examples-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-examples-http-client jar diff --git a/web-services/examples/jms-client/pom.xml b/web-services/examples/jms-client/pom.xml index 424566888c2..cb1b0e29a30 100644 --- a/web-services/examples/jms-client/pom.xml +++ b/web-services/examples/jms-client/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-examples-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-examples-jms-client jar diff --git a/web-services/examples/pom.xml b/web-services/examples/pom.xml index b17ee57d781..ff8dc100e50 100644 --- a/web-services/examples/pom.xml +++ b/web-services/examples/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-examples-parent pom diff --git a/web-services/examples/query-war/pom.xml b/web-services/examples/query-war/pom.xml index d30ca62152f..cd043708f21 100644 --- a/web-services/examples/query-war/pom.xml +++ b/web-services/examples/query-war/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-examples-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-examples-query-war war diff --git a/web-services/map-reduce-embedded/pom.xml b/web-services/map-reduce-embedded/pom.xml index c2f31d4c66e..7374807a9f0 100644 --- a/web-services/map-reduce-embedded/pom.xml +++ b/web-services/map-reduce-embedded/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-map-reduce-embedded jar diff --git a/web-services/map-reduce-status/pom.xml b/web-services/map-reduce-status/pom.xml index 994ad4feed3..9920d1b606d 100644 --- a/web-services/map-reduce-status/pom.xml +++ b/web-services/map-reduce-status/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-map-reduce-status ejb diff --git a/web-services/map-reduce/pom.xml b/web-services/map-reduce/pom.xml index 5f6e41d20d6..8f1c89a09b6 100644 --- a/web-services/map-reduce/pom.xml +++ b/web-services/map-reduce/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-map-reduce ejb diff --git a/web-services/map-reduce/src/test/resources/datawave/mapreduce/MapReduceJobs.xml b/web-services/map-reduce/src/test/resources/datawave/mapreduce/MapReduceJobs.xml index b8b4fc5d158..c5fa0ba6742 100644 --- a/web-services/map-reduce/src/test/resources/datawave/mapreduce/MapReduceJobs.xml +++ b/web-services/map-reduce/src/test/resources/datawave/mapreduce/MapReduceJobs.xml @@ -58,7 +58,7 @@ - + diff --git a/web-services/metrics/pom.xml b/web-services/metrics/pom.xml index e009aa302fa..8b7d3c42bd0 100644 --- a/web-services/metrics/pom.xml +++ b/web-services/metrics/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-metrics ejb diff --git a/web-services/model/pom.xml b/web-services/model/pom.xml index 84e0df6f838..c1f606e4cfc 100644 --- a/web-services/model/pom.xml +++ b/web-services/model/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-model ejb diff --git a/web-services/modification/pom.xml b/web-services/modification/pom.xml index 674c21e2d9d..bfc58214da7 100644 --- a/web-services/modification/pom.xml +++ b/web-services/modification/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-modification ejb diff --git a/web-services/pom.xml b/web-services/pom.xml index 53597e1f8f0..958283e8255 100644 --- a/web-services/pom.xml +++ b/web-services/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave datawave-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT gov.nsa.datawave.webservices datawave-ws-parent diff --git a/web-services/query-websocket/pom.xml b/web-services/query-websocket/pom.xml index d719cf706a6..040a8f2c011 100644 --- a/web-services/query-websocket/pom.xml +++ b/web-services/query-websocket/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-query-websocket war diff --git a/web-services/query/pom.xml b/web-services/query/pom.xml index c4a758a4c8e..96b02b5e777 100644 --- a/web-services/query/pom.xml +++ b/web-services/query/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-query ejb @@ -113,6 +113,10 @@ org.easymock easymock + + org.mockito + mockito-core + org.powermock powermock-api-easymock diff --git a/web-services/query/src/main/java/datawave/webservice/query/cache/QueryExpirationBean.java b/web-services/query/src/main/java/datawave/webservice/query/cache/QueryExpirationBean.java index f68bce9e461..9f69ddd0a1a 100644 --- a/web-services/query/src/main/java/datawave/webservice/query/cache/QueryExpirationBean.java +++ b/web-services/query/src/main/java/datawave/webservice/query/cache/QueryExpirationBean.java @@ -41,17 +41,17 @@ public class QueryExpirationBean { private static final Logger log = Logger.getLogger(QueryExpirationBean.class); @Inject - private QueryCache cache; + QueryCache cache; @Inject @SpringBean(refreshable = true) - private QueryExpirationProperties conf; + QueryExpirationProperties conf; @Inject - private AccumuloConnectionFactory connectionFactory; + AccumuloConnectionFactory connectionFactory; @Inject - private CreatedQueryLogicCacheBean qlCache; + CreatedQueryLogicCacheBean qlCache; @Inject private QueryMetricsBean metrics; diff --git a/web-services/query/src/test/java/datawave/webservice/query/cache/QueryExpirationBeanTest.java b/web-services/query/src/test/java/datawave/webservice/query/cache/QueryExpirationBeanTest.java index 31856b666bd..899c7638538 100644 --- a/web-services/query/src/test/java/datawave/webservice/query/cache/QueryExpirationBeanTest.java +++ b/web-services/query/src/test/java/datawave/webservice/query/cache/QueryExpirationBeanTest.java @@ -8,10 +8,7 @@ import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.easymock.PowerMock; -import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.reflect.Whitebox; +import org.mockito.Mockito; import com.google.common.cache.Cache; @@ -21,7 +18,6 @@ import datawave.microservice.querymetric.QueryMetricFactoryImpl; import datawave.webservice.query.runner.RunningQuery; -@RunWith(PowerMockRunner.class) public class QueryExpirationBeanTest { private static CreatedQueryLogicCacheBean qlCache; @@ -33,7 +29,7 @@ public static void setup() throws IllegalArgumentException, IllegalAccessExcepti queryCache = new QueryCache(); queryCache.init(); qlCache = new CreatedQueryLogicCacheBean(); - connFactory = PowerMock.createMock(AccumuloConnectionFactory.class); + connFactory = Mockito.mock(AccumuloConnectionFactory.class); } @Test @@ -52,18 +48,21 @@ public void testRemoveIdleOrExpired() throws Exception { Assert.assertFalse("Query Cache still contains query", queryCache.containsKey(qid)); Assert.assertFalse("Query Logic Cache still contains query logic", qlCache.snapshot().containsKey(qid)); + Cache queryCacheBuild = queryCache.buildCache(); for (int i = 0; i < 5; i++) { RunningQuery runningQuery = createRunningQuery(); String key = runningQuery.getSettings().getId().toString(); - queryCache.put(key, runningQuery); + queryCacheBuild.put(key, runningQuery); qlCache.add(key, key, runningQuery.getLogic(), null); } - int queryCacheSize = Whitebox.getInternalState(queryCache, Cache.class).asMap().size(); + int queryCacheSize = queryCacheBuild.asMap().size(); Assert.assertEquals(5, queryCacheSize); Assert.assertEquals(5, qlCache.snapshot().size()); bean.close(); qlCache.shutdown(); - queryCacheSize = Whitebox.getInternalState(queryCache, Cache.class).asMap().size(); + + queryCacheBuild = queryCache.buildCache(); + queryCacheSize = queryCacheBuild.asMap().size(); Assert.assertEquals("Query Cache is not empty: " + queryCacheSize, 0, queryCacheSize); Assert.assertEquals("Query Logic Cache is not empty: " + qlCache.snapshot().size(), 0, qlCache.snapshot().size()); } @@ -72,13 +71,13 @@ private QueryExpirationBean createBean(int expireTime) throws IllegalArgumentExc QueryExpirationBean bean = new QueryExpirationBean(); QueryExpirationProperties expirationConfiguration = new QueryExpirationProperties(); - setInternalState(expirationConfiguration, "idleTimeout", expireTime); - setInternalState(expirationConfiguration, "callTimeout", expireTime); + expirationConfiguration.setIdleTimeout(expireTime); + expirationConfiguration.setCallTimeout(expireTime); - setInternalState(bean, QueryExpirationProperties.class, expirationConfiguration); - setInternalState(bean, QueryCache.class, queryCache); - setInternalState(bean, CreatedQueryLogicCacheBean.class, qlCache); - setInternalState(bean, AccumuloConnectionFactory.class, connFactory); + bean.conf = expirationConfiguration; + bean.cache = queryCache; + bean.qlCache = qlCache; + bean.connectionFactory = connFactory; return bean; } diff --git a/web-services/query/src/test/java/datawave/webservice/query/logic/filtered/FilteredQueryLogicTest.java b/web-services/query/src/test/java/datawave/webservice/query/logic/filtered/FilteredQueryLogicTest.java index 7d8ac10a341..98ffa3d7385 100644 --- a/web-services/query/src/test/java/datawave/webservice/query/logic/filtered/FilteredQueryLogicTest.java +++ b/web-services/query/src/test/java/datawave/webservice/query/logic/filtered/FilteredQueryLogicTest.java @@ -5,12 +5,11 @@ import java.util.Set; import org.apache.accumulo.core.security.Authorizations; -import org.easymock.EasyMock; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.powermock.api.easymock.PowerMock; +import org.mockito.Mockito; import datawave.core.query.configuration.GenericQueryConfiguration; import datawave.core.query.logic.QueryLogic; @@ -26,7 +25,7 @@ public class FilteredQueryLogicTest { @Before public void setup() { - delegate = PowerMock.createMock(QueryLogic.class); + delegate = Mockito.mock(QueryLogic.class); logic = new FilteredQueryLogic(); logic.setDelegate(delegate); logic.setFilter(new QueryLogicFilterByAuth("FOO|BAR")); @@ -34,7 +33,7 @@ public void setup() { @After public void cleanup() { - PowerMock.resetAll(); + Mockito.reset(); } @Test @@ -42,14 +41,12 @@ public void testFiltered() throws Exception { Query settings = new QueryImpl(); Set auths = Collections.singleton(new Authorizations("FILTERME")); - PowerMock.replayAll(); GenericQueryConfiguration config = logic.initialize(null, settings, auths); logic.setupQuery(config); Iterator it = logic.iterator(); Assert.assertFalse(it.hasNext()); String plan = logic.getPlan(null, settings, auths, true, true); Assert.assertEquals("", plan); - PowerMock.verifyAll(); } @Test @@ -58,12 +55,11 @@ public void testNotFiltered() throws Exception { Set auths = Collections.singleton(new Authorizations("FOO")); GenericQueryConfiguration config = new GenericQueryConfiguration() {}; - EasyMock.expect(delegate.initialize(null, settings, auths)).andReturn(config); + Mockito.when(delegate.initialize(null, settings, auths)).thenReturn(config); delegate.setupQuery(config); - EasyMock.expect(delegate.iterator()).andReturn(Collections.singleton(new Object()).iterator()); - EasyMock.expect(delegate.getPlan(null, settings, auths, true, true)).andReturn("a plan"); + Mockito.when(delegate.iterator()).thenReturn(Collections.singleton(new Object()).iterator()); + Mockito.when(delegate.getPlan(null, settings, auths, true, true)).thenReturn("a plan"); - PowerMock.replayAll(); logic.initialize(null, new QueryImpl(), Collections.singleton(new Authorizations("FOO"))); logic.setupQuery(config); Iterator it = logic.iterator(); @@ -72,6 +68,5 @@ public void testNotFiltered() throws Exception { Assert.assertFalse(it.hasNext()); String plan = logic.getPlan(null, settings, auths, true, true); Assert.assertEquals("a plan", plan); - PowerMock.verifyAll(); } } diff --git a/web-services/rest-api/pom.xml b/web-services/rest-api/pom.xml index 614aadf59ef..3b437cf6512 100644 --- a/web-services/rest-api/pom.xml +++ b/web-services/rest-api/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-rest-api war diff --git a/web-services/security/pom.xml b/web-services/security/pom.xml index b8c6b9fd992..e40f9d3f842 100644 --- a/web-services/security/pom.xml +++ b/web-services/security/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-security ejb diff --git a/web-services/web-root/pom.xml b/web-services/web-root/pom.xml index f8afe281437..4b7d9001810 100644 --- a/web-services/web-root/pom.xml +++ b/web-services/web-root/pom.xml @@ -4,7 +4,7 @@ gov.nsa.datawave.webservices datawave-ws-parent - 7.12.0-SNAPSHOT + 7.13.0-SNAPSHOT datawave-ws-web-root war