@Test public void testEagleQuery() throws Exception { EagleServiceQueryBuilder builder = new EagleServiceQueryBuilder(); builder.setStartTime(0).setEndTime(DateUtils.MILLIS_PER_DAY).setPageSize(Integer.MAX_VALUE).addReturnField("field1").addReturnField("field2") .addReturnTag("tag1").addSearchTag("tagKey", "tagValue"); EagleServiceQueryRequest request = builder.buildRequest(); Assert.assertEquals("pageSize=2147483647&startTime=1970-01-01%2000:00:00&endTime=1970-01-02%2000:00:00&tagNameValue=tagKey%3DtagValue&outputTag=tag1&outputField=field1&outputField=field2", request.getQueryParameterString()); }
public EagleServiceQueryBuilder addSearchTag(String tagKey, String tagValue) throws EagleServiceClientException { if (tagKey == null || tagValue == null) { throw new EagleServiceClientException("tagKey or tagValue is null, tagKey: " + tagKey + ", tagValue: " + tagValue); } List<EagleServiceQueryRequest.Tag> searchTags = request.getSearchTags(); if (searchTags == null) { searchTags = new ArrayList<EagleServiceQueryRequest.Tag>(); request.setSearchTags(searchTags); } if (!containsTag(tagKey, tagValue)) { final EagleServiceQueryRequest.Tag tag = new EagleServiceQueryRequest.Tag(); tag.setKey(tagKey); tag.setValue(tagValue); searchTags.add(tag); } return this; }
public EagleServiceQueryBuilder addSearchTag(String tagKey, String tagValue) throws EagleServiceClientException { if (tagKey == null || tagValue == null) { throw new EagleServiceClientException("tagKey or tagValue is null, tagKey: " + tagKey + ", tagValue: " + tagValue); } List<EagleServiceQueryRequest.Tag> searchTags = request.getSearchTags(); if (searchTags == null) { searchTags = new ArrayList<EagleServiceQueryRequest.Tag>(); request.setSearchTags(searchTags); } if (!containsTag(tagKey, tagValue)) { final EagleServiceQueryRequest.Tag tag = new EagleServiceQueryRequest.Tag(); tag.setKey(tagKey); tag.setValue(tagValue); searchTags.add(tag); } return this; }