You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by al...@apache.org on 2016/07/05 04:31:25 UTC
nifi-minifi git commit: MINIFI-49 Made TestRestChangeNotifier upload
file system independent.
Repository: nifi-minifi
Updated Branches:
refs/heads/master c92c552cb -> 3370cacbe
MINIFI-49 Made TestRestChangeNotifier upload file system independent.
This closes #24.
Signed-off-by: Aldrin Piri <al...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/nifi-minifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi-minifi/commit/3370cacb
Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi/tree/3370cacb
Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi/diff/3370cacb
Branch: refs/heads/master
Commit: 3370cacbe69c2bd3b46afcca1e17f4feab784d3e
Parents: c92c552
Author: Joseph Percivall <jo...@yahoo.com>
Authored: Mon Jul 4 20:35:55 2016 -0400
Committer: Aldrin Piri <al...@apache.org>
Committed: Tue Jul 5 00:29:50 2016 -0400
----------------------------------------------------------------------
.../util/TestRestChangeNotifierCommon.java | 15 +++++----------
.../src/test/resources/testUploadFile.txt | 18 ------------------
2 files changed, 5 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi-minifi/blob/3370cacb/minifi-bootstrap/src/test/java/org/apache/nifi/minifi/bootstrap/configuration/notifiers/util/TestRestChangeNotifierCommon.java
----------------------------------------------------------------------
diff --git a/minifi-bootstrap/src/test/java/org/apache/nifi/minifi/bootstrap/configuration/notifiers/util/TestRestChangeNotifierCommon.java b/minifi-bootstrap/src/test/java/org/apache/nifi/minifi/bootstrap/configuration/notifiers/util/TestRestChangeNotifierCommon.java
index 78f6cd5..1d9f54c 100644
--- a/minifi-bootstrap/src/test/java/org/apache/nifi/minifi/bootstrap/configuration/notifiers/util/TestRestChangeNotifierCommon.java
+++ b/minifi-bootstrap/src/test/java/org/apache/nifi/minifi/bootstrap/configuration/notifiers/util/TestRestChangeNotifierCommon.java
@@ -23,18 +23,18 @@ import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
+import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.minifi.bootstrap.configuration.notifiers.RestChangeNotifier;
import org.junit.Test;
-import java.io.File;
import java.io.IOException;
-import java.nio.file.Files;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
public abstract class TestRestChangeNotifierCommon {
+ private static String testString = "This is a test string.";
+
public static OkHttpClient client;
public static RestChangeNotifier restChangeNotifier;
public static final MediaType MEDIA_TYPE_MARKDOWN = MediaType.parse("text/x-markdown; charset=utf-8");
@@ -63,14 +63,9 @@ public abstract class TestRestChangeNotifierCommon {
@Test
public void testFileUpload() throws Exception {
assertEquals(1, restChangeNotifier.getChangeListeners().size());
-
- File file = new File("src/test/resources/testUploadFile.txt");
- assertTrue(file.exists());
- assertTrue(file.canRead());
-
Request request = new Request.Builder()
.url(url)
- .post(RequestBody.create(MEDIA_TYPE_MARKDOWN, file))
+ .post(RequestBody.create(MEDIA_TYPE_MARKDOWN, testString))
.addHeader("charset","UTF-8")
.build();
@@ -84,6 +79,6 @@ public abstract class TestRestChangeNotifierCommon {
assertEquals("The result of notifying listeners:\nMockChangeListener successfully handled the configuration change\n", response.body().string());
- assertEquals(new String(Files.readAllBytes(file.toPath())), mockChangeListener.getConfFile());
+ assertEquals(testString, StringUtils.trim(mockChangeListener.getConfFile()));
}
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi/blob/3370cacb/minifi-bootstrap/src/test/resources/testUploadFile.txt
----------------------------------------------------------------------
diff --git a/minifi-bootstrap/src/test/resources/testUploadFile.txt b/minifi-bootstrap/src/test/resources/testUploadFile.txt
deleted file mode 100644
index cbd1af8..0000000
--- a/minifi-bootstrap/src/test/resources/testUploadFile.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * 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.
- */
-
- this is a test upload file created to test the RestChangeListener
\ No newline at end of file