*/
public class AllTmfCoreTests {
+ /**
+ * @return the TMF Core test suite
+ */
public static Test suite() {
TestSuite suite = new TestSuite(AllTmfCoreTests.class.getName());
//$JUnit-BEGIN$
/*******************************************************************************
* Copyright (c) 2009, 2010 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
*******************************************************************************/
// Plug-in instantiation
static final Activator fPlugin = new Activator();
-
+
// ------------------------------------------------------------------------
// Housekeping
// ------------------------------------------------------------------------
// Test cases
// ------------------------------------------------------------------------
- public void testTmfCorePluginId() throws Exception {
+ /**
+ *
+ */
+ public void testTmfCorePluginId() {
assertEquals("Plugin ID", "org.eclipse.linuxtools.tmf.core", Activator.PLUGIN_ID);
}
- public void testGetDefault() throws Exception {
+ /**
+ *
+ */
+ public void testGetDefault() {
Activator plugin = Activator.getDefault();
assertEquals("getDefault()", plugin, fPlugin);
}
/*******************************************************************************
* Copyright (c) 2009, 2010 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
*******************************************************************************/
// ------------------------------------------------------------------------
// The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.linuxtools.tmf.tests";
+ @SuppressWarnings("javadoc")
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.tmf.tests";
// The shared instance
private static TmfCoreTestPlugin fPlugin;
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
import junit.framework.Test;
import junit.framework.TestSuite;
+/**
+ * <b><u>AllTests</u></b>
+ * <p>
+ * Implement me. Please.
+ * <p>
+ */
public class AllTests {
+ /**
+ * @return the TMF Core Component test suite
+ */
public static Test suite() {
TestSuite suite = new TestSuite(AllTests.class.getName());
//$JUnit-BEGIN$
TmfEventProviderStub fEventProvider;
TmfSyntheticEventProviderStub fSyntheticEventProvider;
+ /**
+ * @param name the test anme
+ */
public TmfEventProviderTest(String name) {
super(name);
}
// getProviders (more a sanity check than a test)
// ------------------------------------------------------------------------
- @SuppressWarnings("unchecked")
+ /**
+ *
+ */
public void testGetProviders() {
// There should be 2 TmfEvent providers: a TmfTraceStub and a
// getSyntheticEvent
// ------------------------------------------------------------------------
- @SuppressWarnings("unchecked")
+ /**
+ *
+ */
public void testGetPlainEvents() {
final int BLOCK_SIZE = 100;
}
}
- @SuppressWarnings("unchecked")
+ /**
+ *
+ */
public void testCancelRequests() {
final int BLOCK_SIZE = 100;
}
}
- @SuppressWarnings("unchecked")
private static void getSyntheticData(final TmfTimeRange range,
final int nbEvents, final int blockSize) throws InterruptedException {
}
}
+ /**
+ *
+ */
// The following tests are the same but for the size of the requested blocks
// with regards to the size of the TmfSyntheticEventProviderStub block
public void testGetSyntheticEvents_EqualBlockSizes() {
}
}
+ /**
+ *
+ */
public void testGetSyntheticEvents_SmallerBlock() {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
try {
}
}
+ /**
+ *
+ */
public void testGetSyntheticEvents_LargerBlock() {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
try {
}
}
+ /**
+ *
+ */
public void testGetSyntheticEvents_TimeRange() {
TmfTimestamp start = new TmfTimestamp(1, (byte) -3, 0);
TmfTimestamp end = new TmfTimestamp(1000, (byte) -3, 0);
// getProviders (more a sanity check than a test)
// ------------------------------------------------------------------------
- @SuppressWarnings("unchecked")
+ /**
+ *
+ */
public void testGetProviders2() {
// There should be 2 TmfEvent providers: a TmfTraceStub and a
/*******************************************************************************
* Copyright (c) 2009, 2010 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
*******************************************************************************/
@SuppressWarnings({ "nls" })
public class TmfProviderManagerTest extends TestCase {
+ /**
+ * @param name the test anme
+ */
public TmfProviderManagerTest(String name) {
super(name);
}
// ------------------------------------------------------------------------
// Dummy Providers
// ------------------------------------------------------------------------
-
- public class TestProvider1 extends TmfDataProvider<TmfEvent> {
+
+ private class TestProvider1 extends TmfDataProvider<TmfEvent> {
public TestProvider1(Class<TmfEvent> type) {
super("TestProvider1", type);
}
}
}
- public class TestProvider2 extends TmfDataProvider<TmfEvent> {
+ private class TestProvider2 extends TmfDataProvider<TmfEvent> {
public TestProvider2(Class<TmfEvent> type) {
super("TestProvider2", type);
}
}
}
- public class TmfEvent3 extends TmfEvent {
- public TmfEvent3(TmfEvent3 other) {
+ private class TmfEvent3 extends TmfEvent {
+ @SuppressWarnings("unused")
+ public TmfEvent3(TmfEvent3 other) {
super(other);
}
}
- public class TestProvider3 extends TmfDataProvider<TmfEvent3> {
+ private class TestProvider3 extends TmfDataProvider<TmfEvent3> {
public TestProvider3(Class<TmfEvent3> type) {
super("TestProvider3", type);
}
// register/dispose
// ------------------------------------------------------------------------
- @SuppressWarnings("unchecked")
+ /**
+ *
+ */
public void testRegister_0() {
TmfDataProvider<TmfEvent>[] providers = (TmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class);
assertEquals("getProviders", 0, providers.length);
assertEquals("getProviders", 0, providers.length);
}
- @SuppressWarnings("unchecked")
+ /**
+ *
+ */
public void testRegister_Unregister_1() {
// Register a single provider
assertEquals("getProviders", 0, providers.length);
}
- @SuppressWarnings("unchecked")
+ /**
+ *
+ */
public void testRegister_Unregister_2() {
// Register 2 providers, same data type
assertEquals("getProviders", 0, providers.length);
}
- @SuppressWarnings("unchecked")
+ /**
+ *
+ */
public void testRegister_Unregister_3() {
// Register 3 providers, mixed data types
assertEquals("getProviders", 0, providers.length);
}
- @SuppressWarnings("unchecked")
+ /**
+ *
+ */
public void testGetProvider() {
// Register 3 providers, mixed data types
* Context fuzzer. Use an amount of contexts greater than the size of the
* iterator cache and have them access the trace in parallel.
*
- * @throws TmfTraceException
- * Would fail the test
* @throws InterruptedException
* Would fail the test
*/
@Test
- public void testTooManyContexts() throws TmfTraceException, InterruptedException {
+ public void testTooManyContexts() throws InterruptedException {
final int lwcCount = 101;
double increment = (end - begin) / lwcCount;
final ArrayList<Long> vals = new ArrayList<Long>();
/*******************************************************************************
* Copyright (c) 2009, 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 - Adjusted for new Event Model
@SuppressWarnings({ "nls" })
public class AllTests {
+ /**
+ * @return the CTF COre Event test suite
+ */
public static Test suite() {
final TestSuite suite = new TestSuite("Test suite for " + Activator.PLUGIN_ID + ".event"); //$NON-NLS-1$;
//$JUnit-BEGIN$
/*******************************************************************************
* Copyright (c) 2009, 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 - Adjusted for new Event Model
// Constructors
// ------------------------------------------------------------------------
+ /**
+ *
+ */
public void testTerminalStructConstructor() {
assertSame("getName", fFieldName1, fStructTerminalField1.getName());
assertNull("getValue", fStructTerminalField1.getValue());
assertNull("getFieldName", fStructTerminalField1.getFieldName(0));
}
+ /**
+ *
+ */
public void testNonTerminalStructConstructor() {
assertSame("getName", fStructRootFieldName, fStructRootField.getName());
assertNull("getValue", fStructRootField.getValue());
assertNull("getFieldName", fStructRootField.getFieldName(names.length));
}
+ /**
+ *
+ */
public void testTerminalConstructor() {
assertSame("getName", fFieldName1, fField1.getName());
assertSame("getValue", fValue1, fField1.getValue());
assertNull("getFieldName", fField2.getFieldName(0));
}
+ /**
+ *
+ */
public void testNonTerminalConstructor() {
assertSame("getName", fRootFieldName, fRootField.getName());
assertNull("getValue", fRootField.getValue());
assertNull("getFieldName", fRootField.getFieldName(names.length));
}
+ /**
+ *
+ */
public void testConstructorBadArg() {
try {
new TmfEventField(null, fValue1, null);
}
}
+ /**
+ *
+ */
public void testTerminalCopyConstructor() {
final TmfEventField copy = new TmfEventField(fField1);
assertSame("getName", fFieldName1, copy.getName());
assertNull("getFieldName", copy.getFieldName(0));
}
+ /**
+ *
+ */
public void testNonTerminalCopyConstructor() {
assertSame("getName", fRootFieldName, fRootField.getName());
assertNull("getValue", fRootField.getValue());
assertNull("getFieldName", fRootField.getFieldName(names.length));
}
+ /**
+ *
+ */
public void testCopyConstructorBadArg() {
try {
new TmfEventField(null);
}
}
+ /**
+ *
+ */
public void testSetValue() {
final TmfEventField field = new TmfEventField(fFieldName1, fValue1, null);
// clone
// ------------------------------------------------------------------------
- public void testFieldClone() throws Exception {
+ /**
+ *
+ */
+ public void testFieldClone() {
TmfEventField clone = fField1.clone();
assertTrue("clone", fField1.clone().equals(fField1));
assertTrue("clone", clone.clone().equals(clone));
assertEquals("clone", clone, fRootField);
}
- public void testStructFieldClone() throws Exception {
+ /**
+ *
+ */
+ public void testStructFieldClone() {
TmfEventField clone = fStructTerminalField1.clone();
assertTrue("clone", fStructTerminalField1.clone().equals(fStructTerminalField1));
assertTrue("clone", clone.clone().equals(clone));
// hashCode
// ------------------------------------------------------------------------
- public void testHashCode() throws Exception {
+ /**
+ *
+ */
+ public void testHashCode() {
TmfEventField copy = new TmfEventField(fField1);
assertTrue("hashCode", fField1.hashCode() == copy.hashCode());
assertTrue("hashCode", fField1.hashCode() != fField2.hashCode());
// equals
// ------------------------------------------------------------------------
- public void testEqualsReflexivity() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsReflexivity() {
assertTrue("equals", fField1.equals(fField1));
assertTrue("equals", fField2.equals(fField2));
assertFalse("equals", fStructTerminalField2.equals(fStructTerminalField1));
}
- public void testEqualsSymmetry() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsSymmetry() {
final TmfEventField copy0 = new TmfEventField(fField1);
assertTrue("equals", fField1.equals(copy0));
assertTrue("equals", copy0.equals(fField1));
assertTrue("equals", copy3.equals(fField2));
}
- public void testEqualsTransivity() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsTransivity() {
TmfEventField copy1 = new TmfEventField(fField1);
TmfEventField copy2 = new TmfEventField(copy1);
assertTrue("equals", fField1.equals(copy1));
assertTrue("equals", fField2.equals(copy2));
}
- public void testEquals() throws Exception {
+ /**
+ *
+ */
+ public void testEquals() {
assertTrue("equals", fStructTerminalField1.equals(fStructTerminalField3));
assertTrue("equals", fStructTerminalField3.equals(fStructTerminalField1));
assertFalse("equals", fField3.equals(fStructTerminalField1));
}
- public void testEqualsNull() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsNull() {
assertFalse("equals", fField1.equals(null));
assertFalse("equals", fField2.equals(null));
}
- public void testNonEqualClasses() throws Exception {
+ /**
+ *
+ */
+ public void testNonEqualClasses() {
assertFalse("equals", fField1.equals(fStructTerminalField1));
assertFalse("equals", fField1.equals(fValue1));
}
- public void testNonEqualValues() throws Exception {
+ /**
+ *
+ */
+ public void testNonEqualValues() {
final TmfEventField copy1 = new TmfEventField(fFieldName1, fValue1);
TmfEventField copy2 = new TmfEventField(fFieldName1, fValue1);
assertTrue("equals", copy1.equals(copy2));
assertFalse("equals", copy2.equals(copy1));
}
- public void testNonEquals() throws Exception {
+ /**
+ *
+ */
+ public void testNonEquals() {
assertFalse("equals", fField1.equals(fField2));
assertFalse("equals", fField2.equals(fField1));
// toString
// ------------------------------------------------------------------------
+ /**
+ *
+ */
public void testToString() {
final String expected1 = "TmfEventField [fFieldId=" + fFieldName1 + ", fValue=" + fValue1.toString() + "]";
TmfEventField field = new TmfEventField(fFieldName1, fValue1, null);
// makeRoot
// ------------------------------------------------------------------------
+ /**
+ *
+ */
public void testMakeRoot() {
ITmfEventField root = TmfEventField.makeRoot(fStructFieldNames);
String[] names = root.getFieldNames();
/*******************************************************************************
* Copyright (c) 2009, 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 - Adjusted for new Event Model
// Constructors
// ------------------------------------------------------------------------
+ /**
+ *
+ */
public void testDefaultConstructor() {
final ITmfEvent event = new TmfEvent();
assertNull("getTrace", event.getTrace());
assertNull("getReference", event.getReference());
}
+ /**
+ *
+ */
public void testFullConstructor() {
assertNull("getTrace", fEvent1.getTrace());
assertEquals("getRank", 0, fEvent1.getRank());
assertEquals("getReference", fReference2, fEvent2.getReference());
}
+ /**
+ *
+ */
public void testNoRankConstructor() {
final TmfEvent event = new TmfEvent(null, fTimestamp1, fSource, fType, fContent1, fReference1);
assertNull("getTrace", event.getTrace());
assertEquals("getReference", fReference1, event.getReference());
}
+ /**
+ *
+ */
public void testConstructorWithTrace() {
final ITmfTrace<TmfEvent> trace = openTrace();
final TmfEvent event = new TmfEvent(trace, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
trace.dispose();
}
+ /**
+ *
+ */
public void testTmfEventCopy() {
final TmfEvent event = new TmfEvent(fEvent1);
assertNull("getTrace", event.getTrace());
assertEquals("getReference", fReference1, event.getReference());
}
- public void testEventCopy2() throws Exception {
+ /**
+ *
+ */
+ public void testEventCopy2() {
try {
new TmfEvent(null);
fail("null copy");
return trace;
}
+ /**
+ *
+ */
public void testSetTrace() {
final ITmfTrace<TmfEvent> trace = setupTrace();
assertNotNull(trace);
trace.dispose();
}
+ /**
+ *
+ */
public void testSetRank() {
final TestEvent event = new TestEvent(fEvent1);
assertEquals("setRank", 0, event.getRank());
assertEquals("setRank", 0, event.getRank());
}
+ /**
+ *
+ */
public void testSetTimestamp() {
final TestEvent event = new TestEvent(fEvent1);
assertEquals("setTimestamp", fTimestamp1, event.getTimestamp());
assertEquals("setTimestamp", fTimestamp1, event.getTimestamp());
}
+ /**
+ *
+ */
public void testSetSource() {
final TestEvent event = new TestEvent(fEvent1);
assertEquals("setSource", fSource, event.getSource());
assertEquals("setContent", fSource, event.getSource());
}
+ /**
+ *
+ */
public void testSetType() {
final TestEvent event = new TestEvent(fEvent1);
assertEquals("setType", fType, event.getType());
assertEquals("setType", fType, event.getType());
}
+ /**
+ *
+ */
public void testSetContent() {
final TestEvent event = new TestEvent(fEvent1);
assertEquals("setContent", fContent1, event.getContent());
assertEquals("setContent", fContent1, event.getContent());
}
+ /**
+ *
+ */
public void testSetReference() {
final TestEvent event = new TestEvent(fEvent1);
assertEquals("setReference", fReference1, event.getReference());
// clone
// ------------------------------------------------------------------------
- public static class MyEvent extends TmfEvent {
+ private static class MyEvent extends TmfEvent {
@Override
public boolean equals(final Object other) {
}
}
- public void testClone1() throws Exception {
+ /**
+ *
+ */
+ public void testClone1() {
final ITmfEvent clone = fEvent1.clone();
assertTrue("clone", fEvent1.clone().equals(fEvent1));
assertEquals("clone", clone, fEvent1);
}
- public void testClone2() throws Exception {
+ /**
+ *
+ */
+ public void testClone2() {
final TmfEvent event = new MyEvent();
final TmfEvent clone = event.clone();
// hashCode
// ------------------------------------------------------------------------
- public void testHashCode() throws Exception {
+ /**
+ *
+ */
+ public void testHashCode() {
TmfEvent event1 = new TmfEvent();
TmfEvent event2 = new TmfEvent();
// equals
// ------------------------------------------------------------------------
- public void testEqualsReflexivity() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsReflexivity() {
assertTrue("equals", fEvent1.equals(fEvent1));
assertTrue("equals", fEvent2.equals(fEvent2));
assertFalse("equals", fEvent2.equals(fEvent1));
}
- public void testEqualsSymmetry() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsSymmetry() {
final TmfEvent event1 = new TmfEvent(fEvent1);
final TmfEvent event2 = new TmfEvent(fEvent2);
assertTrue("equals", fEvent2.equals(event2));
}
- public void testEqualsTransivity() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsTransivity() {
final TmfEvent event1 = new TmfEvent(fEvent1);
final TmfEvent event2 = new TmfEvent(fEvent1);
final TmfEvent event3 = new TmfEvent(fEvent1);
assertTrue("equals", event1.equals(event3));
}
- public void testEqualsNull() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsNull() {
assertFalse("equals", fEvent1.equals(null));
assertFalse("equals", fEvent2.equals(null));
}
- public void testNonEqualClasses() throws Exception {
+ /**
+ *
+ */
+ public void testNonEqualClasses() {
assertFalse("equals", fEvent1.equals(fEvent1.getType()));
assertFalse("equals", fEvent1.equals(null));
}
- public void testNonEqualTraces() throws Exception {
+ /**
+ *
+ */
+ public void testNonEqualTraces() {
final ITmfTrace<TmfEvent> trace1 = openTrace();
final ITmfTrace<TmfEvent> trace2 = openTrace();
trace2.dispose();
}
- public void testNonEqualRanks() throws Exception {
+ /**
+ *
+ */
+ public void testNonEqualRanks() {
final TmfEvent event1 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
TmfEvent event2 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
assertTrue("equals", event1.equals(event2));
assertFalse("equals", event2.equals(event1));
}
- public void testNonEqualTimestamps() throws Exception {
+ /**
+ *
+ */
+ public void testNonEqualTimestamps() {
final TmfEvent event1 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
TmfEvent event2 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
assertTrue("equals", event1.equals(event2));
assertFalse("equals", event2.equals(event1));
}
- public void testNonEqualSources() throws Exception {
+ /**
+ *
+ */
+ public void testNonEqualSources() {
final TmfEvent event1 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
TmfEvent event2 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
assertTrue("equals", event1.equals(event2));
assertFalse("equals", event2.equals(event1));
}
- public void testNonEqualTypes() throws Exception {
+ /**
+ *
+ */
+ public void testNonEqualTypes() {
final TmfEvent event1 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
TmfEvent event2 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
assertTrue("equals", event1.equals(event2));
assertFalse("equals", event2.equals(event1));
}
- public void testNonEqualContents() throws Exception {
+ /**
+ *
+ */
+ public void testNonEqualContents() {
final TmfEvent event1 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
TmfEvent event2 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
assertTrue("equals", event1.equals(event2));
assertFalse("equals", event2.equals(event1));
}
- public void testNonEqualReferences() throws Exception {
+ /**
+ *
+ */
+ public void testNonEqualReferences() {
final TmfEvent event1 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
TmfEvent event2 = new TmfEvent(null, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
assertTrue("equals", event1.equals(event2));
// toString
// ------------------------------------------------------------------------
+ /**
+ *
+ */
public void testToString() {
final String expected1 = "TmfEvent [fTimestamp=" + fTimestamp1 + ", fTrace=null, fRank=0, fSource=" + fSource
+ ", fType=" + fType + ", fContent=" + fContent1 + ", fReference=" + fReference1 + "]";
/*******************************************************************************
* Copyright (c) 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
*******************************************************************************/
// Getters
// ------------------------------------------------------------------------
+ /**
+ *
+ */
public void testGetContexts() {
fInstance.clear();
fInstance.add(fContext1, fType0);
assertEquals("getContexts", fContext2, contexts[1]);
}
+ /**
+ *
+ */
public void testGetTypes() {
fInstance.clear();
fInstance.add(fContext1, fType0);
ITmfEventType[] types = fInstance.getTypes(fContext1);
assertEquals("getTypes", 2, types.length);
- if (fType0 == types[0])
+ if (fType0 == types[0]) {
assertSame("getTypes", fType1, types[1]);
- else {
+ } else {
assertSame("getTypes", fType0, types[1]);
assertSame("getTypes", fType1, types[0]);
}
types = fInstance.getTypes(fContext2);
assertEquals("getTypes", 2, types.length);
- if (fType2 == types[0])
+ if (fType2 == types[0]) {
assertSame("getTypes", fType3, types[1]);
- else {
+ } else {
assertSame("getTypes", fType2, types[1]);
assertSame("getTypes", fType3, types[0]);
}
}
+ /**
+ *
+ */
public void testGetType() {
fInstance.clear();
fInstance.add(fContext1, fType0);
// Operations
// ------------------------------------------------------------------------
+ /**
+ *
+ */
public void testClear() {
fInstance.clear();
assertEquals("clear", 0, fInstance.getContexts().length);
assertEquals("clear", "TmfEventTypeManager [fEventTypes={}]", fInstance.toString());
}
+ /**
+ *
+ */
public void testClearContext() {
fInstance.clear();
fInstance.add(fContext1, fType0);
types = fInstance.getTypes(fContext2);
assertEquals("clear context", 2, types.length);
- if (fType2 == types[0])
+ if (fType2 == types[0]) {
assertSame("clear context", fType3, types[1]);
- else {
+ } else {
assertSame("clear context", fType2, types[1]);
assertSame("clear context", fType3, types[0]);
}
}
+ /**
+ *
+ */
public void testBasicAdd() {
fInstance.clear();
fInstance.add(fContext1, fType0);
assertNotSame("add", fType0, type);
}
+ /**
+ *
+ */
public void testAdd() {
fInstance.clear();
fInstance.add(fContext1, fType0);
ITmfEventType[] types = fInstance.getTypes(fContext1);
assertEquals("add", 2, types.length);
- if (fType0 == types[0])
+ if (fType0 == types[0]) {
assertSame("add", fType1, types[1]);
- else {
+ } else {
assertSame("add", fType0, types[1]);
assertSame("add", fType1, types[0]);
}
types = fInstance.getTypes(fContext2);
assertEquals("add", 2, types.length);
- if (fType2 == types[0])
+ if (fType2 == types[0]) {
assertSame("add", fType3, types[1]);
- else {
+ } else {
assertSame("add", fType2, types[1]);
assertSame("add", fType3, types[0]);
}
// Object
// ------------------------------------------------------------------------
+ /**
+ *
+ */
public void testToString() {
fInstance.clear();
assertEquals("toString", "TmfEventTypeManager [fEventTypes={}]", fInstance.toString());
// Constructors
// ------------------------------------------------------------------------
+ /**
+ *
+ */
public void testDefaultConstructor() {
final ITmfEventType type = new TmfEventType();
assertEquals("getContext", ITmfEventType.DEFAULT_CONTEXT_ID, type.getContext());
assertNull("getFieldName", type.getFieldName(0));
}
+ /**
+ *
+ */
public void testFullConstructor() {
final ITmfEventType type0 = new TmfEventType(fContext1, fTypeId1, TmfEventField.makeRoot(fLabels0));
assertEquals("getContext", fContext1, type0.getContext());
assertNull("getFieldName", type2.getFieldName(labels2.length));
}
+ /**
+ *
+ */
public void testConstructorCornerCases() {
try {
new TmfEventType(null, fTypeId1, null);
}
}
+ /**
+ *
+ */
public void testCopyConstructor() {
final TmfEventType original = new TmfEventType(fContext1, fTypeId1, TmfEventField.makeRoot(fLabels1));
final TmfEventType copy = new TmfEventType(original);
assertNull("getFieldName", copy.getFieldName(labels1.length));
}
+ /**
+ *
+ */
public void testCopyConstructorCornerCases() {
try {
new TmfEventType(null);
// clone
// ------------------------------------------------------------------------
- public static class MyEventType extends TmfEventType {
-
- @Override
- public boolean equals(final Object other) {
- return super.equals(other);
- }
-
- @Override
- public MyEventType clone() {
- return (MyEventType) super.clone();
- }
- }
-
- public void testClone() throws Exception {
+ /**
+ *
+ */
+ public void testClone() {
final ITmfEventType clone = fType1.clone();
assertTrue("clone", fType1.clone().equals(fType1));
assertEquals("clone", fType1, clone);
}
- public void testClone2() throws Exception {
+ /**
+ *
+ */
+ public void testClone2() {
final ITmfEventType type = new TmfEventType();
final ITmfEventType clone = type.clone();
// hashCode
// ------------------------------------------------------------------------
- public void testHashCode() throws Exception {
+ /**
+ *
+ */
+ public void testHashCode() {
final TmfEventType copy1 = new TmfEventType(fType0);
assertTrue("hashCode", fType0.hashCode() == copy1.hashCode());
// equals
// ------------------------------------------------------------------------
- public void testEqualsReflexivity() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsReflexivity() {
assertTrue("equals", fType0.equals(fType0));
assertTrue("equals", fType3.equals(fType3));
assertFalse("equals", fType3.equals(fType0));
}
- public void testEqualsSymmetry() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsSymmetry() {
final TmfEventType copy0 = new TmfEventType(fType0);
assertTrue("equals", fType0.equals(copy0));
assertTrue("equals", copy0.equals(fType0));
assertTrue("equals", copy2.equals(fType2));
}
- public void testEqualsTransivity() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsTransivity() {
TmfEventType copy1 = new TmfEventType(fType1);
TmfEventType copy2 = new TmfEventType(copy1);
assertTrue("equals", fType1.equals(copy1));
assertTrue("equals", fType3.equals(copy2));
}
- public void testEqualsNull() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsNull() {
assertFalse("equals", fType0.equals(null));
assertFalse("equals", fType3.equals(null));
}
- public void testNonEquals() throws Exception {
+ /**
+ *
+ */
+ public void testNonEquals() {
assertFalse("equals", fType0.equals(fType1));
assertFalse("equals", fType1.equals(fType2));
assertFalse("equals", fType2.equals(fType3));
assertFalse("equals", fType3.equals(fType0));
}
- public void testNonEqualsClasses() throws Exception {
+ /**
+ *
+ */
+ public void testNonEqualsClasses() {
assertFalse("equals", fType1.equals(fLabels1));
}
// toString
// ------------------------------------------------------------------------
+ /**
+ *
+ */
public void testToString() {
final String expected1 = "TmfEventType [fContext=" + ITmfEventType.DEFAULT_CONTEXT_ID +
", fTypeId=" + ITmfEventType.DEFAULT_TYPE_ID + "]";
/*******************************************************************************
* Copyright (c) 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
*******************************************************************************/
// Constructors
// ------------------------------------------------------------------------
- public void testDefaultConstructor() throws Exception {
+ /**
+ *
+ */
+ public void testDefaultConstructor() {
assertEquals("getValue", 0, ts0.getValue());
assertEquals("getscale", 0, ts0.getScale());
assertEquals("getPrecision", 0, ts0.getPrecision());
}
- public void testFullConstructor() throws Exception {
+ /**
+ *
+ */
+ public void testFullConstructor() {
assertEquals("getValue", 12345, ts1.getValue());
assertEquals("getscale", 0, ts1.getScale());
assertEquals("getPrecision", 0, ts1.getPrecision());
}
- public void testCopyConstructor() throws Exception {
+ /**
+ *
+ */
+ public void testCopyConstructor() {
final ITmfTimestamp copy = new TmfSimpleTimestamp(ts1);
assertEquals("getValue", ts1.getValue(), copy.getValue());
assertEquals("getPrecision", 0, copy.getPrecision());
}
- public void testCopyBadTimestamp() throws Exception {
+ /**
+ *
+ */
+ public void testCopyBadTimestamp() {
final ITmfTimestamp ts0a = new TmfTimestamp(0, 1, 0);
final ITmfTimestamp ts0b = new TmfTimestamp(0, 0, 1);
// clone
// ------------------------------------------------------------------------
- public static class MyTimestamp extends TmfSimpleTimestamp {
+ private static class MyTimestamp extends TmfSimpleTimestamp {
@Override
public boolean equals(final Object other) {
}
}
- public void testClone() throws Exception {
+ /**
+ *
+ */
+ public void testClone() {
final ITmfTimestamp clone = ts0.clone();
assertTrue("clone", ts0.clone().equals(ts0));
assertEquals("clone", ts0, clone);
}
- public void testClone2() throws Exception {
+ /**
+ *
+ */
+ public void testClone2() {
final MyTimestamp timestamp = new MyTimestamp();
final MyTimestamp clone = timestamp.clone();
// equals
// ------------------------------------------------------------------------
- public void testEqualsReflexivity() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsReflexivity() {
assertTrue("equals", ts0.equals(ts0));
assertTrue("equals", ts1.equals(ts1));
assertTrue("equals", ts2.equals(ts2));
assertTrue("equals", !ts2.equals(ts1));
}
- public void testEqualsSymmetry() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsSymmetry() {
final ITmfTimestamp ts0copy = new TmfSimpleTimestamp(ts0);
assertTrue("equals", ts0.equals(ts0copy));
assertTrue("equals", ts0copy.equals(ts0));
assertTrue("equals", ts1copy.equals(ts1));
}
- public void testEqualsTransivity() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsTransivity() {
final ITmfTimestamp ts0copy1 = new TmfSimpleTimestamp(ts0);
final ITmfTimestamp ts0copy2 = new TmfSimpleTimestamp(ts0copy1);
assertTrue("equals", ts0.equals(ts0copy1));
assertTrue("equals", ts1.equals(ts1copy2));
}
- public void testEqualsNull() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsNull() {
assertTrue("equals", !ts0.equals(null));
assertTrue("equals", !ts1.equals(null));
assertTrue("equals", !ts2.equals(null));
}
- public void testEqualsNonTimestamp() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsNonTimestamp() {
assertFalse("equals", ts0.equals(ts0.toString()));
}
// toString
// ------------------------------------------------------------------------
- public void testToString() throws Exception {
+ /**
+ *
+ */
+ public void testToString() {
assertEquals("toString", "TmfSimpleTimestamp [fValue=0]", ts0.toString());
assertEquals("toString", "TmfSimpleTimestamp [fValue=12345]", ts1.toString());
assertEquals("toString", "TmfSimpleTimestamp [fValue=-1234]", ts2.toString());
// hashCode
// ------------------------------------------------------------------------
- public void testHashCode() throws Exception {
+ /**
+ *
+ */
+ public void testHashCode() {
final ITmfTimestamp ts0copy = new TmfTimestamp(ts0);
final ITmfTimestamp ts1copy = new TmfTimestamp(ts1);
final ITmfTimestamp ts2copy = new TmfTimestamp(ts2);
// normalize
// ------------------------------------------------------------------------
- public void testNormalizeScale0() throws Exception {
+ /**
+ *
+ */
+ public void testNormalizeScale0() {
ITmfTimestamp ts = ts0.normalize(0, 0);
assertEquals("getValue", 0, ts.getValue());
assertEquals("getscale", 0, ts.getScale());
assertEquals("getPrecision", 0, ts.getPrecision());
}
- public void testNormalizeScaleNot0() throws Exception {
+ /**
+ *
+ */
+ public void testNormalizeScaleNot0() {
ITmfTimestamp ts = ts0.normalize(0, 1);
assertEquals("getValue", 0, ts.getValue());
assertEquals("getscale", 1, ts.getScale());
// compareTo
// ------------------------------------------------------------------------
- public void testBasicCompareTo() throws Exception {
- final ITmfTimestamp ts1 = new TmfSimpleTimestamp(900);
- final ITmfTimestamp ts2 = new TmfSimpleTimestamp(1000);
- final ITmfTimestamp ts3 = new TmfSimpleTimestamp(1100);
+ /**
+ *
+ */
+ public void testBasicCompareTo() {
+ final ITmfTimestamp tstamp1 = new TmfSimpleTimestamp(900);
+ final ITmfTimestamp tstamp2 = new TmfSimpleTimestamp(1000);
+ final ITmfTimestamp tstamp3 = new TmfSimpleTimestamp(1100);
- assertTrue(ts1.compareTo(ts1) == 0);
+ assertTrue(tstamp1.compareTo(tstamp1) == 0);
- assertTrue("CompareTo", ts1.compareTo(ts2) < 0);
- assertTrue("CompareTo", ts1.compareTo(ts3) < 0);
+ assertTrue("CompareTo", tstamp1.compareTo(tstamp2) < 0);
+ assertTrue("CompareTo", tstamp1.compareTo(tstamp3) < 0);
- assertTrue("CompareTo", ts2.compareTo(ts1) > 0);
- assertTrue("CompareTo", ts2.compareTo(ts3) < 0);
+ assertTrue("CompareTo", tstamp2.compareTo(tstamp1) > 0);
+ assertTrue("CompareTo", tstamp2.compareTo(tstamp3) < 0);
- assertTrue("CompareTo", ts3.compareTo(ts1) > 0);
- assertTrue("CompareTo", ts3.compareTo(ts2) > 0);
+ assertTrue("CompareTo", tstamp3.compareTo(tstamp1) > 0);
+ assertTrue("CompareTo", tstamp3.compareTo(tstamp2) > 0);
}
- public void testCompareTo() throws Exception {
+ /**
+ *
+ */
+ public void testCompareTo() {
final ITmfTimestamp ts0a = new TmfTimestamp(0, 2, 0);
final ITmfTimestamp ts1a = new TmfTimestamp(123450, -1);
final ITmfTimestamp ts2a = new TmfTimestamp(-12340, -1);
// getDelta
// ------------------------------------------------------------------------
- public void testDelta() throws Exception {
+ /**
+ *
+ */
+ public void testDelta() {
// Delta for same scale and precision (delta > 0)
- TmfTimestamp ts0 = new TmfSimpleTimestamp(10);
- TmfTimestamp ts1 = new TmfSimpleTimestamp(5);
- TmfTimestamp exp = new TmfSimpleTimestamp(5);
+ TmfTimestamp tstamp0 = new TmfSimpleTimestamp(10);
+ TmfTimestamp tstamp1 = new TmfSimpleTimestamp(5);
+ TmfTimestamp expectd = new TmfSimpleTimestamp(5);
- ITmfTimestamp delta = ts0.getDelta(ts1);
- assertEquals("getDelta", 0, delta.compareTo(exp, false));
+ ITmfTimestamp delta = tstamp0.getDelta(tstamp1);
+ assertEquals("getDelta", 0, delta.compareTo(expectd, false));
// Delta for same scale and precision (delta < 0)
- ts0 = new TmfTimestamp(5);
- ts1 = new TmfTimestamp(10);
- exp = new TmfTimestamp(-5);
+ tstamp0 = new TmfTimestamp(5);
+ tstamp1 = new TmfTimestamp(10);
+ expectd = new TmfTimestamp(-5);
- delta = ts0.getDelta(ts1);
- assertEquals("getDelta", 0, delta.compareTo(exp, false));
+ delta = tstamp0.getDelta(tstamp1);
+ assertEquals("getDelta", 0, delta.compareTo(expectd, false));
}
- public void testDelta2() throws Exception {
+ /**
+ *
+ */
+ public void testDelta2() {
// Delta for different scale and same precision (delta > 0)
- final TmfTimestamp ts0 = new TmfSimpleTimestamp(10);
- final TmfTimestamp ts1 = new TmfTimestamp(1, 1);
- final TmfTimestamp exp = new TmfTimestamp(0, 0);
+ final TmfTimestamp tstamp0 = new TmfSimpleTimestamp(10);
+ final TmfTimestamp tstamp1 = new TmfTimestamp(1, 1);
+ final TmfTimestamp expectd = new TmfTimestamp(0, 0);
- final ITmfTimestamp delta = ts0.getDelta(ts1);
- assertEquals("getDelta", 0, delta.compareTo(exp, false));
+ final ITmfTimestamp delta = tstamp0.getDelta(tstamp1);
+ assertEquals("getDelta", 0, delta.compareTo(expectd, false));
}
}
/*******************************************************************************
* 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 - Adjusted for new Event Model
// Housekeeping
// ------------------------------------------------------------------------
+ /**
+ * @param name the test name
+ */
public TmfTimeRangeTest(final String name) {
super(name);
}
// Constructors
// ------------------------------------------------------------------------
- public void testConstructor() throws Exception {
+ /**
+ *
+ */
+ public void testConstructor() {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
final TmfTimeRange range = new TmfTimeRange(ts1, ts2);
assertEquals("endTime", ts2, range.getEndTime());
}
- public void testBadConstructor() throws Exception {
+ /**
+ *
+ */
+ public void testBadConstructor() {
try {
new TmfTimeRange(TmfTimestamp.BIG_BANG, null);
fail("TmfTimeRange: bad end time");
}
}
- public void testOpenRange1() throws Exception {
+ /**
+ *
+ */
+ public void testOpenRange1() {
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, ts2);
assertEquals("endTime", ts2, range.getEndTime());
}
- public void testOpenRange2() throws Exception {
+ /**
+ *
+ */
+ public void testOpenRange2() {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final TmfTimeRange range = new TmfTimeRange(ts1, TmfTimestamp.BIG_CRUNCH);
assertEquals("endTime", TmfTimestamp.BIG_CRUNCH, range.getEndTime());
}
- public void testOpenRange3() throws Exception {
+ /**
+ *
+ */
+ public void testOpenRange3() {
final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
assertEquals("startTime", TmfTimestamp.BIG_BANG, range.getStartTime());
assertEquals("endTime", TmfTimestamp.BIG_CRUNCH, range.getEndTime());
}
- public void testCopyConstructor() throws Exception {
+ /**
+ *
+ */
+ public void testCopyConstructor() {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
final TmfTimeRange range0 = new TmfTimeRange(ts1, ts2);
assertEquals("endTime", TmfTimestamp.BIG_CRUNCH, range3.getEndTime());
}
- public void testCopyConstructor2() throws Exception {
+ /**
+ *
+ */
+ public void testCopyConstructor2() {
try {
new TmfTimeRange(null);
fail("TmfTimeRange: null argument");
// clone
// ------------------------------------------------------------------------
- public void testClone() throws Exception {
+ /**
+ * @throws CloneNotSupportedException cloning problem
+ */
+ public void testClone() throws CloneNotSupportedException {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
// hashCode
// ------------------------------------------------------------------------
- public void testHashCode() throws Exception {
+ /**
+ *
+ */
+ public void testHashCode() {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
final TmfTimeRange range1 = new TmfTimeRange(ts1, ts2);
// equals
// ------------------------------------------------------------------------
- public void testEqualsReflexivity() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsReflexivity() {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
final TmfTimeRange range1 = new TmfTimeRange(ts1, ts2);
assertTrue("equals", !range2.equals(range1));
}
- public void testEqualsSymmetry() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsSymmetry() {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
final TmfTimeRange range1a = new TmfTimeRange(ts1, ts2);
assertTrue("equals", range2b.equals(range2a));
}
- public void testEqualsTransivity() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsTransivity() {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
final TmfTimeRange range1a = new TmfTimeRange(ts1, ts2);
assertTrue("equals", range1a.equals(range1c));
}
- public void testEqualsNull() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsNull() {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
final TmfTimeRange range1 = new TmfTimeRange(ts1, ts2);
assertTrue("equals", !range1.equals(null));
}
- public void testEqualsBadType() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsBadType() {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
final TmfTimeRange range1 = new TmfTimeRange(ts1, ts2);
assertTrue("equals", !range1.equals(ts1));
}
- public void testEqualStartTime() throws Exception {
+ /**
+ *
+ */
+ public void testEqualStartTime() {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
final ITmfTimestamp ts3 = new TmfTimestamp(12355);
assertTrue("equals", !range1.equals(range3));
}
- public void testEqualsEndTime() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsEndTime() {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
final ITmfTimestamp ts3 = new TmfTimestamp(12355);
// toString
// ------------------------------------------------------------------------
- public void testToString() throws Exception {
+ /**
+ *
+ */
+ public void testToString() {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
final TmfTimeRange range = new TmfTimeRange(ts1, ts2);
// contains
// ------------------------------------------------------------------------
- public void testContainsTimestamp() throws Exception {
+ /**
+ *
+ */
+ public void testContainsTimestamp() {
final ITmfTimestamp ts1 = new TmfTimestamp(12345);
final ITmfTimestamp ts2 = new TmfTimestamp(12350);
final TmfTimeRange range = new TmfTimeRange(ts1, ts2);
assertTrue("contains (zero)", range.contains(TmfTimestamp.ZERO));
}
- public void testContainsRange() throws Exception {
+ /**
+ *
+ */
+ public void testContainsRange() {
final ITmfTimestamp ts1 = new TmfTimestamp(10);
final ITmfTimestamp ts2 = new TmfTimestamp(20);
final ITmfTimestamp ts3 = new TmfTimestamp(30);
// getIntersection
// ------------------------------------------------------------------------
- public void testGetIntersection() throws Exception {
+ /**
+ *
+ */
+ public void testGetIntersection() {
final ITmfTimestamp ts1a = new TmfTimestamp(1000);
final ITmfTimestamp ts1b = new TmfTimestamp(2000);
/*******************************************************************************
* Copyright (c) 2009, 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 - Adjusted for new Event Model
// Constructors
// ------------------------------------------------------------------------
- public void testDefaultConstructor() throws Exception {
+ /**
+ *
+ */
+ public void testDefaultConstructor() {
assertEquals("getValue", 0, ts0.getValue());
assertEquals("getscale", 0, ts0.getScale());
assertEquals("getPrecision", 0, ts0.getPrecision());
}
- public void testValueConstructor() throws Exception {
+ /**
+ *
+ */
+ public void testValueConstructor() {
assertEquals("getValue", 12345, ts1.getValue());
assertEquals("getscale", 0, ts1.getScale());
assertEquals("getPrecision", 0, ts1.getPrecision());
}
- public void testValueScaleConstructor() throws Exception {
+ /**
+ *
+ */
+ public void testValueScaleConstructor() {
assertEquals("getValue", 12345, ts2.getValue());
assertEquals("getscale", -1, ts2.getScale());
assertEquals("getPrecision", 0, ts2.getPrecision());
}
- public void testFullConstructor() throws Exception {
+ /**
+ *
+ */
+ public void testFullConstructor() {
assertEquals("getValue", 12345, ts3.getValue());
assertEquals("getscale", 2, ts3.getScale());
assertEquals("getPrecision", 5, ts3.getPrecision());
}
- public void testCopyConstructor() throws Exception {
+ /**
+ *
+ */
+ public void testCopyConstructor() {
final ITmfTimestamp ts = new TmfTimestamp(12345, 2, 5);
final ITmfTimestamp copy = new TmfTimestamp(ts);
assertEquals("getPrecision", 5, copy.getPrecision());
}
- public void testCopyNullConstructor() throws Exception {
+ /**
+ *
+ */
+ public void testCopyNullConstructor() {
try {
new TmfTimestamp(null);
fail("TmfTimestamp: null argument");
}
}
- public void testCopyConstructorBigBang() throws Exception {
+ /**
+ *
+ */
+ public void testCopyConstructorBigBang() {
final ITmfTimestamp ts = new TmfTimestamp(TmfTimestamp.BIG_BANG);
assertEquals("getValue", TmfTimestamp.BIG_BANG.getValue(), ts.getValue());
assertEquals("getscale", TmfTimestamp.BIG_BANG.getScale(), ts.getScale());
assertEquals("getPrecision", TmfTimestamp.BIG_BANG.getPrecision(), ts.getPrecision());
}
- public void testCopyConstructorBigCrunch() throws Exception {
+ /**
+ *
+ */
+ public void testCopyConstructorBigCrunch() {
final ITmfTimestamp ts = new TmfTimestamp(TmfTimestamp.BIG_CRUNCH);
assertEquals("getValue", TmfTimestamp.BIG_CRUNCH.getValue(), ts.getValue());
assertEquals("getscale", TmfTimestamp.BIG_CRUNCH.getScale(), ts.getScale());
assertEquals("getPrecision", TmfTimestamp.BIG_CRUNCH.getPrecision(), ts.getPrecision());
}
- public void testCopyConstructorZero() throws Exception {
+ /**
+ *
+ */
+ public void testCopyConstructorZero() {
final ITmfTimestamp ts = new TmfTimestamp(TmfTimestamp.ZERO);
assertEquals("getValue", TmfTimestamp.ZERO.getValue(), ts.getValue());
assertEquals("getscale", TmfTimestamp.ZERO.getScale(), ts.getScale());
// clone
// ------------------------------------------------------------------------
- public static class MyTimestamp extends TmfTimestamp {
+ private static class MyTimestamp extends TmfTimestamp {
@Override
public boolean equals(final Object other) {
}
}
- public void testClone() throws Exception {
+ /**
+ *
+ */
+ public void testClone() {
final ITmfTimestamp clone = ts0.clone();
assertTrue("clone", ts0.clone().equals(ts0));
assertEquals("clone", ts0, clone);
}
- public void testClone2() throws Exception {
+ /**
+ *
+ */
+ public void testClone2() {
final MyTimestamp timestamp = new MyTimestamp();
final MyTimestamp clone = timestamp.clone();
// hashCode
// ------------------------------------------------------------------------
- public void testHashCode() throws Exception {
+ /**
+ *
+ */
+ public void testHashCode() {
final ITmfTimestamp ts0copy = new TmfTimestamp(ts0);
final ITmfTimestamp ts1copy = new TmfTimestamp(ts1);
final ITmfTimestamp ts2copy = new TmfTimestamp(ts2);
// equals
// ------------------------------------------------------------------------
- public void testEqualsReflexivity() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsReflexivity() {
assertTrue("equals", ts0.equals(ts0));
assertTrue("equals", ts1.equals(ts1));
assertTrue("equals", !ts1.equals(ts0));
}
- public void testEqualsSymmetry() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsSymmetry() {
final ITmfTimestamp ts0copy = new TmfTimestamp(ts0);
assertTrue("equals", ts0.equals(ts0copy));
assertTrue("equals", ts0copy.equals(ts0));
assertTrue("equals", ts2copy.equals(ts2));
}
- public void testEqualsTransivity() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsTransivity() {
final ITmfTimestamp ts0copy1 = new TmfTimestamp(ts0);
final ITmfTimestamp ts0copy2 = new TmfTimestamp(ts0copy1);
assertTrue("equals", ts0.equals(ts0copy1));
assertTrue("equals", ts2.equals(ts2copy2));
}
- public void testEqualsNull() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsNull() {
assertTrue("equals", !ts0.equals(null));
assertTrue("equals", !ts1.equals(null));
}
- public void testEqualsNonTimestamp() throws Exception {
+ /**
+ *
+ */
+ public void testEqualsNonTimestamp() {
assertFalse("equals", ts0.equals(ts0.toString()));
}
// toString
// ------------------------------------------------------------------------
- public void testToString() throws Exception {
+ /**
+ *
+ */
+ public void testToString() {
assertEquals("toString", "TmfTimestamp [fValue=0, fScale=0, fPrecision=0]", ts0.toString());
assertEquals("toString", "TmfTimestamp [fValue=12345, fScale=0, fPrecision=0]", ts1.toString());
assertEquals("toString", "TmfTimestamp [fValue=12345, fScale=-1, fPrecision=0]", ts2.toString());
// normalize
// ------------------------------------------------------------------------
- public void testNormalizeOffset() throws Exception {
+ /**
+ *
+ */
+ public void testNormalizeOffset() {
ITmfTimestamp ts = ts0.normalize(0, 0);
assertEquals("getValue", 0, ts.getValue());
assertEquals("getscale", 0, ts.getScale());
assertEquals("getPrecision", 0, ts.getPrecision());
}
- public void testNormalizeOffsetLowerLimits() throws Exception {
+ /**
+ *
+ */
+ public void testNormalizeOffsetLowerLimits() {
final ITmfTimestamp ref = new TmfTimestamp(Long.MIN_VALUE + 5);
ITmfTimestamp ts = ref.normalize(-4, 0);
assertEquals("getPrecision", 0, ts.getPrecision());
}
- public void testNormalizeOffsetUpperLimits() throws Exception {
+ /**
+ *
+ */
+ public void testNormalizeOffsetUpperLimits() {
final ITmfTimestamp ref = new TmfTimestamp(Long.MAX_VALUE - 5);
ITmfTimestamp ts = ref.normalize(4, 0);
assertEquals("getPrecision", 0, ts.getPrecision());
}
- public void testNormalizeScale() throws Exception {
+ /**
+ *
+ */
+ public void testNormalizeScale() {
ITmfTimestamp ts = ts0.normalize(0, 10);
assertEquals("getValue", 0, ts.getValue());
assertEquals("getscale", 10, ts.getScale());
assertEquals("getPrecision", 0, ts.getPrecision());
}
- public void testNormalizedScaleLimits() throws Exception {
+ /**
+ *
+ */
+ public void testNormalizedScaleLimits() {
final int MAX_SCALE_DIFF = 19;
// Test below limit
}
}
- public void testNormalizeOffsetAndScaleTrivial() throws Exception {
+ /**
+ *
+ */
+ public void testNormalizeOffsetAndScaleTrivial() {
final ITmfTimestamp ts = ts0.normalize(0, 0);
assertEquals("getValue", 0, ts.getValue());
assertEquals("getscale", 0, ts.getScale());
assertEquals("getPrecision", 0, ts.getPrecision());
}
- public void testNormalizeOffsetAndScale() throws Exception {
+ /**
+ *
+ */
+ public void testNormalizeOffsetAndScale() {
final int SCALE = 12;
ITmfTimestamp ts = ts0.normalize(0, SCALE);
assertEquals("getPrecision", 0, ts.getPrecision());
}
- public void testNormalizeOffsetAndScale2() throws Exception {
+ /**
+ *
+ */
+ public void testNormalizeOffsetAndScale2() {
int SCALE = 2;
ITmfTimestamp ts = ts1.normalize(0, SCALE);
assertEquals("getValue", 123, ts.getValue());
// compareTo
// ------------------------------------------------------------------------
- public void testBasicCompareTo() throws Exception {
+ /**
+ *
+ */
+ @SuppressWarnings("hiding")
+ public void testBasicCompareTo() {
final ITmfTimestamp ts1 = new TmfTimestamp(900, 0, 50);
final ITmfTimestamp ts2 = new TmfTimestamp(1000, 0, 50);
final ITmfTimestamp ts3 = new TmfTimestamp(1100, 0, 50);
assertTrue("CompareTo", ts3.compareTo(ts4) > 0);
}
- public void testCompareToCornerCases1() throws Exception {
+ /**
+ *
+ */
+ public void testCompareToCornerCases1() {
final ITmfTimestamp ts0a = new TmfTimestamp(ts0);
final ITmfTimestamp ts0b = new TmfTimestamp(ts0.getValue(), ts0.getScale() + 1);
final ITmfTimestamp ts0c = new TmfTimestamp(ts0.getValue() + 1, ts0.getScale());
assertTrue("compareTo", ts0.compareTo(ts0d, false) == -1);
}
- public void testCompareToCornerCases2() throws Exception {
+ /**
+ *
+ */
+ public void testCompareToCornerCases2() {
final ITmfTimestamp ts0a = new TmfTimestamp(Long.MAX_VALUE, Integer.MAX_VALUE - 1);
final ITmfTimestamp ts0b = new TmfTimestamp(0, Integer.MAX_VALUE);
final ITmfTimestamp ts0c = new TmfTimestamp(Long.MAX_VALUE, Integer.MAX_VALUE);
assertTrue("compareTo", ts0c.compareTo(ts0b, false) == 1);
}
- public void testCompareToCornerCases3() throws Exception {
+ /**
+ *
+ */
+ public void testCompareToCornerCases3() {
final ITmfTimestamp ts0a = new TmfTimestamp(Long.MIN_VALUE, Integer.MAX_VALUE - 1);
final ITmfTimestamp ts0b = new TmfTimestamp(0, Integer.MAX_VALUE);
final ITmfTimestamp ts0c = new TmfTimestamp(Long.MIN_VALUE, Integer.MAX_VALUE);
assertTrue("compareTo", ts0c.compareTo(ts0b, false) == -1);
}
- public void testCompareToCornerCases4() throws Exception {
+ /**
+ *
+ */
+ public void testCompareToCornerCases4() {
assertTrue("compareTo", ts0.compareTo(null, false) == 1);
assertTrue("compareTo", ts0.compareTo(null, true) == 1);
}
- public void testCompareToSameScale() throws Exception {
+ /**
+ *
+ */
+ @SuppressWarnings("hiding")
+ public void testCompareToSameScale() {
final ITmfTimestamp ts1 = new TmfTimestamp(900, 0, 50);
final ITmfTimestamp ts2 = new TmfTimestamp(1000, 0, 50);
final ITmfTimestamp ts3 = new TmfTimestamp(1100, 0, 50);
assertTrue("CompareTo", ts3.compareTo(ts4, false) > 0);
}
- public void testCompareToDifferentScale() throws Exception {
+ /**
+ *
+ */
+ @SuppressWarnings("hiding")
+ public void testCompareToDifferentScale() {
final ITmfTimestamp ts1 = new TmfTimestamp(9000, -1, 50);
final ITmfTimestamp ts2 = new TmfTimestamp(1000, 0, 50);
final ITmfTimestamp ts3 = new TmfTimestamp(110, 1, 50);
assertTrue("CompareTo", ts3.compareTo(ts4, false) > 0);
}
- public void testCompareToWithinPrecision() throws Exception {
+ /**
+ *
+ */
+ @SuppressWarnings("hiding")
+ public void testCompareToWithinPrecision() {
final ITmfTimestamp ts1 = new TmfTimestamp(900, 0, 50);
final ITmfTimestamp ts2 = new TmfTimestamp(1000, 0, 50);
final ITmfTimestamp ts3 = new TmfTimestamp(1100, 0, 50);
assertTrue("CompareTo", ts3.compareTo(ts4, true) == 0);
}
- public void testCompareToLargeScale1() throws Exception {
+ /**
+ *
+ */
+ @SuppressWarnings("hiding")
+ public void testCompareToLargeScale1() {
final ITmfTimestamp ts1 = new TmfTimestamp(-1, 100);
final ITmfTimestamp ts2 = new TmfTimestamp(-1000, -100);
final ITmfTimestamp ts3 = new TmfTimestamp(1, 100);
assertTrue("CompareTo", ts4.compareTo(ts3, false) < 0);
}
- public void testCompareToLargeScale2() throws Exception {
+ /**
+ *
+ */
+ public void testCompareToLargeScale2() {
final ITmfTimestamp ts0a = new TmfTimestamp(0, Integer.MAX_VALUE);
final ITmfTimestamp ts0b = new TmfTimestamp(1, Integer.MAX_VALUE);
// getDelta
// ------------------------------------------------------------------------
- public void testDelta() throws Exception {
+ /**
+ *
+ */
+ @SuppressWarnings("hiding")
+ public void testDelta() {
// Delta for same scale and precision (delta > 0)
ITmfTimestamp ts0 = new TmfTimestamp(10, 9);
ITmfTimestamp ts1 = new TmfTimestamp(5, 9);
import org.eclipse.linuxtools.internal.tmf.core.Activator;
+/**
+ * <b><u>AllTests</u></b>
+ * <p>
+ * Implement me. Please.
+ * <p>
+ */
@SuppressWarnings({ "nls" })
public class AllTests {
+ /**
+ * @return the test suite
+ */
public static Test suite() {
TestSuite suite = new TestSuite("Test suite for " + Activator.PLUGIN_ID + ".request"); //$NON-NLS-1$);
//$JUnit-BEGIN$
/**
* Test suite for the TmfCoalescedDataRequest class.
*/
-@SuppressWarnings({ "nls" })
+@SuppressWarnings({"nls","javadoc"})
public class TmfCoalescedDataRequestTest extends TestCase {
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
- public TmfCoalescedDataRequestTest(String name) {
+ /**
+ * @param name the test name
+ */
+ public TmfCoalescedDataRequestTest(final String name) {
super(name);
}
// Constructors
// ------------------------------------------------------------------------
- public void testTmfCoalescedDataRequest() {
+ public void testTmfCoalescedDataRequest() {
TmfCoalescedDataRequest<TmfEvent> request = new TmfCoalescedDataRequest<TmfEvent>(TmfEvent.class);
assertEquals("getRequestId", fRequestCount++, request.getRequestId());
// equals
// ------------------------------------------------------------------------
- public void testEqualsReflexivity() throws Exception {
+ public void testEqualsReflexivity() {
assertTrue("equals", fRequest1.equals(fRequest1));
assertTrue("equals", fRequest2.equals(fRequest2));
assertFalse("equals", fRequest2.equals(fRequest1));
}
- public void testEqualsSymmetry() throws Exception {
+ public void testEqualsSymmetry() {
assertTrue("equals", fRequest1.equals(fRequest1b));
assertTrue("equals", fRequest1b.equals(fRequest1));
assertFalse("equals", fRequest3.equals(fRequest2));
}
- public void testEqualsTransivity() throws Exception {
+ public void testEqualsTransivity() {
assertTrue("equals", fRequest1.equals(fRequest1b));
assertTrue("equals", fRequest1b.equals(fRequest1c));
assertTrue("equals", fRequest1.equals(fRequest1c));
}
- public void testEqualsNull() throws Exception {
+ public void testEqualsNull() {
assertFalse("equals", fRequest1.equals(null));
assertFalse("equals", fRequest2.equals(null));
}
// hashCode
// ------------------------------------------------------------------------
- public void testHashCode() throws Exception {
+ public void testHashCode() {
assertTrue("hashCode", fRequest1.hashCode() == fRequest1.hashCode());
assertTrue("hashCode", fRequest2.hashCode() == fRequest2.hashCode());
assertTrue("hashCode", fRequest1.hashCode() != fRequest2.hashCode());
* <p>
* Test suite for the TmfCoalescedEventRequest class.
*/
-@SuppressWarnings({ "nls" })
+@SuppressWarnings({"nls","javadoc"})
public class TmfCoalescedEventRequestTest extends TestCase {
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
+ /**
+ * @param name the test name
+ */
public TmfCoalescedEventRequestTest(String name) {
super(name);
}
// equals
// ------------------------------------------------------------------------
- public void testEqualsReflexivity() throws Exception {
+ public void testEqualsReflexivity() {
assertTrue("equals", fRequest1.equals(fRequest1));
assertTrue("equals", fRequest2.equals(fRequest2));
assertFalse("equals", fRequest2.equals(fRequest1));
}
- public void testEqualsSymmetry() throws Exception {
+ public void testEqualsSymmetry() {
assertTrue("equals", fRequest1.equals(fRequest1b));
assertTrue("equals", fRequest1b.equals(fRequest1));
assertFalse("equals", fRequest3.equals(fRequest2));
}
- public void testEqualsTransivity() throws Exception {
+ public void testEqualsTransivity() {
assertTrue("equals", fRequest1.equals(fRequest1b));
assertTrue("equals", fRequest1b.equals(fRequest1c));
assertTrue("equals", fRequest1.equals(fRequest1c));
}
- public void testEqualsNull() throws Exception {
+ public void testEqualsNull() {
assertFalse("equals", fRequest1.equals(null));
assertFalse("equals", fRequest2.equals(null));
}
- public void testEqualsSuper() throws Exception {
+ public void testEqualsSuper() {
TmfCoalescedDataRequest<TmfEvent> dataRequest1 = new TmfCoalescedDataRequest<TmfEvent>(
fRequest1.getDataType(), fRequest1.getIndex(), fRequest1.getNbRequested());
TmfCoalescedDataRequest<TmfEvent> dataRequest2 = new TmfCoalescedDataRequest<TmfEvent>(
// hashCode
// ------------------------------------------------------------------------
- public void testHashCode() throws Exception {
+ public void testHashCode() {
assertTrue("hashCode", fRequest1.hashCode() == fRequest1.hashCode());
assertTrue("hashCode", fRequest2.hashCode() == fRequest2.hashCode());
assertTrue("hashCode", fRequest1.hashCode() != fRequest2.hashCode());
// isCompatible
// ------------------------------------------------------------------------
- public void testIsCompatible() {
+ @SuppressWarnings("hiding")
+ public void testIsCompatible() {
TmfCoalescedEventRequest<TmfEvent> coalescedRequest = new TmfCoalescedEventRequest<TmfEvent>(TmfEvent.class, range1, 100, 200);
TmfEventRequest<TmfEvent> request1 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range1, 100, 200);
TmfEventRequest<TmfEvent> request2 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range2, 100, 200);
// addEvent
// ------------------------------------------------------------------------
+ @SuppressWarnings("hiding")
public void testAddEvent1() {
TmfCoalescedEventRequest<TmfEvent> coalescedRequest = new TmfCoalescedEventRequest<TmfEvent>(TmfEvent.class, range1, 0, 2147483647, 200, ExecutionType.FOREGROUND);
TmfEventRequest<TmfEvent> request1 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range1, 0, 2147483647, 200);
}
+ @SuppressWarnings("hiding")
public void testAddEvent2() {
TmfCoalescedEventRequest<TmfEvent> coalescedRequest = new TmfCoalescedEventRequest<TmfEvent>(TmfEvent.class, range1, 1, 2147483647, 200, ExecutionType.FOREGROUND);
TmfEventRequest<TmfEvent> request1 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range1, 1, 2147483647, 200);
}
@TmfSignalHandler
- @SuppressWarnings("unchecked")
public void trigger(final TmfTestTriggerSignal signal) {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
providers[0].sendRequest(request3);
}
- public void runCoalescedRequest(long startIndex) throws Exception {
+ public void runCoalescedRequest(long startIndex) throws InterruptedException {
fTrace = setupTrace(DIRECTORY + File.separator + TEST_STREAM);
}
}
- public void testCoalescedRequest() throws Exception {
+ public void testCoalescedRequest() throws InterruptedException {
runCoalescedRequest(0);
runCoalescedRequest(1);
runCoalescedRequest(5);
}
- public void testCancelCoalescedRequest() throws Exception {
+ public void testCancelCoalescedRequest() throws InterruptedException {
fTrace = setupTrace(DIRECTORY + File.separator + TEST_STREAM);
}
// ------------------------------------------------------------------------
- //
+ //
// ------------------------------------------------------------------------
}
* <p>
* Test suite for the TmfDataRequest class.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class TmfDataRequestTest extends TestCase {
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
+ /**
+ * @param name the test name
+ */
public TmfDataRequestTest(String name) {
super(name);
}
// equals
// ------------------------------------------------------------------------
- public void testEqualsReflexivity() throws Exception {
+ public void testEqualsReflexivity() {
assertTrue("equals", fRequest1.equals(fRequest1));
assertTrue("equals", fRequest2.equals(fRequest2));
assertFalse("equals", fRequest2.equals(fRequest1));
}
- public void testEqualsSymmetry() throws Exception {
+ public void testEqualsSymmetry() {
assertTrue("equals", fRequest1.equals(fRequest1b));
assertTrue("equals", fRequest1b.equals(fRequest1));
assertFalse("equals", fRequest3.equals(fRequest2));
}
- public void testEqualsTransivity() throws Exception {
+ public void testEqualsTransivity() {
assertTrue("equals", fRequest1.equals(fRequest1b));
assertTrue("equals", fRequest1b.equals(fRequest1c));
assertTrue("equals", fRequest1.equals(fRequest1c));
}
- public void testEqualsNull() throws Exception {
+ public void testEqualsNull() {
assertFalse("equals", fRequest1.equals(null));
assertFalse("equals", fRequest2.equals(null));
}
// hashCode
// ------------------------------------------------------------------------
- public void testHashCode() throws Exception {
+ public void testHashCode() {
assertTrue("hashCode", fRequest1.hashCode() == fRequest1.hashCode());
assertTrue("hashCode", fRequest2.hashCode() == fRequest2.hashCode());
assertTrue("hashCode", fRequest1.hashCode() != fRequest2.hashCode());
* <p>
* Test suite for the TmfEventRequest class.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class TmfEventRequestTest extends TestCase {
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
- public TmfEventRequestTest(String name) {
+ /**
+ * @param name the test name
+ */
+ public TmfEventRequestTest(final String name) {
super(name);
}
// equals
// ------------------------------------------------------------------------
- public void testEqualsReflexivity() throws Exception {
+ public void testEqualsReflexivity() {
assertTrue("equals", fRequest1.equals(fRequest1));
assertTrue("equals", fRequest2.equals(fRequest2));
assertFalse("equals", fRequest2.equals(fRequest1));
}
- public void testEqualsSymmetry() throws Exception {
+ public void testEqualsSymmetry() {
assertTrue("equals", fRequest1.equals(fRequest1b));
assertTrue("equals", fRequest1b.equals(fRequest1));
assertFalse("equals", fRequest3.equals(fRequest2));
}
- public void testEqualsTransivity() throws Exception {
+ public void testEqualsTransivity() {
assertTrue("equals", fRequest1.equals(fRequest1b));
assertTrue("equals", fRequest1b.equals(fRequest1c));
assertTrue("equals", fRequest1.equals(fRequest1c));
}
- public void testEqualsNull() throws Exception {
+ public void testEqualsNull() {
assertFalse("equals", fRequest1.equals(null));
assertFalse("equals", fRequest2.equals(null));
}
// hashCode
// ------------------------------------------------------------------------
- public void testHashCode() throws Exception {
+ public void testHashCode() {
assertTrue("hashCode", fRequest1.hashCode() == fRequest1.hashCode());
assertTrue("hashCode", fRequest2.hashCode() == fRequest2.hashCode());
assertTrue("hashCode", fRequest1.hashCode() != fRequest2.hashCode());
* @author alexmont
*
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class VerifyHistoryFile {
// Enter the .ht file name to test here
/*******************************************************************************
* Copyright (c) 2009, 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 - Adjusted for new Trace Model
@SuppressWarnings({ "nls" })
public class AllTests {
+ /**
+ * @return the test suite
+ */
public static Test suite() {
TestSuite suite = new TestSuite("Test suite for " + Activator.PLUGIN_ID + ".trace"); //$NON-NLS-1$);
//$JUnit-BEGIN$
/**
* Test suite for the TmfCheckpointIndexTest class.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class TmfCheckpointIndexTest extends TestCase {
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
- public TmfCheckpointIndexTest(final String name) throws Exception {
+ /**
+ * @param name the test name
+ */
+ public TmfCheckpointIndexTest(final String name) {
super(name);
}
// Verify checkpoints
// ------------------------------------------------------------------------
- public void testTmfTraceIndexing() throws Exception {
+ @SuppressWarnings("null")
+ public void testTmfTraceIndexing() {
assertEquals("getCacheSize", BLOCK_SIZE, fTrace.getCacheSize());
assertEquals("getTraceSize", NB_EVENTS, fTrace.getNbEvents());
assertEquals("getRange-start", 1, fTrace.getTimeRange().getStartTime().getValue());
}
}
- public void testEmptyTmfTraceIndexing() throws Exception {
+ @SuppressWarnings("null")
+ public void testEmptyTmfTraceIndexing() {
assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, fEmptyTrace.getCacheSize());
assertEquals("getTraceSize", 0, fEmptyTrace.getNbEvents());
assertEquals("getRange-start", TmfTimestamp.BIG_CRUNCH, fEmptyTrace.getTimeRange().getStartTime());
/*******************************************************************************
* 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
/**
* Test suite for the TmfCheckpoint class.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class TmfCheckpointTest extends TestCase {
// ------------------------------------------------------------------------
assertEquals("TmfCheckpoint", fLocation1, checkpoint.getLocation());
}
- public void testTmfLocationCopy2() throws Exception {
+ public void testTmfLocationCopy2() {
try {
new TmfCheckpoint(null);
fail("null copy");
// 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 {
+ 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);
// 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, new TmfContext(fLocation1));
final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp2, new TmfContext(fLocation1));
/**
* Test suite for the TmfContext class.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class TmfContextTest extends TestCase {
// ------------------------------------------------------------------------
// equals
// ------------------------------------------------------------------------
- public void testEqualsReflexivity() throws Exception {
+ public void testEqualsReflexivity() {
assertTrue("equals", fContext1.equals(fContext1));
assertTrue("equals", fContext2.equals(fContext2));
assertFalse("equals", fContext2.equals(fContext1));
}
- public void testEqualsSymmetry() throws Exception {
+ public void testEqualsSymmetry() {
final TmfContext context1 = new TmfContext(fContext1);
final TmfContext context2 = new TmfContext(fContext2);
assertTrue("equals", fContext2.equals(context2));
}
- public void testEqualsTransivity() throws Exception {
+ public void testEqualsTransivity() {
final TmfContext context1 = new TmfContext(fContext1);
final TmfContext context2 = new TmfContext(context1);
final TmfContext context3 = new TmfContext(context2);
assertTrue("equals", context1.equals(context3));
}
- public void testEqualsNull() throws Exception {
+ public void testEqualsNull() {
assertFalse("equals", fContext1.equals(null));
assertFalse("equals", fContext2.equals(null));
}
private static class MyContext extends TmfContext {
}
- public void testNonEquals() throws Exception {
+ public void testNonEquals() {
// Different classes
final MyContext myContext = new MyContext();
// hashCode
// ------------------------------------------------------------------------
- public void testHashCode() throws Exception {
+ public void testHashCode() {
final TmfContext context1 = new TmfContext(fContext1);
final TmfContext context2 = new TmfContext(fContext2);
/**
* Test suite for the TmfCheckpointIndexTest class.
*/
-@SuppressWarnings({ "nls" })
+@SuppressWarnings({"nls","javadoc"})
public class TmfExperimentCheckpointIndexTest extends TestCase {
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
- public TmfExperimentCheckpointIndexTest(final String name) throws Exception {
+ /**
+ * @param name the test name
+ */
+ public TmfExperimentCheckpointIndexTest(final String name) {
super(name);
}
// Verify checkpoints
// ------------------------------------------------------------------------
- public void testTmfTraceIndexing() throws Exception {
+ @SuppressWarnings("null")
+ public void testTmfTraceIndexing() {
assertEquals("getCacheSize", BLOCK_SIZE, fExperiment.getCacheSize());
assertEquals("getTraceSize", NB_EVENTS, fExperiment.getNbEvents());
assertEquals("getRange-start", 1, fExperiment.getTimeRange().getStartTime().getValue());
// Streaming
// ------------------------------------------------------------------------
- public void testGrowingIndex() throws Exception {
+ @SuppressWarnings("null")
+ public void testGrowingIndex() {
ITmfTrace<TmfEvent>[] testTraces = new TmfTraceStub[2];
try {
/**
* Test suite for the TmfExperiment class (single trace).
*/
-@SuppressWarnings({ "nls" })
+@SuppressWarnings({"nls","javadoc"})
public class TmfExperimentTest extends TestCase {
// ------------------------------------------------------------------------
}
}
- public TmfExperimentTest(final String name) throws Exception {
+ /**
+ * @param name the test name
+ */
+ public TmfExperimentTest(final String name) {
super(name);
}
// getTimestamp
// ------------------------------------------------------------------------
- public void testGetTimestamp() throws Exception {
+ public void testGetTimestamp() {
assertEquals("getTimestamp", new TmfTimestamp( 1, (byte) -3), fExperiment.getTimestamp( 0));
assertEquals("getTimestamp", new TmfTimestamp( 2, (byte) -3), fExperiment.getTimestamp( 1));
assertEquals("getTimestamp", new TmfTimestamp( 11, (byte) -3), fExperiment.getTimestamp( 10));
// Bookmarks file handling
// ------------------------------------------------------------------------
- public void testBookmarks() throws Exception {
+ public void testBookmarks() {
assertNull("GetBookmarksFile", fExperiment.getBookmarksFile());
IFile bookmarks = (IFile) fTestTraces[0].getResource();
fExperiment.setBookmarksFile(bookmarks);
// seekEvent by location
// ------------------------------------------------------------------------
- public void testSeekBadLocation() throws Exception {
+ public void testSeekBadLocation() {
ITmfContext context = fExperiment.seekEvent(new TmfLocation<Long>(0L));
assertNull("seekEvent", context);
}
- public void testSeekNoTrace() throws Exception {
+ public void testSeekNoTrace() {
TmfExperiment<TmfEvent> experiment = new TmfExperiment<TmfEvent>(TmfEvent.class, EXPERIMENT, null);
ITmfContext context = experiment.seekEvent((TmfExperimentLocation) null);
assertNull("seekEvent", context);
// seekEvent on ratio
// ------------------------------------------------------------------------
- public void testSeekEventOnRatio() throws Exception {
+ public void testSeekEventOnRatio() {
// First event
ITmfContext context = fExperiment.seekEvent(0.0);
}
@SuppressWarnings("rawtypes")
- public void testGetLocationRatio() throws Exception {
+ public void testGetLocationRatio() {
// First event
ITmfContext context = fExperiment.seekEvent((ITmfLocation) null);
}
// @SuppressWarnings("rawtypes")
-// public void testGetCurrentLocation() throws Exception {
+// public void testGetCurrentLocation() {
// ITmfContext context = fExperiment.seekEvent((ITmfLocation) null);
// ITmfLocation location = fExperiment.getCurrentLocation();
// assertEquals("getCurrentLocation", location, context.getLocation());
// seekEvent on rank
// ------------------------------------------------------------------------
- public void testSeekRankOnCacheBoundary() throws Exception {
+ public void testSeekRankOnCacheBoundary() {
long cacheSize = fExperiment.getCacheSize();
assertEquals("Context rank", 4 * cacheSize + 1, context.getRank());
}
- public void testSeekRankNotOnCacheBoundary() throws Exception {
+ public void testSeekRankNotOnCacheBoundary() {
long cacheSize = fExperiment.getCacheSize();
assertEquals("Context rank", 4501, context.getRank());
}
- public void testSeekRankOutOfScope() throws Exception {
+ public void testSeekRankOutOfScope() {
// Position trace at beginning
ITmfContext context = fExperiment.seekEvent(-1);
// seekEvent on timestamp
// ------------------------------------------------------------------------
- public void testSeekTimestampOnCacheBoundary() throws Exception {
+ public void testSeekTimestampOnCacheBoundary() {
long cacheSize = fExperiment.getCacheSize();
assertEquals("Context rank", 4 * cacheSize + 1, context.getRank());
}
- public void testSeekTimestampNotOnCacheBoundary() throws Exception {
+ public void testSeekTimestampNotOnCacheBoundary() {
// Position trace at event rank 1 (TS = 2)
ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(2, SCALE, 0));
assertEquals("Context rank", 4501, context.getRank());
}
- public void testSeekTimestampOutOfScope() throws Exception {
+ public void testSeekTimestampOutOfScope() {
// Position trace at beginning
ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(-1, SCALE, 0));
// seekEvent by location (context rank is undefined)
// ------------------------------------------------------------------------
- public void testSeekLocationOnCacheBoundary() throws Exception {
+ public void testSeekLocationOnCacheBoundary() {
long cacheSize = fExperiment.getCacheSize();
assertEquals("Event timestamp", 4 * cacheSize + 2, event.getTimestamp().getValue());
}
- public void testSeekLocationNotOnCacheBoundary() throws Exception {
+ public void testSeekLocationNotOnCacheBoundary() {
long cacheSize = fExperiment.getCacheSize();
assertEquals("Event timestamp", 4502, event.getTimestamp().getValue());
}
- public void testSeekLocationOutOfScope() throws Exception {
+ public void testSeekLocationOutOfScope() {
// Position trace at beginning
ITmfContext context = fExperiment.seekEvent((ITmfLocation<?>) null);
// getNext - updates the context
// ------------------------------------------------------------------------
- private void validateContextRanks(ITmfContext context) {
+ private static void validateContextRanks(ITmfContext context) {
assertTrue("Experiment context type", context instanceof TmfExperimentContext);
TmfExperimentContext ctx = (TmfExperimentContext) context;
assertEquals("Experiment context rank", expRank, ctx.getRank());
}
- public void testGetNextAfteSeekingOnTS_1() throws Exception {
+ public void testGetNextAfteSeekingOnTS_1() {
final long INITIAL_TS = 1;
final int NB_READS = 20;
validateContextRanks(context);
}
- public void testGetNextAfteSeekingOnTS_2() throws Exception {
+ public void testGetNextAfteSeekingOnTS_2() {
final long INITIAL_TS = 2;
final int NB_READS = 20;
validateContextRanks(context);
}
- public void testGetNextAfteSeekingOnTS_3() throws Exception {
+ public void testGetNextAfteSeekingOnTS_3() {
final long INITIAL_TS = 500;
final int NB_READS = 20;
validateContextRanks(context);
}
- public void testGetNextAfterSeekingOnRank_1() throws Exception {
+ public void testGetNextAfterSeekingOnRank_1() {
final long INITIAL_RANK = 0L;
final int NB_READS = 20;
validateContextRanks(context);
}
- public void testGetNextAfterSeekingOnRank_2() throws Exception {
+ public void testGetNextAfterSeekingOnRank_2() {
final long INITIAL_RANK = 1L;
final int NB_READS = 20;
validateContextRanks(context);
}
- public void testGetNextAfterSeekingOnRank_3() throws Exception {
+ public void testGetNextAfterSeekingOnRank_3() {
final long INITIAL_RANK = 500L;
final int NB_READS = 20;
validateContextRanks(context);
}
- public void testGetNextAfterSeekingOnLocation_1() throws Exception {
+ public void testGetNextAfterSeekingOnLocation_1() {
final ITmfLocation<?> INITIAL_LOC = null;
final long INITIAL_TS = 1;
validateContextRanks(context);
}
- public void testGetNextAfterSeekingOnLocation_2() throws Exception {
+ public void testGetNextAfterSeekingOnLocation_2() {
final ITmfLocation<?> INITIAL_LOC = fExperiment.seekEvent(1L).getLocation();
final long INITIAL_TS = 2;
validateContextRanks(context);
}
- public void testGetNextAfterSeekingOnLocation_3() throws Exception {
+ public void testGetNextAfterSeekingOnLocation_3() {
final ITmfLocation<?> INITIAL_LOC = fExperiment.seekEvent(500L).getLocation();
final long INITIAL_TS = 501;
validateContextRanks(context);
}
- public void testGetNextLocation() throws Exception {
+ public void testGetNextLocation() {
ITmfContext context1 = fExperiment.seekEvent(0);
fExperiment.getNext(context1);
ITmfLocation<?> location = context1.getLocation().clone();
assertEquals("Event timestamp", event1.getTimestamp().getValue(), event2.getTimestamp().getValue());
}
- public void testGetNextEndLocation() throws Exception {
+ public void testGetNextEndLocation() {
ITmfContext context1 = fExperiment.seekEvent(fExperiment.getNbEvents() - 1);
fExperiment.getNext(context1);
ITmfLocation<?> location = context1.getLocation().clone();
ITmfEvent event = fExperiment.getNext(context2);
assertNull("Event", event);
}
-
+
// ------------------------------------------------------------------------
// processRequest
// ------------------------------------------------------------------------
- public void testProcessRequestForNbEvents() throws Exception {
+ public void testProcessRequestForNbEvents() throws InterruptedException {
final int blockSize = 100;
final int nbEvents = 1000;
}
}
- public void testProcessRequestForNbEvents2() throws Exception {
+ public void testProcessRequestForNbEvents2() throws InterruptedException {
final int blockSize = 2 * NB_EVENTS;
final int nbEvents = 1000;
}
}
- public void testProcessRequestForAllEvents() throws Exception {
+ public void testProcessRequestForAllEvents() throws InterruptedException {
final int nbEvents = TmfDataRequest.ALL_DATA;
final int blockSize = 1;
// cancel
// ------------------------------------------------------------------------
- public void testCancel() throws Exception {
+ public void testCancel() throws InterruptedException {
final int nbEvents = NB_EVENTS;
final int blockSize = BLOCK_SIZE;
/*******************************************************************************
* 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
*******************************************************************************/
/**
* Test suite for the TmfLocation class.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class TmfLocationTest extends TestCase {
// ------------------------------------------------------------------------
}
}
- public static class MyCloneableClass implements Cloneable, Comparable<MyCloneableClass> {
+ private static class MyCloneableClass implements Cloneable, Comparable<MyCloneableClass> {
private String fName;
public MyCloneableClass(String name) {
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (!(obj instanceof MyCloneableClass))
+ }
+ if (!(obj instanceof MyCloneableClass)) {
return false;
+ }
MyCloneableClass other = (MyCloneableClass) obj;
if (fName == null) {
- if (other.fName != null)
+ if (other.fName != null) {
return false;
- } else if (!fName.equals(other.fName))
+ }
+ } else if (!fName.equals(other.fName)) {
return false;
+ }
return true;
}
}
}
}
- public static class MyUnCloneableClass implements Comparable<MyUnCloneableClass> {
+ private static class MyUnCloneableClass implements Comparable<MyUnCloneableClass> {
private String fName;
public MyUnCloneableClass(String name) {
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (!(obj instanceof MyUnCloneableClass))
+ }
+ if (!(obj instanceof MyUnCloneableClass)) {
return false;
+ }
MyUnCloneableClass other = (MyUnCloneableClass) obj;
if (fName == null) {
- if (other.fName != null)
+ if (other.fName != null) {
return false;
- } else if (!fName.equals(other.fName))
+ }
+ } else if (!fName.equals(other.fName)) {
return false;
+ }
return true;
}
}
// hashCode
// ------------------------------------------------------------------------
- public void testHashCode() throws Exception {
+ public void testHashCode() {
TmfLocation<String> location1 = new TmfLocation<String>((String) null);
TmfLocation<String> location2 = new TmfLocation<String>(aString);
TmfLocation<Long> location3 = new TmfLocation<Long>(aLong);
}
}
- public void testEqualsWrongTypes() throws Exception {
+ public void testEqualsWrongTypes() {
TmfLocation<String> location1 = new TmfLocation<String>(aString);
TmfLocation2 location2 = new TmfLocation2(aString);
-
+
assertFalse("equals", location1.equals(location2));
assertFalse("equals", location2.equals(location1));
}
- public void testEqualsWithNulls() throws Exception {
+ public void testEqualsWithNulls() {
TmfLocation<String> location1 = new TmfLocation<String>(aString);
TmfLocation<String> location2 = new TmfLocation<String>((String) null);
-
+
assertFalse("equals", location1.equals(location2));
assertFalse("equals", location2.equals(location1));
}
- public void testEqualsReflexivity() throws Exception {
+ public void testEqualsReflexivity() {
assertTrue("equals", fLocation2.equals(fLocation2));
assertTrue("equals", fLocation3.equals(fLocation3));
assertTrue("equals", !fLocation3.equals(fLocation2));
}
- public void testEqualsSymmetry() throws Exception {
+ public void testEqualsSymmetry() {
TmfLocation<String> location2 = new TmfLocation<String>(aString);
TmfLocation<Long> location3 = new TmfLocation<Long>(aLong);
assertTrue("equals", fLocation3.equals(location3));
}
- public void testEqualsTransivity() throws Exception {
+ public void testEqualsTransivity() {
TmfLocation<String> location1 = new TmfLocation<String>(aString);
TmfLocation<String> location2 = new TmfLocation<String>(aString);
TmfLocation<String> location3 = new TmfLocation<String>(aString);
assertTrue("equals", location3.equals(location1));
}
- public void testEqualsNull() throws Exception {
+ public void testEqualsNull() {
assertTrue("equals", !fLocation2.equals(null));
assertTrue("equals", !fLocation2.equals(null));
}
// toString
// ------------------------------------------------------------------------
+ @SuppressWarnings("hiding")
public void testToString() {
String aString = "some location";
Long aLong = 12345L;
/**
* Test suite for the TmfExperiment class (multiple traces).
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class TmfMultiTraceExperimentTest extends TestCase {
// ------------------------------------------------------------------------
return fTraces;
}
- public TmfMultiTraceExperimentTest(final String name) throws Exception {
+ /**
+ * @param name the test name
+ */
+ public TmfMultiTraceExperimentTest(final String name) {
super(name);
}
// seekEvent on rank
// ------------------------------------------------------------------------
- public void testSeekRankOnCacheBoundary() throws Exception {
+ public void testSeekRankOnCacheBoundary() {
long cacheSize = fExperiment.getCacheSize();
assertEquals("Context rank", 4 * cacheSize + 1, context.getRank());
}
- public void testSeekRankNotOnCacheBoundary() throws Exception {
+ public void testSeekRankNotOnCacheBoundary() {
long cacheSize = fExperiment.getCacheSize();
assertEquals("Context rank", 4501, context.getRank());
}
- public void testSeekRankOutOfScope() throws Exception {
+ public void testSeekRankOutOfScope() {
// Position trace at beginning
ITmfContext context = fExperiment.seekEvent(-1);
// seekEvent on timestamp
// ------------------------------------------------------------------------
- public void testSeekTimestampOnCacheBoundary() throws Exception {
+ public void testSeekTimestampOnCacheBoundary() {
long cacheSize = fExperiment.getCacheSize();
assertEquals("Context rank", 4 * cacheSize + 1, context.getRank());
}
- public void testSeekTimestampNotOnCacheBoundary() throws Exception {
+ public void testSeekTimestampNotOnCacheBoundary() {
// Position trace at event rank 1 (TS = 2)
ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(2, SCALE, 0));
assertEquals("Context rank", 4501, context.getRank());
}
- public void testSeekTimestampOutOfScope() throws Exception {
+ public void testSeekTimestampOutOfScope() {
// Position trace at beginning
ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(-1, SCALE, 0));
// seekEvent by location (context rank is undefined)
// ------------------------------------------------------------------------
- public void testSeekLocationOnCacheBoundary() throws Exception {
+ public void testSeekLocationOnCacheBoundary() {
long cacheSize = fExperiment.getCacheSize();
assertEquals("Event timestamp", 4 * cacheSize + 2, event.getTimestamp().getValue());
}
- public void testSeekLocationNotOnCacheBoundary() throws Exception {
+ public void testSeekLocationNotOnCacheBoundary() {
long cacheSize = fExperiment.getCacheSize();
assertEquals("Event timestamp", 4502, event.getTimestamp().getValue());
}
- public void testSeekLocationOutOfScope() throws Exception {
+ public void testSeekLocationOutOfScope() {
// Position trace at beginning
ITmfContext context = fExperiment.seekEvent((ITmfLocation<?>) null);
// getNext - updates the context
// ------------------------------------------------------------------------
- private void validateContextRanks(ITmfContext context) {
+ private static void validateContextRanks(ITmfContext context) {
assertTrue("Experiment context type", context instanceof TmfExperimentContext);
TmfExperimentContext ctx = (TmfExperimentContext) context;
assertEquals("Experiment context rank", expRank, ctx.getRank());
}
- public void testGetNextAfteSeekingOnTS_1() throws Exception {
+ public void testGetNextAfteSeekingOnTS_1() {
final long INITIAL_TS = 1;
final int NB_READS = 20;
validateContextRanks(context);
}
- public void testGetNextAfteSeekingOnTS_2() throws Exception {
+ public void testGetNextAfteSeekingOnTS_2() {
final long INITIAL_TS = 2;
final int NB_READS = 20;
validateContextRanks(context);
}
- public void testGetNextAfteSeekingOnTS_3() throws Exception {
+ public void testGetNextAfteSeekingOnTS_3() {
final long INITIAL_TS = 500;
final int NB_READS = 20;
validateContextRanks(context);
}
- public void testGetNextAfterSeekingOnRank_1() throws Exception {
+ public void testGetNextAfterSeekingOnRank_1() {
final long INITIAL_RANK = 0L;
final int NB_READS = 20;
validateContextRanks(context);
}
- public void testGetNextAfterSeekingOnRank_2() throws Exception {
+ public void testGetNextAfterSeekingOnRank_2() {
final long INITIAL_RANK = 1L;
final int NB_READS = 20;
validateContextRanks(context);
}
- public void testGetNextAfterSeekingOnRank_3() throws Exception {
+ public void testGetNextAfterSeekingOnRank_3() {
final long INITIAL_RANK = 500L;
final int NB_READS = 20;
validateContextRanks(context);
}
- public void testGetNextAfterSeekingOnLocation_1() throws Exception {
+ public void testGetNextAfterSeekingOnLocation_1() {
final ITmfLocation<?> INITIAL_LOC = null;
final long INITIAL_TS = 1;
validateContextRanks(context);
}
- public void testGetNextAfterSeekingOnLocation_2() throws Exception {
+ public void testGetNextAfterSeekingOnLocation_2() {
final ITmfLocation<?> INITIAL_LOC = fExperiment.seekEvent(1L).getLocation();
final long INITIAL_TS = 2;
validateContextRanks(context);
}
- public void testGetNextAfterSeekingOnLocation_3() throws Exception {
+ public void testGetNextAfterSeekingOnLocation_3() {
final ITmfLocation<?> INITIAL_LOC = fExperiment.seekEvent(500L).getLocation();
final long INITIAL_TS = 501;
validateContextRanks(context);
}
- public void testGetNextLocation() throws Exception {
+ public void testGetNextLocation() {
ITmfContext context1 = fExperiment.seekEvent(0);
fExperiment.getNext(context1);
ITmfLocation<?> location = context1.getLocation().clone();
assertEquals("Event timestamp", event1.getTimestamp().getValue(), event2.getTimestamp().getValue());
}
- public void testGetNextEndLocation() throws Exception {
+ public void testGetNextEndLocation() {
ITmfContext context1 = fExperiment.seekEvent(fExperiment.getNbEvents() - 1);
fExperiment.getNext(context1);
ITmfLocation<?> location = context1.getLocation().clone();
// processRequest
// ------------------------------------------------------------------------
- public void testProcessRequestForNbEvents() throws Exception {
+ public void testProcessRequestForNbEvents() throws InterruptedException {
final int blockSize = 100;
final int nbEvents = 1000;
}
}
- public void testProcessRequestForNbEvents2() throws Exception {
+ public void testProcessRequestForNbEvents2() throws InterruptedException {
final int blockSize = 2 * NB_EVENTS;
final int nbEvents = 1000;
}
}
- public void testProcessRequestForAllEvents() throws Exception {
+ public void testProcessRequestForAllEvents() throws InterruptedException {
final int nbEvents = TmfDataRequest.ALL_DATA;
final int blockSize = 1;
// cancel
// ------------------------------------------------------------------------
- public void testCancel() throws Exception {
+ public void testCancel() throws InterruptedException {
final int nbEvents = NB_EVENTS;
final int blockSize = BLOCK_SIZE;
// getTimestamp
// ------------------------------------------------------------------------
- public void testGetTimestamp() throws Exception {
+ public void testGetTimestamp() {
assertEquals("getTimestamp", new TmfTimestamp( 1, (byte) -3), fExperiment.getTimestamp( 0));
assertEquals("getTimestamp", new TmfTimestamp( 2, (byte) -3), fExperiment.getTimestamp( 1));
assertEquals("getTimestamp", new TmfTimestamp( 11, (byte) -3), fExperiment.getTimestamp( 10));
/**
* Test suite for the TmfTrace class.
*/
-@SuppressWarnings({ "nls" })
+@SuppressWarnings({"nls","javadoc"})
public class TmfTraceTest extends TestCase {
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
- public TmfTraceTest(final String name) throws Exception {
+ /**
+ * @param name the test name
+ */
+ public TmfTraceTest(final String name) {
super(name);
}
// Constructors
// ------------------------------------------------------------------------
- public void testStandardConstructor() throws Exception {
+ @SuppressWarnings("null")
+ public void testStandardConstructor() throws TmfTraceException {
TmfTraceStub trace = null;
File testfile = null;
try {
assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
}
- public void testStandardConstructorCacheSize() throws Exception {
+ @SuppressWarnings("null")
+ public void testStandardConstructorCacheSize() throws TmfTraceException {
TmfTraceStub trace = null;
File testfile = null;
try {
assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
}
- public void testFullConstructor() throws Exception {
+ @SuppressWarnings("null")
+ public void testFullConstructor() throws TmfTraceException {
TmfTraceStub trace = null;
File testfile = null;
try {
assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
}
- public void testLiveTraceConstructor() throws Exception {
+ @SuppressWarnings("null")
+ public void testLiveTraceConstructor() throws TmfTraceException {
TmfTraceStub trace = null;
File testfile = null;
final long interval = 100;
assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
}
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public void testCopyConstructor() throws Exception {
+ @SuppressWarnings({ "unchecked", "rawtypes", "null" })
+ public void testCopyConstructor() throws TmfTraceException {
TmfTraceStub original = null;
TmfTraceStub trace = null;
File testfile = null;
// Trace initialization
// ------------------------------------------------------------------------
- public void testInitializeNullPath() throws Exception {
+ public void testInitializeNullPath() {
// Instantiate an "empty" trace
final TmfTraceStub trace = new TmfTraceStub();
fail("TmfTrace.initialize() - wrong exception thrown");
}
}
-
- public void testInitializeSimplePath() throws Exception {
+
+ public void testInitializeSimplePath() {
// Instantiate an "empty" trace
final TmfTraceStub trace = new TmfTraceStub();
assertEquals("getEndTime", Long.MIN_VALUE, trace.getEndTime().getValue());
}
- public void testInitializeNormalPath() throws Exception {
+ public void testInitializeNormalPath() {
// Instantiate an "empty" trace
final TmfTraceStub trace = new TmfTraceStub();
assertEquals("getEndTime", Long.MIN_VALUE, trace.getEndTime().getValue());
}
- public void testInitTrace() throws Exception {
+ public void testInitTrace() throws URISyntaxException, IOException, TmfTraceException, InterruptedException {
// Instantiate an "empty" trace
final TmfTraceStub trace = new TmfTraceStub();
// Set/Get streaming interval
// ------------------------------------------------------------------------
- public void testSetStreamingInterval() throws Exception {
+ public void testSetStreamingInterval() throws TmfTraceException {
final TmfTraceStub trace = new TmfTraceStub(fTrace);
long interval = 0;
interval = 100;
trace.setStreamingInterval(interval);
assertEquals("getStreamingInterval", interval, trace.getStreamingInterval());
-
+
interval = -1;
trace.setStreamingInterval(interval);
assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
-
+
interval = 0;
trace.setStreamingInterval(interval);
assertEquals("getStreamingInterval", interval, trace.getStreamingInterval());
-
+
trace.dispose();
}
// Set/Get time range
// ------------------------------------------------------------------------
- public void testSetTimeRange() throws Exception {
+ public void testSetTimeRange() throws TmfTraceException {
final TmfTraceStub trace = new TmfTraceStub(fTrace);
trace.indexTrace();
trace.dispose();
}
- public void testSetStartTime() throws Exception {
+ public void testSetStartTime() throws TmfTraceException {
final TmfTraceStub trace = new TmfTraceStub(fTrace);
trace.indexTrace();
trace.dispose();
}
- public void testSetEndTime() throws Exception {
+ public void testSetEndTime() throws TmfTraceException {
final TmfTraceStub trace = new TmfTraceStub(fTrace);
trace.indexTrace();
trace.dispose();
}
- public void testSetNbEvents() throws Exception {
+ public void testSetNbEvents() throws TmfTraceException {
final TmfTraceStub trace = new TmfTraceStub(fTrace);
trace.indexTrace();
// seekEvent on location (note: does not reliably set the rank)
// ------------------------------------------------------------------------
- public void testSeekEventOnCacheBoundary() throws Exception {
+ public void testSeekEventOnCacheBoundary() {
// Position trace at event rank 0
ITmfContext context = fTrace.seekEvent(0);
assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
}
- public void testSeekEventNotOnCacheBoundary() throws Exception {
+ public void testSeekEventNotOnCacheBoundary() {
// Position trace at event rank 9
ITmfContext tmpContext = fTrace.seekEvent(new TmfTimestamp(10, SCALE, 0));
assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
}
- public void testSeekEventOutOfScope() throws Exception {
+ public void testSeekEventOutOfScope() {
// Position trace at beginning
ITmfContext tmpContext = fTrace.seekEvent(0);
// seekEvent on timestamp (note: does not reliably set the rank)
// ------------------------------------------------------------------------
- public void testSeekEventOnNullTimestamp() throws Exception {
+ public void testSeekEventOnNullTimestamp() {
// Position trace at event rank 0
ITmfContext context = fTrace.seekEvent((ITmfTimestamp) null);
assertEquals("Event rank", 0, context.getRank());
}
- public void testSeekEventOnTimestampOnCacheBoundary() throws Exception {
+ public void testSeekEventOnTimestampOnCacheBoundary() {
// Position trace at event rank 0
ITmfContext context = fTrace.seekEvent(new TmfTimestamp(1, SCALE, 0));
assertEquals("Event rank", 4001, context.getRank());
}
- public void testSeekEventOnTimestampNotOnCacheBoundary() throws Exception {
+ public void testSeekEventOnTimestampNotOnCacheBoundary() {
// Position trace at event rank 1
ITmfContext context = fTrace.seekEvent(new TmfTimestamp(2, SCALE, 0));
assertEquals("Event rank", 4501, context.getRank());
}
- public void testSeekEventOnTimestampOutOfScope() throws Exception {
+ public void testSeekEventOnTimestampOutOfScope() {
// Position trace at beginning
ITmfContext context = fTrace.seekEvent(new TmfTimestamp(-1, SCALE, 0));
// seekEvent on rank
// ------------------------------------------------------------------------
- public void testSeekEventOnNegativeRank() throws Exception {
+ public void testSeekEventOnNegativeRank() {
// Position trace at event rank 0
ITmfContext context = fTrace.seekEvent(-1);
assertEquals("Event rank", 0, context.getRank());
}
- public void testSeekOnRankOnCacheBoundary() throws Exception {
+ public void testSeekOnRankOnCacheBoundary() {
// On lower bound, returns the first event (ts = 1)
ITmfContext context = fTrace.seekEvent(0);
assertEquals("Event rank", 4001, context.getRank());
}
- public void testSeekOnRankNotOnCacheBoundary() throws Exception {
+ public void testSeekOnRankNotOnCacheBoundary() {
// Position trace at event rank 9
ITmfContext context = fTrace.seekEvent(9);
assertEquals("Event rank", 4501, context.getRank());
}
- public void testSeekEventOnRankOutOfScope() throws Exception {
+ public void testSeekEventOnRankOutOfScope() {
// Position trace at beginning
ITmfContext context = fTrace.seekEvent(-1);
// parseEvent - make sure parseEvent doesn't update the context
// ------------------------------------------------------------------------
- public void testParseEvent() throws Exception {
+ public void testParseEvent() {
final int NB_READS = 20;
// getNext - updates the context
// ------------------------------------------------------------------------
- public void testGetNextAfteSeekingOnTS_1() throws Exception {
+ public void testGetNextAfteSeekingOnTS_1() {
final long INITIAL_TS = 1;
final int NB_READS = 20;
assertEquals("Event rank", INITIAL_TS + NB_READS - 1, context.getRank());
}
- public void testGetNextAfteSeekingOnTS_2() throws Exception {
+ public void testGetNextAfteSeekingOnTS_2() {
final long INITIAL_TS = 2;
final int NB_READS = 20;
assertEquals("Event rank", INITIAL_TS + NB_READS - 1, context.getRank());
}
- public void testGetNextAfteSeekingOnTS_3() throws Exception {
+ public void testGetNextAfteSeekingOnTS_3() {
final long INITIAL_TS = 500;
final int NB_READS = 20;
assertEquals("Event rank", INITIAL_TS + NB_READS - 1, context.getRank());
}
- public void testGetNextAfterSeekingOnRank_1() throws Exception {
+ public void testGetNextAfterSeekingOnRank_1() {
final long INITIAL_RANK = 0L;
final int NB_READS = 20;
assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
}
- public void testGetNextAfterSeekingOnRank_2() throws Exception {
+ public void testGetNextAfterSeekingOnRank_2() {
final long INITIAL_RANK = 1L;
final int NB_READS = 20;
assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
}
- public void testGetNextAfterSeekingOnRank_3() throws Exception {
+ public void testGetNextAfterSeekingOnRank_3() {
final long INITIAL_RANK = 500L;
final int NB_READS = 20;
assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
}
- public void testGetNextAfterSeekingOnLocation_1() throws Exception {
+ public void testGetNextAfterSeekingOnLocation_1() {
final ITmfLocation<?> INITIAL_LOC = null;
final long INITIAL_TS = 1;
assertEquals("Event rank", INITIAL_TS + NB_READS - 1, context.getRank());
}
- public void testGetNextAfterSeekingOnLocation_2() throws Exception {
+ public void testGetNextAfterSeekingOnLocation_2() {
final ITmfLocation<?> INITIAL_LOC = fTrace.seekEvent(1L).getLocation();
final long INITIAL_TS = 2;
assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
}
- public void testGetNextAfterSeekingOnLocation_3() throws Exception {
+ public void testGetNextAfterSeekingOnLocation_3() {
final ITmfLocation<?> INITIAL_LOC = fTrace.seekEvent(500L).getLocation();
final long INITIAL_TS = 501;
assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
}
- public void testGetNextLocation() throws Exception {
+ public void testGetNextLocation() {
ITmfContext context1 = fTrace.seekEvent(0);
fTrace.getNext(context1);
ITmfLocation<?> location = context1.getLocation().clone();
assertEquals("Event timestamp", event1.getTimestamp().getValue(), event2.getTimestamp().getValue());
}
- public void testGetNextEndLocation() throws Exception {
+ public void testGetNextEndLocation() {
ITmfContext context1 = fTrace.seekEvent(fTrace.getNbEvents() - 1);
fTrace.getNext(context1);
ITmfLocation<?> location = context1.getLocation().clone();
// processRequest
// ------------------------------------------------------------------------
- @SuppressWarnings("unchecked")
- public void testProcessEventRequestForAllEvents() throws Exception {
+ @SuppressWarnings("hiding")
+ public void testProcessEventRequestForAllEvents() throws InterruptedException {
final int BLOCK_SIZE = 1;
final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>();
}
}
- @SuppressWarnings("unchecked")
- public void testProcessEventRequestForNbEvents() throws Exception {
+ @SuppressWarnings("hiding")
+ public void testProcessEventRequestForNbEvents() throws InterruptedException {
final int BLOCK_SIZE = 100;
final int NB_EVENTS = 1000;
final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>();
}
}
- @SuppressWarnings("unchecked")
- public void testProcessEventRequestForSomeEvents() throws Exception {
+ @SuppressWarnings("hiding")
+ public void testProcessEventRequestForSomeEvents() throws InterruptedException {
final int BLOCK_SIZE = 1;
final long startTime = 100;
final int NB_EVENTS = 1000;
}
}
- @SuppressWarnings("unchecked")
- public void testProcessEventRequestForOtherEvents() throws Exception {
+ @SuppressWarnings("hiding")
+ public void testProcessEventRequestForOtherEvents() throws InterruptedException {
final int BLOCK_SIZE = 1;
final int startIndex = 99;
final long startTime = 100;
}
}
- @SuppressWarnings("unchecked")
- public void testProcessDataRequestForSomeEvents() throws Exception {
+ @SuppressWarnings("hiding")
+ public void testProcessDataRequestForSomeEvents() throws InterruptedException {
final int startIndex = 100;
final int NB_EVENTS = 1000;
final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>();
// cancel
// ------------------------------------------------------------------------
- @SuppressWarnings("unchecked")
- public void testCancel() throws Exception {
+ public void testCancel() throws InterruptedException {
final Vector<TmfEvent> requestedEvents = new Vector<TmfEvent>();
final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
// toString
// ------------------------------------------------------------------------
- public void testDefaultTmfTraceStub() throws Exception {
+ public void testDefaultTmfTraceStub() {
assertFalse ("Open trace", fTrace == null);
assertEquals("getType", TmfEvent.class, fTrace.getType());
assertNull ("getResource", fTrace.getResource());
import org.eclipse.linuxtools.internal.tmf.core.Activator;
+/**
+ * <b><u>AllTests</u></b>
+ * <p>
+ * Implement me. Please.
+ * <p>
+ */
@SuppressWarnings({ "nls" })
public class AllTests {
+ /**
+ * @return the test suite
+ */
public static Test suite() {
TestSuite suite = new TestSuite("Test suite for " + Activator.PLUGIN_ID + ".uml2sd"); //$NON-NLS-1$);
//$JUnit-BEGIN$
import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.uml2sd.TmfAsyncSequenceDiagramEvent;
-@SuppressWarnings("nls")
+/**
+ * <b><u>TmfAsyncSequenceDiagramEventTest</u></b>
+ * <p>
+ * Implement me. Please.
+ * <p>
+ */
+@SuppressWarnings({"nls","javadoc"})
public class TmfAsyncSequenceDiagramEventTest extends TestCase {
private final String fContext = ITmfEventType.DEFAULT_CONTEXT_ID;
import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.uml2sd.TmfSyncSequenceDiagramEvent;
-@SuppressWarnings("nls")
+/**
+ * <b><u>TmfSyncSequenceDiagramEventTest</u></b>
+ * <p>
+ * Implement me. Please.
+ * <p>
+ */
+@SuppressWarnings({"nls","javadoc"})
public class TmfSyncSequenceDiagramEventTest extends TestCase {
private final String fContext = ITmfEventType.DEFAULT_CONTEXT_ID;
import org.eclipse.linuxtools.internal.tmf.core.Activator;
+/**
+ * <b><u>AllTests</u></b>
+ * <p>
+ * Implement me. Please.
+ * <p>
+ */
@SuppressWarnings({ "nls" })
public class AllTests {
+ /**
+ * @return the test suite
+ */
public static Test suite() {
TestSuite suite = new TestSuite("Test suite for " + Activator.PLUGIN_ID + ".util"); //$NON-NLS-1$);
//$JUnit-BEGIN$
/*******************************************************************************
* Copyright (c) 2011 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:
* Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation
*******************************************************************************/
import org.eclipse.linuxtools.tmf.core.util.TmfFixedArray;
+/**
+ * <b><u>TmfFixedArrayTest</u></b>
+ * <p>
+ * Implement me. Please.
+ * <p>
+ */
+@SuppressWarnings({"nls","javadoc"})
public class TmfFixedArrayTest extends TestCase {
-
+
// ------------------------------------------------------------------------
// Field(s)
// ------------------------------------------------------------------------
TmfFixedArray<String> fFixedArray1 = null;
TmfFixedArray<String> fFixedArray2 = null;
String fString1, fString2, fString3, fString4, fString5;
-
+
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
-
+
public TmfFixedArrayTest() {
- fString1 = "First String"; //$NON-NLS-1$
- fString2 = "Second String"; //$NON-NLS-1$
- fString3 = "Third String"; //$NON-NLS-1$
- fString4 = "Fourth String"; //$NON-NLS-1$
- fString5 = "Fifth String"; //$NON-NLS-1$
+ fString1 = "First String";
+ fString2 = "Second String";
+ fString3 = "Third String";
+ fString4 = "Fourth String";
+ fString5 = "Fifth String";
fFixedArray1 = new TmfFixedArray<String>(fString1, fString2, fString3);
fFixedArray2 = new TmfFixedArray<String>(); // Empty array at the beginning
}
-
+
@Override
protected void setUp() throws Exception {
super.setUp();
}
-
+
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
-
+
// ------------------------------------------------------------------------
// Get
// ------------------------------------------------------------------------
-
- public void testGet() throws Exception {
- assertTrue("get", fString1.equals(fFixedArray1.get(0))); //$NON-NLS-1$
- assertTrue("get", fString2.equals(fFixedArray1.get(1))); //$NON-NLS-1$
- assertTrue("get", fString3.equals(fFixedArray1.get(2))); //$NON-NLS-1$
-
+
+ public void testGet() {
+ assertTrue("get", fString1.equals(fFixedArray1.get(0)));
+ assertTrue("get", fString2.equals(fFixedArray1.get(1)));
+ assertTrue("get", fString3.equals(fFixedArray1.get(2)));
+
try {
fFixedArray2.get(0);
fail();
// Success
}
}
-
- public void testGetArray() throws Exception {
+
+ public void testGetArray() {
String[] stringArray = fFixedArray1.getArray();
- assertNotNull("getArray", stringArray); //$NON-NLS-1$
- assertTrue("getArray", fString1.equals(stringArray[0])); //$NON-NLS-1$
- assertTrue("getArray", fString2.equals(stringArray[1])); //$NON-NLS-1$
- assertTrue("getArray", fString3.equals(stringArray[2])); //$NON-NLS-1$
+ assertNotNull("getArray", stringArray);
+ assertTrue("getArray", fString1.equals(stringArray[0]));
+ assertTrue("getArray", fString2.equals(stringArray[1]));
+ assertTrue("getArray", fString3.equals(stringArray[2]));
}
-
+
// ------------------------------------------------------------------------
// Equals
// ------------------------------------------------------------------------
-
- public void testEqualsReflexivity() throws Exception {
- assertTrue("equals", fFixedArray1.equals(fFixedArray1)); //$NON-NLS-1$
- assertTrue("equals", fFixedArray2.equals(fFixedArray2)); //$NON-NLS-1$
-
- assertTrue("equals", !fFixedArray1.equals(fFixedArray2)); //$NON-NLS-1$
- assertTrue("equals", !fFixedArray2.equals(fFixedArray1)); //$NON-NLS-1$
+
+ public void testEqualsReflexivity() {
+ assertTrue("equals", fFixedArray1.equals(fFixedArray1));
+ assertTrue("equals", fFixedArray2.equals(fFixedArray2));
+
+ assertTrue("equals", !fFixedArray1.equals(fFixedArray2));
+ assertTrue("equals", !fFixedArray2.equals(fFixedArray1));
}
-
- @SuppressWarnings("unchecked")
- public void testEqualsSymmetry() throws Exception {
+
+ public void testEqualsSymmetry() {
TmfFixedArray<String> fixedArray1 = (TmfFixedArray<String>) fFixedArray1.clone();
TmfFixedArray<String> fixedArray2 = (TmfFixedArray<String>) fFixedArray2.clone();
- assertTrue("equals", fixedArray1.equals(fFixedArray1)); //$NON-NLS-1$
- assertTrue("equals", fFixedArray1.equals(fixedArray1)); //$NON-NLS-1$
+ assertTrue("equals", fixedArray1.equals(fFixedArray1));
+ assertTrue("equals", fFixedArray1.equals(fixedArray1));
- assertTrue("equals", fixedArray2.equals(fFixedArray2)); //$NON-NLS-1$
- assertTrue("equals", fFixedArray2.equals(fixedArray2)); //$NON-NLS-1$
+ assertTrue("equals", fixedArray2.equals(fFixedArray2));
+ assertTrue("equals", fFixedArray2.equals(fixedArray2));
}
-
- @SuppressWarnings("unchecked")
- public void testEqualsTransivity() throws Exception {
+
+ public void testEqualsTransivity() {
TmfFixedArray<String> fixedArray1 = (TmfFixedArray<String>) fFixedArray1.clone();
TmfFixedArray<String> fixedArray2 = (TmfFixedArray<String>) fFixedArray1.clone();
TmfFixedArray<String> fixedArray3 = (TmfFixedArray<String>) fFixedArray1.clone();
- assertTrue("equals", fixedArray1.equals(fixedArray2)); //$NON-NLS-1$
- assertTrue("equals", fixedArray2.equals(fixedArray3)); //$NON-NLS-1$
- assertTrue("equals", fixedArray1.equals(fixedArray3)); //$NON-NLS-1$
+ assertTrue("equals", fixedArray1.equals(fixedArray2));
+ assertTrue("equals", fixedArray2.equals(fixedArray3));
+ assertTrue("equals", fixedArray1.equals(fixedArray3));
}
-
- public void testEqualsNull() throws Exception {
- assertTrue("equals", !fFixedArray1.equals(null)); //$NON-NLS-1$
- assertTrue("equals", !fFixedArray2.equals(null)); //$NON-NLS-1$
+
+ public void testEqualsNull() {
+ assertTrue("equals", !fFixedArray1.equals(null));
+ assertTrue("equals", !fFixedArray2.equals(null));
}
-
+
// ------------------------------------------------------------------------
// Append
// ------------------------------------------------------------------------
public void testAppend() {
- TmfFixedArray<String> fixedArray = new TmfFixedArray<String>();
-
+ TmfFixedArray<String> fixedArray = new TmfFixedArray<String>();
+
fixedArray = fixedArray.append(fString1, fString2, fString3);
- assertEquals("append", 3, fixedArray.size()); //$NON-NLS-1$
- assertTrue("append", fString1.equals(fixedArray.get(0))); //$NON-NLS-1$
- assertTrue("append", fString2.equals(fixedArray.get(1))); //$NON-NLS-1$
- assertTrue("append", fString3.equals(fixedArray.get(2))); //$NON-NLS-1$
+ assertEquals("append", 3, fixedArray.size());
+ assertTrue("append", fString1.equals(fixedArray.get(0)));
+ assertTrue("append", fString2.equals(fixedArray.get(1)));
+ assertTrue("append", fString3.equals(fixedArray.get(2)));
fixedArray = fixedArray.append(fString4);
- assertEquals("append", 4, fixedArray.size()); //$NON-NLS-1$
- assertTrue("append", fString4.equals(fixedArray.get(3))); //$NON-NLS-1$
+ assertEquals("append", 4, fixedArray.size());
+ assertTrue("append", fString4.equals(fixedArray.get(3)));
}
-
-
+
+
@SuppressWarnings("unchecked")
- public void testAppendFixedArray() throws Exception {
+ public void testAppendFixedArray() {
TmfFixedArray<String> fixedArrayToAppend1 = new TmfFixedArray<String>(fString4);
TmfFixedArray<String> fixedArrayToAppend2 = new TmfFixedArray<String>(fString5);
TmfFixedArray<String> fixedArray = new TmfFixedArray<String>();
-
+
fixedArray = fixedArray.append(fFixedArray1, fixedArrayToAppend1);
- assertEquals("append", 4, fixedArray.size()); //$NON-NLS-1$
- assertTrue("append", fString1.equals(fixedArray.get(0))); //$NON-NLS-1$
- assertTrue("append", fString2.equals(fixedArray.get(1))); //$NON-NLS-1$
- assertTrue("append", fString3.equals(fixedArray.get(2))); //$NON-NLS-1$
- assertTrue("append", fString4.equals(fixedArray.get(3))); //$NON-NLS-1$
-
+ assertEquals("append", 4, fixedArray.size());
+ assertTrue("append", fString1.equals(fixedArray.get(0)));
+ assertTrue("append", fString2.equals(fixedArray.get(1)));
+ assertTrue("append", fString3.equals(fixedArray.get(2)));
+ assertTrue("append", fString4.equals(fixedArray.get(3)));
+
fixedArray = fixedArray.append(fixedArrayToAppend2);
- assertEquals("append", 5, fixedArray.size()); //$NON-NLS-1$
- assertTrue("append", fString5.equals(fixedArray.get(4))); //$NON-NLS-1$
+ assertEquals("append", 5, fixedArray.size());
+ assertTrue("append", fString5.equals(fixedArray.get(4)));
}
-
+
// ------------------------------------------------------------------------
// hashCode
// ------------------------------------------------------------------------
-
- @SuppressWarnings("unchecked")
- public void testHashCode() throws Exception {
+
+ public void testHashCode() {
TmfFixedArray<String> fixedArray1 = (TmfFixedArray<String>) fFixedArray1.clone();
TmfFixedArray<String> fixedArray2 = (TmfFixedArray<String>) fFixedArray2.clone();
- assertTrue("hashCode", fixedArray1.hashCode() == fFixedArray1.hashCode()); //$NON-NLS-1$
- assertTrue("hashCode", fFixedArray2.hashCode() == fixedArray2.hashCode()); //$NON-NLS-1$
+ assertTrue("hashCode", fixedArray1.hashCode() == fFixedArray1.hashCode());
+ assertTrue("hashCode", fFixedArray2.hashCode() == fixedArray2.hashCode());
- assertTrue("hashCode", fFixedArray1.hashCode() != fixedArray2.hashCode()); //$NON-NLS-1$
- assertTrue("hashCode", fFixedArray2.hashCode() != fixedArray1.hashCode()); //$NON-NLS-1$
+ assertTrue("hashCode", fFixedArray1.hashCode() != fixedArray2.hashCode());
+ assertTrue("hashCode", fFixedArray2.hashCode() != fixedArray1.hashCode());
}
-
+
// ------------------------------------------------------------------------
// toArray
// ------------------------------------------------------------------------
public void testToArray() {
String[] expected1 = {fString1, fString2, fString3};
- assertTrue("toArray", Arrays.equals(expected1, fFixedArray1.toArray())); //$NON-NLS-1$
-
+ assertTrue("toArray", Arrays.equals(expected1, fFixedArray1.toArray()));
+
String[] expected2 = {};
- assertTrue("toArray", Arrays.equals(expected2, fFixedArray2.toArray())); //$NON-NLS-1$
+ assertTrue("toArray", Arrays.equals(expected2, fFixedArray2.toArray()));
}
- public void testToArrayArg() throws Exception {
+ public void testToArrayArg() {
String[] stringArray = new String[3];
fFixedArray1.toArray(stringArray);
- assertTrue("toArrayArg", stringArray[0].equals(fFixedArray1.get(0))); //$NON-NLS-1$
- assertTrue("toArrayArg", stringArray[1].equals(fFixedArray1.get(1))); //$NON-NLS-1$
- assertTrue("toArrayArg", stringArray[2].equals(fFixedArray1.get(2))); //$NON-NLS-1$
-
+ assertTrue("toArrayArg", stringArray[0].equals(fFixedArray1.get(0)));
+ assertTrue("toArrayArg", stringArray[1].equals(fFixedArray1.get(1)));
+ assertTrue("toArrayArg", stringArray[2].equals(fFixedArray1.get(2)));
+
String[] stringBigArray = new String[10];
fFixedArray1.toArray(stringBigArray);
- assertNull("toArrayArg", stringBigArray[3]); //$NON-NLS-1$
-
+ assertNull("toArrayArg", stringBigArray[3]);
+
TmfFixedArray<Object> fFixedArrayObject = new TmfFixedArray<Object>(fString1);
stringArray = fFixedArrayObject.toArray(new String[0]);
- assertTrue("toArrayArg", stringArray[0].equals(fString1)); //$NON-NLS-1$
+ assertTrue("toArrayArg", stringArray[0].equals(fString1));
}
-
+
// ------------------------------------------------------------------------
// Size
// ------------------------------------------------------------------------
public void testSize() {
- assertEquals("toArray", 3, fFixedArray1.size()); //$NON-NLS-1$
-
- assertEquals("toArray", 0, fFixedArray2.size()); //$NON-NLS-1$
+ assertEquals("toArray", 3, fFixedArray1.size());
+
+ assertEquals("toArray", 0, fFixedArray2.size());
}
-
+
// ------------------------------------------------------------------------
// SubArray
// ------------------------------------------------------------------------
- public void testSubArray() throws Exception {
+ public void testSubArray() {
TmfFixedArray<String> subArray = fFixedArray1.subArray(1);
-
- assertEquals("SubArray", 2, subArray.size()); //$NON-NLS-1$
- assertTrue("SubArray", fString2.equals(subArray.get(0))); //$NON-NLS-1$
- assertTrue("SubArray", fString3.equals(subArray.get(1))); //$NON-NLS-1$
+
+ assertEquals("SubArray", 2, subArray.size());
+ assertTrue("SubArray", fString2.equals(subArray.get(0)));
+ assertTrue("SubArray", fString3.equals(subArray.get(1)));
}
-
+
public void testSubArray2() {
TmfFixedArray<String> subArray = fFixedArray1.subArray(1, 2);
-
- assertEquals("SubArray", 2, subArray.size()); //$NON-NLS-1$
- assertTrue("SubArray", fString2.equals(subArray.get(0))); //$NON-NLS-1$
- assertTrue("SubArray", fString3.equals(subArray.get(1))); //$NON-NLS-1$
+
+ assertEquals("SubArray", 2, subArray.size());
+ assertTrue("SubArray", fString2.equals(subArray.get(0)));
+ assertTrue("SubArray", fString3.equals(subArray.get(1)));
}
-
+
// ------------------------------------------------------------------------
// Set
// ------------------------------------------------------------------------
-
- public void testSet() throws Exception {
- String[] newString = {"new FirstString", "new SecondString", "new ThirdString"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
+ public void testSet() {
+ String[] newString = {"new FirstString", "new SecondString", "new ThirdString"};
+
fFixedArray1.set(0, newString[0]);
- assertTrue("getArray", newString[0].equals(newString[0])); //$NON-NLS-1$
-
+ assertTrue("getArray", newString[0].equals(newString[0]));
+
fFixedArray1.set(1, newString[1]);
- assertTrue("getArray", newString[1].equals(newString[1])); //$NON-NLS-1$
-
+ assertTrue("getArray", newString[1].equals(newString[1]));
+
fFixedArray1.set(2, newString[2]);
- assertTrue("getArray", newString[2].equals(newString[2])); //$NON-NLS-1$
-
+ assertTrue("getArray", newString[2].equals(newString[2]));
+
try {
- fFixedArray2.set(0, "newString"); //$NON-NLS-1$
+ fFixedArray2.set(0, "newString");
fail();
} catch (Exception e) {
// Success
}
}
-
+
// ------------------------------------------------------------------------
// toString
// ------------------------------------------------------------------------
public void testToString() {
String expected1 = Arrays.asList(fString1, fString2, fString3).toString();
- assertEquals("toString", expected1, fFixedArray1.toString()); //$NON-NLS-1$
+ assertEquals("toString", expected1, fFixedArray1.toString());
String expected2 = Arrays.asList().toString();
- assertEquals("toString", expected2, fFixedArray2.toString()); //$NON-NLS-1$
+ assertEquals("toString", expected2, fFixedArray2.toString());
}
}
* <p>
* TODO: Implement me. Please.
*/
-@SuppressWarnings({ "nls" })
+@SuppressWarnings({"nls","javadoc"})
public class TmfClientStub extends TmfComponent {
private TmfDataProvider<TmfSyntheticEventStub>[] fProviders;
super("TmfClientStub");
}
- @SuppressWarnings("unchecked")
public void findProvider() {
fProviders = (TmfDataProvider<TmfSyntheticEventStub>[]) TmfProviderManager.getProviders(TmfSyntheticEventStub.class, TmfSyntheticEventProviderStub.class);
// TmfEventRequest<TmfEventStub> request;
/*******************************************************************************
* Copyright (c) 2009, 2010 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
*******************************************************************************/
* <p>
* TODO: Implement me. Please.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class TmfDataProviderStub extends TmfDataProvider<TmfEvent> {
private static final String DIRECTORY = "testfiles";
/*******************************************************************************
* Copyright (c) 2009, 2010 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
*******************************************************************************/
* <p>
* TODO: Implement me. Please.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class TmfEventProviderStub extends TmfEventProvider<TmfEvent> {
private static final String DIRECTORY = "testfiles";
/*******************************************************************************
* Copyright (c) 2009, 2010 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
*******************************************************************************/
* <p>
* TODO: Implement me. Please.
*/
-@SuppressWarnings({ "nls" })
+@SuppressWarnings({"nls","javadoc"})
public class TmfSyntheticEventProviderStub extends TmfEventProvider<TmfSyntheticEventStub> {
public static final int BLOCK_SIZE = 100;
super("TmfSyntheticEventProviderStub", TmfSyntheticEventStub.class);
}
- @SuppressWarnings("unchecked")
@Override
public ITmfContext armRequest(final ITmfDataRequest<TmfSyntheticEventStub> request) {
@Override
public void handleData(final TmfEvent event) {
super.handleData(event);
- if (event != null)
+ if (event != null) {
handleIncomingData(event);
- else
+ } else {
request.done();
+ }
}
};
provider.sendRequest(subRequest);
TmfSyntheticEventStub data = null;
try {
data = fDataQueue.poll(TIMEOUT, TimeUnit.MILLISECONDS);
- if (data == null)
+ if (data == null) {
throw new InterruptedException();
+ }
}
catch (final InterruptedException e) {
}
boolean ok = false;
try {
ok = fDataQueue.offer(data, TIMEOUT, TimeUnit.MILLISECONDS);
- if (!ok)
+ if (!ok) {
throw new InterruptedException();
+ }
}
catch (final InterruptedException e) {
}
/*******************************************************************************
* Copyright (c) 2009 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
*******************************************************************************/
* <p>
* TODO: Implement me. Please.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class TmfEventTypeStub extends TmfEventType {
private static final ITmfEventField FIELD_1 = new TmfEventField("Field1", null);
/*******************************************************************************
* Copyright (c) 2009, 2010 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
*******************************************************************************/
* <p>
* TODO: Implement me. Please.
*/
+@SuppressWarnings("javadoc")
public class TmfSyntheticEventStub extends TmfEvent {
/*******************************************************************************
* Copyright (c) 2009 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
*******************************************************************************/
* <p>
* TODO: Implement me. Please.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class TmfEventParserStub implements ITmfEventParser<TmfEvent> {
// ------------------------------------------------------------------------
static final String typePrefix = "Type-";
@Override
- @SuppressWarnings("unchecked")
public TmfEvent parseEvent(final ITmfContext context) {
- if (! (fEventStream instanceof TmfTraceStub))
+ if (! (fEventStream instanceof TmfTraceStub)) {
return null;
+ }
// Highly inefficient...
final RandomAccessFile stream = ((TmfTraceStub) fEventStream).getStream();
final Integer reference = stream.readInt();
final int typeIndex = Integer.parseInt(type.substring(typePrefix.length()));
final String[] fields = new String[typeIndex];
- for (int i = 0; i < typeIndex; i++)
+ for (int i = 0; i < typeIndex; i++) {
fields[i] = stream.readUTF();
+ }
final StringBuffer content = new StringBuffer("[");
- if (typeIndex > 0)
+ if (typeIndex > 0) {
content.append(fields[0]);
- for (int i = 1; i < typeIndex; i++)
+ }
+ for (int i = 1; i < typeIndex; i++) {
content.append(", ").append(fields[i]);
+ }
content.append("]");
final TmfEventField root = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, content.toString());
* Implement me. Please.
* <p>
*/
+@SuppressWarnings("javadoc")
public class TmfExperimentStub<T extends ITmfEvent> extends TmfExperiment<TmfEvent> {
public TmfExperimentStub(String name, ITmfTrace<TmfEvent>[] traces, int blockSize) {
/*******************************************************************************
* Copyright (c) 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
*******************************************************************************/
* Implement me. Please.
* <p>
*/
+@SuppressWarnings("javadoc")
public class TmfIndexerStub extends TmfCheckpointIndexer<ITmfTrace<ITmfEvent>> {
@SuppressWarnings({ "rawtypes", "unchecked" })
* <p>
* Dummy test trace. Use in conjunction with TmfEventParserStub.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
public class TmfTraceStub extends TmfTrace<TmfEvent> implements ITmfEventParser<TmfEvent> {
// ------------------------------------------------------------------------