本文整理了Java中io.airlift.testing.Assertions.assertEqualsIgnoreOrder()
方法的一些代码示例,展示了Assertions.assertEqualsIgnoreOrder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assertions.assertEqualsIgnoreOrder()
方法的具体详情如下:
包路径:io.airlift.testing.Assertions
类名称:Assertions
方法名:assertEqualsIgnoreOrder
暂无
代码示例来源:origin: prestodb/presto
private void testJsonEquals(String json, Map<String, Object> expectedMap)
throws Exception
{
Map<String, Object> jsonMap = objectMapper.readValue(json, new TypeReference<Map<String, Object>>() {});
assertEqualsIgnoreOrder(jsonMap.entrySet(), expectedMap.entrySet());
}
}
代码示例来源:origin: prestodb/presto
private void testJsonEquals(String json, Map<String, Object> expectedMap)
throws Exception
{
Map<String, Object> jsonMap = objectMapper.readValue(json, new TypeReference<Map<String, Object>>() {});
assertEqualsIgnoreOrder(jsonMap.entrySet(), expectedMap.entrySet());
}
}
代码示例来源:origin: prestodb/presto
private void testJsonEquals(String json, Map<String, Object> expectedMap)
throws Exception
{
Map<String, Object> jsonMap = objectMapper.readValue(json, new TypeReference<Map<String, Object>>() {});
assertEqualsIgnoreOrder(jsonMap.entrySet(), expectedMap.entrySet());
}
}
代码示例来源:origin: prestodb/presto
private void testJsonEquals(String json, Map<String, Object> expectedMap)
throws Exception
{
Map<String, Object> jsonMap = objectMapper.readValue(json, new TypeReference<Map<String, Object>>() {});
assertEqualsIgnoreOrder(jsonMap.entrySet(), expectedMap.entrySet());
}
}
代码示例来源:origin: prestodb/presto
@Test
public void testGetAllNodes()
{
DiscoveryNodeManager manager = new DiscoveryNodeManager(selector, nodeInfo, new NoOpFailureDetector(), expectedVersion, testHttpClient, internalCommunicationConfig);
AllNodes allNodes = manager.getAllNodes();
Set<Node> activeNodes = allNodes.getActiveNodes();
assertEqualsIgnoreOrder(activeNodes, this.activeNodes);
for (Node actual : activeNodes) {
for (Node expected : this.activeNodes) {
assertNotSame(actual, expected);
}
}
assertEqualsIgnoreOrder(activeNodes, manager.getNodes(ACTIVE));
Set<Node> inactiveNodes = allNodes.getInactiveNodes();
assertEqualsIgnoreOrder(inactiveNodes, this.inactiveNodes);
for (Node actual : inactiveNodes) {
for (Node expected : this.inactiveNodes) {
assertNotSame(actual, expected);
}
}
assertEqualsIgnoreOrder(inactiveNodes, manager.getNodes(INACTIVE));
}
代码示例来源:origin: prestodb/presto
public static void assertWindowQuery(@Language("SQL") String sql, MaterializedResult expected, LocalQueryRunner localQueryRunner)
{
@Language("SQL") String query = format("" +
"SELECT orderkey, orderstatus,\n%s\n" +
"FROM (%s) x", sql, VALUES);
MaterializedResult actual = localQueryRunner.execute(query);
assertEqualsIgnoreOrder(actual.getMaterializedRows(), expected.getMaterializedRows());
}
代码示例来源:origin: prestodb/presto
public static void assertOperatorEqualsIgnoreOrder(
OperatorFactory operatorFactory,
DriverContext driverContext,
List<Page> input,
MaterializedResult expected,
boolean hashEnabled,
Optional<Integer> hashChannel)
{
List<Page> pages = toPages(operatorFactory, driverContext, input);
if (hashEnabled && hashChannel.isPresent()) {
// Drop the hashChannel for all pages
pages = dropChannel(pages, ImmutableList.of(hashChannel.get()));
}
MaterializedResult actual = toMaterializedResult(driverContext.getSession(), expected.getTypes(), pages);
assertEqualsIgnoreOrder(actual.getMaterializedRows(), expected.getMaterializedRows());
}
代码示例来源:origin: prestodb/presto
public static void assertWindowQueryWithNulls(@Language("SQL") String sql, MaterializedResult expected, LocalQueryRunner localQueryRunner)
{
MaterializedResult actual = executeWindowQueryWithNulls(sql, localQueryRunner);
assertEqualsIgnoreOrder(actual.getMaterializedRows(), expected.getMaterializedRows());
}
代码示例来源:origin: prestodb/presto
protected void assertExpectedTableLayout(ConnectorTableLayout actualTableLayout, ConnectorTableLayout expectedTableLayout)
{
assertExpectedTableLayoutHandle(actualTableLayout.getHandle(), expectedTableLayout.getHandle());
assertEquals(actualTableLayout.getPredicate(), expectedTableLayout.getPredicate());
assertEquals(actualTableLayout.getDiscretePredicates().isPresent(), expectedTableLayout.getDiscretePredicates().isPresent());
actualTableLayout.getDiscretePredicates().ifPresent(actual -> {
DiscretePredicates expected = expectedTableLayout.getDiscretePredicates().get();
assertEquals(actual.getColumns(), expected.getColumns());
assertEqualsIgnoreOrder(actual.getPredicates(), expected.getPredicates());
});
assertEquals(actualTableLayout.getStreamPartitioningColumns(), expectedTableLayout.getStreamPartitioningColumns());
assertEquals(actualTableLayout.getLocalProperties(), expectedTableLayout.getLocalProperties());
}
代码示例来源:origin: prestodb/presto
assertEqualsIgnoreOrder(list, ImmutableList.of(test1, test2));
代码示例来源:origin: prestodb/presto
static class HiveTransaction
implements Transaction
{
private final HiveTransactionManager transactionManager;
private final ConnectorTransactionHandle transactionHandle;
private boolean closed;
public HiveTransaction(HiveTransactionManager transactionManager, HiveMetadata hiveMetadata)
{
this.transactionManager = requireNonNull(transactionManager, "transactionManager is null");
this.transactionHandle = new HiveTransactionHandle();
transactionManager.put(transactionHandle, hiveMetadata);
getMetastore().testOnlyThrowOnCleanupFailures();
}
@Override
public ConnectorMetadata getMetadata()
{
return transactionManager.get(transactionHandle);
}
@Override
public SemiTransactionalHiveMetastore getMetastore(String schema)
{
return getMetastore();
}
private SemiTransactionalHiveMetastore getMetastore()
{
return ((HiveMetadata) transactionManager.get(transactionHandle)).getMetastore();
代码示例来源:origin: prestodb/presto
public void assertQuery(@Language("SQL") String actual, @Language("SQL") String expected, boolean ensureOrdering)
{
MaterializedResult actualResults = null;
try {
actualResults = runner.execute(runner.getDefaultSession(), actual).toTestTypes();
}
catch (RuntimeException ex) {
fail("Execution of 'actual' query failed: " + actual, ex);
}
MaterializedResult expectedResults = null;
try {
expectedResults = runner.execute(runner.getDefaultSession(), expected).toTestTypes();
}
catch (RuntimeException ex) {
fail("Execution of 'expected' query failed: " + expected, ex);
}
assertEquals(actualResults.getTypes(), expectedResults.getTypes(), "Types mismatch for query: \n " + actual + "\n:");
List<MaterializedRow> actualRows = actualResults.getMaterializedRows();
List<MaterializedRow> expectedRows = expectedResults.getMaterializedRows();
if (ensureOrdering) {
if (!actualRows.equals(expectedRows)) {
assertEquals(actualRows, expectedRows, "For query: \n " + actual + "\n:");
}
}
else {
assertEqualsIgnoreOrder(actualRows, expectedRows, "For query: \n " + actual);
}
}
代码示例来源:origin: prestodb/presto
assertEqualsIgnoreOrder(partitionNames, CREATE_TABLE_PARTITIONED_DATA.getMaterializedRows().stream()
.map(row -> "ds=" + row.getField(CREATE_TABLE_PARTITIONED_DATA.getTypes().size() - 1))
.collect(toList()));
assertEqualsIgnoreOrder(result.getMaterializedRows(), CREATE_TABLE_PARTITIONED_DATA.getMaterializedRows());
assertEqualsIgnoreOrder(result.getMaterializedRows(), CREATE_TABLE_PARTITIONED_DATA.getMaterializedRows());
代码示例来源:origin: prestodb/presto
assertEqualsIgnoreOrder(result.getMaterializedRows(), CREATE_TABLE_DATA.getMaterializedRows());
代码示例来源:origin: prestodb/presto
assertEqualsIgnoreOrder(partitionNames, CREATE_TABLE_PARTITIONED_DATA.getMaterializedRows().stream()
.map(row -> "ds=" + row.getField(CREATE_TABLE_PARTITIONED_DATA.getTypes().size() - 1))
.collect(toList()));
assertEqualsIgnoreOrder(result.getMaterializedRows(), resultBuilder.build().getMaterializedRows());
assertEqualsIgnoreOrder(result.getMaterializedRows(), resultBuilder.build().getMaterializedRows());
代码示例来源:origin: prestodb/presto
assertEqualsIgnoreOrder(partitionNames, CREATE_TABLE_PARTITIONED_DATA.getMaterializedRows().stream()
.map(row -> "ds=" + row.getField(CREATE_TABLE_PARTITIONED_DATA.getTypes().size() - 1))
.collect(toList()));
List<ColumnHandle> columnHandles = filterNonHiddenColumnHandles(metadata.getColumnHandles(session, tableHandle).values());
MaterializedResult result = readTable(transaction, tableHandle, columnHandles, session, TupleDomain.all(), OptionalInt.empty(), Optional.of(storageFormat));
assertEqualsIgnoreOrder(result.getMaterializedRows(), expectedResultBuilder.build().getMaterializedRows());
.collect(toImmutableList());
MaterializedResult actualAfterDelete = readTable(transaction, tableHandle, columnHandles, session, TupleDomain.all(), OptionalInt.empty(), Optional.of(storageFormat));
assertEqualsIgnoreOrder(actualAfterDelete.getMaterializedRows(), expectedRows);
assertEqualsIgnoreOrder(actualAfterDelete2.getMaterializedRows(), ImmutableList.of());
代码示例来源:origin: prestodb/presto
assertEqualsIgnoreOrder(result.getMaterializedRows(), dataBefore.getMaterializedRows());
transaction.commit();
assertEqualsIgnoreOrder(result.getMaterializedRows(), dataAfter.getMaterializedRows());
代码示例来源:origin: prestodb/presto
assertEqualsIgnoreOrder(result.getMaterializedRows(), resultBuilder.build().getMaterializedRows());
List<ColumnHandle> columnHandles = filterNonHiddenColumnHandles(metadata.getColumnHandles(session, tableHandle).values());
MaterializedResult result = readTable(transaction, tableHandle, columnHandles, session, TupleDomain.all(), OptionalInt.empty(), Optional.empty());
assertEqualsIgnoreOrder(result.getMaterializedRows(), resultBuilder.build().getMaterializedRows());
代码示例来源:origin: prestodb/presto
assertEqualsIgnoreOrder(result.getMaterializedRows(), data.getMaterializedRows());
代码示例来源:origin: prestodb/presto
assertEqualsIgnoreOrder(actual.getMaterializedRows(), expectedResult.getMaterializedRows());
内容来源于网络,如有侵权,请联系作者删除!