NIFI-632 cleaning up tests

This commit is contained in:
danbress 2015-05-30 12:04:54 -04:00
parent 4074ec3785
commit e4e9efad44
1 changed files with 19 additions and 12 deletions

View File

@ -1,3 +1,19 @@
/*
* 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.documentation; package org.apache.nifi.documentation;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
@ -8,15 +24,12 @@ import java.io.InputStream;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.nifi.nar.ExtensionManager; import org.apache.nifi.nar.ExtensionManager;
import org.apache.nifi.nar.ExtensionMapping;
import org.apache.nifi.nar.NarClassLoaders; import org.apache.nifi.nar.NarClassLoaders;
import org.apache.nifi.nar.NarUnpacker; import org.apache.nifi.nar.NarUnpacker;
import org.apache.nifi.stream.io.StreamUtils;
import org.apache.nifi.util.NiFiProperties; import org.apache.nifi.util.NiFiProperties;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TemporaryFolder; import org.junit.rules.TemporaryFolder;
import org.mockito.internal.util.io.IOUtil;
public class DocGeneratorTest { public class DocGeneratorTest {
@ -25,18 +38,16 @@ public class DocGeneratorTest {
TemporaryFolder temporaryFolder = new TemporaryFolder(); TemporaryFolder temporaryFolder = new TemporaryFolder();
temporaryFolder.create(); temporaryFolder.create();
System.out.println("temp folder: " + temporaryFolder.getRoot());
NiFiProperties properties = loadSpecifiedProperties("/conf/nifi.properties"); NiFiProperties properties = loadSpecifiedProperties("/conf/nifi.properties");
properties.setProperty(NiFiProperties.COMPONENT_DOCS_DIRECTORY, temporaryFolder.getRoot().getAbsolutePath()); properties.setProperty(NiFiProperties.COMPONENT_DOCS_DIRECTORY, temporaryFolder.getRoot().getAbsolutePath());
final ExtensionMapping extensionMapping = NarUnpacker.unpackNars(properties); NarUnpacker.unpackNars(properties);
NarClassLoaders.load(properties); NarClassLoaders.load(properties);
ExtensionManager.discoverExtensions(); ExtensionManager.discoverExtensions();
DocGenerator.generate(properties); DocGenerator.generate(properties);
File processorDirectory = new File(temporaryFolder.getRoot(), "org.apache.nifi.processors.WriteResourceToStream"); File processorDirectory = new File(temporaryFolder.getRoot(), "org.apache.nifi.processors.WriteResourceToStream");
File indexHtml = new File(processorDirectory, "index.html"); File indexHtml = new File(processorDirectory, "index.html");
@ -44,11 +55,7 @@ public class DocGeneratorTest {
String generatedHtml = FileUtils.readFileToString(indexHtml); String generatedHtml = FileUtils.readFileToString(indexHtml);
Assert.assertNotNull(generatedHtml); Assert.assertNotNull(generatedHtml);
} }
private static String toString(String fileName) {
return fileName;
}
private NiFiProperties loadSpecifiedProperties(String propertiesFile) { private NiFiProperties loadSpecifiedProperties(String propertiesFile) {
String file = DocGeneratorTest.class.getResource(propertiesFile).getFile(); String file = DocGeneratorTest.class.getResource(propertiesFile).getFile();