public void testMetricsSize() { byte[] data = new byte[ClusterMetricsSnapshot.METRICS_SIZE]; // Test serialization. int off = ClusterMetricsSnapshot.serialize(data, 0, createMetrics()); assert off == ClusterMetricsSnapshot.METRICS_SIZE; // Test deserialization. ClusterMetrics res = ClusterMetricsSnapshot.deserialize(data, 0); assert res != null; }
public void testSerialization() { byte[] data = new byte[ClusterMetricsSnapshot.METRICS_SIZE]; ClusterMetrics metrics1 = createMetrics(); // Test serialization. int off = ClusterMetricsSnapshot.serialize(data, 0, metrics1); assert off == ClusterMetricsSnapshot.METRICS_SIZE; // Test deserialization. ClusterMetrics metrics2 = ClusterMetricsSnapshot.deserialize(data, 0); assert metrics2 != null; assert isMetricsEquals(metrics1, metrics2); }
/** Checks compatibility with old serialized metrics. */ public void testMetricsCompatibility() { ClusterMetrics metrics = ClusterMetricsSnapshot.deserialize(METRICS_V1, 0); assert metrics != null; }