import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import org.junit.Test;
import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
import org.junit.Test;
import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
- @Test(expected = NullPointerException.class)
- public final void testCreateMetadataSnapshotNullInput() {
- new FrontendShardDataTreeSnapshotMetadata(null);
+ @Test
+ public void testCreateMetadataSnapshotNullInput() {
+ assertThrows(NullPointerException.class, () -> new FrontendShardDataTreeSnapshotMetadata(null));
final FrontendShardDataTreeSnapshotMetadata emptyOrigSnapshot = createEmptyMetadataSnapshot();
final FrontendShardDataTreeSnapshotMetadata emptyCopySnapshot = copy(emptyOrigSnapshot, 127);
testMetadataSnapshotEqual(emptyOrigSnapshot, emptyCopySnapshot);
}
@Test
final FrontendShardDataTreeSnapshotMetadata emptyOrigSnapshot = createEmptyMetadataSnapshot();
final FrontendShardDataTreeSnapshotMetadata emptyCopySnapshot = copy(emptyOrigSnapshot, 127);
testMetadataSnapshotEqual(emptyOrigSnapshot, emptyCopySnapshot);
}
@Test
final FrontendShardDataTreeSnapshotMetadata origSnapshot = createMetadataSnapshot(1);
final FrontendShardDataTreeSnapshotMetadata copySnapshot = copy(origSnapshot, 162);
testMetadataSnapshotEqual(origSnapshot, copySnapshot);
}
@Test
final FrontendShardDataTreeSnapshotMetadata origSnapshot = createMetadataSnapshot(1);
final FrontendShardDataTreeSnapshotMetadata copySnapshot = copy(origSnapshot, 162);
testMetadataSnapshotEqual(origSnapshot, copySnapshot);
}
@Test
final FrontendShardDataTreeSnapshotMetadata origSnapshot = createMetadataSnapshot(5);
final FrontendShardDataTreeSnapshotMetadata copySnapshot = copy(origSnapshot, 314);
testMetadataSnapshotEqual(origSnapshot, copySnapshot);
final FrontendShardDataTreeSnapshotMetadata origSnapshot = createMetadataSnapshot(5);
final FrontendShardDataTreeSnapshotMetadata copySnapshot = copy(origSnapshot, 314);
testMetadataSnapshotEqual(origSnapshot, copySnapshot);
final List<FrontendClientMetadata> origClientList = origSnapshot.getClients();
final List<FrontendClientMetadata> copyClientList = copySnapshot.getClients();
final List<FrontendClientMetadata> origClientList = origSnapshot.getClients();
final List<FrontendClientMetadata> copyClientList = copySnapshot.getClients();
final Map<ClientIdentifier, FrontendClientMetadata> origIdent = new HashMap<>();
final Map<ClientIdentifier, FrontendClientMetadata> copyIdent = new HashMap<>();
final Map<ClientIdentifier, FrontendClientMetadata> origIdent = new HashMap<>();
final Map<ClientIdentifier, FrontendClientMetadata> copyIdent = new HashMap<>();
origIdent.values().forEach(client -> {
final FrontendClientMetadata copyClient = copyIdent.get(client.getIdentifier());
testObject(client.getIdentifier(), copyClient.getIdentifier());
origIdent.values().forEach(client -> {
final FrontendClientMetadata copyClient = copyIdent.get(client.getIdentifier());
testObject(client.getIdentifier(), copyClient.getIdentifier());
- assertTrue(client.getPurgedHistories().equals(copyClient.getPurgedHistories()));
- assertTrue(client.getCurrentHistories().equals(copyClient.getCurrentHistories()));
+ assertEquals(client.getPurgedHistories(), copyClient.getPurgedHistories());
+ assertEquals(client.getCurrentHistories(), copyClient.getCurrentHistories());
final ClientIdentifier clientIdentifier = ClientIdentifier.create(frontendIdentifier, num);
final RangeSet<UnsignedLong> purgedHistories = TreeRangeSet.create();
final ClientIdentifier clientIdentifier = ClientIdentifier.create(frontendIdentifier, num);
final RangeSet<UnsignedLong> purgedHistories = TreeRangeSet.create();
new FrontendHistoryMetadata(num, num, true, ImmutableMap.of(UnsignedLong.ZERO, Boolean.TRUE),
purgedHistories));
new FrontendHistoryMetadata(num, num, true, ImmutableMap.of(UnsignedLong.ZERO, Boolean.TRUE),
purgedHistories));