/*******************************************************************************
* Copyright (c) 2009, 2010, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Adapted for TMF Trace Model 1.0
*******************************************************************************/
package org.eclipse.linuxtools.tmf.core.tests.trace;
import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpoint;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
/**
- * <b><u>TmfCheckpointTest</u></b>
- * <p>
* Test suite for the TmfCheckpoint class.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class TmfCheckpointTest extends TestCase {
// ------------------------------------------------------------------------
Long aLong1 = 12345L;
Long aLong2 = 23456L;
Long aLong3 = 34567L;
- TmfLocation<Long> fLocation1 = new TmfLocation<Long>(aLong1);
- TmfLocation<Long> fLocation2 = new TmfLocation<Long>(aLong2);
- TmfLocation<Long> fLocation3 = new TmfLocation<Long>(aLong3);
+ ITmfLocation fLocation1 = new TmfLongLocation(aLong1);
+ ITmfLocation fLocation2 = new TmfLongLocation(aLong2);
+ ITmfLocation fLocation3 = new TmfLongLocation(aLong3);
- TmfCheckpoint fCheckpoint1 = new TmfCheckpoint(fTimestamp1, fLocation1);
- TmfCheckpoint fCheckpoint2 = new TmfCheckpoint(fTimestamp2, fLocation2);
- TmfCheckpoint fCheckpoint3 = new TmfCheckpoint(fTimestamp3, fLocation3);
+ TmfCheckpoint fCheckpoint1 = new TmfCheckpoint(fTimestamp1, new TmfContext(fLocation1));
+ TmfCheckpoint fCheckpoint2 = new TmfCheckpoint(fTimestamp2, new TmfContext(fLocation2));
+ TmfCheckpoint fCheckpoint3 = new TmfCheckpoint(fTimestamp3, new TmfContext(fLocation3));
// ------------------------------------------------------------------------
// Housekeeping
assertEquals("TmfCheckpoint", fLocation1, checkpoint.getLocation());
}
- public void testTmfLocationCopy2() throws Exception {
+ public void testTmfLocationCopy2() {
try {
new TmfCheckpoint(null);
fail("null copy");
checkpoint1 = new TmfCheckpoint(fTimestamp1, null);
checkpoint2 = checkpoint1.clone();
assertEquals("clone", checkpoint1, checkpoint2);
- assertNull(checkpoint1.getLocation());
- assertNull(checkpoint2.getLocation());
+ assertNull(checkpoint1.getContext());
+ assertNull(checkpoint2.getContext());
- checkpoint1 = new TmfCheckpoint(null, fLocation1);
+ checkpoint1 = new TmfCheckpoint(null, new TmfContext(fLocation1));
checkpoint3 = checkpoint1.clone();
assertEquals("clone", checkpoint1, checkpoint3);
assertNull(checkpoint1.getTimestamp());
}
public void testCompareToNull() {
- final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, fLocation1);
- final TmfCheckpoint checkpoint2 = new TmfCheckpoint(null, fLocation2);
- final TmfCheckpoint checkpoint3 = new TmfCheckpoint(null, fLocation3);
- final TmfCheckpoint checkpoint4 = new TmfCheckpoint(null, fLocation1);
+ final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, new TmfContext(fLocation1));
+ final TmfCheckpoint checkpoint2 = new TmfCheckpoint(null, new TmfContext(fLocation2));
+ final TmfCheckpoint checkpoint3 = new TmfCheckpoint(null, new TmfContext(fLocation3));
+ final TmfCheckpoint checkpoint4 = new TmfCheckpoint(null, new TmfContext(fLocation1));
// Test the various 'null' vs. '!null' combinations
assertEquals("compareTo", 0, checkpoint1.compareTo(fCheckpoint1));
// hashCode
// ------------------------------------------------------------------------
- public void testHashCode() throws Exception {
+ public void testHashCode() {
final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fCheckpoint2);
assertTrue("hashCode", fCheckpoint2.hashCode() != checkpoint1.hashCode());
}
- public void testHashCodeNull() throws Exception {
- final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, fLocation1);
+ public void testHashCodeNull() {
+ final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, new TmfContext(fLocation1));
final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp1, null);
final TmfCheckpoint checkpoint3 = new TmfCheckpoint(checkpoint1);
final TmfCheckpoint checkpoint4 = new TmfCheckpoint(checkpoint2);
// equals
// ------------------------------------------------------------------------
- public void testEqualsReflexivity() throws Exception {
+ public void testEqualsReflexivity() {
assertTrue("equals", fCheckpoint1.equals(fCheckpoint1));
assertTrue("equals", fCheckpoint2.equals(fCheckpoint2));
assertTrue("equals", !fCheckpoint2.equals(fCheckpoint1));
}
- public void testEqualsSymmetry() throws Exception {
+ public void testEqualsSymmetry() {
final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fCheckpoint2);
assertTrue("equals", fCheckpoint2.equals(checkpoint2));
}
- public void testEqualsTransivity() throws Exception {
+ public void testEqualsTransivity() {
final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
final TmfCheckpoint checkpoint2 = new TmfCheckpoint(checkpoint1);
final TmfCheckpoint checkpoint3 = new TmfCheckpoint(checkpoint2);
assertTrue("equals", checkpoint1.equals(checkpoint3));
}
- public void testNotEqual() throws Exception {
+ public void testNotEqual() {
// Various checkpoints
- final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fTimestamp1, fLocation1);
- final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp2, fLocation1);
- final TmfCheckpoint checkpoint3 = new TmfCheckpoint(fTimestamp1, fLocation2);
+ final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fTimestamp1, new TmfContext(fLocation1));
+ final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp2, new TmfContext(fLocation1));
+ final TmfCheckpoint checkpoint3 = new TmfCheckpoint(fTimestamp1, new TmfContext(fLocation2));
final TmfCheckpoint checkpoint4 = new TmfCheckpoint(fTimestamp1, null);
- final TmfCheckpoint checkpoint5 = new TmfCheckpoint(null, fLocation1);
+ final TmfCheckpoint checkpoint5 = new TmfCheckpoint(null, new TmfContext(fLocation1));
// Null check
assertFalse("equals", checkpoint1.equals(null));
// ------------------------------------------------------------------------
public void testToString() {
- final String expected1 = "TmfCheckpoint [fLocation=" + fCheckpoint1.getLocation() +
+ final String expected1 = "TmfCheckpoint [fContext=" + fCheckpoint1.getContext() +
", fTimestamp=" + fCheckpoint1.getTimestamp() + "]";
- final String expected2 = "TmfCheckpoint [fLocation=" + fCheckpoint2.getLocation() +
+ final String expected2 = "TmfCheckpoint [fContext=" + fCheckpoint2.getContext() +
", fTimestamp=" + fCheckpoint2.getTimestamp() + "]";
- final String expected3 = "TmfCheckpoint [fLocation=" + fCheckpoint3.getLocation() +
+ final String expected3 = "TmfCheckpoint [fContext=" + fCheckpoint3.getContext() +
", fTimestamp=" + fCheckpoint3.getTimestamp() + "]";
assertEquals("toString", expected1, fCheckpoint1.toString());