mirror of https://github.com/apache/nifi.git
NIFI-9818 fix flaky tests
This closes #5883 Signed-off-by: Mike Thomsen <mthomsen@apache.org>
This commit is contained in:
parent
7823156606
commit
8d5de6b292
|
@ -548,7 +548,7 @@ public class DataTypeUtils {
|
|||
map = (Map<String, Object>) value;
|
||||
} else {
|
||||
final Map<?, ?> m = (Map<?, ?>) value;
|
||||
map = new HashMap<>(m.size());
|
||||
map = new LinkedHashMap<>(m.size());
|
||||
m.forEach((k, v) -> map.put(k == null ? null : k.toString(), v));
|
||||
}
|
||||
return inferRecordDataType(map);
|
||||
|
|
|
@ -43,6 +43,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -611,7 +612,7 @@ public class TestDataTypeUtils {
|
|||
|
||||
@Test
|
||||
public void testInferTypeWithMapStringKeys() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
Map<String, String> map = new LinkedHashMap<>();
|
||||
map.put("a", "Hello");
|
||||
map.put("b", "World");
|
||||
|
||||
|
@ -626,7 +627,7 @@ public class TestDataTypeUtils {
|
|||
|
||||
@Test
|
||||
public void testInferTypeWithMapNonStringKeys() {
|
||||
Map<Integer, String> map = new HashMap<>();
|
||||
Map<Integer, String> map = new LinkedHashMap<>();
|
||||
map.put(1, "Hello");
|
||||
map.put(2, "World");
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -78,7 +79,7 @@ public class TestMapRecord {
|
|||
}
|
||||
|
||||
private Set<String> set(final String... values) {
|
||||
final Set<String> set = new HashSet<>();
|
||||
final Set<String> set = new LinkedHashSet<>();
|
||||
for (final String value : values) {
|
||||
set.add(value);
|
||||
}
|
||||
|
@ -122,7 +123,7 @@ public class TestMapRecord {
|
|||
fields.add(new RecordField("foo", RecordFieldType.STRING.getDataType(), null, set("bar", "baz")));
|
||||
|
||||
final RecordSchema schema = new SimpleRecordSchema(fields);
|
||||
final Map<String, Object> values = new HashMap<>();
|
||||
final Map<String, Object> values = new LinkedHashMap<>();
|
||||
values.put("baz", 1);
|
||||
values.put("bar", 33);
|
||||
|
||||
|
@ -161,7 +162,7 @@ public class TestMapRecord {
|
|||
fields.add(new RecordField("foo", RecordFieldType.STRING.getDataType(), "hello", set("bar", "baz")));
|
||||
|
||||
final RecordSchema schema = new SimpleRecordSchema(fields);
|
||||
final Map<String, Object> values = new HashMap<>();
|
||||
final Map<String, Object> values = new LinkedHashMap<>();
|
||||
values.put("baz", 1);
|
||||
values.put("bar", 33);
|
||||
|
||||
|
|
Loading…
Reference in New Issue