org.jboss.resteasy.specimpl.MultivaluedMapImpl Java Examples
The following examples show how to use
org.jboss.resteasy.specimpl.MultivaluedMapImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UsernamePasswordForm.java From keycloak with Apache License 2.0 | 6 votes |
@Override public void authenticate(AuthenticationFlowContext context) { MultivaluedMap<String, String> formData = new MultivaluedMapImpl<>(); String loginHint = context.getAuthenticationSession().getClientNote(OIDCLoginProtocol.LOGIN_HINT_PARAM); String rememberMeUsername = AuthenticationManager.getRememberMeUsername(context.getRealm(), context.getHttpRequest().getHttpHeaders()); if (loginHint != null || rememberMeUsername != null) { if (loginHint != null) { formData.add(AuthenticationManager.FORM_USERNAME, loginHint); } else { formData.add(AuthenticationManager.FORM_USERNAME, rememberMeUsername); formData.add("rememberMe", "on"); } } Response challengeResponse = challenge(context, formData); context.challenge(challengeResponse); }
Example #2
Source File: SelectUserAuthenticatorForm.java From keycloak-extension-playground with Apache License 2.0 | 6 votes |
private MultivaluedMap<String, String> createLoginFormData(AuthenticationFlowContext context) { MultivaluedMap<String, String> formData = new MultivaluedMapImpl<>(); String loginHint = context.getAuthenticationSession().getClientNote(OIDCLoginProtocol.LOGIN_HINT_PARAM); String rememberMeUsername = AuthenticationManager.getRememberMeUsername(context.getRealm(), context.getHttpRequest().getHttpHeaders()); if (loginHint != null || rememberMeUsername != null) { if (loginHint != null) { formData.add(AuthenticationManager.FORM_USERNAME, loginHint); } else { formData.add(AuthenticationManager.FORM_USERNAME, rememberMeUsername); formData.add("rememberMe", "on"); } } return formData; }
Example #3
Source File: QueryExecutorBeanTest.java From datawave with Apache License 2.0 | 6 votes |
private MultivaluedMap createNewQueryParameterMap() throws Exception { MultivaluedMap<String,String> p = new MultivaluedMapImpl<>(); p.putSingle(QueryParameters.QUERY_STRING, "foo == 'bar'"); p.putSingle(QueryParameters.QUERY_NAME, "query name"); p.putSingle(QueryParameters.QUERY_AUTHORIZATIONS, StringUtils.join(auths, ",")); p.putSingle(QueryParameters.QUERY_BEGIN, QueryParametersImpl.formatDate(beginDate)); p.putSingle(QueryParameters.QUERY_END, QueryParametersImpl.formatDate(endDate)); p.putSingle(QueryParameters.QUERY_EXPIRATION, QueryParametersImpl.formatDate(expirationDate)); p.putSingle(QueryParameters.QUERY_NAME, queryName); p.putSingle(QueryParameters.QUERY_PAGESIZE, Integer.toString(pagesize)); p.putSingle(QueryParameters.QUERY_STRING, query); p.putSingle(QueryParameters.QUERY_PERSISTENCE, persist.name()); p.putSingle(ColumnVisibilitySecurityMarking.VISIBILITY_MARKING, "PRIVATE|PUBLIC"); return p; }
Example #4
Source File: JsonQueryMessageDecoder.java From datawave with Apache License 2.0 | 6 votes |
@Override public QueryMessage decode(String s) throws DecodeException { MultivaluedMapImpl<String,String> map = new MultivaluedMapImpl<>(); try (JsonParser parser = Json.createParser(new StringReader(s))) { while (parser.hasNext()) { if (parser.next() == JsonParser.Event.KEY_NAME) { String key = parser.getString(); addValueToMap(key, parser, map); } } } if (map.size() == 1 && map.containsKey("cancel")) return new CancelMessage(); else return new CreateQueryMessage(map); }
Example #5
Source File: AuditBeanTest.java From datawave with Apache License 2.0 | 6 votes |
@Test public void restCallTest() { MultivaluedMap<String,String> mvMapParams = new MultivaluedMapImpl<>(); mvMapParams.putAll(params); auditBean.auditRest(mvMapParams); AuditParameters expected = new AuditParameters(); expected.validate(mvMapParams); AuditParameters actual = new AuditParameters(); actual.validate(AuditParameters.parseMessage(auditor.params)); assertEquals(expected.getUserDn(), actual.getUserDn()); assertEquals(expected.getQuery(), actual.getQuery()); assertEquals(expected.getSelectors(), actual.getSelectors()); assertEquals(expected.getAuths(), actual.getAuths()); assertEquals(expected.getAuditType(), actual.getAuditType()); assertEquals(expected.getColviz(), actual.getColviz()); }
Example #6
Source File: AuditBeanTest.java From datawave with Apache License 2.0 | 6 votes |
@Test public void internalCallTest() { MultivaluedMap<String,String> paramsMap = new MultivaluedMapImpl<>(); paramsMap.putAll(params); AuditParameters auditParams = new AuditParameters(); auditParams.validate(params); auditBean.auditRest(paramsMap); AuditParameters actual = new AuditParameters(); actual.validate(AuditParameters.parseMessage(auditor.params)); assertEquals(auditParams.getUserDn(), actual.getUserDn()); assertEquals(auditParams.getQuery(), actual.getQuery()); assertEquals(auditParams.getSelectors(), actual.getSelectors()); assertEquals(auditParams.getAuths(), actual.getAuths()); assertEquals(auditParams.getAuditType(), actual.getAuditType()); assertEquals(auditParams.getColviz(), actual.getColviz()); }
Example #7
Source File: CachedResultsBean.java From datawave with Apache License 2.0 | 6 votes |
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class}) public Future<CachedResultsResponse> loadAndCreateAsync(@Required("newQueryId") String newQueryId, String alias, @Required("queryId") String queryId, @Required("fields") String fields, String conditions, String grouping, String order, @Required("columnVisibility") String columnVisibility, @DefaultValue("-1") Integer pagesize, String fixedFieldsInEvent) { MultivaluedMap<String,String> queryParameters = new MultivaluedMapImpl<>(); queryParameters.putSingle(CachedResultsParameters.QUERY_ID, queryId); queryParameters.putSingle("newQueryId", newQueryId); queryParameters.putSingle(CachedResultsParameters.ALIAS, alias); queryParameters.putSingle(CachedResultsParameters.FIELDS, fields); queryParameters.putSingle(CachedResultsParameters.CONDITIONS, conditions); queryParameters.putSingle(CachedResultsParameters.GROUPING, grouping); queryParameters.putSingle(CachedResultsParameters.ORDER, order); queryParameters.putSingle("columnVisibility", columnVisibility); queryParameters.putSingle(QueryParameters.QUERY_PAGESIZE, Integer.toString(pagesize)); queryParameters.putSingle(CachedResultsParameters.FIXED_FIELDS_IN_EVENT, fixedFieldsInEvent); return loadAndCreateAsync(queryParameters); }
Example #8
Source File: SecurityWsTest.java From ipst with Mozilla Public License 2.0 | 6 votes |
@Test public void testSecurityAnalysisJson() { MultipartFormDataInput dataInput = mock(MultipartFormDataInput.class); Map<String, List<InputPart>> formValues = new HashMap<>(); formValues.put("format", Collections.singletonList(new InputPartImpl("JSON", MediaType.TEXT_PLAIN_TYPE))); formValues.put("limit-types", Collections.singletonList(new InputPartImpl("CURRENT", MediaType.TEXT_PLAIN_TYPE))); MultivaluedMap<String, String> headers = new MultivaluedMapImpl<>(); headers.putSingle("Content-Disposition", "filename=" + "case-file.xiidm"); formValues.put("case-file", Collections.singletonList(new InputPartImpl(new ByteArrayInputStream("Network".getBytes()), MediaType.APPLICATION_OCTET_STREAM_TYPE, headers))); MultivaluedMap<String, String> headers2 = new MultivaluedMapImpl<>(); headers2.putSingle("Content-Disposition", "filename=" + "contingencies-file.csv"); formValues.put("contingencies-file", Collections.singletonList(new InputPartImpl(new ByteArrayInputStream("contingencies".getBytes()), MediaType.APPLICATION_OCTET_STREAM_TYPE, headers2))); when(dataInput.getFormDataMap()).thenReturn(formValues); Response res = service.analyze(dataInput); Assert.assertEquals(200, res.getStatus()); }
Example #9
Source File: SecurityWsTest.java From ipst with Mozilla Public License 2.0 | 6 votes |
@Test public void testSecurityAnalysisCsv() { MultipartFormDataInput dataInput = mock(MultipartFormDataInput.class); Map<String, List<InputPart>> formValues = new HashMap<>(); formValues.put("format", Collections.singletonList(new InputPartImpl("CSV", MediaType.TEXT_PLAIN_TYPE))); formValues.put("limit-types", Collections.singletonList(new InputPartImpl("CURRENT", MediaType.TEXT_PLAIN_TYPE))); MultivaluedMap<String, String> headers = new MultivaluedMapImpl<>(); headers.putSingle("Content-Disposition", "filename=" + "case-file.xiidm"); formValues.put("case-file", Collections.singletonList(new InputPartImpl(new ByteArrayInputStream("Network".getBytes()), MediaType.APPLICATION_OCTET_STREAM_TYPE, headers))); MultivaluedMap<String, String> headers2 = new MultivaluedMapImpl<>(); headers2.putSingle("Content-Disposition", "filename=" + "contingencies-file.csv"); formValues.put("contingencies-file", Collections.singletonList(new InputPartImpl(new ByteArrayInputStream("contingencies".getBytes()), MediaType.APPLICATION_OCTET_STREAM_TYPE, headers2))); when(dataInput.getFormDataMap()).thenReturn(formValues); Response res = service.analyze(dataInput); Assert.assertEquals(200, res.getStatus()); }
Example #10
Source File: SecurityWsTest.java From ipst with Mozilla Public License 2.0 | 6 votes |
@Test public void testWrongFormat() { MultipartFormDataInput dataInput = mock(MultipartFormDataInput.class); Map<String, List<InputPart>> formValues = new HashMap<>(); formValues.put("format", Collections.singletonList(new InputPartImpl("ERR", MediaType.TEXT_PLAIN_TYPE))); formValues.put("limit-types", Collections.singletonList(new InputPartImpl("CURRENT", MediaType.TEXT_PLAIN_TYPE))); MultivaluedMap<String, String> headers = new MultivaluedMapImpl<>(); headers.putSingle("Content-Disposition", "filename=" + "case-file.xiidm.gz"); formValues.put("case-file", Collections.singletonList(new InputPartImpl(new ByteArrayInputStream("Network".getBytes()), MediaType.APPLICATION_OCTET_STREAM_TYPE, headers))); MultivaluedMap<String, String> headers2 = new MultivaluedMapImpl<>(); headers2.putSingle("Content-Disposition", "filename=" + "contingencies-file.csv"); formValues.put("contingencies-file", Collections.singletonList(new InputPartImpl(new ByteArrayInputStream("contingencies".getBytes()), MediaType.APPLICATION_OCTET_STREAM_TYPE, headers2))); when(dataInput.getFormDataMap()).thenReturn(formValues); Response res = service.analyze(dataInput); Assert.assertEquals(400, res.getStatus()); }
Example #11
Source File: SecurityWsTest.java From ipst with Mozilla Public License 2.0 | 6 votes |
@Test public void testMissingFormat() { MultipartFormDataInput dataInput = mock(MultipartFormDataInput.class); Map<String, List<InputPart>> formValues = new HashMap<>(); formValues.put("limit-types", Collections.singletonList(new InputPartImpl("HIGH_VOLTAGE,CURRENT", MediaType.TEXT_PLAIN_TYPE))); MultivaluedMap<String, String> headers = new MultivaluedMapImpl<>(); headers.putSingle("Content-Disposition", "filename=" + "case-file.xiidm.gz"); formValues.put("case-file", Collections.singletonList(new InputPartImpl(new ByteArrayInputStream("Network".getBytes()), MediaType.APPLICATION_OCTET_STREAM_TYPE, headers))); MultivaluedMap<String, String> headers2 = new MultivaluedMapImpl<>(); headers2.putSingle("Content-Disposition", "filename=" + "contingencies-file.csv"); formValues.put("contingencies-file", Collections.singletonList(new InputPartImpl(new ByteArrayInputStream("contingencies".getBytes()), MediaType.APPLICATION_OCTET_STREAM_TYPE, headers2))); when(dataInput.getFormDataMap()).thenReturn(formValues); Response res = service.analyze(dataInput); Assert.assertEquals(400, res.getStatus()); }
Example #12
Source File: SecurityWsTest.java From ipst with Mozilla Public License 2.0 | 6 votes |
@Test public void testMissingCaseFile() { MultipartFormDataInput dataInput = mock(MultipartFormDataInput.class); Map<String, List<InputPart>> formValues = new HashMap<>(); formValues.put("format", Collections.singletonList(new InputPartImpl("JSON", MediaType.TEXT_PLAIN_TYPE))); formValues.put("limit-types", Collections.singletonList(new InputPartImpl("CURRENT", MediaType.TEXT_PLAIN_TYPE))); MultivaluedMap<String, String> headers2 = new MultivaluedMapImpl<>(); headers2.putSingle("Content-Disposition", "filename=" + "contingencies-file.csv"); formValues.put("contingencies-file", Collections.singletonList(new InputPartImpl(new ByteArrayInputStream("contingencies".getBytes()), MediaType.APPLICATION_OCTET_STREAM_TYPE, headers2))); when(dataInput.getFormDataMap()).thenReturn(formValues); Response res = service.analyze(dataInput); Assert.assertEquals(400, res.getStatus()); }
Example #13
Source File: SecurityWsTest.java From ipst with Mozilla Public License 2.0 | 6 votes |
@Test public void testWrongLimits() { MultipartFormDataInput dataInput = mock(MultipartFormDataInput.class); Map<String, List<InputPart>> formValues = new HashMap<>(); formValues.put("format", Collections.singletonList(new InputPartImpl("JSON", MediaType.TEXT_PLAIN_TYPE))); formValues.put("limit-types", Collections.singletonList(new InputPartImpl("ERRR", MediaType.TEXT_PLAIN_TYPE))); MultivaluedMap<String, String> headers = new MultivaluedMapImpl<>(); headers.putSingle("Content-Disposition", "filename=" + "case-file.xiidm.gz"); formValues.put("case-file", Collections.singletonList(new InputPartImpl(new ByteArrayInputStream("Network".getBytes()), MediaType.APPLICATION_OCTET_STREAM_TYPE, headers))); MultivaluedMap<String, String> headers2 = new MultivaluedMapImpl<>(); headers2.putSingle("Content-Disposition", "filename=" + "contingencies-file.csv"); formValues.put("contingencies-file", Collections.singletonList(new InputPartImpl(new ByteArrayInputStream("contingencies".getBytes()), MediaType.APPLICATION_OCTET_STREAM_TYPE, headers2))); when(dataInput.getFormDataMap()).thenReturn(formValues); Response res = service.analyze(dataInput); Assert.assertEquals(400, res.getStatus()); }
Example #14
Source File: SynchronousDispatcherInterceptorTest.java From skywalking with Apache License 2.0 | 6 votes |
@Test public void testWithSW6SerializedContextData() throws Throwable { MultivaluedMapImpl<String, String> multivaluedMap = new MultivaluedMapImpl<String, String>(); multivaluedMap.putSingle(SW8CarrierItem.HEADER_NAME, "1-My40LjU=-MS4yLjM=-3-c2VydmljZQ==-aW5zdGFuY2U=-L2FwcA==-MTI3LjAuMC4xOjgwODA="); when(request.getHttpHeaders()).thenReturn(new ResteasyHttpHeaders(multivaluedMap)); synchronousDispatcherInterceptor.beforeMethod(enhancedInstance, null, arguments, argumentType, methodInterceptResult); synchronousDispatcherInterceptor.afterMethod(enhancedInstance, null, arguments, argumentType, null); assertThat(segmentStorage.getTraceSegments().size(), is(1)); TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0); List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment); AssertTools.assertHttpSpan(spans.get(0)); AssertTools.assertTraceSegmentRef(traceSegment.getRefs().get(0)); }
Example #15
Source File: VertxHttpResponse.java From quarkus with Apache License 2.0 | 5 votes |
public VertxHttpResponse(HttpServerRequest request, ResteasyProviderFactory providerFactory, final HttpMethod method, BufferAllocator allocator, VertxOutput output) { outputHeaders = new MultivaluedMapImpl<String, Object>(); this.method = method; os = (method == null || !method.equals(HttpMethod.HEAD)) ? new VertxOutputStream(this, allocator) : null; this.request = request; this.response = request.response(); this.providerFactory = providerFactory; this.output = output; }
Example #16
Source File: DefaultAuditParameterBuilder.java From datawave with Apache License 2.0 | 5 votes |
@Override public Map<String,String> convertAndValidate(MultivaluedMap<String,String> queryParameters) { AuditParameters validatedParams = new AuditParameters(); MultivaluedMapImpl<String,String> auditParams = new MultivaluedMapImpl<>(); // Pull parameters that are specified as query parameters (potentially under a different name) into the // audit parameters. if (queryParameters.containsKey(QueryParameters.QUERY_AUTHORIZATIONS)) auditParams.put(AuditParameters.QUERY_AUTHORIZATIONS, queryParameters.get(AuditParameters.QUERY_AUTHORIZATIONS)); if (queryParameters.containsKey(QueryParameters.QUERY_STRING)) auditParams.put(AuditParameters.QUERY_STRING, queryParameters.get(AuditParameters.QUERY_STRING)); // Put additional values passed by the caller (because these values were computed programmatically and not // directly supplied in the query call) into the audit parameters. if (queryParameters.containsKey(PrivateAuditConstants.AUDIT_TYPE)) auditParams.putSingle(AuditParameters.QUERY_AUDIT_TYPE, queryParameters.getFirst(PrivateAuditConstants.AUDIT_TYPE)); if (queryParameters.containsKey(PrivateAuditConstants.COLUMN_VISIBILITY)) auditParams.putSingle(AuditParameters.QUERY_SECURITY_MARKING_COLVIZ, queryParameters.getFirst(PrivateAuditConstants.COLUMN_VISIBILITY)); if (queryParameters.containsKey(PrivateAuditConstants.USER_DN)) auditParams.putSingle(AuditParameters.USER_DN, queryParameters.getFirst(PrivateAuditConstants.USER_DN)); if (queryParameters.containsKey(PrivateAuditConstants.LOGIC_CLASS)) auditParams.putSingle(AuditParameters.QUERY_LOGIC_CLASS, queryParameters.getFirst(PrivateAuditConstants.LOGIC_CLASS)); if (queryParameters.containsKey(PrivateAuditConstants.SELECTORS)) validatedParams.setSelectors(queryParameters.get(PrivateAuditConstants.SELECTORS)); // Now validate the audit parameters and convert to a map. validatedParams.validate(auditParams); log.debug("generated audit parameters: " + validatedParams); return validatedParams.toMap(); }
Example #17
Source File: SynchronousDispatcherInterceptorTest.java From skywalking with Apache License 2.0 | 5 votes |
@Before public void setup() throws URISyntaxException { synchronousDispatcherInterceptor = new SynchronousDispatcherInterceptor(); exceptionInterceptor = new SynchronousDispatcherExceptionInterceptor(); when(request.getUri()).thenReturn(new ResteasyUriInfo(new URI("http://localhost:8080/test/testRequestURL"))); when(request.getHttpHeaders()).thenReturn(new ResteasyHttpHeaders(new MultivaluedMapImpl<String, String>())); when(response.getStatus()).thenReturn(200); when(request.getAsyncContext()).thenReturn(resteasyAsynchronousContext); when(request.getAsyncContext().isSuspended()).thenReturn(false); arguments = new Object[] { request, response, resourceInvoker }; argumentType = new Class[] { request.getClass(), response.getClass(), resourceInvoker.getClass() }; exceptionArguments = new Object[] { request, response, new RuntimeException() }; exceptionArgumentType = new Class[] { request.getClass(), response.getClass(), new RuntimeException().getClass() }; }
Example #18
Source File: TestQueryParameters.java From datawave with Apache License 2.0 | 5 votes |
@Before public void setup() { qp = new QueryParametersImpl(); parameters = new MultivaluedMapImpl<String,String>(); parameters.putSingle(QueryParameters.QUERY_AUTHORIZATIONS, "ALL"); parameters.putSingle(QueryParameters.QUERY_NAME, "Test"); parameters.putSingle(QueryParameters.QUERY_PERSISTENCE, "TRANSIENT"); parameters.putSingle(QueryParameters.QUERY_STRING, "FOO == BAR"); parameters.putSingle(QueryParameters.QUERY_LOGIC_NAME, "LogicName"); }
Example #19
Source File: QueryParametersImpl.java From datawave with Apache License 2.0 | 5 votes |
@Override public MultivaluedMap<String,String> getUnknownParameters(MultivaluedMap<String,String> allQueryParameters) { MultivaluedMap<String,String> p = new MultivaluedMapImpl<String,String>(); for (String key : allQueryParameters.keySet()) { if (!KNOWN_PARAMS.contains(key)) { for (String value : allQueryParameters.get(key)) { p.add(key, value); } } } return p; }
Example #20
Source File: ModificationRequestBase.java From datawave with Apache License 2.0 | 5 votes |
public MultivaluedMap<String,String> toMap() { MultivaluedMap<String,String> p = new MultivaluedMapImpl<String,String>(); if (this.mode != null) { p.putSingle("mode", this.mode.name()); } return p; }
Example #21
Source File: ContentFunctionQueryTest.java From datawave with Apache License 2.0 | 5 votes |
private Iterator getResultsIterator(String queryString, ShardQueryLogic logic, MultivaluedMap<String,String> optionalParams) throws Exception { MultivaluedMap<String,String> params = new MultivaluedMapImpl<>(); params.putSingle(QUERY_STRING, queryString); params.putSingle(QUERY_NAME, "contentQuery"); params.putSingle(QUERY_LOGIC_NAME, "EventQueryLogic"); params.putSingle(QUERY_PERSISTENCE, "PERSISTENT"); params.putSingle(QUERY_AUTHORIZATIONS, AUTHS); params.putSingle(QUERY_EXPIRATION, "20200101 000000.000"); params.putSingle(QUERY_BEGIN, BEGIN_DATE); params.putSingle(QUERY_END, END_DATE); QueryParameters queryParams = new QueryParametersImpl(); queryParams.validate(params); Set<Authorizations> auths = new HashSet<>(); auths.add(new Authorizations(AUTHS)); Query query = new QueryImpl(); query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, optionalParams); ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query); logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths); logic.setupQuery(config); return logic.getTransformIterator(query); }
Example #22
Source File: MixedGeoAndGeoWaveTest.java From datawave with Apache License 2.0 | 5 votes |
private Iterator getResultsIterator(String queryString, ShardQueryLogic logic) throws Exception { MultivaluedMap<String,String> params = new MultivaluedMapImpl<>(); params.putSingle(QUERY_LOGIC_NAME, "EventQuery"); params.putSingle(QUERY_STRING, queryString); params.putSingle(QUERY_NAME, "geoQuery"); params.putSingle(QUERY_PERSISTENCE, "PERSISTENT"); params.putSingle(QUERY_AUTHORIZATIONS, AUTHS); params.putSingle(QUERY_EXPIRATION, "20200101 000000.000"); params.putSingle(QUERY_BEGIN, BEGIN_DATE); params.putSingle(QUERY_END, END_DATE); QueryParameters queryParams = new QueryParametersImpl(); queryParams.validate(params); Set<Authorizations> auths = new HashSet<>(); auths.add(new Authorizations(AUTHS)); Query query = new QueryImpl(); query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, null); ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query); QueryModel queryModel = new QueryModel(); queryModel.addTermToModel(GEO_FIELD, GEO_FIELD); queryModel.addTermToModel(GEO_FIELD, POINT_FIELD); config.setQueryModel(queryModel); logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths); logic.setupQuery(config); return logic.getTransformIterator(query); }
Example #23
Source File: MultiValueCompositeIndexTest.java From datawave with Apache License 2.0 | 5 votes |
private Iterator getQueryRangesIterator(String queryString, ShardQueryLogic logic) throws Exception { MultivaluedMap<String,String> params = new MultivaluedMapImpl<>(); params.putSingle(QUERY_STRING, queryString); params.putSingle(QUERY_NAME, "geoQuery"); params.putSingle(QUERY_LOGIC_NAME, "EventQueryLogic"); params.putSingle(QUERY_PERSISTENCE, "PERSISTENT"); params.putSingle(QUERY_AUTHORIZATIONS, AUTHS); params.putSingle(QUERY_EXPIRATION, "20200101 000000.000"); params.putSingle(QUERY_BEGIN, BEGIN_DATE); params.putSingle(QUERY_END, END_DATE); QueryParameters queryParams = new QueryParametersImpl(); queryParams.validate(params); Set<Authorizations> auths = new HashSet<>(); auths.add(new Authorizations(AUTHS)); Query query = new QueryImpl(); query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, null); ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query); logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths); logic.setupQuery(config); return config.getQueries(); }
Example #24
Source File: MultiValueCompositeIndexTest.java From datawave with Apache License 2.0 | 5 votes |
private Iterator getResultsIterator(String queryString, ShardQueryLogic logic) throws Exception { MultivaluedMap<String,String> params = new MultivaluedMapImpl<>(); params.putSingle(QUERY_STRING, queryString); params.putSingle(QUERY_NAME, "geoQuery"); params.putSingle(QUERY_LOGIC_NAME, "EventQueryLogic"); params.putSingle(QUERY_PERSISTENCE, "PERSISTENT"); params.putSingle(QUERY_AUTHORIZATIONS, AUTHS); params.putSingle(QUERY_EXPIRATION, "20200101 000000.000"); params.putSingle(QUERY_BEGIN, BEGIN_DATE); params.putSingle(QUERY_END, END_DATE); QueryParameters queryParams = new QueryParametersImpl(); queryParams.validate(params); Set<Authorizations> auths = new HashSet<>(); auths.add(new Authorizations(AUTHS)); Query query = new QueryImpl(); query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, null); ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query); logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths); logic.setupQuery(config); return logic.getTransformIterator(query); }
Example #25
Source File: CompositeIndexTest.java From datawave with Apache License 2.0 | 5 votes |
private Iterator getQueryRangesIterator(String queryString, ShardQueryLogic logic) throws Exception { MultivaluedMap<String,String> params = new MultivaluedMapImpl<>(); params.putSingle(QUERY_STRING, queryString); params.putSingle(QUERY_NAME, "geoQuery"); params.putSingle(QUERY_LOGIC_NAME, "EventQueryLogic"); params.putSingle(QUERY_PERSISTENCE, "PERSISTENT"); params.putSingle(QUERY_AUTHORIZATIONS, AUTHS); params.putSingle(QUERY_EXPIRATION, "20200101 000000.000"); params.putSingle(QUERY_BEGIN, BEGIN_DATE); params.putSingle(QUERY_END, END_DATE); QueryParameters queryParams = new QueryParametersImpl(); queryParams.validate(params); Set<Authorizations> auths = new HashSet<>(); auths.add(new Authorizations(AUTHS)); Query query = new QueryImpl(); query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, null); ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query); logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths); logic.setupQuery(config); return config.getQueries(); }
Example #26
Source File: CompositeIndexTest.java From datawave with Apache License 2.0 | 5 votes |
private Iterator getResultsIterator(String queryString, ShardQueryLogic logic) throws Exception { MultivaluedMap<String,String> params = new MultivaluedMapImpl<>(); params.putSingle(QUERY_STRING, queryString); params.putSingle(QUERY_NAME, "geoQuery"); params.putSingle(QUERY_LOGIC_NAME, "EventQueryLogic"); params.putSingle(QUERY_PERSISTENCE, "PERSISTENT"); params.putSingle(QUERY_AUTHORIZATIONS, AUTHS); params.putSingle(QUERY_EXPIRATION, "20200101 000000.000"); params.putSingle(QUERY_BEGIN, BEGIN_DATE); params.putSingle(QUERY_END, END_DATE); QueryParameters queryParams = new QueryParametersImpl(); queryParams.validate(params); Set<Authorizations> auths = new HashSet<>(); auths.add(new Authorizations(AUTHS)); Query query = new QueryImpl(); query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, null); ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query); logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths); logic.setupQuery(config); return logic.getTransformIterator(query); }
Example #27
Source File: GeoSortedQueryDataTest.java From datawave with Apache License 2.0 | 5 votes |
private Iterator<QueryData> initializeGeoQuery() throws Exception { MultivaluedMap<String,String> params = new MultivaluedMapImpl<>(); params.putSingle(QUERY_STRING, "geowave:intersects(" + FIELD_NAME + ", '" + QUERY_WKT + "')"); params.putSingle(QUERY_NAME, "geoQuery"); params.putSingle(QUERY_LOGIC_NAME, "EventQueryLogic"); params.putSingle(QUERY_PERSISTENCE, "PERSISTENT"); params.putSingle(QUERY_AUTHORIZATIONS, AUTHS); params.putSingle(QUERY_EXPIRATION, "20200101 000000.000"); params.putSingle(QUERY_BEGIN, BEGIN_DATE); params.putSingle(QUERY_END, END_DATE); QueryParameters queryParams = new QueryParametersImpl(); queryParams.validate(params); Set<Authorizations> auths = new HashSet<>(); auths.add(new Authorizations(AUTHS)); Query query = new QueryImpl(); query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, null); ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query); logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths); logic.setupQuery(config); return config.getQueries(); }
Example #28
Source File: ExceededOrThresholdMarkerJexlNodeTest.java From datawave with Apache License 2.0 | 5 votes |
private Iterator getQueryRangesIterator(String queryString, ShardQueryLogic logic) throws Exception { MultivaluedMap<String,String> params = new MultivaluedMapImpl<>(); params.putSingle(QUERY_LOGIC_NAME, "EventQuery"); params.putSingle(QUERY_STRING, queryString); params.putSingle(QUERY_NAME, "geoQuery"); params.putSingle(QUERY_PERSISTENCE, "PERSISTENT"); params.putSingle(QUERY_AUTHORIZATIONS, AUTHS); params.putSingle(QUERY_EXPIRATION, "20200101 000000.000"); params.putSingle(QUERY_BEGIN, BEGIN_DATE); params.putSingle(QUERY_END, END_DATE); QueryParameters queryParams = new QueryParametersImpl(); queryParams.validate(params); Set<Authorizations> auths = new HashSet<>(); auths.add(new Authorizations(AUTHS)); Query query = new QueryImpl(); query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, null); ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query); logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths); logic.setupQuery(config); return Iterators.transform( config.getQueries(), queryData -> { try { return JexlStringBuildingVisitor.buildQuery(PushdownLargeFieldedListsVisitor.pushdown(config, JexlASTHelper.parseJexlQuery(queryData.getQuery()), null, null)); } catch (ParseException e) { return null; } }); }
Example #29
Source File: ExceededOrThresholdMarkerJexlNodeTest.java From datawave with Apache License 2.0 | 5 votes |
private Iterator getResultsIterator(String queryString, ShardQueryLogic logic) throws Exception { MultivaluedMap<String,String> params = new MultivaluedMapImpl<>(); params.putSingle(QUERY_LOGIC_NAME, "EventQuery"); params.putSingle(QUERY_STRING, queryString); params.putSingle(QUERY_NAME, "geoQuery"); params.putSingle(QUERY_PERSISTENCE, "PERSISTENT"); params.putSingle(QUERY_AUTHORIZATIONS, AUTHS); params.putSingle(QUERY_EXPIRATION, "20200101 000000.000"); params.putSingle(QUERY_BEGIN, BEGIN_DATE); params.putSingle(QUERY_END, END_DATE); QueryParameters queryParams = new QueryParametersImpl(); queryParams.validate(params); Set<Authorizations> auths = new HashSet<>(); auths.add(new Authorizations(AUTHS)); Query query = new QueryImpl(); query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, null); ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query); logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths); logic.setupQuery(config); return logic.getTransformIterator(query); }
Example #30
Source File: ContentFunctionQueryTest.java From datawave with Apache License 2.0 | 5 votes |
@Test public void withinTestWithAlternateDate() throws Exception { String query = "ID == 'TEST_ID' && content:within(1,termOffsetMap,'dog','cat')"; MultivaluedMap<String,String> optionalParams = new MultivaluedMapImpl<>(); optionalParams.putSingle(DATE_RANGE_TYPE, "BOGUSDATETYPE"); final List<DefaultEvent> events = getQueryResults(query, true, optionalParams); Assert.assertEquals(0, events.size()); }