Github user justinleet commented on a diff in the pull request:
https://github.com/apache/metron/pull/1050#discussion_r193207026
--- Diff:
metron-platform/metron-solr/src/test/java/org/apache/metron/solr/integration/SolrRetrieveLatestIntegrationTest.java
---
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.metron.solr.integration;
+
+import static org.apache.metron.solr.SolrConstants.SOLR_ZOOKEEPER;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.collect.Iterables;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.metron.common.Constants;
+import org.apache.metron.indexing.dao.AccessConfig;
+import org.apache.metron.indexing.dao.IndexDao;
+import org.apache.metron.indexing.dao.search.GetRequest;
+import org.apache.metron.indexing.dao.update.Document;
+import org.apache.metron.solr.dao.SolrDao;
+import org.apache.metron.solr.integration.components.SolrComponent;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class SolrRetrieveLatestIntegrationTest {
+
+ private static SolrComponent solrComponent;
+
+ protected static final String TEST_COLLECTION = "test";
+ protected static final String TEST_SENSOR = "test_sensor";
+ protected static final String BRO_SENSOR = "bro";
+
+ private static IndexDao dao;
+
+ @BeforeClass
+ public static void setupBeforeClass() throws Exception {
+ solrComponent = new SolrComponent.Builder().build();
+ solrComponent.start();
+ }
+
+ @Before
+ public void setup() throws Exception {
+ solrComponent
+ .addCollection(TEST_COLLECTION,
"../metron-solr/src/test/resources/config/test/conf");
+ solrComponent.addCollection(BRO_SENSOR,
"../metron-solr/src/main/config/schema/bro");
+
+ AccessConfig accessConfig = new AccessConfig();
+ Map<String, Object> globalConfig = new HashMap<>();
+ globalConfig.put(SOLR_ZOOKEEPER, solrComponent.getZookeeperUrl());
+ accessConfig.setGlobalConfigSupplier(() -> globalConfig);
+ // Map the sensor name to the collection name for test.
+ accessConfig.setIndexSupplier(s -> s.equals(TEST_SENSOR) ?
TEST_COLLECTION : s);
+
+ dao = new SolrDao();
+ dao.init(accessConfig);
+ addData(BRO_SENSOR, BRO_SENSOR);
+ addData(TEST_COLLECTION, TEST_SENSOR);
+ }
+
+ @After
+ public void reset() {
+ solrComponent.reset();
+ }
+
+ @AfterClass
+ public static void teardown() {
+ solrComponent.stop();
+ }
+
+ @Test
+ public void testGetLatest() throws IOException {
--- End diff --
I'll add a case for it.
---