mirror of https://github.com/apache/nifi.git
NIFI-9420 Upgraded MiNiFi Guava from 26.0 to 31.0.1
- Replaced usage of Guava Lists with standard Java classes in TemplatesIteratorTest Signed-off-by: Matthew Burgess <mattyb149@apache.org> This closes #5556
This commit is contained in:
parent
07c4a05cdf
commit
55e91d607c
|
@ -18,7 +18,6 @@
|
||||||
package org.apache.nifi.minifi.c2.provider.nifi.rest;
|
package org.apache.nifi.minifi.c2.provider.nifi.rest;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonFactory;
|
import com.fasterxml.jackson.core.JsonFactory;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import org.apache.nifi.minifi.c2.api.ConfigurationProviderException;
|
import org.apache.nifi.minifi.c2.api.ConfigurationProviderException;
|
||||||
import org.apache.nifi.minifi.c2.api.util.Pair;
|
import org.apache.nifi.minifi.c2.api.util.Pair;
|
||||||
import org.apache.nifi.minifi.c2.provider.util.HttpConnector;
|
import org.apache.nifi.minifi.c2.provider.util.HttpConnector;
|
||||||
|
@ -27,6 +26,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
|
@ -64,9 +64,9 @@ public class TemplatesIteratorTest {
|
||||||
@Test
|
@Test
|
||||||
public void testIteratorNoTemplates() throws ConfigurationProviderException, IOException {
|
public void testIteratorNoTemplates() throws ConfigurationProviderException, IOException {
|
||||||
when(httpURLConnection.getInputStream()).thenReturn(TemplatesIteratorTest.class.getClassLoader().getResourceAsStream("noTemplates.json"));
|
when(httpURLConnection.getInputStream()).thenReturn(TemplatesIteratorTest.class.getClassLoader().getResourceAsStream("noTemplates.json"));
|
||||||
List<Pair<String, String>> idToNameList;
|
List<Pair<String, String>> idToNameList = new ArrayList<>();
|
||||||
try (TemplatesIterator templatesIterator = new TemplatesIterator(httpConnector, jsonFactory)) {
|
try (TemplatesIterator templatesIterator = new TemplatesIterator(httpConnector, jsonFactory)) {
|
||||||
idToNameList = Lists.newArrayList(templatesIterator);
|
templatesIterator.forEachRemaining(idToNameList::add);
|
||||||
}
|
}
|
||||||
assertEquals(0, idToNameList.size());
|
assertEquals(0, idToNameList.size());
|
||||||
|
|
||||||
|
@ -76,9 +76,9 @@ public class TemplatesIteratorTest {
|
||||||
@Test
|
@Test
|
||||||
public void testIteratorSingleTemplate() throws ConfigurationProviderException, IOException {
|
public void testIteratorSingleTemplate() throws ConfigurationProviderException, IOException {
|
||||||
when(httpURLConnection.getInputStream()).thenReturn(TemplatesIteratorTest.class.getClassLoader().getResourceAsStream("oneTemplate.json"));
|
when(httpURLConnection.getInputStream()).thenReturn(TemplatesIteratorTest.class.getClassLoader().getResourceAsStream("oneTemplate.json"));
|
||||||
List<Pair<String, String>> idToNameList;
|
List<Pair<String, String>> idToNameList = new ArrayList<>();
|
||||||
try (TemplatesIterator templatesIterator = new TemplatesIterator(httpConnector, jsonFactory)) {
|
try (TemplatesIterator templatesIterator = new TemplatesIterator(httpConnector, jsonFactory)) {
|
||||||
idToNameList = Lists.newArrayList(templatesIterator);
|
templatesIterator.forEachRemaining(idToNameList::add);
|
||||||
}
|
}
|
||||||
assertEquals(1, idToNameList.size());
|
assertEquals(1, idToNameList.size());
|
||||||
Pair<String, String> idNamePair = idToNameList.get(0);
|
Pair<String, String> idNamePair = idToNameList.get(0);
|
||||||
|
@ -91,9 +91,9 @@ public class TemplatesIteratorTest {
|
||||||
@Test
|
@Test
|
||||||
public void testIteratorTwoTemplates() throws ConfigurationProviderException, IOException {
|
public void testIteratorTwoTemplates() throws ConfigurationProviderException, IOException {
|
||||||
when(httpURLConnection.getInputStream()).thenReturn(TemplatesIteratorTest.class.getClassLoader().getResourceAsStream("twoTemplates.json"));
|
when(httpURLConnection.getInputStream()).thenReturn(TemplatesIteratorTest.class.getClassLoader().getResourceAsStream("twoTemplates.json"));
|
||||||
List<Pair<String, String>> idToNameList;
|
List<Pair<String, String>> idToNameList = new ArrayList<>();
|
||||||
try (TemplatesIterator templatesIterator = new TemplatesIterator(httpConnector, jsonFactory)) {
|
try (TemplatesIterator templatesIterator = new TemplatesIterator(httpConnector, jsonFactory)) {
|
||||||
idToNameList = Lists.newArrayList(templatesIterator);
|
templatesIterator.forEachRemaining(idToNameList::add);
|
||||||
}
|
}
|
||||||
assertEquals(2, idToNameList.size());
|
assertEquals(2, idToNameList.size());
|
||||||
Pair<String, String> idNamePair = idToNameList.get(0);
|
Pair<String, String> idNamePair = idToNameList.get(0);
|
||||||
|
|
|
@ -933,7 +933,7 @@ limitations under the License.
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>26.0-jre</version>
|
<version>31.0.1-jre</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
|
|
Loading…
Reference in New Issue