Search in sources :

Example 1 with ShardResult

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.shard.result.output.ShardResult in project controller by opendaylight.

the class ClusterAdminRpcServiceTest method verifyShardResults.

private static void verifyShardResults(List<ShardResult> shardResults, ShardResult... expShardResults) {
    Map<String, ShardResult> expResultsMap = new HashMap<>();
    for (ShardResult r : expShardResults) {
        expResultsMap.put(r.getShardName() + "-" + r.getDataStoreType(), r);
    }
    for (ShardResult result : shardResults) {
        ShardResult exp = expResultsMap.remove(result.getShardName() + "-" + result.getDataStoreType());
        assertNotNull(String.format("Unexpected result for shard %s, type %s", result.getShardName(), result.getDataStoreType()), exp);
        assertEquals("isSucceeded", exp.isSucceeded(), result.isSucceeded());
        if (exp.isSucceeded()) {
            assertNull("Expected null error message", result.getErrorMessage());
        } else {
            assertNotNull("Expected error message", result.getErrorMessage());
        }
    }
    if (!expResultsMap.isEmpty()) {
        fail("Missing shard results for " + expResultsMap.keySet());
    }
}
Also used : HashMap(java.util.HashMap) ShardResult(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.shard.result.output.ShardResult) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString)

Aggregations

HashMap (java.util.HashMap)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 ShardResult (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.shard.result.output.ShardResult)1