[
https://issues.apache.org/jira/browse/NIFI-461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14503827#comment-14503827
]
ASF GitHub Bot commented on NIFI-461:
-------------------------------------
Github user madrob commented on a diff in the pull request:
https://github.com/apache/incubator-nifi/pull/43#discussion_r28735551
--- Diff:
nifi/nifi-nar-bundles/nifi-solr-bundle/nifi-solr-processors/src/test/java/org/apache/nifi/processors/solr/TestGetSolr.java
---
@@ -0,0 +1,198 @@
+/*
+ * 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.nifi.processors.solr;
+
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.apache.solr.client.solrj.SolrClient;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.common.SolrInputDocument;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+import static org.junit.Assert.assertTrue;
+
+public class TestGetSolr {
+
+ static final String DEFAULT_SOLR_CORE = "testCollection";
+
+ private SolrClient solrClient;
+
+ @Before
+ public void setup() {
+ // create the conf dir if it doesn't exist
+ File confDir = new File("conf");
+ if (!confDir.exists()) {
+ confDir.mkdir();
+ }
+
+ try {
+ // create an EmbeddedSolrServer for the processor to use
+ String relPath =
getClass().getProtectionDomain().getCodeSource()
+ .getLocation().getFile() + "../../target";
+
+ solrClient =
EmbeddedSolrServerFactory.create(EmbeddedSolrServerFactory.DEFAULT_SOLR_HOME,
+ EmbeddedSolrServerFactory.DEFAULT_CORE_HOME,
DEFAULT_SOLR_CORE, relPath);
+
+ // create some test documents
+ SolrInputDocument doc1 = new SolrInputDocument();
+ doc1.addField("first", "bob");
+ doc1.addField("last", "smith");
+ doc1.addField("created", new Date());
+
+ SolrInputDocument doc2 = new SolrInputDocument();
+ doc2.addField("first", "alice");
+ doc2.addField("last", "smith");
+ doc2.addField("created", new Date());
+
+ SolrInputDocument doc3 = new SolrInputDocument();
+ doc3.addField("first", "mike");
+ doc3.addField("last", "smith");
+ doc3.addField("created", new Date());
+
+ SolrInputDocument doc4 = new SolrInputDocument();
+ doc4.addField("first", "john");
+ doc4.addField("last", "smith");
+ doc4.addField("created", new Date());
+
+ SolrInputDocument doc5 = new SolrInputDocument();
+ doc5.addField("first", "joan");
+ doc5.addField("last", "smith");
+ doc5.addField("created", new Date());
+
+ // add the test data to the index
+ solrClient.add(doc1);
--- End diff --
Can use a collection here.
> Add processors to interact with Apache Solr
> -------------------------------------------
>
> Key: NIFI-461
> URL: https://issues.apache.org/jira/browse/NIFI-461
> Project: Apache NiFi
> Issue Type: New Feature
> Components: Core Framework
> Reporter: Bryan Bende
> Priority: Minor
>
> I'd like to see processors for interacting with Apache Solr.
> Solr has a variety of "update handlers" which allow posting data for
> indexing, and NiFi would be a great framework to provide the data.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)