Search in sources :

Example 1 with AbstractModification

use of org.opendaylight.controller.cluster.datastore.modification.AbstractModification in project controller by opendaylight.

the class AbstractTransactionProxyTest method verifyBatchedModifications.

protected void verifyBatchedModifications(final Object message, final boolean expIsReady, final boolean expIsDoCommitOnReady, final Modification... expected) {
    assertEquals("Message type", BatchedModifications.class, message.getClass());
    BatchedModifications batchedModifications = (BatchedModifications) message;
    assertEquals("BatchedModifications size", expected.length, batchedModifications.getModifications().size());
    assertEquals("isReady", expIsReady, batchedModifications.isReady());
    assertEquals("isDoCommitOnReady", expIsDoCommitOnReady, batchedModifications.isDoCommitOnReady());
    for (int i = 0; i < batchedModifications.getModifications().size(); i++) {
        Modification actual = batchedModifications.getModifications().get(i);
        assertEquals("Modification type", expected[i].getClass(), actual.getClass());
        assertEquals("getPath", ((AbstractModification) expected[i]).getPath(), ((AbstractModification) actual).getPath());
        if (actual instanceof WriteModification) {
            assertEquals("getData", ((WriteModification) expected[i]).getData(), ((WriteModification) actual).getData());
        }
    }
}
Also used : WriteModification(org.opendaylight.controller.cluster.datastore.modification.WriteModification) Modification(org.opendaylight.controller.cluster.datastore.modification.Modification) AbstractModification(org.opendaylight.controller.cluster.datastore.modification.AbstractModification) WriteModification(org.opendaylight.controller.cluster.datastore.modification.WriteModification) BatchedModifications(org.opendaylight.controller.cluster.datastore.messages.BatchedModifications)

Aggregations

BatchedModifications (org.opendaylight.controller.cluster.datastore.messages.BatchedModifications)1 AbstractModification (org.opendaylight.controller.cluster.datastore.modification.AbstractModification)1 Modification (org.opendaylight.controller.cluster.datastore.modification.Modification)1 WriteModification (org.opendaylight.controller.cluster.datastore.modification.WriteModification)1