[
https://issues.apache.org/jira/browse/NIFI-2613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15868858#comment-15868858
]
ASF GitHub Bot commented on NIFI-2613:
--------------------------------------
Github user jvwing commented on a diff in the pull request:
https://github.com/apache/nifi/pull/929#discussion_r101416263
--- Diff:
nifi-nar-bundles/nifi-poi-bundle/nifi-poi-processors/src/test/java/org/apache/nifi/processors/poi/ConvertExcelToCSVProcessorTest.java
---
@@ -0,0 +1,90 @@
+/*
+ * 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.poi;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConvertExcelToCSVProcessorTest {
+
+ private TestRunner testRunner;
+
+ @Before
+ public void init() {
+ testRunner =
TestRunners.newTestRunner(ConvertExcelToCSVProcessor.class);
+ }
+
+ @Test
+ public void testProcessAllSheets() throws Exception {
+
+ testRunner.enqueue(new
File("src/test/resources/CollegeScorecard.xlsx").toPath());
+ testRunner.run();
+
+ testRunner.assertTransferCount(ConvertExcelToCSVProcessor.SUCCESS,
1);
+
testRunner.assertTransferCount(ConvertExcelToCSVProcessor.ORIGINAL, 1);
+ testRunner.assertTransferCount(ConvertExcelToCSVProcessor.FAILURE,
0);
+
+ MockFlowFile ff =
testRunner.getFlowFilesForRelationship(ConvertExcelToCSVProcessor.SUCCESS).get(0);
+ Long l = new
Long(ff.getAttribute(ConvertExcelToCSVProcessor.ROW_NUM));
+ assertTrue(l == 7805l);
+ }
+
+ @Test
+ public void testProcessASpecificSheetThatDoesNotExist() throws
Exception {
--- End diff --
Should this be testProcessASpecificSheetThatDoesExist? The spreadsheet
does have a "Scorecard" sheet, and the test asserts that rows are processed.
> Support extracting content from Microsoft Excel (.xlxs) documents
> -----------------------------------------------------------------
>
> Key: NIFI-2613
> URL: https://issues.apache.org/jira/browse/NIFI-2613
> Project: Apache NiFi
> Issue Type: New Feature
> Components: Extensions
> Reporter: Jeremy Dyer
> Assignee: Jeremy Dyer
>
> Microsoft Excel is a wildly popular application that businesses rely heavily
> on to store, visualize, and calculate data. Any single company most likely
> has thousands of Excel documents containing data that could be very valuable
> if ingested via NiFi and combined with other datasources. Apache POI is a
> popular 100% Java library for parsing several Microsoft document formats
> including Excel. Apache POI is extremely flexible and can do several things.
> This issue would focus solely on using Apache POI to parse an incoming .xlxs
> document and convert it to CSV. The processor should be capable of limiting
> which excel sheets. CSV seems like the natural choice for outputting each row
> since this feature is already available in Excel and feels very natural to
> most Excel sheet designs.
> This capability should most likely introduce a new "poi" module as I envision
> many more capabilities around parsing Microsoft documents could come from
> this base effort.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)