Skip to content

Commit

Permalink
Merge branch 'integration' into bugfix/matchesInGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
ivakegg committed Jun 26, 2024
2 parents 7ea9ba3 + 853999e commit 1ff4af4
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 20 deletions.
2 changes: 1 addition & 1 deletion core/in-memory-accumulo
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public GenericQueryConfiguration initialize(AccumuloClient client, Query setting
logicQueryStringBuilder.append(config.getQueryString());
QueryLogicHolder holder = new QueryLogicHolder(logicName, logic);
holder.setSettings(settingsCopy);
holder.setMaxResults(logic.getMaxResults());
holder.setMaxResults(logic.getResultLimit(settingsCopy));
configs.put(logicName, config);
logicState.put(logicName, holder);

Expand Down
26 changes: 13 additions & 13 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- quickstart
# To run the wildfly webservice, change `--accumulo` to `--web`
command: ["datawave-bootstrap.sh", "--accumulo"]
image: datawave/quickstart-compose:7.0.1-SNAPSHOT
image: datawave/quickstart-compose
environment:
- DW_CONTAINER_HOST=quickstart
- DW_DATAWAVE_WEB_JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8787 -Duser.timezone=GMT -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true
Expand Down Expand Up @@ -122,7 +122,7 @@ services:

configuration:
entrypoint: [ "java","-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5009","-jar","app.jar" ]
image: datawave/config-service:4.0.1-SNAPSHOT
image: datawave/config-service
command:
- --spring.output.ansi.enabled=ALWAYS
- --spring.profiles.active=consul,native,open_actuator
Expand All @@ -146,7 +146,7 @@ services:
condition: service_started

cache:
image: datawave/hazelcast-service:4.0.1-SNAPSHOT
image: datawave/hazelcast-service
scale: 1
command:
- --spring.profiles.active=consul,compose,remoteauth
Expand Down Expand Up @@ -174,7 +174,7 @@ services:

authorization:
entrypoint: [ "java","-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5008","-jar","app.jar" ]
image: datawave/authorization-service:4.0.1-SNAPSHOT
image: datawave/authorization-service
command:
- --spring.output.ansi.enabled=ALWAYS
- --spring.profiles.active=consul,mock,compose,federation
Expand Down Expand Up @@ -203,7 +203,7 @@ services:
profiles:
- accumulo
- full
image: datawave/accumulo-service:4.0.1-SNAPSHOT
image: datawave/accumulo-service
command:
- --spring.output.ansi.enabled=ALWAYS
- --spring.profiles.active=consul,compose,remoteauth
Expand Down Expand Up @@ -236,7 +236,7 @@ services:
condition: service_healthy

audit:
image: datawave/audit-service:4.0.1-SNAPSHOT
image: datawave/audit-service
command:
- --spring.output.ansi.enabled=ALWAYS
- --spring.profiles.active=consul,compose,remoteauth
Expand Down Expand Up @@ -270,7 +270,7 @@ services:

metrics:
entrypoint: ["java","-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5007","-jar","app.jar"]
image: datawave/query-metric-service:4.0.2-SNAPSHOT
image: datawave/query-metric-service
command:
- --spring.output.ansi.enabled=ALWAYS
- --spring.profiles.active=consul,compose,remoteauth
Expand Down Expand Up @@ -307,7 +307,7 @@ services:
profiles:
- dictionary
- full
image: datawave/dictionary-service:4.0.1-SNAPSHOT
image: datawave/dictionary-service
command:
- --spring.output.ansi.enabled=ALWAYS
- --spring.profiles.active=consul,compose,remoteauth
Expand Down Expand Up @@ -355,7 +355,7 @@ services:
# If you want to test cached results, set the CACHED_RESULTS environment variable to 'true'
query:
entrypoint: ["java","-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005","-jar","app.jar"]
image: datawave/query-service:1.0.1-SNAPSHOT
image: datawave/query-service
command:
- --spring.output.ansi.enabled=ALWAYS
- --spring.profiles.active=consul,compose,remoteauth,querymessaging,metricssource,query,mrquery,cachedresults,federation
Expand Down Expand Up @@ -399,7 +399,7 @@ services:
profiles:
- full
entrypoint: ["java","-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005","-jar","app.jar"]
image: datawave/mapreduce-query-service:1.0.1-SNAPSHOT
image: datawave/mapreduce-query-service
command:
- --spring.output.ansi.enabled=ALWAYS
- --spring.profiles.active=consul,compose,remoteauth,query,mrquery,federation
Expand Down Expand Up @@ -437,7 +437,7 @@ services:

executor-pool1:
entrypoint: ["java","-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5006","-jar","app.jar"]
image: datawave/query-executor-service:1.0.1-SNAPSHOT
image: datawave/query-executor-service
command:
- --spring.application.name=executor-pool1
- --spring.cloud.config.name=executor
Expand Down Expand Up @@ -486,7 +486,7 @@ services:
profiles:
- pool2
- full
image: datawave/query-executor-service:1.0.1-SNAPSHOT
image: datawave/query-executor-service
command:
- --spring.application.name=executor-pool2
- --spring.cloud.config.name=executor
Expand Down Expand Up @@ -533,7 +533,7 @@ services:
profiles:
- modification
- full
image: datawave/modification-service:1.0.1-SNAPSHOT
image: datawave/modification-service
command:
- --spring.output.ansi.enabled=ALWAYS
- --spring.profiles.active=consul,compose,remoteauth,query
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<version.hamcrest>1.3</version.hamcrest>
<version.httpcomponents-httpclient>4.5.13</version.httpcomponents-httpclient>
<version.httpcomponents-httpcore>4.4.8</version.httpcomponents-httpcore>
<version.in-memory-accumulo>4.0.0</version.in-memory-accumulo>
<version.in-memory-accumulo>4.0.1</version.in-memory-accumulo>
<version.infinispan>9.4.21.Final</version.infinispan>
<version.jackson>2.10.0.pr1</version.jackson>
<version.jackson-mapper-asl>1.9.13</version.jackson-mapper-asl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,151 @@ public void testQueryLogicWithMaxResultsOverride() throws Exception {

}

@Test
// testQueryLogic with max.results.override is set
public void testQueryLogicWithMaxResultsOverrideWithDNOverride() throws Exception {
Map<String,QueryLogic<?>> logics = new HashMap<>();
TestQueryLogic logic1 = new TestQueryLogic();
TestQueryLogic2 logic2 = new TestQueryLogic2();
logics.put("TestQueryLogic", logic1);
logics.put("TestQueryLogic2", logic2);

logic1.getData().put(key1, value1);
logic1.getData().put(key2, value2);
logic2.getData().put(key3, value3);
logic2.getData().put(key4, value4);
logic1.getData().put(key5, value5);
logic1.getData().put(key6, value6);
logic2.getData().put(key7, value7);
logic2.getData().put(key8, value8);

QueryImpl settings = new QueryImpl();
settings.setPagesize(100);
settings.setQueryAuthorizations(auths.toString());
settings.setQuery("FOO == 'BAR'");
settings.setParameters(new HashSet<>());
settings.setId(UUID.randomUUID());
settings.setDnList(Arrays.asList(principal.getUserDN().subjectDN()));

CompositeQueryLogic c = new CompositeQueryLogic();
// max.results.override is set to -1 when it is not passed in as it is an optional parameter
logic1.setMaxResults(2); // it can return 4, so this will cap it at 3 (1 more than max)
logic2.setMaxResults(1); // it cat return 4, so this will cap it at 2 (1 more than max)

// just FYI, setting up DNResultLimits for the composite query logic doesn't do anything
// c.setDnResultLimits(Map.of(principal.getUserDN().subjectDN(), 3L));

// settings the DNResultLimits for each logics configured for composite
logic1.setDnResultLimits(Map.of(principal.getUserDN().subjectDN(), 2L));
logic2.setDnResultLimits(Map.of(principal.getUserDN().subjectDN(), 3L));
/**
* RunningQuery.setupConnection()
*/
c.setQueryLogics(logics);
c.setCurrentUser(principal);
c.initialize(null, settings, Collections.singleton(auths));
c.setupQuery(null);
TransformIterator iter = c.getTransformIterator(settings);

/**
* RunningQuery.next() - iterate over results coming from tablet server through the TransformIterator to turn them into the objects.
*/
List<Object> results = new ArrayList<>();
while (iter.hasNext()) {
Object o = iter.next();
if (null == o)
break;
Assert.assertTrue(o instanceof TestQueryResponse);
results.add(o);
}
Assert.assertEquals(7, results.size());
ResultsPage page = new ResultsPage(results, Status.COMPLETE);

/**
* QueryExecutorBean.next() - transform list of objects into JAXB response
*/
TestQueryResponseList response = (TestQueryResponseList) c.getEnrichedTransformer((Query) settings).createResponse(page);
Assert.assertEquals(7, response.getResponses().size());
for (TestQueryResponse r : response.getResponses()) {
Assert.assertNotNull(r);
}

c.close();

}

@Test
// testQueryLogic with max.results.override is set
public void testQueryLogicWithMaxResultsOverrideWithDNOverrideNonMatchingDN() throws Exception {
Map<String,QueryLogic<?>> logics = new HashMap<>();
TestQueryLogic logic1 = new TestQueryLogic();
TestQueryLogic2 logic2 = new TestQueryLogic2();
logics.put("TestQueryLogic", logic1);
logics.put("TestQueryLogic2", logic2);

logic1.getData().put(key1, value1);
logic1.getData().put(key2, value2);
logic2.getData().put(key3, value3);
logic2.getData().put(key4, value4);
logic1.getData().put(key5, value5);
logic1.getData().put(key6, value6);
logic2.getData().put(key7, value7);
logic2.getData().put(key8, value8);

QueryImpl settings = new QueryImpl();
settings.setPagesize(100);
settings.setQueryAuthorizations(auths.toString());
settings.setQuery("FOO == 'BAR'");
settings.setParameters(new HashSet<>());
settings.setId(UUID.randomUUID());
settings.setDnList(Arrays.asList(principal.getUserDN().subjectDN()));

CompositeQueryLogic c = new CompositeQueryLogic();
// max.results.override is set to -1 when it is not passed in as it is an optional parameter
logic1.setMaxResults(2); // it can return 4, so this will cap it at 3 (1 more than max)
logic2.setMaxResults(1); // it cat return 4, so this will cap it at 2 (1 more than max)

// setting up DNResultLimits for the composite query logic
// c.setDnResultLimits(Map.of(principal.getUserDN().toString(), 3L));

logic1.setDnResultLimits(Map.of(principal.getUserDN().subjectDN() + "foo", 2L));
logic2.setDnResultLimits(Map.of(principal.getUserDN().subjectDN() + "bar", 3L));
/**
* RunningQuery.setupConnection()
*/
c.setQueryLogics(logics);
c.setCurrentUser(principal);
c.initialize(null, settings, Collections.singleton(auths));
c.setupQuery(null);
TransformIterator iter = c.getTransformIterator(settings);

/**
* RunningQuery.next() - iterate over results coming from tablet server through the TransformIterator to turn them into the objects.
*/
List<Object> results = new ArrayList<>();
while (iter.hasNext()) {
Object o = iter.next();
if (null == o)
break;
Assert.assertTrue(o instanceof TestQueryResponse);
results.add(o);
}
Assert.assertEquals(5, results.size());
ResultsPage page = new ResultsPage(results, Status.COMPLETE);

/**
* QueryExecutorBean.next() - transform list of objects into JAXB response
*/
TestQueryResponseList response = (TestQueryResponseList) c.getEnrichedTransformer((Query) settings).createResponse(page);
Assert.assertEquals(5, response.getResponses().size());
for (TestQueryResponse r : response.getResponses()) {
Assert.assertNotNull(r);
}

c.close();

}

@Test
public void testQueryLogicNoDataLogic1() throws Exception {
Map<String,QueryLogic<?>> logics = new HashMap<>();
Expand Down

0 comments on commit 1ff4af4

Please sign in to comment.