From 81c8e6f7d15368d4af81694b876ab14603980c69 Mon Sep 17 00:00:00 2001 From: Matthew Khouzam Date: Thu, 3 May 2012 18:55:57 -0400 Subject: [PATCH] Improve test cases. Coverage of 85%+ and fix bugs. Signed-off-by: Matthew Khouzam --- .../ctf/core/tests/trace/TestAll.java | 5 +- .../META-INF/MANIFEST.MF | 3 +- .../core/event/types/FloatDeclaration.java | 3 +- .../ctf/core/trace/StreamInputReader.java | 41 + .../internal/ctf/core/trace/StreamInput.java | 36 + .../tests/ctfadaptor/CtfIteratorTest.java | 797 +++++++++++++ .../tests/ctfadaptor/CtfLocationTest.java | 158 +++ .../tests/ctfadaptor/CtfTmfContentTest.java | 112 ++ .../ctfadaptor/CtfTmfEventFieldTest.java | 181 +++ .../tests/ctfadaptor/CtfTmfEventTest.java | 40 +- .../tests/ctfadaptor/CtfTmfEventTypeTest.java | 96 ++ .../tests/ctfadaptor/CtfTmfTimestampTest.java | 388 +++++++ .../tests/ctfadaptor/CtfTmfTraceTest.java | 1003 +++++++++++++++++ .../tmf/core/tests/ctfadaptor/TestAll.java | 39 + .../tmf/core/tests/ctfadaptor/TestParams.java | 6 +- .../tmf/core/ctfadaptor/CtfLocation.java | 37 + .../tmf/core/ctfadaptor/CtfTmfEvent.java | 3 +- .../tmf/core/ctfadaptor/CtfTmfEventField.java | 13 +- .../tmf/core/ctfadaptor/CtfTmfTimestamp.java | 4 +- 19 files changed, 2945 insertions(+), 20 deletions(-) create mode 100644 org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfIteratorTest.java create mode 100644 org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationTest.java create mode 100644 org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfContentTest.java create mode 100644 org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventFieldTest.java create mode 100644 org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTypeTest.java create mode 100644 org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTimestampTest.java create mode 100644 org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTraceTest.java create mode 100644 org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/TestAll.java diff --git a/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/TestAll.java b/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/TestAll.java index f2e3a982dd..3c9025911f 100644 --- a/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/TestAll.java +++ b/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/TestAll.java @@ -8,7 +8,7 @@ import org.junit.runners.Suite; * The class TestAll builds a suite that can be used to run all of * the tests within its package as well as within any subpackages of its * package. - * + * * @author ematkho * @version $Revision: 1.0 $ */ @@ -19,7 +19,6 @@ import org.junit.runners.Suite; StreamInputReaderTimestampComparatorTest.class, StreamInputReaderTest.class, StreamInputReaderComparatorTest.class, - // StreamInputPacketReaderTest.class, StreamInputPacketIndexEntryTest.class, StreamInputPacketIndexTest.class, StreamTest.class, CTFTraceTest.class, MetadataTest.class, }) @@ -27,7 +26,7 @@ public class TestAll { /** * Launch the test. - * + * * @param args * the command line arguments */ diff --git a/org.eclipse.linuxtools.ctf.core/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.ctf.core/META-INF/MANIFEST.MF index 64b5eb13b5..8240824e6c 100644 --- a/org.eclipse.linuxtools.ctf.core/META-INF/MANIFEST.MF +++ b/org.eclipse.linuxtools.ctf.core/META-INF/MANIFEST.MF @@ -13,4 +13,5 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0", org.eclipse.linuxtools.ctf.parser;bundle-version="0.1.0" Export-Package: org.eclipse.linuxtools.ctf.core.event, org.eclipse.linuxtools.ctf.core.event.types, - org.eclipse.linuxtools.ctf.core.trace + org.eclipse.linuxtools.ctf.core.trace, + org.eclipse.linuxtools.internal.ctf.core.event.io diff --git a/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/FloatDeclaration.java b/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/FloatDeclaration.java index 89ef7e523b..5576e3fdf4 100644 --- a/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/FloatDeclaration.java +++ b/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/FloatDeclaration.java @@ -72,6 +72,7 @@ public class FloatDeclaration implements IDeclaration { return encoding; } + @Override public long getAlignment() { return alignment; } @@ -81,7 +82,7 @@ public class FloatDeclaration implements IDeclaration { // ------------------------------------------------------------------------ @Override - public Definition createDefinition(IDefinitionScope definitionScope, + public FloatDefinition createDefinition(IDefinitionScope definitionScope, String fieldName) { return new FloatDefinition(this, definitionScope, fieldName); } diff --git a/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java b/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java index 1e0f3663ec..e6710aaad6 100644 --- a/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java +++ b/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java @@ -277,4 +277,45 @@ public class StreamInputReader { return packetReader; } + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = (prime * result) + name; + result = (prime * result) + + ((streamInput == null) ? 0 : streamInput.hashCode()); + return result; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof StreamInputReader)) { + return false; + } + StreamInputReader other = (StreamInputReader) obj; + if (name != other.name) { + return false; + } + if (streamInput == null) { + if (other.streamInput != null) { + return false; + } + } else if (!streamInput.equals(other.streamInput)) { + return false; + } + return true; + } + } diff --git a/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/trace/StreamInput.java b/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/trace/StreamInput.java index 7116c1be91..92b2945eb0 100644 --- a/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/trace/StreamInput.java +++ b/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/trace/StreamInput.java @@ -362,4 +362,40 @@ public class StreamInput implements IDefinitionScope { index.getEntries().get(0).setIndexBegin(0L); } + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = (prime * result) + ((file == null) ? 0 : file.hashCode()); + return result; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof StreamInput)) { + return false; + } + StreamInput other = (StreamInput) obj; + if (file == null) { + if (other.file != null) { + return false; + } + } else if (!file.equals(other.file)) { + return false; + } + return true; + } + } diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfIteratorTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfIteratorTest.java new file mode 100644 index 0000000000..9619e8b398 --- /dev/null +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfIteratorTest.java @@ -0,0 +1,797 @@ +package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator; +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocation; +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent; +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace; +import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * The class CtfIteratorTest contains tests for the class {@link CtfIterator}. + * + * @generatedBy CodePro at 03/05/12 2:29 PM + * @author ematkho + * @version $Revision: 1.0 $ + */ +@SuppressWarnings("static-method") +public class CtfIteratorTest { + /** + * Run the CtfIterator(CtfTmfTrace) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testCtfIterator_1() + throws Exception { + CtfTmfTrace trace = createTrace(); + CtfIterator result = new CtfIterator(trace); + assertNotNull(result); + } + + /** + * Run the CtfIterator(CtfTmfTrace) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testCtfIterator_2() + throws Exception { + CtfTmfTrace trace = createTrace(); + trace.init("test"); + + CtfIterator result = new CtfIterator(trace); + + assertNotNull(result); + } + + /** + * Run the CtfIterator(CtfTmfTrace,long,long) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testCtfIterator_3() + throws Exception { + CtfTmfTrace trace = createTrace(); + long timestampValue = 1L; + long rank = 1L; + + CtfIterator result = new CtfIterator(trace, timestampValue, rank); + + assertNotNull(result); + } + + + /** + * Run the boolean advance() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testAdvance_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + + boolean result = fixture.advance(); + assertTrue(result); + } + + /** + * Run the boolean advance() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testAdvance_2() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + + boolean result = fixture.advance(); + + assertTrue(result); + } + + /** + * Run the CtfIterator clone() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testClone_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + + CtfIterator result = fixture.clone(); + assertNotNull(result); + } + + /** + * Run the int compareTo(CtfIterator) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + + @Test + public void testCompareTo_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + CtfIterator o = new CtfIterator(createTrace()); + + int result = fixture.compareTo(o); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertEquals(0, result); + } + + /** + * @return + * @throws TmfTraceException + */ + private CtfTmfTrace createTrace() throws TmfTraceException { + return TestParams.createTrace(); + } + + /** + * Run the int compareTo(CtfIterator) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testCompareTo_2() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + CtfIterator o = new CtfIterator(createTrace()); + + int result = fixture.compareTo(o); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertEquals(0, result); + } + + /** + * Run the int compareTo(CtfIterator) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testCompareTo_3() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + CtfIterator o = new CtfIterator(createTrace()); + + int result = fixture.compareTo(o); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertEquals(0, result); + } + + /** + * Run the void dispose() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testDispose_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + + fixture.dispose(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + } + + /** + * Run the boolean equals(Object) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testEquals_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + CtfIterator obj = new CtfIterator(createTrace()); + CtfLocation ctfLocation1 = new CtfLocation(new Long(1L)); + ctfLocation1.setLocation(new Long(1L)); + obj.setLocation(ctfLocation1); + obj.increaseRank(); + + boolean result = fixture.equals(obj); + + assertTrue(result); + } + + /** + * Run the boolean equals(Object) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testEquals_2() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + Object obj = new Object(); + + boolean result = fixture.equals(obj); + + assertFalse(result); + } + + /** + * Run the boolean equals(Object) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testEquals_3() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + Object obj = new Object(); + + boolean result = fixture.equals(obj); + + assertFalse(result); + } + + /** + * Run the CtfTmfTrace getCtfTmfTrace() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetCtfTmfTrace_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + + CtfTmfTrace result = fixture.getCtfTmfTrace(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertNotNull(result); + } + + /** + * Run the CtfTmfEvent getCurrentEvent() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetCurrentEvent_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + + CtfTmfEvent result = fixture.getCurrentEvent(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertNotNull(result); + } + + /** + * Run the CtfTmfEvent getCurrentEvent() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetCurrentEvent_2() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + + CtfTmfEvent result = fixture.getCurrentEvent(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertNotNull(result); + } + + /** + * Run the CtfLocation getLocation() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetLocation_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + + CtfLocation result = fixture.getLocation(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertNotNull(result); + } + + /** + * Run the long getRank() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetRank_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + + long result = fixture.getRank(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertEquals(0L, result); + } + + /** + * Run the boolean hasValidRank() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testHasValidRank_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + + boolean result = fixture.hasValidRank(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertTrue(result); + } + + /** + * Run the boolean hasValidRank() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testHasValidRank_2() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + + boolean result = fixture.hasValidRank(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertTrue(result); + } + + /** + * Run the int hashCode() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testHashCode_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + + int result = fixture.hashCode(); + int result2 = fixture.hashCode(); + assertEquals(result, result2); + } + + /** + * Run the void increaseRank() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testIncreaseRank_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + + fixture.increaseRank(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + } + + /** + * Run the boolean seek(long) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testSeek_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + long timestamp = 1L; + + boolean result = fixture.seek(timestamp); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertTrue(result); + } + + /** + * Run the boolean seek(long) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testSeek_2() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + long timestamp = 1L; + + boolean result = fixture.seek(timestamp); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertTrue(result); + } + + /** + * Run the boolean seekRank(long) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testSeekRank_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + long rank = 1L; + + boolean result = fixture.seekRank(rank); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertTrue(result); + } + + /** + * Run the boolean seekRank(long) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testSeekRank_2() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + long rank = 1L; + + boolean result = fixture.seekRank(rank); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + assertTrue(result); + } + + /** + * Run the void setLocation(ITmfLocation) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testSetLocation_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + CtfLocation location = new CtfLocation(new Long(1L)); + location.setLocation(new Long(1L)); + + fixture.setLocation(location); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + } + + /** + * Run the void setRank(long) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testSetRank_1() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + long rank = 1L; + + fixture.setRank(rank); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + } + + /** + * Run the void setRank(long) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testSetRank_2() + throws Exception { + CtfIterator fixture = new CtfIterator(createTrace()); + CtfLocation ctfLocation = new CtfLocation(new Long(1L)); + ctfLocation.setLocation(new Long(1L)); + fixture.setLocation(ctfLocation); + fixture.increaseRank(); + long rank = 1L; + + fixture.setRank(rank); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // java.lang.NullPointerException + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152) + // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.(CTFTraceReader.java:92) + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.(CtfIterator.java:40) + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(CtfIteratorTest.class); + } +} \ No newline at end of file diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationTest.java new file mode 100644 index 0000000000..389889b543 --- /dev/null +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationTest.java @@ -0,0 +1,158 @@ +package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor; + +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocation; +import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp; +import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp; +import org.junit.*; +import static org.junit.Assert.*; + +/** + * The class CtfLocationTest contains tests for the class {@link CtfLocation}. + * + * @generatedBy CodePro at 03/05/12 2:29 PM + * @author ematkho + * @version $Revision: 1.0 $ + */ +public class CtfLocationTest { + /** + * Run the CtfLocation(Long) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testCtfLocation_1() + throws Exception { + Long location = new Long(1L); + + CtfLocation result = new CtfLocation(location); + + // add additional test code here + assertNotNull(result); + assertEquals(new Long(1L), result.getLocation()); + } + + /** + * Run the CtfLocation(ITmfTimestamp) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testCtfLocation_2() + throws Exception { + ITmfTimestamp timestamp = new TmfTimestamp(); + + CtfLocation result = new CtfLocation(timestamp); + + // add additional test code here + assertNotNull(result); + assertEquals(new Long(0L), result.getLocation()); + } + + /** + * Run the CtfLocation clone() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testClone_1() + throws Exception { + CtfLocation fixture = new CtfLocation(new Long(1L)); + fixture.setLocation(new Long(1L)); + + CtfLocation result = fixture.clone(); + + // add additional test code here + assertNotNull(result); + assertEquals(new Long(1L), result.getLocation()); + } + + /** + * Run the Long getLocation() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetLocation_1() + throws Exception { + CtfLocation fixture = new CtfLocation(new Long(1L)); + fixture.setLocation(new Long(1L)); + + Long result = fixture.getLocation(); + + // add additional test code here + assertNotNull(result); + assertEquals("1", result.toString()); + assertEquals((byte) 1, result.byteValue()); + assertEquals((short) 1, result.shortValue()); + assertEquals(1, result.intValue()); + assertEquals(1L, result.longValue()); + assertEquals(1.0f, result.floatValue(), 1.0f); + assertEquals(1.0, result.doubleValue(), 1.0); + } + + /** + * Run the void setLocation(Long) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testSetLocation_1() + throws Exception { + CtfLocation fixture = new CtfLocation(new Long(1L)); + fixture.setLocation(new Long(1L)); + Long location = new Long(1L); + + fixture.setLocation(location); + + // add additional test code here + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(CtfLocationTest.class); + } +} \ No newline at end of file diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfContentTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfContentTest.java new file mode 100644 index 0000000000..5b880e6bfc --- /dev/null +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfContentTest.java @@ -0,0 +1,112 @@ +package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor; + +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfContent; +import org.eclipse.linuxtools.tmf.core.event.ITmfEventField; +import org.junit.*; +import static org.junit.Assert.*; + +/** + * The class CtfTmfContentTest contains tests for the class {@link CtfTmfContent}. + * + * @generatedBy CodePro at 03/05/12 2:29 PM + * @author ematkho + * @version $Revision: 1.0 $ + */ +public class CtfTmfContentTest { + /** + * Run the CtfTmfContent(String,ITmfEventField[]) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testCtfTmfContent_1() + throws Exception { + String name = ""; + ITmfEventField[] fields = new ITmfEventField[] {}; + + CtfTmfContent result = new CtfTmfContent(name, fields); + + // add additional test code here + assertNotNull(result); + assertEquals("", result.toString()); + assertEquals("", result.getName()); + assertEquals(null, result.getValue()); + } + + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testToString_1() + throws Exception { + CtfTmfContent fixture = new CtfTmfContent("", new ITmfEventField[] {}); + + String result = fixture.toString(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testToString_2() + throws Exception { + CtfTmfContent fixture = new CtfTmfContent("", new ITmfEventField[] {}); + + String result = fixture.toString(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(CtfTmfContentTest.class); + } +} \ No newline at end of file diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventFieldTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventFieldTest.java new file mode 100644 index 0000000000..bcbabefccb --- /dev/null +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventFieldTest.java @@ -0,0 +1,181 @@ +package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.nio.ByteOrder; + +import org.eclipse.linuxtools.ctf.core.event.types.ArrayDeclaration; +import org.eclipse.linuxtools.ctf.core.event.types.Definition; +import org.eclipse.linuxtools.ctf.core.event.types.Encoding; +import org.eclipse.linuxtools.ctf.core.event.types.FloatDeclaration; +import org.eclipse.linuxtools.ctf.core.event.types.FloatDefinition; +import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration; +import org.eclipse.linuxtools.ctf.core.event.types.SequenceDeclaration; +import org.eclipse.linuxtools.ctf.core.event.types.StringDeclaration; +import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration; +import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition; +import org.eclipse.linuxtools.internal.ctf.core.event.io.BitBuffer; +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEventField; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * The class CtfTmfEventFieldTest contains tests for the class + * {@link CtfTmfEventField}. + * + * @generatedBy CodePro at 03/05/12 2:29 PM + * @author ematkho + * @version $Revision: 1.0 $ + */ +public class CtfTmfEventFieldTest { + + private static final String ROOT = "root"; //$NON-NLS-1$ + private static final String SEQ = "seq"; //$NON-NLS-1$ + private static final String ARRAY = "array"; //$NON-NLS-1$ + private static final String STR = "str"; //$NON-NLS-1$ + private static final String FLOAT = "float"; //$NON-NLS-1$ + private static final String LEN = "len"; //$NON-NLS-1$ + private static final String INT = "int"; //$NON-NLS-1$ + private static final String NAME = "test"; //$NON-NLS-1$ + + /** + * Run the CtfTmfEventField parseField(Definition,String) method test. + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testParseField_1() { + FloatDefinition fieldDef = (FloatDefinition) fixture + .lookupDefinition(FLOAT); + CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, "_"+NAME); //$NON-NLS-1$ + String result2 =CtfTmfEventField.copyFrom(result).toString(); + assertEquals( result2, "test=9.551467814359616E-38"); //$NON-NLS-1$ + } + + /** + * Run the CtfTmfEventField parseField(Definition,String) method test. + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testParseField_2() { + CtfTmfEventField result = CtfTmfEventField.parseField( + fixture.lookupArray(ARRAY), NAME); + String result2 =CtfTmfEventField.copyFrom(result).toString(); + assertEquals( result2, "test={ 2, 2}"); //$NON-NLS-1$ + } + + /** + * Run the CtfTmfEventField parseField(Definition,String) method test. + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testParseField_3() { + Definition fieldDef = fixture.lookupDefinition(INT); + CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME); + String result2 =CtfTmfEventField.copyFrom(result).toString(); + assertEquals( result2, "test=2"); //$NON-NLS-1$ + } + + /** + * Run the CtfTmfEventField parseField(Definition,String) method test. + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testParseField_4() { + Definition fieldDef = fixture.lookupDefinition(SEQ); + CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME); + String result2 =CtfTmfEventField.copyFrom(result).toString(); + assertEquals( result2, "test={ 2, 2}"); //$NON-NLS-1$ + } + + /** + * Run the CtfTmfEventField parseField(Definition,String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testParseField_5() { + Definition fieldDef = fixture.lookupDefinition(STR); + CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME); + String result2 =CtfTmfEventField.copyFrom(result).toString(); + assertEquals( result2, "test="); //$NON-NLS-1$ + } + + @Test + public void testClone() { + Definition fieldDef = fixture.lookupDefinition(STR); + CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME); + assertNotNull(result.clone()); + } + + + StructDefinition fixture; + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Before + public void setUp() throws Exception { + StructDeclaration sDec = new StructDeclaration(1l); + StringDeclaration strDec = new StringDeclaration(); + IntegerDeclaration intDec = new IntegerDeclaration(8, false, 8, + ByteOrder.BIG_ENDIAN, Encoding.NONE, null, 8); + FloatDeclaration flDec = new FloatDeclaration(8, 24, + ByteOrder.BIG_ENDIAN, Encoding.NONE, 8); + ArrayDeclaration arrDec = new ArrayDeclaration(2, intDec); + SequenceDeclaration seqDec = new SequenceDeclaration(LEN, intDec); + sDec.addField(INT, intDec); + sDec.addField(LEN, intDec); + sDec.addField(FLOAT, flDec); + sDec.addField(STR, strDec); + sDec.addField(ARRAY, arrDec); + sDec.addField(SEQ, seqDec); + fixture = sDec.createDefinition(fixture, ROOT); + int capacity = 1024; + java.nio.ByteBuffer bb = java.nio.ByteBuffer.allocateDirect(capacity); + for (int i = 0; i < capacity; i++) { + bb.put((byte) 2); + } + bb.position(20); + bb.put((byte) 0); + bb.position(0); + fixture.read(new BitBuffer(bb)); + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @After + public void tearDown() throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args + * the command line arguments + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(CtfTmfEventFieldTest.class); + } +} \ No newline at end of file diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java index 4ccb2a93f1..f572f59d20 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java @@ -10,6 +10,7 @@ import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator; import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent; import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace; import org.eclipse.linuxtools.tmf.core.event.ITmfEventField; +import org.eclipse.linuxtools.tmf.core.event.ITmfEventType; import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException; import org.junit.After; import org.junit.Before; @@ -38,8 +39,8 @@ public class CtfTmfEventTest { /** * Perform pre-test initialization. - * - * @throws FileNotFoundException + * + * @throws FileNotFoundException */ @Before public void setUp() throws TmfTraceException { @@ -112,7 +113,7 @@ public class CtfTmfEventTest { */ @Test public void testGetFieldValue() { - String fieldName = "id"; //$NON-NLS-1$ + String fieldName = "ret"; //$NON-NLS-1$ Object result = fixture.getContent().getField(fieldName).getValue(); assertNotNull(result); @@ -125,8 +126,8 @@ public class CtfTmfEventTest { public void testGetFields() { CtfTmfEvent nullEvent = CtfTmfEvent.getNullEvent(); ITmfEventField[] fields = nullEvent.getContent().getFields(); - - assertArrayEquals(null, fields); + ITmfEventField[] fields2 = new ITmfEventField[0]; + assertArrayEquals(fields2, fields); } /** @@ -140,6 +141,11 @@ public class CtfTmfEventTest { assertEquals(-1L, result); } + @Test + public void testClone() { + CtfTmfEvent other = CtfTmfEvent.getNullEvent().clone(); + assertNotNull(other); + } /** * Run the CTFEvent getNullEvent() method test. @@ -152,7 +158,7 @@ public class CtfTmfEventTest { assertEquals(-1, nullEvent.getCPU()); assertEquals("Empty CTF event", nullEvent.getEventName()); //$NON-NLS-1$ assertEquals("No stream", nullEvent.getChannelName()); //$NON-NLS-1$ - assertArrayEquals(null, nullEvent.getContent().getFields()); + assertArrayEquals(new ITmfEventField[0], nullEvent.getContent().getFields()); assertEquals(-1L, nullEvent.getID()); assertEquals(-1L, nullEvent.getTimestampValue()); } @@ -168,4 +174,26 @@ public class CtfTmfEventTest { assertEquals(-1L, result); } + + @Test + public void testRankTraceRefSourceType() { + long rank = fixture.getRank(); + CtfTmfTrace trace = fixture.getTrace(); + String channelName = fixture.getChannelName(); + String reference = fixture.getReference(); + String source = fixture.getSource(); + ITmfEventType type = fixture.getType(); + assertEquals(rank, 0); + assertEquals(trace.getName(), "kernel"); //$NON-NLS-1$ + assertEquals(channelName, "channel0_1"); //$NON-NLS-1$ + assertEquals(reference,"channel0_1"); //$NON-NLS-1$ + assertEquals(source, "1"); //$NON-NLS-1$ + assertEquals(type.toString(), "exit_syscall"); //$NON-NLS-1$ + } + + @Test + public void TestToString() { + String s = fixture.getContent().toString(); + assertEquals("ret=4132\t", s); //$NON-NLS-1$ + } } diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTypeTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTypeTest.java new file mode 100644 index 0000000000..0ce7d82670 --- /dev/null +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTypeTest.java @@ -0,0 +1,96 @@ +package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor; + +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEventType; +import org.eclipse.linuxtools.tmf.core.event.ITmfEventField; +import org.eclipse.linuxtools.tmf.core.event.TmfEventField; +import org.junit.*; +import static org.junit.Assert.*; + +/** + * The class CtfTmfEventTypeTest contains tests for the class {@link CtfTmfEventType}. + * + * @generatedBy CodePro at 03/05/12 2:29 PM + * @author ematkho + * @version $Revision: 1.0 $ + */ +public class CtfTmfEventTypeTest { + /** + * Run the CtfTmfEventType(String,String,ITmfEventField) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testCtfTmfEventType_1() + throws Exception { + String contextId = ""; + String eventName = ""; + ITmfEventField content = new TmfEventField("", new ITmfEventField[] {}); + + CtfTmfEventType result = new CtfTmfEventType(contextId, eventName, content); + + // add additional test code here + assertNotNull(result); + assertEquals("", result.toString()); + assertEquals("", result.getName()); + assertEquals("", result.getContext()); + } + + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testToString_1() + throws Exception { + CtfTmfEventType fixture = new CtfTmfEventType("", "", new TmfEventField("", new ITmfEventField[] {})); + + String result = fixture.toString(); + + // add additional test code here + assertEquals("", result); + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(CtfTmfEventTypeTest.class); + } +} \ No newline at end of file diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTimestampTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTimestampTest.java new file mode 100644 index 0000000000..805e91f3ba --- /dev/null +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTimestampTest.java @@ -0,0 +1,388 @@ +package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp; +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp.TimestampType; +import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp; +import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * The class CtfTmfTimestampTest contains tests for the class {@link CtfTmfTimestamp}. + * + * @generatedBy CodePro at 03/05/12 2:29 PM + * @author ematkho + * @version $Revision: 1.0 $ + */ +public class CtfTmfTimestampTest { + /** + * Run the CtfTmfTimestamp(long) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testCtfTmfTimestamp() + throws Exception { + long timestamp = 1L; + + CtfTmfTimestamp result = new CtfTmfTimestamp(timestamp); + result.setType(TimestampType.NANOS); + + // add additional test code here + assertNotNull(result); + assertEquals("1 ns", result.toString()); //$NON-NLS-1$ + assertEquals(0, result.getPrecision()); + assertEquals(-9, result.getScale()); + assertEquals(1L, result.getValue()); + } + + + /** + * Run the boolean equals(Object) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testEquals_1() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.DAY); + CtfTmfTimestamp obj = new CtfTmfTimestamp(1L); + obj.setType(CtfTmfTimestamp.TimestampType.DAY); + + boolean result = fixture.equals(obj); + + // add additional test code here + assertEquals(true, result); + } + + /** + * Run the boolean equals(Object) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testEquals_2() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.DAY); + Object obj = new Object(); + + boolean result = fixture.equals(obj); + + // add additional test code here + assertEquals(false, result); + } + + /** + * Run the boolean equals(Object) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testEquals_3() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.DAY); + Object obj = new Object(); + + boolean result = fixture.equals(obj); + + // add additional test code here + assertEquals(false, result); + } + + /** + * Run the boolean equals(Object) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testEquals_4() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.DAY); + CtfTmfTimestamp obj = new CtfTmfTimestamp(1L); + obj.setType(CtfTmfTimestamp.TimestampType.DAY); + + boolean result = fixture.equals(obj); + + // add additional test code here + assertEquals(true, result); + } + + /** + * Run the boolean equals(Object) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testEquals_5() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.DAY); + CtfTmfTimestamp obj = new CtfTmfTimestamp(1L); + obj.setType(CtfTmfTimestamp.TimestampType.DAY); + + boolean result = fixture.equals(obj); + + // add additional test code here + assertEquals(true, result); + } + + /** + * Run the ITmfTimestamp getDelta(ITmfTimestamp) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetDelta_1() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.DAY); + ITmfTimestamp ts = new TmfTimestamp(); + + ITmfTimestamp result = fixture.getDelta(ts); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.getPrecision()); + assertEquals(-9, result.getScale()); + assertEquals(1L, result.getValue()); + } + + /** + * Run the ITmfTimestamp getDelta(ITmfTimestamp) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetDelta_2() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.DAY); + ITmfTimestamp ts = new TmfTimestamp(); + + ITmfTimestamp result = fixture.getDelta(ts); + + // add additional test code here + assertNotNull(result); + assertEquals(0, result.getPrecision()); + assertEquals(-9, result.getScale()); + assertEquals(1L, result.getValue()); + } + + /** + * Run the CtfTmfTimestamp.TimestampType getType() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetType_1() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.DAY); + + CtfTmfTimestamp.TimestampType result = fixture.getType(); + + // add additional test code here + assertNotNull(result); + assertEquals("DAY", result.name()); //$NON-NLS-1$ + assertEquals("DAY", result.toString()); //$NON-NLS-1$ + assertEquals(1, result.ordinal()); + } + + /** + * Run the int hashCode() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testHashCode_1() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.DAY); + + int result = fixture.hashCode(); + + // add additional test code here + assertEquals(1012115, result); + } + + /** + * Run the int hashCode() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testHashCode_2() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(null); + + int result = fixture.hashCode(); + + // add additional test code here + assertEquals(944663, result); + } + + /** + * Run the void setType(TimestampType) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testSetType_1() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.DAY); + CtfTmfTimestamp.TimestampType value = CtfTmfTimestamp.TimestampType.DAY; + + fixture.setType(value); + + // add additional test code here + } + + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testToString_1() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.NANOS); + + String result = fixture.toString(); + + // add additional test code here + assertEquals("1 ns", result); //$NON-NLS-1$ + } + + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testToString_2() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.SECONDS); + + String result = fixture.toString(); + + // add additional test code here + assertEquals("1.0E-9 s", result); //$NON-NLS-1$ + } + + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testToString_3() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.DAY); + + String result = fixture.toString(); + + // add additional test code here + assertEquals("19:00:00.000000001", result); //$NON-NLS-1$ + } + + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testToString_4() + throws Exception { + CtfTmfTimestamp fixture = new CtfTmfTimestamp(1L); + fixture.setType(CtfTmfTimestamp.TimestampType.FULL_DATE); + + String result = fixture.toString(); + + // add additional test code here + assertEquals("1969-12-31 19:00:00.000000001", result); //$NON-NLS-1$ + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(CtfTmfTimestampTest.class); + } +} \ No newline at end of file diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTraceTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTraceTest.java new file mode 100644 index 0000000000..8bc5d88479 --- /dev/null +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTraceTest.java @@ -0,0 +1,1003 @@ +package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocation; +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent; +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp; +import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace; +import org.eclipse.linuxtools.tmf.core.event.ITmfEvent; +import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp; +import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange; +import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp; +import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException; +import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest; +import org.eclipse.linuxtools.tmf.core.request.TmfCoalescedEventRequest; +import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal; +import org.eclipse.linuxtools.tmf.core.signal.TmfSignal; +import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemQuerier; +import org.eclipse.linuxtools.tmf.core.trace.ITmfContext; +import org.eclipse.linuxtools.tmf.core.trace.TmfContext; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * The class CtfTmfTraceTest contains tests for the class {@link CtfTmfTrace}. + * + * @generatedBy CodePro at 03/05/12 2:29 PM + * @author ematkho + * @version $Revision: 1.0 $ + */ +public class CtfTmfTraceTest { + private static final String PATH = TestParams.getPath(); + + /** + * Run the CtfTmfTrace() constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testCtfTmfTrace_1() + throws Exception { + + CtfTmfTrace result = new CtfTmfTrace(); + + // add additional test code here + assertNotNull(result); + assertEquals(null, result.getEventType()); + assertEquals(50000, result.getCacheSize()); + assertEquals(0L, result.getNbEvents()); + assertEquals(0L, result.getStreamingInterval()); + assertEquals(null, result.getStateSystem()); + assertEquals(null, result.getResource()); + assertEquals(1000, result.getQueueSize()); + assertEquals(null, result.getType()); + } + + /** + * Run the ITmfContext armRequest(ITmfDataRequest) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testArmRequest_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + ITmfDataRequest request = new TmfCoalescedEventRequest(ITmfEvent.class); + + ITmfContext result = fixture.armRequest(request); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + + /** + * @return + * @throws TmfTraceException + */ + private CtfTmfTrace initTrace() throws TmfTraceException { + CtfTmfTrace fixture = new CtfTmfTrace(); + fixture.initTrace((IResource) null, PATH, CtfTmfEvent.class); + return fixture; + } + + /** + * Run the ITmfContext armRequest(ITmfDataRequest) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testArmRequest_2() + throws Exception { + CtfTmfTrace fixture = initTrace(); + ITmfDataRequest request = new TmfCoalescedEventRequest(ITmfEvent.class); + + ITmfContext result = fixture.armRequest(request); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + /** + * Run the ITmfContext armRequest(ITmfDataRequest) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testArmRequest_3() + throws Exception { + CtfTmfTrace fixture = initTrace(); + ITmfDataRequest request = new TmfCoalescedEventRequest(ITmfEvent.class); + + ITmfContext result = fixture.armRequest(request); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + /** + * Run the ITmfContext armRequest(ITmfDataRequest) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testArmRequest_4() + throws Exception { + CtfTmfTrace fixture = initTrace(); + ITmfDataRequest request = new TmfCoalescedEventRequest(ITmfEvent.class); + + ITmfContext result = fixture.armRequest(request); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + + /** + * Run the void broadcast(TmfSignal) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testBroadcast_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + TmfSignal signal = new TmfEndSynchSignal(1); + + fixture.broadcast(signal); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + } + + + /** + * Run the void dispose() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testDispose_1() + throws Exception { + CtfTmfTrace fixture = new CtfTmfTrace(); + + fixture.dispose(); + + } + + /** + * Run the int getCacheSize() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetCacheSize_1() + throws Exception { + CtfTmfTrace fixture = new CtfTmfTrace(); + + int result = fixture.getCacheSize(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertEquals(50000, result); + } + + /** + * Run the ITmfLocation getCurrentLocation() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetCurrentLocation_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + CtfLocation result = (CtfLocation) fixture.getCurrentLocation(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + @Test + public void testSeekEventLoc_1() throws TmfTraceException { + CtfTmfTrace fixture = initTrace(); + CtfLocation loc = null; + fixture.seekEvent(loc); + assertNotNull(fixture); + } + + @Test + public void testSeekEventLoc_2() throws TmfTraceException { + CtfTmfTrace fixture = initTrace(); + CtfLocation loc = new CtfLocation(new CtfTmfTimestamp(0L)); + fixture.seekEvent(loc); + assertNotNull(fixture); + } + + + /** + * Run the ITmfTimestamp getEndTime() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetEndTime_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + ITmfTimestamp result = fixture.getEndTime(); + assertNotNull(result); + } + + /** + * Run the String[] getEnvNames() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetEnvNames_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + String[] result = fixture.getEnvNames(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + /** + * Run the String getEnvValue(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetEnvValue_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + String key = "tracer_name"; //$NON-NLS-1$ + + String result = fixture.getEnvValue(key); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertEquals("\"lttng-modules\"",result); //$NON-NLS-1$ + } + + /** + * Run the Class getEventType() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetEventType_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + Class result = fixture.getEventType(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNull(result); + } + + /** + * Run the double getLocationRatio(ITmfLocation) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetLocationRatio_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + CtfLocation location = new CtfLocation(new Long(1L)); + location.setLocation(new Long(1L)); + + double result = fixture.getLocationRatio(location); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertEquals(Double.POSITIVE_INFINITY, result, 0.1); + } + + /** + * Run the String getName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetName_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + String result = fixture.getName(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + /** + * Run the String getName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetName_2() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + String result = fixture.getName(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + /** + * Run the String getName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetName_3() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + String result = fixture.getName(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + /** + * Run the int getNbEnvVars() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetNbEnvVars_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + int result = fixture.getNbEnvVars(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertEquals(8, result); + } + + /** + * Run the long getNbEvents() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetNbEvents_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + long result = fixture.getNbEvents(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertEquals(0L, result); + } + + /** + * Run the CtfTmfEvent getNext(ITmfContext) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetNext_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + ITmfContext context = new TmfContext(); + + CtfTmfEvent result = fixture.getNext(context); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + /** + * Run the String getPath() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetPath_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + String result = fixture.getPath(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + /** + * Run the IResource getResource() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetResource_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + IResource result = fixture.getResource(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNull(result); + } + + /** + * Run the ITmfTimestamp getStartTime() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetStartTime_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + ITmfTimestamp result = fixture.getStartTime(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + /** + * Run the IStateSystemQuerier getStateSystem() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetStateSystem_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + IStateSystemQuerier result = fixture.getStateSystem(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNull(result); + } + + /** + * Run the long getStreamingInterval() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetStreamingInterval_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + long result = fixture.getStreamingInterval(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertEquals(0L, result); + } + + /** + * Run the TmfTimeRange getTimeRange() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testGetTimeRange_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + TmfTimeRange result = fixture.getTimeRange(); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + /** + * Run the void initTrace(IResource,String,Class) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testInitTrace_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + IResource resource = null; + String path = PATH; + Class eventType = CtfTmfEvent.class; + + fixture.initTrace(resource, path, eventType); + + assertNotNull(fixture); + } + + /** + * Run the void initTrace(IResource,String,Class) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testInitTrace_2() + throws Exception { + CtfTmfTrace fixture = initTrace(); + IResource resource = null; + String path = PATH; + Class eventType = CtfTmfEvent.class; + + fixture.initTrace(resource, path, eventType); + + assertNotNull(fixture); + } + + /** + * Run the void initTrace(IResource,String,Class) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testInitTrace_3() + throws Exception { + CtfTmfTrace fixture = initTrace(); + IResource resource = null; + String path = PATH; + Class eventType = CtfTmfEvent.class; + + fixture.initTrace(resource, path, eventType); + + assertNotNull(fixture); + } + + /** + * Run the void initTrace(IResource,String,Class) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testInitTrace_4() + throws Exception { + CtfTmfTrace fixture = initTrace(); + + IResource resource = null; + String path = PATH; + Class eventType = CtfTmfEvent.class; + + fixture.initTrace(resource, path, eventType); + + assertNotNull(fixture); + } + + /** + * Run the void initTrace(IResource,String,Class) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testInitTrace_5() + throws Exception { + CtfTmfTrace fixture = initTrace(); + IResource resource = null; + String path = PATH; + Class eventType = CtfTmfEvent.class; + + fixture.initTrace(resource, path, eventType); + + assertNotNull(fixture); + } + + /** + * Run the void initTrace(IResource,String,Class) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testInitTrace_6() + throws Exception { + CtfTmfTrace fixture = initTrace(); + IResource resource = null; + String path = PATH; + Class eventType = CtfTmfEvent.class; + + fixture.initTrace(resource, path, eventType); + + assertNotNull(fixture); + } + + /** + * Run the void initTrace(IResource,String,Class) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testInitTrace_7() + throws Exception { + CtfTmfTrace fixture = initTrace(); + IResource resource = null; + String path = PATH; + Class eventType = CtfTmfEvent.class; + + fixture.initTrace(resource, path, eventType); + + assertNotNull(fixture); + } + + /** + * Run the CtfTmfEvent readNextEvent(ITmfContext) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testReadNextEvent_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + ITmfContext context = new TmfContext(); + + CtfTmfEvent result = fixture.readNextEvent(context); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + /** + * Run the ITmfContext seekEvent(double) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testSeekEvent_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + double ratio = 1.0; + + ITmfContext result = fixture.seekEvent(ratio); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + /** + * Run the ITmfContext seekEvent(long) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testSeekEvent_2() + throws Exception { + CtfTmfTrace fixture = initTrace(); + long rank = 1L; + + ITmfContext result = fixture.seekEvent(rank); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + + /** + * Run the ITmfContext seekEvent(ITmfTimestamp) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testSeekEvent_3() + throws Exception { + CtfTmfTrace fixture = initTrace(); + ITmfTimestamp timestamp = new TmfTimestamp(); + + ITmfContext result = fixture.seekEvent(timestamp); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertNotNull(result); + } + +// /** +// * Run the ITmfContext seekEvent(ITmfLocation) method test. +// * +// * @throws Exception +// * +// * @generatedBy CodePro at 03/05/12 2:29 PM +// */ +// @Test +// public void testSeekEvent_4() +// throws Exception { +// CtfTmfTrace fixture = initTrace(); +// fixture.setStartTime(new TmfTimestamp()); +// CtfIterator ctfIterator = new CtfIterator(new CtfTmfTrace()); +// CtfLocation ctfLocation = new CtfLocation(new Long(1L)); +// ctfLocation.setLocation(new Long(1L)); +// ctfIterator.setLocation(ctfLocation); +// fixture.iterator = ctfIterator; +// fixture.ss = new StateHistorySystem(new HistoryTreeBackend(new File(PATH)), true); +// fixture.startSynch(new TmfStartSynchSignal(1)); +// fixture.fNbEvents = 1L; +// ITmfLocation location = new CtfLocation(new Long(1L)); +// +// ITmfContext result = fixture.seekEvent(location); +// +// // add additional test code here +// // An unexpected exception was thrown in user code while executing this test: +// // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory +// // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) +// assertNotNull(result); +// } +// +// /** +// * Run the ITmfContext seekEvent(ITmfLocation) method test. +// * +// * @throws Exception +// * +// * @generatedBy CodePro at 03/05/12 2:29 PM +// */ +// @Test +// public void testSeekEvent_5() +// throws Exception { +// CtfTmfTrace fixture = initTrace(); +// CtfIterator ctfIterator = new CtfIterator(new CtfTmfTrace()); +// CtfLocation ctfLocation = new CtfLocation(new Long(1L)); +// ITmfContext result = fixture.seekEvent(ctfLocation); +// assertNotNull(result); +// } + + + + /** + * Run the boolean validate(IProject,String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testValidate_1() + throws Exception { + CtfTmfTrace fixture = initTrace(); + IProject project = null; + String path = PATH; + + boolean result = fixture.validate(project, path); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertTrue(result); + } + + /** + * Run the boolean validate(IProject,String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testValidate_2() + throws Exception { + CtfTmfTrace fixture = initTrace(); + IProject project = null; + String path = PATH; + + boolean result = fixture.validate(project, path); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertTrue(result); + } + + /** + * Run the boolean validate(IProject,String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Test + public void testValidate_3() + throws Exception { + CtfTmfTrace fixture = initTrace(); + IProject project = null; + String path = PATH; + + boolean result = fixture.validate(project, path); + + // add additional test code here + // An unexpected exception was thrown in user code while executing this test: + // org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException: Path must be a valid directory + // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace.initTrace(CtfTmfTrace.java:98) + assertTrue(result); + } + + /** + * Perform pre-test initialization. + * + * @throws Exception + * if the initialization fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @Before + public void setUp() + throws Exception { + // add additional set up code here + } + + /** + * Perform post-test clean-up. + * + * @throws Exception + * if the clean-up fails for some reason + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + @After + public void tearDown() + throws Exception { + // Add additional tear down code here + } + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + public static void main(String[] args) { + new org.junit.runner.JUnitCore().run(CtfTmfTraceTest.class); + } +} \ No newline at end of file diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/TestAll.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/TestAll.java new file mode 100644 index 0000000000..7b424eb9f9 --- /dev/null +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/TestAll.java @@ -0,0 +1,39 @@ +package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor; + +import org.junit.runner.JUnitCore; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * The class TestAll builds a suite that can be used to run all + * of the tests within its package as well as within any subpackages of its + * package. + * + * @generatedBy CodePro at 03/05/12 2:29 PM + * @author ematkho + * @version $Revision: 1.0 $ + */ +@RunWith(Suite.class) +@Suite.SuiteClasses({ + CtfTmfContentTest.class, + CtfTmfTimestampTest.class, + CtfTmfEventFieldTest.class, + CtfTmfEventTypeTest.class, + CtfIteratorTest.class, + CtfLocationTest.class, + CtfTmfTraceTest.class, + CtfTmfEventTest.class, +}) +public class TestAll { + + /** + * Launch the test. + * + * @param args the command line arguments + * + * @generatedBy CodePro at 03/05/12 2:29 PM + */ + public static void main(String[] args) { + JUnitCore.runClasses(new Class[] { TestAll.class }); + } +} diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/TestParams.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/TestParams.java index 503ea40fe3..f29abef44b 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/TestParams.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/TestParams.java @@ -10,7 +10,7 @@ import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException; public abstract class TestParams { /* Path to test traces */ - private static final String testTracePath1 = "testfiles/trace20m"; //$NON-NLS-1$ + private static final String testTracePath1 = "testfiles/kernel"; //$NON-NLS-1$ private static CtfTmfTrace testTrace1 = null; private static final File emptyFile = new File(""); //$NON-NLS-1$ @@ -24,6 +24,10 @@ public abstract class TestParams { return emptyTrace; } + public static String getPath(){ + return testTracePath1; + } + public static CtfTmfTrace createTrace() throws TmfTraceException { if ( testTrace1 == null ) { testTrace1 = new CtfTmfTrace(); diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java index e0bc5b9630..db31c723c0 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java @@ -67,4 +67,41 @@ public class CtfLocation implements ITmfLocation { return new CtfLocation(getLocation()); } + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = (prime * result) + + ((fTimestamp == null) ? 0 : fTimestamp.hashCode()); + return result; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof CtfLocation)) { + return false; + } + CtfLocation other = (CtfLocation) obj; + if (fTimestamp == null) { + if (other.fTimestamp != null) { + return false; + } + } else if (!fTimestamp.equals(other.fTimestamp)) { + return false; + } + return true; + } + } diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java index 49b150139e..acb3a658c2 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java @@ -156,7 +156,8 @@ public final class CtfTmfEvent implements ITmfEvent { this.typeId = -1; this.fileName = NO_STREAM; this.eventName = EMPTY_CTF_EVENT_NAME; - this.fContent = null; + this.fContent = new CtfTmfContent("", new CtfTmfEventField[0]); + } // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java index 6e5353ccbb..2fa7d65e17 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java @@ -43,7 +43,7 @@ public abstract class CtfTmfEventField implements ITmfEventField { * @param name String */ protected CtfTmfEventField(String name) { - /* Strip the damn underscores, screw you CTF */ + /* Strip the underscore*/ if ( name.startsWith("_") ) { //$NON-NLS-1$ this.name = name.substring(1); } else { @@ -150,6 +150,9 @@ public abstract class CtfTmfEventField implements ITmfEventField { case 2: return new CTFIntegerArrayField( ((CTFIntegerArrayField) other).getValue(), other.name); + case 3: + return new CTFFloatField( + ((CTFFloatField) other).getValue(), other.name); default: return null; } @@ -168,7 +171,7 @@ public abstract class CtfTmfEventField implements ITmfEventField { /** * Return the int representing this field's value type * - + * @return the field type */ public abstract int getFieldType(); @@ -176,7 +179,7 @@ public abstract class CtfTmfEventField implements ITmfEventField { * Return this field's value. You can cast it to the correct type depending * on what getFieldType says. * - + * @return the field value * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getValue() */ @Override @@ -186,7 +189,7 @@ public abstract class CtfTmfEventField implements ITmfEventField { * Other methods defined by ITmfEventField, but not used here: the CTF * fields do not have sub-fields (yet!) * - + * @return the field names * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getFieldNames() */ @Override @@ -426,7 +429,7 @@ final class CTFFloatField extends CtfTmfEventField { * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getValue() */ @Override - public Object getValue() { + public Double getValue() { return this.value; } diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java index c0464fa546..9e1deddc46 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java @@ -171,8 +171,8 @@ public class CtfTmfTimestamp extends TmfTimestamp { @Override public int hashCode() { final int prime = 31; - int result = super.hashCode(); - result = (prime * result) + ((type == null) ? 0 : type.hashCode()); + int result = super.hashCode() * prime; + result += ((type == null) ? 0 : type.toString().hashCode()); return result; } -- 2.34.1