Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Hufmann2012-07-27 18:38:09 +0000
committerBernd Hufmann2012-07-27 18:46:20 +0000
commitecc18b80174f38b1319b524888c0f7655f996543 (patch)
tree3375a711f52e2188157456afb561168c9563e566
parentd184aaa40527c67adddb57b142a7cc31b29ea3ac (diff)
downloadorg.eclipse.linuxtools-ecc18b80174f38b1319b524888c0f7655f996543.tar.gz
org.eclipse.linuxtools-ecc18b80174f38b1319b524888c0f7655f996543.tar.xz
org.eclipse.linuxtools-ecc18b80174f38b1319b524888c0f7655f996543.zip
Fix more compiler/javadoc warnings as per new project specific settings
See also bug 385535 for the set of settings. Change-Id: I76b5e8a78113908379cb9d73bbbbfae6bf1006a6 Reviewed-on: https://git.eclipse.org/r/7006 Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-by: Bernd Hufmann <bhufmann@gmail.com>
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/shells/LTTngToolsFileShell.java12
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java6
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java28
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/AllTmfUITests.java7
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/histogram/AllTests.java13
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/histogram/HistogramDataModelTest.java153
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/AllTests.java14
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java12
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java24
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java120
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java149
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java49
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java26
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/dialogs/AllTests.java12
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/dialogs/CriteriaTest.java87
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/load/AllTests.java12
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/load/LoadersManagerTest.java6
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/AllTests.java11
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/IUml2SDTestConstants.java58
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/IUml2SdSignalValidator.java76
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderExpTest.java76
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderFilterTest.java80
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderFindTest.java91
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderPagesTest.java63
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderSignalTest.java36
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderTimeTest.java68
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDSignalValidator.java21
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestFacility.java13
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestSetup.java10
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestTimestamp.java14
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/tests/uml2sd/load/TestLoaders.java14
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/tests/uml2sd/trace/TmfUml2SDTestTrace.java27
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/adaption/TsfImplProvider.java7
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/EventImpl.java18
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/TraceImpl.java8
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/TraceModelImplFactory.java8
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/views/TsfTraceAnalysisView.java3
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java1
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java4
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java2
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/FilterListDialog.java18
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/handlers/MoveToMessage.java17
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java2
43 files changed, 997 insertions, 479 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/shells/LTTngToolsFileShell.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/shells/LTTngToolsFileShell.java
index d6a3b94978..f96fbef969 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/shells/LTTngToolsFileShell.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/shells/LTTngToolsFileShell.java
@@ -184,7 +184,9 @@ public class LTTngToolsFileShell extends TestCommandShell {
result = Integer.parseInt(strLine);
} else if (OUTPUT_END_KEY.equals(strLine)) {
// Save output/result in command map
- commandMap.put(input, new CommandResult(result, output.toArray(new String[output.size()])));
+ if (output != null) {
+ commandMap.put(input, new CommandResult(result, output.toArray(new String[output.size()])));
+ }
inOutput = false;
} else if (OUTPUT_KEY.equals(strLine)) {
// first line of output
@@ -195,10 +197,14 @@ public class LTTngToolsFileShell extends TestCommandShell {
while (isComment(strLine)) {
strLine = br.readLine();
}
- output.add(strLine);
+ if (output != null) {
+ output.add(strLine);
+ }
} else if (inOutput) {
// subsequent lines of output
- output.add(strLine);
+ if (output != null) {
+ output.add(strLine);
+ }
}
// else {
// if (RESULT_END_KEY.equals(strLine)) {
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java
index 027f9c773f..8aae5261fb 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java
@@ -184,6 +184,12 @@ public class AssignEventHandler extends BaseControlViewHandler {
}
boolean isEnabled = ((!events.isEmpty()) && (sessions != null) && (sessions.length > 0));
+
+ // To avoid compiler warnings check for null even if isKernel is always not null when used below
+ if (isKernel == null) {
+ return false;
+ }
+
fLock.lock();
try {
fParam = null;
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java
index 9688714732..3df844ed6f 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java
@@ -879,26 +879,40 @@ public class LTTngControlService implements ILttngControlService {
} else if (LTTngControlServiceConstants.OVERWRITE_MODE_ATTRIBUTE.matcher(subLine).matches()) {
String value = getAttributeValue(subLine);
- channelInfo.setOverwriteMode(!LTTngControlServiceConstants.OVERWRITE_MODE_ATTRIBUTE_FALSE.equals(value));
+ if (channelInfo != null) {
+ channelInfo.setOverwriteMode(!LTTngControlServiceConstants.OVERWRITE_MODE_ATTRIBUTE_FALSE.equals(value));
+ }
} else if (LTTngControlServiceConstants.SUBBUFFER_SIZE_ATTRIBUTE.matcher(subLine).matches()) {
- channelInfo.setSubBufferSize(Long.valueOf(getAttributeValue(subLine)));
+ if (channelInfo != null) {
+ channelInfo.setSubBufferSize(Long.valueOf(getAttributeValue(subLine)));
+ }
} else if (LTTngControlServiceConstants.NUM_SUBBUFFERS_ATTRIBUTE.matcher(subLine).matches()) {
- channelInfo.setNumberOfSubBuffers(Integer.valueOf(getAttributeValue(subLine)));
+ if (channelInfo != null) {
+ channelInfo.setNumberOfSubBuffers(Integer.valueOf(getAttributeValue(subLine)));
+ }
} else if (LTTngControlServiceConstants.SWITCH_TIMER_ATTRIBUTE.matcher(subLine).matches()) {
- channelInfo.setSwitchTimer(Long.valueOf(getAttributeValue(subLine)));
+ if (channelInfo != null) {
+ channelInfo.setSwitchTimer(Long.valueOf(getAttributeValue(subLine)));
+ }
} else if (LTTngControlServiceConstants.READ_TIMER_ATTRIBUTE.matcher(subLine).matches()) {
- channelInfo.setReadTimer(Long.valueOf(getAttributeValue(subLine)));
+ if (channelInfo != null) {
+ channelInfo.setReadTimer(Long.valueOf(getAttributeValue(subLine)));
+ }
} else if (LTTngControlServiceConstants.OUTPUT_ATTRIBUTE.matcher(subLine).matches()) {
- channelInfo.setOutputType(getAttributeValue(subLine));
+ if (channelInfo != null) {
+ channelInfo.setOutputType(getAttributeValue(subLine));
+ }
} else if (LTTngControlServiceConstants.EVENT_SECTION_PATTERN.matcher(subLine).matches()) {
List<IEventInfo> events = new ArrayList<IEventInfo>();
index = parseEvents(output, index, events);
- channelInfo.setEvents(events);
+ if (channelInfo != null) {
+ channelInfo.setEvents(events);
+ }
// we want to stay at the current index to be able to
// exit the domain
continue;
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/AllTmfUITests.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/AllTmfUITests.java
index b3f75130ef..6a590ae458 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/AllTmfUITests.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/AllTmfUITests.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
* Bernd Hufmann - Add UML2SD tests
@@ -24,6 +24,9 @@ import junit.framework.TestSuite;
*/
public class AllTmfUITests {
+ /**
+ * @return the TMF UI test suite
+ */
public static Test suite() {
TestSuite suite = new TestSuite(AllTmfUITests.class.getName());
//$JUnit-BEGIN$
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/histogram/AllTests.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/histogram/AllTests.java
index 9bd60ea689..dc5bb9791b 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/histogram/AllTests.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/histogram/AllTests.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -14,10 +14,17 @@ package org.eclipse.linuxtools.tmf.ui.tests.histogram;
import junit.framework.Test;
import junit.framework.TestSuite;
+/**
+ *
+ * Test suite class for histogram tests.
+ */
public class AllTests {
+ /**
+ * @return the test suite
+ */
public static Test suite() {
-
+
TestSuite suite = new TestSuite(AllTests.class.getName());
//$JUnit-BEGIN$
suite.addTestSuite(HistogramDataModelTest.class);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/histogram/HistogramDataModelTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/histogram/HistogramDataModelTest.java
index e447dc49f2..21bdfb76b4 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/histogram/HistogramDataModelTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/histogram/HistogramDataModelTest.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Francois Chouinard - Initial API and implementation
* Bernd Hufmann - Adapt to junit.framework.TestCase
@@ -20,8 +20,7 @@ import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramScaledData;
import org.eclipse.linuxtools.tmf.ui.views.histogram.IHistogramModelListener;
/**
- * <b><u>HistogramDataModelTest</u></b>
- * <p>
+ *
* Unit tests for the HistogramDataModel class.
*/
public class HistogramDataModelTest extends TestCase {
@@ -33,7 +32,7 @@ public class HistogramDataModelTest extends TestCase {
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
-
+
@Override
public void setUp() throws Exception {
}
@@ -48,7 +47,7 @@ public class HistogramDataModelTest extends TestCase {
/**
* Test method for
- * {@link org.eclipse.linuxtools.tmf.HistogramDataModel.views.histogram.TmfHistogramDataModel#HistogramDataModel()}
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#HistogramDataModel()}
* .
*/
public void testHistogramDataModel() {
@@ -64,7 +63,7 @@ public class HistogramDataModelTest extends TestCase {
/**
* Test method for
- * {@link org.eclipse.linuxtools.tmf.HistogramDataModel.views.histogram.TmfHistogramDataModel#HistogramDataModel(int)}
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#HistogramDataModel(int)}
* .
*/
public void testHistogramDataModelInt() {
@@ -81,7 +80,7 @@ public class HistogramDataModelTest extends TestCase {
/**
* Test methods for
- * {@link org.eclipse.linuxtools.tmf.HistogramDataModel.views.histogram.TmfHistogramDataModel#countEvent(long)}
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#countEvent(long,long)}
* .
*/
public void testClear() {
@@ -100,7 +99,7 @@ public class HistogramDataModelTest extends TestCase {
/**
* Test methods for
- * {@link org.eclipse.linuxtools.tmf.HistogramDataModel.views.histogram.TmfHistogramDataModel#countEvent(long)}
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#countEvent(long,long)}
* .
*/
public void testCountEvent_0() {
@@ -117,7 +116,14 @@ public class HistogramDataModelTest extends TestCase {
assertTrue(model.getTimeLimit() == nbBuckets);
}
+ /**
+ * Test methods for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#countEvent(long,long)}
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
public void testCountEvent_1() {
+
final int nbBuckets = 100;
final int maxHeight = 10;
@@ -137,6 +143,12 @@ public class HistogramDataModelTest extends TestCase {
assertTrue(model.getTimeLimit() == nbBuckets);
}
+ /**
+ * Test methods for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#countEvent(long,long)}
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
public void testCountEvent_2() {
final int nbBuckets = 100;
final int maxHeight = 10;
@@ -159,6 +171,12 @@ public class HistogramDataModelTest extends TestCase {
assertTrue(model.getTimeLimit() == nbBuckets + 1);
}
+ /**
+ * Test methods for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#countEvent(long,long)}
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
public void testCountEvent_3() {
final int nbBuckets = 100;
final int maxHeight = 10;
@@ -182,6 +200,12 @@ public class HistogramDataModelTest extends TestCase {
assertTrue(model.getTimeLimit() == nbBuckets);
}
+ /**
+ * Test methods for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#countEvent(long,long)}
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
public void testCountEvent_4() {
final int nbBuckets = 100;
final int maxHeight = 10;
@@ -206,6 +230,12 @@ public class HistogramDataModelTest extends TestCase {
assertTrue(model.getTimeLimit() == nbBuckets);
}
+ /**
+ * Test methods for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#countEvent(long,long)}
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
public void testCountEvent_5() {
final int nbBuckets = 100;
final int startTime = 25;
@@ -232,7 +262,7 @@ public class HistogramDataModelTest extends TestCase {
/**
* Test method for
- * {@link org.eclipse.linuxtools.tmf.HistogramDataModel.views.histogram.TmfHistogramDataModel#scaleTo(int,int)}
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
* .
*/
public void testScaleTo_0() {
@@ -257,6 +287,11 @@ public class HistogramDataModelTest extends TestCase {
fail("Uncaught assertion error"); //$NON-NLS-1$
}
+ /**
+ * Test method for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
public void testScaleTo_1() {
final int nbBuckets = 10;
final int maxHeight = 10;
@@ -282,6 +317,11 @@ public class HistogramDataModelTest extends TestCase {
assertTrue(model.getTimeLimit() == nbBuckets);
}
+ /**
+ * Test method for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
public void testScaleTo_2() {
final int nbBuckets = 10;
final int maxHeight = 10;
@@ -307,6 +347,11 @@ public class HistogramDataModelTest extends TestCase {
assertTrue(model.getTimeLimit() == nbBuckets);
}
+ /**
+ * Test method for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
public void testScaleTo_3() {
final int nbBuckets = 10;
final int maxHeight = 10;
@@ -332,6 +377,11 @@ public class HistogramDataModelTest extends TestCase {
assertTrue(model.getTimeLimit() == 2 * nbBuckets);
}
+ /**
+ * Test method for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
public void testScaleTo_4() {
final int nbBuckets = 10;
final int maxHeight = 10;
@@ -357,6 +407,11 @@ public class HistogramDataModelTest extends TestCase {
assertTrue(model.getTimeLimit() == 4 * nbBuckets);
}
+ /**
+ * Test method for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
public void testScaleTo_5() {
final int nbBuckets = 100;
final int maxHeight = 20;
@@ -381,6 +436,11 @@ public class HistogramDataModelTest extends TestCase {
assertTrue(model.getTimeLimit() == 2 * nbBuckets);
}
+ /**
+ * Test method for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
public void testScaleTo_6() {
final int nbBuckets = 100;
final int maxHeight = 24;
@@ -405,7 +465,12 @@ public class HistogramDataModelTest extends TestCase {
assertTrue(model.getEndTime() == nbEvents - 1);
assertTrue(model.getTimeLimit() == 4 * nbBuckets);
}
-
+
+ /**
+ * Test method for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
public void testScaleTo_7() {
// verify scaleTo with barWidth > 1
final int nbBuckets = 100;
@@ -413,16 +478,16 @@ public class HistogramDataModelTest extends TestCase {
final int width = 10;
final int barWidth = 4;
final int nbEvents = 2 * nbBuckets + 1;
-
- // (int)(width / barWith) = 2
- // -> 2 bars -> expected result needs two buckets (scaled data)
- //
+
+ // (int)(width / barWith) = 2
+ // -> 2 bars -> expected result needs two buckets (scaled data)
+ //
// buckets (in model) per bar = last bucket id / nbBars + 1 (plus 1 to cover all used buckets)
- // -> buckets per bar = 50 / 2 + 1 = 26
+ // -> buckets per bar = 50 / 2 + 1 = 26
// -> first entry in expected result is 26 * 4 = 104
// -> second entry in expected result is 22 * 4 + 9 = 97
final int[] expectedResult = new int[] { 104, 97 };
-
+
HistogramDataModel model = new HistogramDataModel(nbBuckets);
for (int i = 0; i < nbEvents; i++) {
model.countEvent(i, i);
@@ -430,7 +495,7 @@ public class HistogramDataModelTest extends TestCase {
// verify scaled data
HistogramScaledData result = model.scaleTo(width, maxHeight, barWidth);
-
+
assertEquals(4 * 26, result.fBucketDuration);
assertEquals(0, result.fCurrentBucket);
assertEquals(0, result.fFirstBucketTime);
@@ -445,7 +510,7 @@ public class HistogramDataModelTest extends TestCase {
for (int i = 0; i < result.fData.length; i++) {
assertEquals(expectedResult[i], result.fData[i]);
}
-
+
// verify model
assertEquals(nbEvents, model.getNbEvents());
assertEquals(nbBuckets, model.getNbBuckets());
@@ -456,20 +521,25 @@ public class HistogramDataModelTest extends TestCase {
assertEquals(4 * nbBuckets, model.getTimeLimit());
}
+ /**
+ * Test method for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
public void testScaleToReverse_1() {
final int nbBuckets = 100;
final int maxHeight = 24;
final int width = 10;
final int barWidth = 1;
final int nbEvents = 2 * nbBuckets + 1;
-
- // (int)(width / barWith) = 10
- // -> 10 bars -> expected result needs 10 buckets (scaled data)
- //
+
+ // (int)(width / barWith) = 10
+ // -> 10 bars -> expected result needs 10 buckets (scaled data)
+ //
// buckets in (model) per bar = last bucket id / nbBars + 1 (plus 1 to cover all used buckets)
- // -> buckets per bar = 50 / 10 + 1 = 6
+ // -> buckets per bar = 50 / 10 + 1 = 6
final int[] expectedResult = new int[] { 21, 24, 24, 24, 24, 24, 24, 24, 12, 0 };
-
+
HistogramDataModel model = new HistogramDataModel(nbBuckets);
for (int i = nbEvents - 1; i >= 0; i--) {
model.countEvent(i, i);
@@ -477,7 +547,7 @@ public class HistogramDataModelTest extends TestCase {
// verify scaled data
HistogramScaledData result = model.scaleTo(width, maxHeight, barWidth);
-
+
assertEquals(4 * 6, result.fBucketDuration);
assertEquals(0, result.fCurrentBucket);
assertEquals(-3, result.fFirstBucketTime); // negative is correct, can happen when reverse
@@ -492,7 +562,7 @@ public class HistogramDataModelTest extends TestCase {
for (int i = 0; i < result.fData.length; i++) {
assertEquals(expectedResult[i], result.fData[i]);
}
-
+
// verify model
assertEquals(nbEvents, model.getNbEvents());
assertEquals(nbBuckets, model.getNbBuckets());
@@ -503,13 +573,17 @@ public class HistogramDataModelTest extends TestCase {
assertEquals(-3 + 4 * nbBuckets, model.getTimeLimit());
}
-
- public void testScaleToReverse_2() {
+ /**
+ * Test method for
+ * {@link org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramDataModel#scaleTo(int,int,int)}
+ * .
+ */
+ public void testScaleToReverse_2() {
final int nbBuckets = 100;
final int maxHeight = 24;
final int width = 10;
final int barWidth = 1;
-
+
final int nbEvents = 2 * nbBuckets;
HistogramDataModel model = new HistogramDataModel(nbBuckets);
@@ -520,13 +594,13 @@ public class HistogramDataModelTest extends TestCase {
HistogramScaledData result = model.scaleTo(width, maxHeight, barWidth);
model.clear();
-
+
for (int i = nbEvents -1; i >= 0; i--) {
model.countEvent(i, i);
}
-
+
HistogramScaledData revResult = model.scaleTo(width, maxHeight, barWidth);
-
+
assertEquals(nbEvents, model.getNbEvents());
assertEquals(nbBuckets, model.getNbBuckets());
assertEquals(2, model.getBucketDuration());
@@ -534,8 +608,8 @@ public class HistogramDataModelTest extends TestCase {
assertEquals(0, model.getStartTime());
assertEquals(nbEvents - 1, model.getEndTime());
assertEquals(2 * nbBuckets, model.getTimeLimit());
-
- // For the above number of events, result and revResult are exactly the same.
+
+ // For the above number of events, result and revResult are exactly the same.
assertEquals(result.fBucketDuration, revResult.fBucketDuration);
assertEquals(result.fCurrentBucket, revResult.fCurrentBucket);
assertEquals(result.fFirstBucketTime, revResult.fFirstBucketTime);
@@ -544,12 +618,15 @@ public class HistogramDataModelTest extends TestCase {
assertEquals(result.fLastBucket, revResult.fLastBucket);
assertEquals(result.getBucketEndTime(0), revResult.getBucketEndTime(0));
assertEquals(result.getBucketStartTime(0), revResult.getBucketStartTime(0));
-
+
for (int i = 0; i < result.fData.length; i++) {
assertTrue(result.fData[i] == revResult.fData[i]);
}
}
-
+
+ /**
+ * Test method for testing model listener.
+ */
public void testModelListener() {
final int nbBuckets = 2000;
final int nbEvents = 10 * nbBuckets + 256;
@@ -584,7 +661,7 @@ public class HistogramDataModelTest extends TestCase {
// Test remove listener
count[0] = 0;
model.removeHistogramListener(listener);
-
+
for (int i = 0; i < nbEvents; i++) {
model.countEvent(i, i);
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/AllTests.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/AllTests.java
index d55cae3c8e..e9f82de763 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/AllTests.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/AllTests.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API and Implementation
* Bernd Hufmann - Fixed suite name
@@ -15,11 +15,17 @@ package org.eclipse.linuxtools.tmf.ui.tests.statistics;
import junit.framework.Test;
import junit.framework.TestSuite;
-@SuppressWarnings("nls")
+
+/**
+ * Test suite for statistic tests.
+ */
public class AllTests {
+ /**
+ * @return the test suite
+ */
public static Test suite() {
- TestSuite suite = new TestSuite(AllTests.class.getName()); //$NON-NLS-1$);
+ TestSuite suite = new TestSuite(AllTests.class.getName());
//$JUnit-BEGIN$
suite.addTestSuite(TmfBaseColumnDataProviderTest.class);
suite.addTestSuite(TmfBaseColumnDataTest.class);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java
index 0b7ea29965..8e35d7a372 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java
@@ -31,6 +31,10 @@ import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseColumnData.IT
import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseColumnDataProvider;
import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseStatisticsTree;
import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeNode;
+
+/**
+ * TmfBaseColumnDataProvider test cases.
+ */
@SuppressWarnings("nls")
public class TmfBaseColumnDataProviderTest extends TestCase {
@@ -82,6 +86,10 @@ public class TmfBaseColumnDataProviderTest extends TestCase {
// Housekeeping
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ * @param name trace name to set
+ */
public TmfBaseColumnDataProviderTest(final String name) {
super(name);
@@ -114,7 +122,9 @@ public class TmfBaseColumnDataProviderTest extends TestCase {
// ------------------------------------------------------------------------
// Get Column Data
// ------------------------------------------------------------------------
-
+ /**
+ * Method with test cases.
+ */
public void testGetColumnData() {
List<TmfBaseColumnData> columnsData = provider.getColumnData();
assertNotNull("getColumnData", columnsData);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java
index 7ead7b038a..3f4f60b267 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java
@@ -27,6 +27,9 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
+/**
+ * TmfBaseColumnData Test Case.
+ */
@SuppressWarnings("nls")
public class TmfBaseColumnDataTest extends TestCase {
@@ -111,6 +114,9 @@ public class TmfBaseColumnDataTest extends TestCase {
// getHeader
// ------------------------------------------------------------------------
+ /**
+ * Test get header
+ */
public void testGetHeader() {
assertEquals("getHeader", 0, fBaseColumnData.getHeader().compareTo(fHeader));
}
@@ -119,6 +125,9 @@ public class TmfBaseColumnDataTest extends TestCase {
// getWidth
// ------------------------------------------------------------------------
+ /**
+ * Test getting of column width.
+ */
public void testGetWidth() {
assertEquals("getWidth", fWidth, fBaseColumnData.getWidth());
}
@@ -127,6 +136,9 @@ public class TmfBaseColumnDataTest extends TestCase {
// getAlignment
// ------------------------------------------------------------------------
+ /**
+ * Test getting of alignment value
+ */
public void testGetAlignment() {
assertEquals("getAlignment", fAlignment, fBaseColumnData.getAlignment());
}
@@ -135,6 +147,9 @@ public class TmfBaseColumnDataTest extends TestCase {
// getToolTip
// ------------------------------------------------------------------------
+ /**
+ * Test getting of tooltip.
+ */
public void testGetTooltip() {
assertEquals("getTooltip", fToolTip, fBaseColumnData.getTooltip());
}
@@ -143,6 +158,9 @@ public class TmfBaseColumnDataTest extends TestCase {
// getLabelProvider
// ------------------------------------------------------------------------
+ /**
+ * Test getting of label provider
+ */
public void testGetLabelProvider() {
assertEquals("getLabelProvider", 0, fBaseColumnData.getLabelProvider().getText(fTreeNode).compareTo(fLabelProvider.getText(fTreeNode)));
assertTrue("getLabelProvider", fBaseColumnData.getLabelProvider().getImage(fTreeNode).equals(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT)));
@@ -153,6 +171,9 @@ public class TmfBaseColumnDataTest extends TestCase {
// getComparator
// ------------------------------------------------------------------------
+ /**
+ * Test getting of comparator.
+ */
public void testGetComparator() {
assertTrue("getComparator", fBaseColumnData.getComparator().equals(fComparator));
}
@@ -161,6 +182,9 @@ public class TmfBaseColumnDataTest extends TestCase {
// getPercentageProvider
// ------------------------------------------------------------------------
+ /**
+ * Test getting of percentage provider.
+ */
public void testGetPercentageProvider() {
assertTrue("getPercentageProvider", fBaseColumnData.getPercentageProvider().equals(fPercentageProvider));
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java
index 9ab73f4152..d955b9b8b3 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation
* Bernd Hufmann - Fixed warnings
@@ -31,18 +31,21 @@ import org.eclipse.linuxtools.tmf.ui.views.statistics.model.Messages;
import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseStatisticsTree;
import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeNode;
+/**
+ * TmfBaseStatistics Test Cases.
+ */
@SuppressWarnings("nls")
public class TmfBaseStatisticsDataTest extends TestCase {
-
+
// ------------------------------------------------------------------------
// Fields
// ------------------------------------------------------------------------
private String fTestName = null;
-
+
private final String fContext = "UnitTest";
private final String fTypeId1 = "Some type1";
private final String fTypeId2 = "Some type2";
-
+
private final String fLabel0 = "label1";
private final String fLabel1 = "label2";
private final String fLabel2 = "label3";
@@ -51,13 +54,13 @@ public class TmfBaseStatisticsDataTest extends TestCase {
private final TmfTimestamp fTimestamp1 = new TmfTimestamp(12345, (byte) 2, 5);
private final TmfTimestamp fTimestamp2 = new TmfTimestamp(12350, (byte) 2, 5);
private final TmfTimestamp fTimestamp3 = new TmfTimestamp(12355, (byte) 2, 5);
-
+
private final String fSource = "Source";
-
+
private final TmfEventType fType1 = new TmfEventType(fContext, fTypeId1, TmfEventField.makeRoot(fLabels));
private final TmfEventType fType2 = new TmfEventType(fContext, fTypeId1, TmfEventField.makeRoot(fLabels));
private final TmfEventType fType3 = new TmfEventType(fContext, fTypeId2, TmfEventField.makeRoot(fLabels));
-
+
private final String fReference = "Some reference";
private final TmfEvent fEvent1;
@@ -67,32 +70,32 @@ public class TmfBaseStatisticsDataTest extends TestCase {
private final TmfEventField fContent1;
private final TmfEventField fContent2;
private final TmfEventField fContent3;
-
+
private final TmfBaseStatisticsTree fStatsData;
-
+
private final ITmfExtraEventInfo fExtraInfo;
-
+
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
-
+
/**
* @param name of the test
*/
public TmfBaseStatisticsDataTest(final String name) {
super(name);
-
+
fTestName = name;
-
+
fContent1 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, "Some content");
fEvent1 = new TmfEvent(null, fTimestamp1, fSource, fType1, fContent1, fReference);
fContent2 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, "Some other content");
fEvent2 = new TmfEvent(null, fTimestamp2, fSource, fType2, fContent2, fReference);
-
+
fContent3 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, "Some other different content");
fEvent3 = new TmfEvent(null, fTimestamp3, fSource, fType3, fContent3, fReference);
-
+
fStatsData = new TmfBaseStatisticsTree();
fExtraInfo = new ITmfExtraEventInfo() {
@Override
@@ -104,31 +107,34 @@ public class TmfBaseStatisticsDataTest extends TestCase {
fStatsData.registerEvent(fEvent2, fExtraInfo);
fStatsData.registerEvent(fEvent3, fExtraInfo);
}
-
+
// ------------------------------------------------------------------------
// GetChildren
// ------------------------------------------------------------------------
+ /**
+ * Test getting of children.
+ */
public void testGetChildren() {
// Getting children of the ROOT
Collection<TmfStatisticsTreeNode> childrenTreeNode = fStatsData.getChildren(AbsTmfStatisticsTree.ROOT);
assertEquals("getChildren", 1, childrenTreeNode.size());
TmfStatisticsTreeNode treeNode = childrenTreeNode.iterator().next();
assertEquals("getChildren", fTestName, treeNode.getKey());
-
+
// Getting children of the trace
childrenTreeNode = fStatsData.getChildren(new TmfFixedArray<String>(fTestName));
assertEquals("getChildren", 1, childrenTreeNode.size());
treeNode = childrenTreeNode.iterator().next();
assertEquals("getChildren", Messages.TmfStatisticsData_EventTypes, treeNode.getKey());
-
- Vector<String> keyExpected = new Vector<String>();
+
+ Vector<String> keyExpected = new Vector<String>();
keyExpected.add(fEvent1.getType().toString());
keyExpected.add(fEvent3.getType().toString());
// Getting children of a category
childrenTreeNode = fStatsData.getChildren(treeNode.getPath());
assertEquals("getChildren", 2, childrenTreeNode.size());
-
+
Iterator<TmfStatisticsTreeNode> iterChild = childrenTreeNode.iterator();
TmfStatisticsTreeNode temp;
while (iterChild.hasNext()) {
@@ -140,30 +146,33 @@ public class TmfBaseStatisticsDataTest extends TestCase {
fail();
}
}
-
+
// Get children of a specific event type
childrenTreeNode = fStatsData.getChildren(childrenTreeNode.iterator().next().getPath());
assertEquals("getChildren", 0, childrenTreeNode.size());
}
-
+
// ------------------------------------------------------------------------
// GetAllChildren
// ------------------------------------------------------------------------
+ /**
+ * Test getting of all children.
+ */
public void testGetAllChildren() {
// Getting children of the ROOT
Collection<TmfStatisticsTreeNode> childrenTreeNode = fStatsData.getAllChildren(AbsTmfStatisticsTree.ROOT);
assertEquals("getChildren", 1, childrenTreeNode.size());
TmfStatisticsTreeNode treeNode = childrenTreeNode.iterator().next();
assertEquals("getChildren", fTestName, treeNode.getKey());
-
+
// Getting children of the trace
childrenTreeNode = fStatsData.getAllChildren(new TmfFixedArray<String>(fTestName));
assertEquals("getChildren", 1, childrenTreeNode.size());
treeNode = childrenTreeNode.iterator().next();
assertEquals("getChildren", Messages.TmfStatisticsData_EventTypes, treeNode.getKey());
-
- Vector<String> keyExpected = new Vector<String>();
+
+ Vector<String> keyExpected = new Vector<String>();
keyExpected.add(fEvent1.getType().toString());
keyExpected.add(fEvent3.getType().toString());
// It should return the eventType even though the number of events equals 0
@@ -171,7 +180,7 @@ public class TmfBaseStatisticsDataTest extends TestCase {
// Getting children of a category
childrenTreeNode = fStatsData.get(treeNode.getPath()).getAllChildren();
assertEquals("getChildren", 2, childrenTreeNode.size());
-
+
Iterator<TmfStatisticsTreeNode> iterChild = childrenTreeNode.iterator();
TmfStatisticsTreeNode temp;
while (iterChild.hasNext()) {
@@ -183,7 +192,7 @@ public class TmfBaseStatisticsDataTest extends TestCase {
fail();
}
}
-
+
// Get children of a specific event type
childrenTreeNode = fStatsData.getAllChildren(childrenTreeNode.iterator().next().getPath());
assertEquals("getChildren", 0, childrenTreeNode.size());
@@ -192,26 +201,32 @@ public class TmfBaseStatisticsDataTest extends TestCase {
// ------------------------------------------------------------------------
// RegisterEvent
// ------------------------------------------------------------------------
-
+
+ /**
+ * Test registering of events.
+ */
public void testRegisterEvent() {
TmfStatisticsTreeNode trace = fStatsData.get(new TmfFixedArray<String>(fTestName));
assertEquals("registerEvent", 3, trace.getValue().nbEvents);
-
+
Collection<TmfStatisticsTreeNode> childrenTreeNode = fStatsData.getChildren(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes));
for (TmfStatisticsTreeNode child : childrenTreeNode) {
if (child.getKey().compareTo(fEvent1.getType().toString()) == 0) {
- assertEquals("registerEvent", 2, child.getValue().nbEvents);
+ assertEquals("registerEvent", 2, child.getValue().nbEvents);
}
else if (child.getKey().compareTo(fEvent3.getType().toString()) == 0) {
assertEquals("registerEvent", 1, child.getValue().nbEvents);
}
}
}
-
+
// ------------------------------------------------------------------------
// Get a node
// ------------------------------------------------------------------------
-
+
+ /**
+ * Test getter.
+ */
public void testGet() {
TmfStatisticsTreeNode traceRoot = fStatsData.get(new TmfFixedArray<String>(fTestName));
assertNotNull("get", traceRoot);
@@ -219,54 +234,60 @@ public class TmfBaseStatisticsDataTest extends TestCase {
assertEquals("get", 3, traceRoot.getValue().nbEvents);
assertEquals("get", 1, traceRoot.getNbChildren());
}
-
+
// ------------------------------------------------------------------------
// GetOrCreate
// ------------------------------------------------------------------------
-
+
+ /**
+ * Test getting or creating of node entries.
+ */
public void testGetOrCreate() {
TmfFixedArray<String> newEventType = new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, "Fancy Type");
TmfStatisticsTreeNode newEventTypeNode;
-
+
// newEventType is not in the tree
newEventTypeNode = fStatsData.get(newEventType);
assertNull("getOrCreate", newEventTypeNode);
-
+
newEventTypeNode = fStatsData.getOrCreate(newEventType);
assertNotNull("getOrCreate", newEventTypeNode);
assertTrue("getOrCreate", newEventTypeNode.getPath().equals(newEventType));
-
+
// newEventType is in the tree
newEventTypeNode.reset();
newEventTypeNode = fStatsData.get(newEventType);
assertNotNull("getOrCreate", newEventTypeNode);
-
+
newEventTypeNode = fStatsData.getOrCreate(newEventType);
assertNotNull("getOrCreate", newEventTypeNode);
assertTrue("getOrCreate", newEventTypeNode.getPath().equals(newEventType));
}
-
+
// ------------------------------------------------------------------------
// GetParent
// ------------------------------------------------------------------------
-
+
+ /**
+ * Test getting of parent node.
+ */
public void testGetParent() {
TmfStatisticsTreeNode parentNode = fStatsData.getParent(AbsTmfStatisticsTree.ROOT);
assertNull("getParent", parentNode);
-
+
parentNode = fStatsData.getParent(new TmfFixedArray<String>("TreeRootNode that should not exist"));
assertNotNull("getParent", parentNode);
assertEquals("getParent", 0, parentNode.getKey().compareTo(fStatsData.get(AbsTmfStatisticsTree.ROOT).getKey().toString()));
-
+
parentNode = fStatsData.getParent(new TmfFixedArray<String>("TreeNode", Messages.TmfStatisticsData_EventTypes, "TreeNode that should not exist"));
assertNull("getParent", parentNode);
parentNode = fStatsData.getParent(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString()));
assertNull("getParent", parentNode);
-
+
parentNode = fStatsData.getParent(new TmfFixedArray<String>(fTestName));
assertNotNull("getParent", parentNode);
assertEquals("getParent", 0, parentNode.getPath().toString().compareTo(AbsTmfStatisticsTree.ROOT.toString()));
-
+
parentNode = fStatsData.getParent(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes));
assertNotNull("getParent", parentNode);
assertEquals("getParent", 0, parentNode.getPath().toString().compareTo(fStatsData.get(new TmfFixedArray<String>(fTestName)).getPath().toString()));
@@ -276,15 +297,18 @@ public class TmfBaseStatisticsDataTest extends TestCase {
// Reset
// ------------------------------------------------------------------------
+ /**
+ * Test reset method
+ */
public void testReset() {
fStatsData.reset(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes));
-
+
assertEquals("reset", 0, fStatsData.getChildren(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes)).size());
assertNull("reset", fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fType1.getName())));
assertNull("reset", fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fType3.getName())));
-
+
fStatsData.reset(new TmfFixedArray<String>(fTestName));
-
+
// A rootz should always have at least one child that is eventType
assertEquals("reset", 1, fStatsData.getChildren(new TmfFixedArray<String>(fTestName)).size());
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java
index c7bda0c63b..c0ec628953 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation
* Bernd Hufmann - Fixed warnings
@@ -31,6 +31,9 @@ import org.eclipse.linuxtools.tmf.ui.views.statistics.model.Messages;
import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseStatisticsTree;
import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeNode;
+/**
+ * TmfStatisticsTreeNode Test Cases.
+ */
@SuppressWarnings("nls")
public class TmfStatisticsTreeNodeTest extends TestCase {
@@ -38,12 +41,12 @@ public class TmfStatisticsTreeNodeTest extends TestCase {
// Fields
// ------------------------------------------------------------------------
private String fTestName = null;
-
-
+
+
private final String fContext = "UnitTest";
private final String fTypeId1 = "Some type1";
private final String fTypeId2 = "Some type2";
-
+
private final String fLabel0 = "label1";
private final String fLabel1 = "label2";
private final String fLabel2 = "label3";
@@ -52,13 +55,13 @@ public class TmfStatisticsTreeNodeTest extends TestCase {
private final TmfTimestamp fTimestamp1 = new TmfTimestamp(12345, (byte) 2, 5);
private final TmfTimestamp fTimestamp2 = new TmfTimestamp(12350, (byte) 2, 5);
private final TmfTimestamp fTimestamp3 = new TmfTimestamp(12355, (byte) 2, 5);
-
+
private final String fSource = "Source";
-
+
private final TmfEventType fType1 = new TmfEventType(fContext, fTypeId1, TmfEventField.makeRoot(fLabels));
private final TmfEventType fType2 = new TmfEventType(fContext, fTypeId1, TmfEventField.makeRoot(fLabels));
private final TmfEventType fType3 = new TmfEventType(fContext, fTypeId2, TmfEventField.makeRoot(fLabels));
-
+
private final String fReference = "Some reference";
private final TmfEvent fEvent1;
@@ -68,29 +71,29 @@ public class TmfStatisticsTreeNodeTest extends TestCase {
private final TmfEventField fContent1;
private final TmfEventField fContent2;
private final TmfEventField fContent3;
-
+
private final TmfBaseStatisticsTree fStatsData;
-
+
private final ITmfExtraEventInfo fExtraInfo;
-
+
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
-
+
/**
* @param name of the test
*/
public TmfStatisticsTreeNodeTest(final String name) {
super(name);
-
+
fTestName = name;
-
+
fContent1 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, "Some content");
fEvent1 = new TmfEvent(null, fTimestamp1, fSource, fType1, fContent1, fReference);
fContent2 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, "Some other content");
fEvent2 = new TmfEvent(null, fTimestamp2, fSource, fType2, fContent2, fReference);
-
+
fContent3 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, "Some other different content");
fEvent3 = new TmfEvent(null, fTimestamp3, fSource, fType3, fContent3, fReference);
@@ -105,54 +108,60 @@ public class TmfStatisticsTreeNodeTest extends TestCase {
fStatsData.registerEvent(fEvent2, fExtraInfo);
fStatsData.registerEvent(fEvent3, fExtraInfo);
}
-
+
// ------------------------------------------------------------------------
// ContainsChild
// ------------------------------------------------------------------------
+ /**
+ * Test checking for child.
+ */
public void testContainsChild() {
TmfStatisticsTreeNode rootNode = fStatsData.get(AbsTmfStatisticsTree.ROOT);
TmfStatisticsTreeNode traceNode = fStatsData.get(new TmfFixedArray<String>(fTestName));
// Creates a category from the key already created
TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next();
-
+
assertTrue("containsChild", rootNode.containsChild(fTestName));
assertFalse("containsChild", rootNode.containsChild(catNode.getKey()));
assertFalse("containsChild", rootNode.containsChild(null));
-
+
assertTrue("containsChild", traceNode.containsChild(catNode.getKey()));
assertFalse("containsChild", traceNode.containsChild(fEvent1.getType().toString()));
assertFalse("containsChild", traceNode.containsChild(null));
-
+
assertTrue("containsChild", catNode.containsChild(fEvent1.getType().toString()));
assertTrue("containsChild", catNode.containsChild(fEvent3.getType().toString()));
assertFalse("containsChild", catNode.containsChild(null));
}
-
+
// ------------------------------------------------------------------------
// GetChildren
// ------------------------------------------------------------------------
+ /**
+ * Test getting of children.
+ */
public void testGetChildren() {
// Getting children of the ROOT
Collection<TmfStatisticsTreeNode> childrenTreeNode = fStatsData.get(AbsTmfStatisticsTree.ROOT).getChildren();
assertEquals("getChildren", 1, childrenTreeNode.size());
TmfStatisticsTreeNode treeNode = childrenTreeNode.iterator().next();
assertEquals("getChildren", fTestName, treeNode.getKey());
-
+
// Getting children of the trace
childrenTreeNode = fStatsData.get(new TmfFixedArray<String>(fTestName)).getChildren();
assertEquals("getChildren", 1, childrenTreeNode.size());
treeNode = childrenTreeNode.iterator().next();
assertEquals("getChildren", Messages.TmfStatisticsData_EventTypes, treeNode.getKey());
-
- Vector<String> keyExpected = new Vector<String>();
+
+ Vector<String> keyExpected = new Vector<String>();
keyExpected.add(fEvent1.getType().toString());
keyExpected.add(fEvent3.getType().toString());
// Getting children of a category
childrenTreeNode = treeNode.getChildren();
assertEquals("getChildren", 2, childrenTreeNode.size());
-
+
Iterator<TmfStatisticsTreeNode> iterChild = childrenTreeNode.iterator();
TmfStatisticsTreeNode temp;
while (iterChild.hasNext()) {
@@ -164,30 +173,33 @@ public class TmfStatisticsTreeNodeTest extends TestCase {
fail();
}
}
-
+
// Get children of a specific event type
childrenTreeNode = fStatsData.get(childrenTreeNode.iterator().next().getPath()).getChildren();
assertEquals("getChildren", 0, childrenTreeNode.size());
}
-
+
// ------------------------------------------------------------------------
// GetAllChildren
// ------------------------------------------------------------------------
+ /**
+ * Test getting of all children.
+ */
public void testGetAllChildren() {
// Getting children of the ROOT
Collection<TmfStatisticsTreeNode> childrenTreeNode = fStatsData.get(AbsTmfStatisticsTree.ROOT).getAllChildren();
assertEquals("getChildren", 1, childrenTreeNode.size());
TmfStatisticsTreeNode treeNode = childrenTreeNode.iterator().next();
assertEquals("getChildren", fTestName, treeNode.getKey());
-
+
// Getting children of the trace
childrenTreeNode = fStatsData.get(new TmfFixedArray<String>(fTestName)).getAllChildren();
assertEquals("getChildren", 1, childrenTreeNode.size());
treeNode = childrenTreeNode.iterator().next();
assertEquals("getChildren", Messages.TmfStatisticsData_EventTypes, treeNode.getKey());
-
- Vector<String> keyExpected = new Vector<String>();
+
+ Vector<String> keyExpected = new Vector<String>();
keyExpected.add(fEvent1.getType().toString());
keyExpected.add(fEvent3.getType().toString());
// It should return the eventType even though the number of events equals 0
@@ -195,7 +207,7 @@ public class TmfStatisticsTreeNodeTest extends TestCase {
// Getting children of a category
childrenTreeNode = treeNode.getAllChildren();
assertEquals("getChildren", 2, childrenTreeNode.size());
-
+
Iterator<TmfStatisticsTreeNode> iterChild = childrenTreeNode.iterator();
TmfStatisticsTreeNode temp;
while (iterChild.hasNext()) {
@@ -207,149 +219,168 @@ public class TmfStatisticsTreeNodeTest extends TestCase {
fail();
}
}
-
+
// Get children of a specific event type
childrenTreeNode = fStatsData.get(childrenTreeNode.iterator().next().getPath()).getAllChildren();
assertEquals("getChildren", 0, childrenTreeNode.size());
}
-
+
// ------------------------------------------------------------------------
// GetNbChildren
// ------------------------------------------------------------------------
-
+ /**
+ * Test getting of number of children.
+ */
public void testGetNbChildren() {
TmfStatisticsTreeNode rootNode = fStatsData.get(AbsTmfStatisticsTree.ROOT);
TmfStatisticsTreeNode traceNode = fStatsData.get(new TmfFixedArray<String>(fTestName));
TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next();
TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString()));
-
+
assertEquals("getNbChildren", 1, rootNode.getNbChildren());
assertEquals("getNbChildren", 1, traceNode.getNbChildren());
assertEquals("getNbChildren", 2, catNode.getNbChildren());
assertEquals("getNbChildren", 0, elementNode.getNbChildren());
}
-
+
// ------------------------------------------------------------------------
// HasChildren
// ------------------------------------------------------------------------
-
+
+ /**
+ * Test checking for children.
+ */
public void testHasChildren() {
TmfStatisticsTreeNode rootNode = fStatsData.get(AbsTmfStatisticsTree.ROOT);
TmfStatisticsTreeNode traceNode = fStatsData.get(new TmfFixedArray<String>(fTestName));
TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next();
TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString()));
-
+
assertTrue ("hasChildren", rootNode.hasChildren());
assertTrue ("hasChildren", traceNode.hasChildren());
assertTrue ("hasChildren", catNode.hasChildren());
assertFalse("hasChildren", elementNode.hasChildren());
}
-
+
// ------------------------------------------------------------------------
// GetParent
// ------------------------------------------------------------------------
-
+
+ /**
+ * Test geting oft parent.
+ */
public void testGetParent() {
TmfStatisticsTreeNode rootNode = fStatsData.get(AbsTmfStatisticsTree.ROOT);
TmfStatisticsTreeNode parentNode = rootNode.getParent();
assertNull("getParent", parentNode);
-
+
TmfStatisticsTreeNode newTraceNode = new TmfStatisticsTreeNode(new TmfFixedArray<String>("newly created trace node"), fStatsData);
parentNode = newTraceNode.getParent();
assertNotNull("getParent", parentNode);
assertEquals("getParent", 0, parentNode.getKey().compareTo(fStatsData.get(AbsTmfStatisticsTree.ROOT).getKey().toString()));
-
+
TmfStatisticsTreeNode traceNode = fStatsData.get(new TmfFixedArray<String>(fTestName));
parentNode = traceNode.getParent();
assertNotNull("getParent", parentNode);
assertEquals("getParent", 0, parentNode.getPath().toString().compareTo(AbsTmfStatisticsTree.ROOT.toString()));
-
+
TmfStatisticsTreeNode newNode = new TmfStatisticsTreeNode(new TmfFixedArray<String>("TreeNode", Messages.TmfStatisticsData_EventTypes, "TreeNode that should not exist"), fStatsData);
parentNode = newNode.getParent();
assertNull("getParent", parentNode);
-
+
TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString()));
parentNode = elementNode.getParent();
assertNull("getParent", parentNode);
-
+
TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next();
parentNode = catNode.getParent();
assertNotNull("getParent", parentNode);
assertEquals("getParent", 0, parentNode.getPath().toString().compareTo(fStatsData.get(new TmfFixedArray<String>(fTestName)).getPath().toString()));
-
+
parentNode = elementNode.getParent();
assertNotNull("getParent", parentNode);
assertTrue("getParent", parentNode.getPath().equals(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes)));
}
-
+
// ------------------------------------------------------------------------
// GetKey
// ------------------------------------------------------------------------
-
+ /**
+ * Test getting of key.
+ */
public void testGetKey() {
TmfStatisticsTreeNode rootNode = fStatsData.get(AbsTmfStatisticsTree.ROOT);
TmfStatisticsTreeNode traceNode = fStatsData.get(new TmfFixedArray<String>(fTestName));
TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next();
TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString()));
-
+
assertEquals("getKey", 0, rootNode.getKey().compareTo(AbsTmfStatisticsTree.ROOT.get(0)));
assertEquals("getKey", 0, traceNode.getKey().compareTo(fTestName));
assertEquals("getKey", 0, catNode.getKey().compareTo(Messages.TmfStatisticsData_EventTypes));
assertEquals("getKey", 0, elementNode.getKey().compareTo(fEvent1.getType().toString()));
}
-
+
// ------------------------------------------------------------------------
// GetPath
// ------------------------------------------------------------------------
-
+
+ /**
+ * Test getting of path to node.
+ */
public void testGetPath() {
TmfStatisticsTreeNode rootNode = fStatsData.get(AbsTmfStatisticsTree.ROOT);
TmfStatisticsTreeNode traceNode = fStatsData.get(new TmfFixedArray<String>(fTestName));
TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next();
TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString()));
-
+
assertTrue("getPath", rootNode.getPath().equals(AbsTmfStatisticsTree.ROOT));
assertTrue("getPath", traceNode.getPath().equals(new TmfFixedArray<String>(fTestName)));
assertTrue("getPath", catNode.getPath().equals(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes)));
assertTrue("getPath", elementNode.getPath().equals(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString())));
}
-
+
// ------------------------------------------------------------------------
// GetValue
// ------------------------------------------------------------------------
-
+
+ /**
+ * Test gettomg statistic value.
+ */
public void testGetValue() {
TmfStatisticsTreeNode rootNode = fStatsData.get(AbsTmfStatisticsTree.ROOT);
TmfStatisticsTreeNode traceNode = fStatsData.get(new TmfFixedArray<String>(fTestName));
TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next();
TmfStatisticsTreeNode elementNode1 = fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString()));
TmfStatisticsTreeNode elementNode2 = fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent3.getType().toString()));
-
+
assertEquals("getValue", 0, rootNode.getValue().nbEvents);
assertEquals("getValue", 3, traceNode.getValue().nbEvents);
assertEquals("getValue", 0, catNode.getValue().nbEvents);
assertEquals("getValue", 2, elementNode1.getValue().nbEvents);
assertEquals("getValue", 1, elementNode2.getValue().nbEvents);
}
-
+
// ------------------------------------------------------------------------
// Reset
// ------------------------------------------------------------------------
-
+
+ /**
+ * Test reset of tree.
+ */
public void testReset() {
TmfStatisticsTreeNode rootNode = fStatsData.get(AbsTmfStatisticsTree.ROOT);
TmfStatisticsTreeNode traceNode = fStatsData.get(new TmfFixedArray<String>(fTestName));
TmfStatisticsTreeNode catNode = traceNode.getChildren().iterator().next();
TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString()));
-
+
elementNode.reset();
assertEquals("reset", 0, elementNode.getValue().nbEvents);
-
+
catNode.reset();
assertEquals("reset", 0, catNode.getValue().nbEvents);
assertEquals("reset", 0, catNode.getNbChildren());
assertNull("reset", fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString())));
-
+
traceNode.reset();
assertEquals("reset", 0, traceNode.getValue().nbEvents);
// A trace always have at least one child that is eventType
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java
index 7282bcc9a7..ae7b5240e1 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeRootFactoryTest.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation
* Bernd Hufmann - Fixed warnings
@@ -20,35 +20,41 @@ import org.eclipse.linuxtools.tmf.ui.views.statistics.model.AbsTmfStatisticsTree
import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeNode;
import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeRootFactory;
+/**
+ * TmfStatisticsTreeRootFactory Test Case.
+ */
@SuppressWarnings("nls")
public class TmfStatisticsTreeRootFactoryTest extends TestCase {
-
+
// ------------------------------------------------------------------------
// Fields
// ------------------------------------------------------------------------
-
+
AbsTmfStatisticsTree fStatisticsData1;
AbsTmfStatisticsTree fStatisticsData2;
AbsTmfStatisticsTree fStatisticsData3;
String fDataKey1 = "key1";
String fDataKey2 = "key2";
String fDataKey3 = "key3";
-
+
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
-
+
@Override
protected void setUp() throws Exception {
super.setUp();
addStatsTreeRoot();
}
-
+
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
-
+
+ /**
+ * Test adding of statistics tree root.
+ */
public void addStatsTreeRoot() {
fStatisticsData1 = new TmfBaseStatisticsTree();
fStatisticsData2 = new TmfBaseStatisticsTree();
@@ -57,11 +63,14 @@ public class TmfStatisticsTreeRootFactoryTest extends TestCase {
TmfStatisticsTreeRootFactory.addStatsTreeRoot(fDataKey2, fStatisticsData2);
TmfStatisticsTreeRootFactory.addStatsTreeRoot(fDataKey2, fStatisticsData3);
}
-
+
// ------------------------------------------------------------------------
// get
// ------------------------------------------------------------------------
-
+
+ /**
+ * Test getting of statistics tree root.
+ */
public void testGetStatTreeRoot() {
TmfStatisticsTreeNode value1 = TmfStatisticsTreeRootFactory.getStatTreeRoot(fDataKey1);
TmfStatisticsTreeNode value2 = TmfStatisticsTreeRootFactory.getStatTreeRoot(fDataKey2);
@@ -72,6 +81,9 @@ public class TmfStatisticsTreeRootFactoryTest extends TestCase {
assertNull("getStatTreeRoot", TmfStatisticsTreeRootFactory.getStatTreeRoot(null));
}
+ /**
+ * Test getting statistics tree.
+ */
public void testGetStatTree() {
AbsTmfStatisticsTree value1 = TmfStatisticsTreeRootFactory.getStatTree(fDataKey1);
AbsTmfStatisticsTree value2 = TmfStatisticsTreeRootFactory.getStatTree(fDataKey2);
@@ -85,7 +97,10 @@ public class TmfStatisticsTreeRootFactoryTest extends TestCase {
// ------------------------------------------------------------------------
// contains
// ------------------------------------------------------------------------
-
+
+ /**
+ * Test checking for tree root existence.
+ */
public void testContainsTreeRoot() {
assertTrue("containsTreeRoot", TmfStatisticsTreeRootFactory.containsTreeRoot(fDataKey1));
assertTrue("containsTreeRoot", TmfStatisticsTreeRootFactory.containsTreeRoot(fDataKey2));
@@ -95,19 +110,25 @@ public class TmfStatisticsTreeRootFactoryTest extends TestCase {
// ------------------------------------------------------------------------
// remove
// ------------------------------------------------------------------------
-
+
+ /**
+ * Test removal of statistics tree node.
+ */
public void testRemoveStatTreeRoot() {
TmfStatisticsTreeRootFactory.removeStatTreeRoot(fDataKey1);
assertNull("removeStatTreeRoot", TmfStatisticsTreeRootFactory.getStatTree(fDataKey1));
-
+
try {
- TmfStatisticsTreeRootFactory.removeStatTreeRoot(null);
+ TmfStatisticsTreeRootFactory.removeStatTreeRoot(null);
// Success
} catch (Exception e) {
fail("removeStatTreeRoot");
}
}
+ /**
+ * Test removal of all root nodes.
+ */
public void testRemoveAll() {
TmfStatisticsTreeRootFactory.removeAll();
assertNull("removeAll", TmfStatisticsTreeRootFactory.getStatTreeRoot(fDataKey2));
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java
index 54d97688f5..82ba6ffdee 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Mathieu Denis (mathieu.denis@polymtl.ca) - Initial design and implementation
* Bernd Hufmann - Fixed warnings
@@ -32,6 +32,9 @@ import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseStatisticsTre
import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeNode;
import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfTreeContentProvider;
+/**
+ * TmfTreeContentProvider Test Cases.
+ */
@SuppressWarnings("nls")
public class TmfTreeContentProviderTest extends TestCase {
@@ -44,7 +47,7 @@ public class TmfTreeContentProviderTest extends TestCase {
private final String fContext = "UnitTest";
private final String fTypeId1 = "Some type1";
private final String fTypeId2 = "Some type2";
-
+
private final String fLabel0 = "label1";
private final String fLabel1 = "label2";
private final String[] fLabels = new String[] { fLabel0, fLabel1 };
@@ -107,6 +110,9 @@ public class TmfTreeContentProviderTest extends TestCase {
// GetChildren
// ------------------------------------------------------------------------
+ /**
+ * Test getting of children.
+ */
public void testGetChildren() {
Object[] objectArray = treeProvider.getChildren(fStatsData.getOrCreate(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes)));
TmfStatisticsTreeNode[] childrenNode = Arrays.asList(objectArray).toArray(new TmfStatisticsTreeNode[0]);
@@ -130,6 +136,9 @@ public class TmfTreeContentProviderTest extends TestCase {
// GetParent
// ------------------------------------------------------------------------
+ /**
+ * Test getting of parent.
+ */
public void testGetParent() {
TmfStatisticsTreeNode parent = (TmfStatisticsTreeNode) treeProvider.getParent(fStatsData.get(new TmfFixedArray<String>(fTestName)));
@@ -140,14 +149,16 @@ public class TmfTreeContentProviderTest extends TestCase {
// ------------------------------------------------------------------------
// HasChildren
// ------------------------------------------------------------------------
-
+ /**
+ * Test checking for children.
+ */
public void testHasChildren() {
Boolean hasChildren = treeProvider.hasChildren(fStatsData.getOrCreate(AbsTmfStatisticsTree.ROOT));
assertTrue("hasChildren", hasChildren);
-
+
hasChildren = treeProvider.hasChildren(fStatsData.getOrCreate(new TmfFixedArray<String>(fTestName)));
assertTrue("hasChildren", hasChildren);
-
+
hasChildren = treeProvider.hasChildren(fStatsData.getOrCreate(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes)));
assertTrue("hasChildren", hasChildren);
@@ -159,6 +170,9 @@ public class TmfTreeContentProviderTest extends TestCase {
// GetElements
// ------------------------------------------------------------------------
+ /**
+ * Test getting of elements.
+ */
public void testGetElements() {
Object[] objectElements = treeProvider.getElements(fStatsData.get(AbsTmfStatisticsTree.ROOT));
TmfStatisticsTreeNode[] nodeElements = Arrays.asList(objectElements).toArray(new TmfStatisticsTreeNode[0]);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/dialogs/AllTests.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/dialogs/AllTests.java
index 2c35444b8e..ea482eae50 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/dialogs/AllTests.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/dialogs/AllTests.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -14,10 +14,16 @@ package org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.dialogs;
import junit.framework.Test;
import junit.framework.TestSuite;
+/**
+ * Test suite of UML2SD dialog tests.
+ */
public class AllTests {
+ /**
+ * @return the test suite of UML2SD dialog tests
+ */
public static Test suite() {
-
+
TestSuite suite = new TestSuite(AllTests.class.getName());
//$JUnit-BEGIN$
suite.addTestSuite(CriteriaTest.class);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/dialogs/CriteriaTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/dialogs/CriteriaTest.java
index 2eaa025a32..32274fd6fd 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/dialogs/CriteriaTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/dialogs/CriteriaTest.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -21,6 +21,10 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.dialogs.Criteria;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDFilterProvider;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDGraphNodeSupporter;
+/**
+ * Test cases to test Criteria class.
+ */
+@SuppressWarnings("nls")
public class CriteriaTest extends TestCase {
@Override
@@ -31,10 +35,12 @@ public class CriteriaTest extends TestCase {
public void tearDown() throws Exception {
}
- @SuppressWarnings("nls")
+ /**
+ * Test default constructor.
+ */
public void testCriteria() {
Criteria criteria = new Criteria();
- assertFalse("testCriteria", criteria.isAsyncMessageReturnSelected());
+ assertFalse("testCriteria", criteria.isAsyncMessageReturnSelected());
assertFalse("testCriteria", criteria.isAsyncMessageSelected());
assertFalse("testCriteria", criteria.isCaseSenstiveSelected());
assertFalse("testCriteria", criteria.isLifeLineSelected());
@@ -45,7 +51,9 @@ public class CriteriaTest extends TestCase {
assertNull("testCriteria", criteria.getPattern());
}
- @SuppressWarnings("nls")
+ /**
+ * Test copy constructor.
+ */
public void testCriteriaCriteria() {
Criteria criteria = new Criteria();
criteria.setExpression("test");
@@ -65,10 +73,12 @@ public class CriteriaTest extends TestCase {
assertEquals("testCriteriaCriteria", criteria.getPattern().pattern(), copy.getPattern().pattern());
}
- @SuppressWarnings("nls")
+ /**
+ * Test accessor methods.
+ */
public void testAccessors() {
Criteria criteria = new Criteria();
- criteria.setAsyncMessageReturnSelected(true);
+ criteria.setAsyncMessageReturnSelected(true);
criteria.setAsyncMessageSelected(true);
criteria.setCaseSenstiveSelected(true);
criteria.setLifeLineSelected(true);
@@ -78,7 +88,7 @@ public class CriteriaTest extends TestCase {
criteria.setExpression("test.*");
// set true to all flags
- assertTrue("testAccessors", criteria.isAsyncMessageReturnSelected());
+ assertTrue("testAccessors", criteria.isAsyncMessageReturnSelected());
assertTrue("testAccessors", criteria.isAsyncMessageSelected());
assertTrue("testAccessors", criteria.isCaseSenstiveSelected());
assertTrue("testAccessors", criteria.isLifeLineSelected());
@@ -91,7 +101,7 @@ public class CriteriaTest extends TestCase {
assertEquals("testAccessors", 0, criteria.getPattern().flags() & Pattern.CASE_INSENSITIVE);
// set false to all flags
- criteria.setAsyncMessageReturnSelected(false);
+ criteria.setAsyncMessageReturnSelected(false);
criteria.setAsyncMessageSelected(false);
criteria.setCaseSenstiveSelected(false);
criteria.setLifeLineSelected(false);
@@ -99,7 +109,7 @@ public class CriteriaTest extends TestCase {
criteria.setSyncMessageReturnSelected(false);
criteria.setSyncMessageSelected(false);
- assertFalse("testAccessors", criteria.isAsyncMessageReturnSelected());
+ assertFalse("testAccessors", criteria.isAsyncMessageReturnSelected());
assertFalse("testAccessors", criteria.isAsyncMessageSelected());
assertFalse("testAccessors", criteria.isCaseSenstiveSelected());
assertFalse("testAccessors", criteria.isLifeLineSelected());
@@ -112,7 +122,9 @@ public class CriteriaTest extends TestCase {
assertEquals("testAccessors", Pattern.CASE_INSENSITIVE, criteria.getPattern().flags() & Pattern.CASE_INSENSITIVE);
}
- @SuppressWarnings("nls")
+ /**
+ * Test compartTo method.
+ */
public void testCompareTo() {
Criteria criteria = new Criteria();
criteria.setExpression("test");
@@ -127,23 +139,25 @@ public class CriteriaTest extends TestCase {
copy.setExpression(null);
assertFalse("testCompareTo", criteria.compareTo(copy));
assertFalse("testCompareTo", copy.compareTo(criteria));
-
+
criteria.setExpression(null);
assertTrue("testCompareTo", criteria.compareTo(copy));
assertTrue("testCompareTo", copy.compareTo(criteria));
-
+
criteria.setExpression("test");
copy.setExpression("test.*[12345]");
assertFalse("testCompareTo", criteria.compareTo(copy));
assertFalse("testCompareTo", copy.compareTo(criteria));
-
+
copy.setExpression("test");
copy.setAsyncMessageReturnSelected(true);
assertFalse("testCompareTo", criteria.compareTo(copy));
assertFalse("testCompareTo", copy.compareTo(criteria));
}
-
- @SuppressWarnings("nls")
+
+ /**
+ * Test save to disk.
+ */
public void testSave() {
DialogSettings settings = new DialogSettings("mysettings");
@@ -151,10 +165,10 @@ public class CriteriaTest extends TestCase {
criteria.setExpression("test");
criteria.setLifeLineSelected(true);
criteria.setSyncMessageSelected(true);
-
+
// Save the criteria to the dialog settings
criteria.save(settings);
-
+
// Check if all values are saved as expected
assertEquals("testSave", "test", settings.get("expression"));
assertEquals("testSave", "false", settings.get("isCaseSenstiveSelected"));
@@ -166,7 +180,9 @@ public class CriteriaTest extends TestCase {
assertEquals("testSave", "true", settings.get("isSyncMessageSelected"));
}
- @SuppressWarnings("nls")
+ /**
+ * Test restore from disk.
+ */
public void testLoad() {
DialogSettings settings = new DialogSettings("mysettings");
@@ -174,10 +190,10 @@ public class CriteriaTest extends TestCase {
criteria.setExpression("test");
criteria.setLifeLineSelected(true);
criteria.setSyncMessageSelected(true);
-
+
// Save the criteria to the dialog settings
criteria.save(settings);
-
+
// Load the criteria from the dialog settings
Criteria copy = new Criteria();
copy.load(settings);
@@ -185,17 +201,20 @@ public class CriteriaTest extends TestCase {
assertTrue("testCompareTo", criteria.compareTo(copy));
assertTrue("testCompareTo", copy.compareTo(criteria));
}
- @SuppressWarnings("nls")
+
+ /**
+ * Test graph node summary usage.
+ */
public void testGetGraphNodeSummary() {
-
+
// Create a dummy provider
ISDFilterProvider provider = new ISDFilterProvider() {
-
+
@Override
public boolean isNodeSupported(int nodeType) {
return true;
}
-
+
@Override
public String getNodeName(int nodeType, String loaderClassName) {
// not clear about purpose loaderClassName
@@ -222,10 +241,10 @@ public class CriteriaTest extends TestCase {
return false;
}
};
-
+
Criteria criteria = new Criteria();
criteria.setExpression("BALL_.*");
- criteria.setAsyncMessageReturnSelected(true);
+ criteria.setAsyncMessageReturnSelected(true);
criteria.setAsyncMessageSelected(true);
criteria.setLifeLineSelected(true);
criteria.setStopSelected(true);
@@ -235,24 +254,26 @@ public class CriteriaTest extends TestCase {
// Test summary when provider is available
String summary = criteria.getGraphNodeSummary(provider, null);
assertEquals("testGetGraphNodeSummary", "[MyLifeline or MySyncMessage or MySyncMessageReturn or MyAsyncMessage or MyAsyncMessageReturn or MyStop]", summary);
-
- // Test default summary when no provider is provided
+
+ // Test default summary when no provider is provided
summary = criteria.getGraphNodeSummary(null, null);
assertEquals("testGetGraphNodeSummary", "[Lifeline or Synchronous message or Synchronous message return or Asynchronous message or Asynchronous message return or Stop]", summary);
-
+
}
- @SuppressWarnings("nls")
+ /**
+ * Test matches algorithm.
+ */
public void testMatches() {
Criteria criteria = new Criteria();
criteria.setExpression("BALL_.*");
-
+
/*
* Note that method matches uses the Pattern class. Test
* only case sensitive/case insensitive case. All other regular
* expression cases are covered by Pattern class.
*/
-
+
// case insensitive
assertTrue("testMatches", criteria.matches("BALL_REQUEST"));
assertTrue("testMatches", criteria.matches("BALL_REPLY"));
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/load/AllTests.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/load/AllTests.java
index 0c4ff39821..e4e52dc522 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/load/AllTests.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/load/AllTests.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -14,10 +14,16 @@ package org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.load;
import junit.framework.Test;
import junit.framework.TestSuite;
+/**
+ * Test suite for testing loader manager of UML2SD extension point.
+ */
public class AllTests {
+ /**
+ * @return the test suite.
+ */
public static Test suite() {
-
+
TestSuite suite = new TestSuite(AllTests.class.getName());
//$JUnit-BEGIN$
suite.addTestSuite(LoadersManagerTest.class);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/load/LoadersManagerTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/load/LoadersManagerTest.java
index 70905c0dc0..9edffd403b 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/load/LoadersManagerTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/load/LoadersManagerTest.java
@@ -20,6 +20,9 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.LoadersManager;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
+/**
+ * Test cases class to test loader manager of UML2SD extension point.
+ */
public class LoadersManagerTest extends TestCase {
private final static String SDVIEW_WITH_ONE_LOADER = "org.eclipse.linuxtools.tmf.ui.tests.testSDView1Loader"; //$NON-NLS-1$
@@ -40,6 +43,9 @@ public class LoadersManagerTest extends TestCase {
super.tearDown();
}
+ /**
+ * Tests of loader manager singleton class.
+ */
@SuppressWarnings("nls")
public void testLoaderManager() {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/AllTests.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/AllTests.java
index b50a38f049..4283bf75b7 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/AllTests.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/AllTests.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -14,8 +14,15 @@ package org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.loader;
import junit.framework.Test;
import junit.framework.TestSuite;
+/**
+ * Test suite for testing the TmfUml2SDSyncLoader class.
+ * @author Bernd Hufmann
+ */
public class AllTests {
+ /**
+ * @return the test suite.
+ */
public static Test suite() {
TestSuite suite = new TestSuite(AllTests.class.getName());
//$JUnit-BEGIN$
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/IUml2SDTestConstants.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/IUml2SDTestConstants.java
index f13fe60c81..7e178c735c 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/IUml2SDTestConstants.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/IUml2SDTestConstants.java
@@ -1,39 +1,79 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.loader;
/**
- * Common constants for the TMF UML2SD test cases
+ * Common constants for the TMF UML2SD test cases
+ * @author Bernd Hufmann
*/
@SuppressWarnings("nls")
public interface IUml2SDTestConstants {
-
- final static public int WAIT_FOR_JOBS_DELAY = 1000;
+
+ /**
+ * Timeout for waiting of jobs to finish (in milliseconds).
+ */
+ final static public int WAIT_FOR_JOBS_DELAY = 1000;
+ /**
+ * Timeout for waiting for GUI display to refresh (in milliseconds).
+ */
final static public int GUI_REFESH_DELAY = 1000;
+ /**
+ * Initial delay before indexing (in milliseconds).
+ */
final static public int INITIAL_INDEX_DELAY = 1000;
+ /**
+ * Delay after broadcasting a TMF signal (in milliseconds)
+ */
final static public int BROADCAST_DELAY = 2000;
-
+ /**
+ * Total number of pages of test trace.
+ */
final static public int TOTAL_NUMBER_OF_PAGES = 9;
+ /**
+ * Number of messages per page (as defined for loader class)
+ */
final static public int MAX_MESSEAGES_PER_PAGE = 10000;
+ /**
+ * Number of messages of last page of the test trace.
+ */
final static public int NUM_MESSAGES_OF_LAST_PAGE = 32;
-
+ /**
+ * Default number of lifelines of test trace.
+ */
final static public int DEFAULT_NUM_LIFELINES = 2;
+ /**
+ * Number of lifelines of test trace when all lifelines are visible.
+ */
final static public int NUM_OF_ALL_LIFELINES = 3;
+ /**
+ * Page number of test trace where all lifelines are visible.
+ */
final static public int PAGE_OF_ALL_LIFELINES = 4;
-
+ /**
+ * Time scale of test trace.
+ */
final static public byte TIME_SCALE = -9;
-
+
+ /**
+ * Master player name (property of test trace)
+ */
final static public String MASTER_PLAYER_NAME = "Master";
+ /**
+ * First player name (property of test trace)
+ */
final static public String FIRST_PLAYER_NAME = "player1";
+ /**
+ * Second player name (property of test trace)
+ */
final static public String SECOND_PLAYER_NAME = "player2";
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/IUml2SdSignalValidator.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/IUml2SdSignalValidator.java
index 2b76e2e26f..9032afa9fd 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/IUml2SdSignalValidator.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/IUml2SdSignalValidator.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -15,31 +15,89 @@ import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
/**
- * Interface for testing signal handling within TmfUml2SD
+ * Interface for testing signal handling within TmfUml2SD
+ *
+ * @author Bernd Hufmann
*/
public interface IUml2SdSignalValidator {
+ /**
+ * @return if signal is received or not
+ */
public boolean isSignalReceived();
+ /**
+ * Sets signal received value
+ * @param received boolean value to set
+ */
public void setSignalReceived(boolean received);
-
+
+ /**
+ * @return whether source of signal is correct or not
+ */
public boolean isSourceError();
+ /**
+ * Sets the source error flag.
+ * @param fIsSourceError boolean value to set
+ */
public void setSourceError(boolean fIsSourceError);
+ /**
+ * @return whether received current time is correct or not
+ */
public boolean isCurrentTimeError();
+ /**
+ * Sets the current time error flag.
+ * @param fIsCurrentTimeError boolean value to set
+ */
public void setCurrentTimeError(boolean fIsCurrentTimeError);
+ /**
+ * @return whether received range is correct or not
+ */
public boolean isRangeError();
+ /**
+ * Sets the range error flag.
+ * @param fIsRangeError boolean value to set
+ */
public void setRangeError(boolean fIsRangeError);
-
+
+ /**
+ * @return whether signal was received or not
+ */
public boolean isSignalError();
+ /**
+ * Sets signal error flag.
+ * @param fIsSignalError boolean value to set
+ */
public void setSignalError(boolean fIsSignalError);
-
+
+ /**
+ * @return source of expected signal.
+ */
public Object getSource();
+ /**
+ * Sets source of expected signal
+ * @param source expected source component
+ */
public void setSource(Object source);
-
+
+ /**
+ * @return the expected current time.
+ */
public TmfTimestamp getCurrentTime();
+ /**
+ * Sets the expected current time
+ * @param currentTime Time to set
+ */
public void setCurrentTime(TmfTimestamp currentTime);
-
+
+ /**
+ * @return the expected current time range.
+ */
public TmfTimeRange getCurrentRange();
+ /**
+ * Sets the expected current time range.
+ * @param currentRange the expected current time range to set
+ */
public void setCurrentRange(TmfTimeRange currentRange);
-
+
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderExpTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderExpTest.java
index 3f455c7407..328f92f005 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderExpTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderExpTest.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -24,6 +24,13 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDAdvancedP
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDPagingProvider;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.loader.TmfUml2SDSyncLoader;
+/**
+ * Test cases for Experiment handling.
+ *
+ * @author Bernd Hufmann
+ *
+ */
+@SuppressWarnings("nls")
public class TmfUml2SDSyncLoaderExpTest extends TestCase {
// ------------------------------------------------------------------------
@@ -37,16 +44,19 @@ public class TmfUml2SDSyncLoaderExpTest extends TestCase {
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new Uml2SDTestSetup(new TestSuite(TmfUml2SDSyncLoaderExpTest.class));
}
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ */
public TmfUml2SDSyncLoaderExpTest() {
}
@@ -68,13 +78,16 @@ public class TmfUml2SDSyncLoaderExpTest extends TestCase {
fFacility = null;
super.tearDown();
}
-
- @SuppressWarnings("nls")
+
+
+ /**
+ * Main method with test cases.
+ */
public void testExperimentHandling() {
/*
* Test Case: 001
- * Description: Verify setup
+ * Description: Verify setup
* Verified Methods: loader.getTitleString()
* view.getPartName()
* view.getFrame()
@@ -84,31 +97,31 @@ public class TmfUml2SDSyncLoaderExpTest extends TestCase {
assertEquals("getTitleString", "Component Interactions", fFacility.getLoader().getTitleString());
assertEquals("getPartName", "Sequence Diagram", fFacility.getSdView().getPartName());
assertNotNull("getFrame", fFacility.getSdView().getFrame());
-
+
fFacility.disposeExperiment();
-
+
fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
verifyPage(0, 0, false, false, 0);
-
+
/*
* Test Case: 002
- * Description: Verifies cancellation of ongoing indexing.
+ * Description: Verifies cancellation of ongoing indexing.
* Verified Methods: loader.experimentSelected(), loader.experimentDisposed(), loader.nextPage()
* Expected result: No exceptions during cancellation and nextPage() operation..
- *
- * Note this test is not sufficient to verify the concurrent access of the loader attributes
+ *
+ * Note this test is not sufficient to verify the concurrent access of the loader attributes
* by multiple threads. Contention might happen but it's not guaranteed.
*/
for(int i = 0; i < 5; i++) {
fFacility.selectExperiment(false);
fFacility.delay(IUml2SDTestConstants.INITIAL_INDEX_DELAY);
-
+
try {
fFacility.getExperiment().dispose();
fFacility.getLoader().nextPage(); // to test out of bounce
- // Note: To actually create an out of bound exception remove
- // safety-checks in nextPage/moveToPage of loader class
+ // Note: To actually create an out of bound exception remove
+ // safety-checks in nextPage/moveToPage of loader class
} catch (Exception e){
// No Exception expected
fail("exp.select/exp.dispose");
@@ -118,12 +131,12 @@ public class TmfUml2SDSyncLoaderExpTest extends TestCase {
/*
* Test Case: 003
* Description: Verifies disposed experiment.
- * Verified Methods: loader.nextPage(),
- * loader.pagesCount(), loader.hasNextPage(), loader.hasPrevPage(),
+ * Verified Methods: loader.nextPage(),
+ * loader.pagesCount(), loader.hasNextPage(), loader.hasPrevPage(),
* frame.syncMessagesCount, frame.lifeLinesCount
* Expected result: Page values and filter are reset.
- *
- * Note this test is not sufficient to verify the concurrent access ofthe loader attributes
+ *
+ * Note this test is not sufficient to verify the concurrent access ofthe loader attributes
* by multiple threads. Contention might happen but it's not guaranteed.
*/
@@ -131,15 +144,15 @@ public class TmfUml2SDSyncLoaderExpTest extends TestCase {
// verify that all enable filters are disabled after disposal
List<FilterCriteria> filter = FilterListDialog.getGlobalFilters();
-
+
for (FilterCriteria filterCriteria : filter) {
assertFalse("exp.dispose", filterCriteria.isActive());
}
-
+
/*
* Test Case: 004
- * Description: Verifies the disposal of the loader.
- * Verified Methods: loader.dispose(),
+ * Description: Verifies the disposal of the loader.
+ * Verified Methods: loader.dispose(),
* Expected result: All providers are removed from SDView.
*/
fFacility.getLoader().dispose();
@@ -148,33 +161,32 @@ public class TmfUml2SDSyncLoaderExpTest extends TestCase {
assertTrue("loader.dispose", fFacility.getSdView().getSDFilterProvider() == null);
assertTrue("loader.dispose", fFacility.getSdView().getExtendedFindProvider() == null);
assertTrue("loader.dispose", fFacility.getSdView().getExtendedFilterProvider() == null);
-
- // Set again loader as signal handler, which was removed by the the dispose above
- TmfSignalManager.register(fFacility.getLoader());
-
+
+ // Set again loader as signal handler, which was removed by the the dispose above
+ TmfSignalManager.register(fFacility.getLoader());
+
/*
* Test Case: 005
* Description: Verifies setViewer.
* Verified Methods: loader.setViewer
* Expected result: Paging, find and filter provider are set
*/
-
+
fFacility.getLoader().setViewer(fFacility.getSdView());
ISDPagingProvider pagingProvider = fFacility.getSdView().getSDPagingProvider();
assertTrue("loader.setViewer", pagingProvider != null);
assertTrue("loader.setViewer", pagingProvider instanceof ISDAdvancedPagingProvider);
assertTrue("loader.setViewer", pagingProvider instanceof TmfUml2SDSyncLoader);
-
+
assertTrue("loader.setViewer", fFacility.getSdView().getSDFindProvider() != null);
assertTrue("loader.setViewer", fFacility.getSdView().getSDFilterProvider() != null);
-
+
// All other providers are not used.
assertTrue("loader.setViewer", fFacility.getSdView().getExtendedFindProvider() == null);
assertTrue("loader.setViewer", fFacility.getSdView().getExtendedFilterProvider() == null);
}
- @SuppressWarnings("nls")
private void verifyPage(int currentPage, int numMsg, boolean hasNext, boolean hasPrev, int lifelineCount) {
assertEquals("currentPage", currentPage, fFacility.getLoader().currentPage());
assertEquals("syncMessageCount, ", numMsg, fFacility.getSdView().getFrame().syncMessageCount());
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderFilterTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderFilterTest.java
index 1ee5d9b63f..cbf737c3cb 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderFilterTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderFilterTest.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -24,6 +24,13 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.dialogs.Criteria;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.dialogs.FilterCriteria;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.loader.TmfSyncMessage;
+/**
+ * Filter test cases.
+ *
+ * @author Bernd Hufmann
+ *
+ */
+@SuppressWarnings("nls")
public class TmfUml2SDSyncLoaderFilterTest extends TestCase {
// ------------------------------------------------------------------------
@@ -33,11 +40,11 @@ public class TmfUml2SDSyncLoaderFilterTest extends TestCase {
// ------------------------------------------------------------------------
// Static methods
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new Uml2SDTestSetup(new TestSuite(TmfUml2SDSyncLoaderFilterTest.class));
@@ -46,6 +53,9 @@ public class TmfUml2SDSyncLoaderFilterTest extends TestCase {
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ */
public TmfUml2SDSyncLoaderFilterTest() {
}
@@ -66,8 +76,10 @@ public class TmfUml2SDSyncLoaderFilterTest extends TestCase {
fFacility = null;
super.tearDown();
}
-
- @SuppressWarnings("nls")
+
+ /**
+ * Main method with test cases.
+ */
public void testFilterHandling() {
// Create Filter Criteria
@@ -76,36 +88,36 @@ public class TmfUml2SDSyncLoaderFilterTest extends TestCase {
criteria.setLifeLineSelected(true);
criteria.setExpression(IUml2SDTestConstants.FIRST_PLAYER_NAME);
filterToSave.add(new FilterCriteria(criteria, true, false));
-
+
criteria = new Criteria();
criteria.setLifeLineSelected(true);
criteria.setExpression(IUml2SDTestConstants.MASTER_PLAYER_NAME);
filterToSave.add(new FilterCriteria(criteria, false, false));
-
+
criteria = new Criteria();
criteria.setSyncMessageSelected(true);
criteria.setExpression("BALL_.*"); //$NON-NLS-1$
filterToSave.add(new FilterCriteria(criteria, false, false));
-
+
/*
* Test Case: 001
- * Description: Verify the filter lifelines (1 out of 2 is hidden)
- * Verified Methods: loader.filter()
- * Expected result: Only one lifeline is visible with no messages
+ * Description: Verify the filter lifelines (1 out of 2 is hidden)
+ * Verified Methods: loader.filter()
+ * Expected result: Only one lifeline is visible with no messages
*/
fFacility.getLoader().filter(filterToSave);
fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
-
+
assertEquals("filter", 1, fFacility.getSdView().getFrame().lifeLinesCount());
assertEquals("filter", IUml2SDTestConstants.MASTER_PLAYER_NAME, fFacility.getSdView().getFrame().getLifeline(0).getName());
assertEquals("filter", 0, fFacility.getSdView().getFrame().syncMessageCount());
-
-
+
+
/*
* Test Case: 002
- * Description: Verify the filter lifelines (2 out of 2 are hidden)
+ * Description: Verify the filter lifelines (2 out of 2 are hidden)
* Verified Methods: loader.filter(), loader.fillCurrentPage()
- * Expected result: Neiter liflines nor messages are visible
+ * Expected result: Neiter liflines nor messages are visible
*/
filterToSave.get(1).setActive(true);
fFacility.getLoader().filter(filterToSave);
@@ -113,47 +125,47 @@ public class TmfUml2SDSyncLoaderFilterTest extends TestCase {
assertEquals("filter", 0, fFacility.getSdView().getFrame().lifeLinesCount());
assertEquals("filter", 0, fFacility.getSdView().getFrame().syncMessageCount());
-
+
/*
* Test Case: 003
- * Description: Verify removal of all filters
- * Verified Methods: loader.filter(), loader.fillCurrentPage()
- * Expected result: Everything is shown
+ * Description: Verify removal of all filters
+ * Verified Methods: loader.filter(), loader.fillCurrentPage()
+ * Expected result: Everything is shown
*/
filterToSave.get(0).setActive(false);
filterToSave.get(1).setActive(false);
fFacility.getLoader().filter(filterToSave);
fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
-
+
assertEquals("filter", 2, fFacility.getSdView().getFrame().lifeLinesCount());
assertEquals("filter", IUml2SDTestConstants.MAX_MESSEAGES_PER_PAGE, fFacility.getSdView().getFrame().syncMessageCount());
/*
* Test Case: 004
- * Description: Verify filter of messages
- * Verified Methods: loader.filter(), loader.fillCurrentPage()
+ * Description: Verify filter of messages
+ * Verified Methods: loader.filter(), loader.fillCurrentPage()
* Expected result: Only particular messages are shown
*/
filterToSave.get(2).setActive(true);
fFacility.getLoader().filter(filterToSave);
fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
-
+
assertEquals("filter", 2, fFacility.getSdView().getFrame().lifeLinesCount());
assertEquals("filter", 6, fFacility.getSdView().getFrame().syncMessageCount());
-
+
String messages[] = { "REGISTER_PLAYER_REQUEST", "REGISTER_PLAYER_REPLY", "GAME_REQUEST", "GAME_REPLY", "START_GAME_REQUEST", "START_GAME_REPLY" };
-
+
for (int i = 0; i < messages.length; i++) {
SyncMessage msg = fFacility.getSdView().getFrame().getSyncMessage(i);
assertTrue("filter", msg instanceof TmfSyncMessage);
assertEquals("filter", messages[i], msg.getName());
}
-
+
/*
* Test Case: 005
- * Description: Verify filter lifeline (1 out of three lifelines).
- * Note that filter was set during change of page.
- * Verified Methods: loader.filter(), loader.fillCurrentPage()
+ * Description: Verify filter lifeline (1 out of three lifelines).
+ * Note that filter was set during change of page.
+ * Verified Methods: loader.filter(), loader.fillCurrentPage()
* Expected result: Only 2 lifelines and their interactions are shown
*/
filterToSave.get(0).setActive(true);
@@ -162,14 +174,14 @@ public class TmfUml2SDSyncLoaderFilterTest extends TestCase {
assertEquals("filter", 2, fFacility.getSdView().getFrame().lifeLinesCount());
String lifelines[] = { IUml2SDTestConstants.MASTER_PLAYER_NAME, IUml2SDTestConstants.SECOND_PLAYER_NAME };
-
+
for (int i = 0; i < lifelines.length; i++) {
Lifeline line = fFacility.getSdView().getFrame().getLifeline(i);
assertEquals("filter", lifelines[i], line.getName());
}
-
+
assertTrue(fFacility.getSdView().getFrame().syncMessageCount() > 0);
-
+
filterToSave.get(2).setActive(false);
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderFindTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderFindTest.java
index 0356fb4e0f..dfa6816029 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderFindTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderFindTest.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -25,8 +25,13 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.dialogs.Criteria;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.provider.ISDGraphNodeSupporter;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.loader.TmfSyncMessage;
+/**
+ * Search Test Cases.
+ *
+ * @author Bernd Hufmann
+ */
public class TmfUml2SDSyncLoaderFindTest extends TestCase {
-
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
@@ -39,7 +44,7 @@ public class TmfUml2SDSyncLoaderFindTest extends TestCase {
final static private int TC_002_END_OCCURRANCE = TC_002_START_OCCURRANCE;
final static private String TC_002_START_LIFELINE = IUml2SDTestConstants.FIRST_PLAYER_NAME;
final static private String TC_002_END_LIFELINE = IUml2SDTestConstants.MASTER_PLAYER_NAME;
-
+
// Test case 003 expected values
final static private Uml2SDTestTimestamp TC_003_TIME_VALUE = new Uml2SDTestTimestamp(9788642113228L);
final static private String TC_003_MESSAGE_NAME = "GAME_REPLY"; //$NON-NLS-1$
@@ -48,16 +53,16 @@ public class TmfUml2SDSyncLoaderFindTest extends TestCase {
final static private int TC_003_END_OCCURRANCE = TC_003_START_OCCURRANCE;
final static private String TC_003_START_LIFELINE = IUml2SDTestConstants.MASTER_PLAYER_NAME;
final static private String TC_003_END_LIFELINE = IUml2SDTestConstants.FIRST_PLAYER_NAME;
-
+
// Test case 004 expected values
final static private Uml2SDTestTimestamp TC_004_TIME_VALUE = new Uml2SDTestTimestamp(9791893030834L);
final static private String TC_004_MESSAGE_NAME = "GAME_REQUEST"; //$NON-NLS-1$
final static private int TC_004_PAGE_VALUE = 4;
final static private int TC_004_START_OCCURRANCE = 19;
final static private int TC_004_END_OCCURRANCE = TC_004_START_OCCURRANCE;
- final static private String TC_004_START_LIFELINE = IUml2SDTestConstants.SECOND_PLAYER_NAME;
+ final static private String TC_004_START_LIFELINE = IUml2SDTestConstants.SECOND_PLAYER_NAME;
final static private String TC_004_END_LIFELINE = IUml2SDTestConstants.MASTER_PLAYER_NAME;
-
+
// Test case 005 expected values
final static private int TC_005_PAGE_VALUE = 0;
final static private String TC_005_LIFELINE_NAME = IUml2SDTestConstants.FIRST_PLAYER_NAME;
@@ -71,19 +76,22 @@ public class TmfUml2SDSyncLoaderFindTest extends TestCase {
// ------------------------------------------------------------------------
// Static methods
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new Uml2SDTestSetup(new TestSuite(TmfUml2SDSyncLoaderFindTest.class));
}
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ */
public TmfUml2SDSyncLoaderFindTest() {
}
@@ -103,14 +111,17 @@ public class TmfUml2SDSyncLoaderFindTest extends TestCase {
fFacility = null;
super.tearDown();
}
-
+
+ /**
+ * Main method with test cases.
+ */
@SuppressWarnings("nls")
public void testFindHandling() {
fTmfComponent = new Uml2SDSignalValidator();
/*
* Test Case: 001
- * Description: Verify the ISDGraphNodeSupporter implementation
+ * Description: Verify the ISDGraphNodeSupporter implementation
* Verified Methods: loader.isNodeSupported(), loader.getNodeName()
* Expected result: Correct values are returned, i.e. only lifelines and sync. messages are supported
*/
@@ -127,12 +138,12 @@ public class TmfUml2SDSyncLoaderFindTest extends TestCase {
assertEquals("getNodeName", "", fFacility.getLoader().getNodeName(ISDGraphNodeSupporter.ASYNCMESSAGE, null));
assertEquals("getNodeName", "", fFacility.getLoader().getNodeName(ISDGraphNodeSupporter.ASYNCMESSAGERETURN, null));
assertEquals("getNodeName", "", fFacility.getLoader().getNodeName(ISDGraphNodeSupporter.STOP, null));
-
+
fFacility.getLoader().cancel();
-
+
/*
* Test Case: 002
- * Description: Verify 1st message find within page
+ * Description: Verify 1st message find within page
* Verified Methods: loader.find(), loader.moveToMessage()
* Expected result: Correct message is selected
*/
@@ -145,9 +156,9 @@ public class TmfUml2SDSyncLoaderFindTest extends TestCase {
fTmfComponent.setCurrentTime(TC_002_TIME_VALUE);
fTmfComponent.setCurrentRange(null); // not used
fTmfComponent.setSignalReceived(false);
-
+
fFacility.getLoader().find(criteria);
- // Wait for the selection to finish - needed due to new platform behavior in Juno
+ // Wait for the selection to finish - needed due to new platform behavior in Juno
fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
assertTrue("find", fTmfComponent.isSignalReceived());
assertFalse("find", fTmfComponent.isSignalError());
@@ -166,10 +177,10 @@ public class TmfUml2SDSyncLoaderFindTest extends TestCase {
assertEquals("find", TC_002_END_OCCURRANCE, msg.getEndOccurrence());
assertEquals("find", TC_002_START_LIFELINE, msg.getStartLifeline().getName());
assertEquals("find", TC_002_END_LIFELINE, msg.getEndLifeline().getName());
-
+
/*
* Test Case: 003
- * Description: Verify 2nd message find within page
+ * Description: Verify 2nd message find within page
* Verified Methods: loader.find(), loader.moveToMessage()
* Expected result: Correct message is selected
*/
@@ -177,9 +188,9 @@ public class TmfUml2SDSyncLoaderFindTest extends TestCase {
fTmfComponent.setSource(fFacility.getLoader());
fTmfComponent.setCurrentTime(TC_003_TIME_VALUE);
fTmfComponent.setCurrentRange(null); // not used
-
+
fTmfComponent.setSignalReceived(false);
-
+
fFacility.getLoader().find(criteria);
// Wait for the selection to finish - needed due to new platform behavior in Juno
fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
@@ -203,7 +214,7 @@ public class TmfUml2SDSyncLoaderFindTest extends TestCase {
/*
* Test Case: 004
- * Description: Verify 1st message across page
+ * Description: Verify 1st message across page
* Verified Methods: loader.find(), loader.moveToPage(), loader.moveToMessage()
* Expected result: Correct message is selected
*/
@@ -211,9 +222,9 @@ public class TmfUml2SDSyncLoaderFindTest extends TestCase {
fTmfComponent.setSource(fFacility.getLoader());
fTmfComponent.setCurrentTime(TC_004_TIME_VALUE);
fTmfComponent.setCurrentRange(new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH)); // not used
-
+
fTmfComponent.setSignalReceived(false);
-
+
fFacility.getLoader().find(criteria);
fFacility.waitForJobs(); // find across pages uses a job
// to make sure pageRequest has been started before calling waitforCompletion()
@@ -242,14 +253,14 @@ public class TmfUml2SDSyncLoaderFindTest extends TestCase {
// cancel find and go back to first page
fFacility.getLoader().cancel();
fFacility.firstPage();
-
+
/*
* Test Case: 005
- * Description: Verify find of lifeline within page
+ * Description: Verify find of lifeline within page
* Verified Methods: loader.find(), loader.moveToPage(), loader.moveToMessage()
* Expected result: Correct message is selected
*/
- criteria = new Criteria();
+ criteria = new Criteria();
criteria.setLifeLineSelected(true);
criteria.setExpression(IUml2SDTestConstants.FIRST_PLAYER_NAME);
fFacility.getLoader().find(criteria);
@@ -263,24 +274,24 @@ public class TmfUml2SDSyncLoaderFindTest extends TestCase {
assertTrue(selection.get(0) instanceof Lifeline);
Lifeline lifeline = (Lifeline) selection.get(0);
assertEquals("find", TC_005_LIFELINE_NAME, lifeline.getName());
-
+
/*
* Test Case: 006
- * Description: Verify lifeline across page
+ * Description: Verify lifeline across page
* Verified Methods: loader.find(), loader.moveToPage(), loader.moveToMessage()
* Expected result: Correct message is selected
*/
- criteria = new Criteria();
+ criteria = new Criteria();
criteria.setLifeLineSelected(true);
criteria.setExpression(IUml2SDTestConstants.SECOND_PLAYER_NAME);
-
+
fFacility.getLoader().find(criteria);
fFacility.waitForJobs(); // find across pages uses a job
// to make sure pageRequest has been started before calling waitforCompletion()
- fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
+ fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
fFacility.getLoader().waitForCompletion();
fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
-
+
assertEquals("find", TC_006_PAGE_VALUE, fFacility.getLoader().currentPage());
selection = fFacility.getSdView().getSDWidget().getSelection();
assertNotNull(selection);
@@ -288,26 +299,26 @@ public class TmfUml2SDSyncLoaderFindTest extends TestCase {
assertTrue(selection.get(0) instanceof Lifeline);
lifeline = (Lifeline) selection.get(0);
assertEquals("find", TC_006_LIFELINE_NAME, lifeline.getName());
-
-
+
+
// cancel find and go back to first page
fFacility.getLoader().cancel();
fFacility.firstPage();
-
+
/*
* Test Case: 007
- * Description: Verify cancel ongoing search job
+ * Description: Verify cancel ongoing search job
* Verified Methods: loader.find(), loader.find()
* Expected result: Cancelled find
*/
- criteria = new Criteria();
+ criteria = new Criteria();
criteria.setLifeLineSelected(true);
criteria.setExpression(IUml2SDTestConstants.SECOND_PLAYER_NAME);
-
+
fFacility.getLoader().find(criteria);
fFacility.delay(200); // to make sure job was started
fFacility.getLoader().cancel();
-
+
assertEquals("find", 0, fFacility.getLoader().currentPage()); // we are still at the first page
fTmfComponent.dispose();
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderPagesTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderPagesTest.java
index 52bf224e3e..c9ef78bb49 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderPagesTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderPagesTest.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -15,6 +15,12 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+/**
+ * Test cases for pages handling.
+ *
+ * @author Bernd Hufmann
+ *
+ */
public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
// ------------------------------------------------------------------------
@@ -24,11 +30,11 @@ public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
// ------------------------------------------------------------------------
// Static methods
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new Uml2SDTestSetup(new TestSuite(TmfUml2SDSyncLoaderPagesTest.class));
@@ -37,6 +43,9 @@ public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ */
public TmfUml2SDSyncLoaderPagesTest() {
}
@@ -58,8 +67,11 @@ public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
super.tearDown();
}
+ /**
+ * Main method with test cases.
+ */
public void testPageHandling() {
-
+
verifyPagesCount();
verifyNextPage();
verifyPrevPage();
@@ -68,9 +80,9 @@ public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
verifyPageNumberChanged();
}
-
+
private void verifyPagesCount() {
-
+
/*
* Test Case: 001
* Description: Test number of pages.
@@ -79,19 +91,19 @@ public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
*/
assertEquals(IUml2SDTestConstants.TOTAL_NUMBER_OF_PAGES, fFacility.getLoader().pagesCount());
}
-
+
private void verifyNextPage() {
// assuming we are at the first page
/*
* Test Case: 002
* Description: Tests next page feature.
- * Verified Methods: loader.nextPage(), loader.fillCurrentPage(), loader.pagesCount(),
- * loader.hasNextPage(), loader.hasPrevPage(),
- * frame.syncMessagesCount, frame.lifeLinesCount
+ * Verified Methods: loader.nextPage(), loader.fillCurrentPage(), loader.pagesCount(),
+ * loader.hasNextPage(), loader.hasPrevPage(),
+ * frame.syncMessagesCount, frame.lifeLinesCount
* Expected result: Expected values are return.
*/
-
+
for(int i = 0; i < IUml2SDTestConstants.TOTAL_NUMBER_OF_PAGES-2; i++) {
fFacility.nextPage();
@@ -102,7 +114,7 @@ public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
verifyPage(i+1, IUml2SDTestConstants.MAX_MESSEAGES_PER_PAGE, true, true);
}
}
-
+
// Last Page
fFacility.nextPage();
verifyPage(IUml2SDTestConstants.TOTAL_NUMBER_OF_PAGES - 1, IUml2SDTestConstants.NUM_MESSAGES_OF_LAST_PAGE, false, true);
@@ -113,7 +125,7 @@ public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
} catch (Exception e) {
fail();
}
-
+
fFacility.firstPage();
}
@@ -124,9 +136,9 @@ public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
/*
* Test Case: 003
* Description: Test previous page feature.
- * Verified Methods: loader.prevPage(), loader.fillCurrentPage(), loader.pagesCount(),
+ * Verified Methods: loader.prevPage(), loader.fillCurrentPage(), loader.pagesCount(),
* loader.hasNextPage(), loader.hasPrevPage(),
- * frame.syncMessagesCount, frame.lifeLinesCount
+ * frame.syncMessagesCount, frame.lifeLinesCount
* Expected result: Expected values are return.
*/
@@ -140,10 +152,11 @@ public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
for(int i = IUml2SDTestConstants.TOTAL_NUMBER_OF_PAGES-2; i > 0; i--) {
fFacility.prevPage();
- if (i == IUml2SDTestConstants.PAGE_OF_ALL_LIFELINES)
+ if (i == IUml2SDTestConstants.PAGE_OF_ALL_LIFELINES) {
verifyPage(i, IUml2SDTestConstants.MAX_MESSEAGES_PER_PAGE, true, true, IUml2SDTestConstants.NUM_OF_ALL_LIFELINES);
- else
+ } else {
verifyPage(i, IUml2SDTestConstants.MAX_MESSEAGES_PER_PAGE, true, true);
+ }
}
fFacility.prevPage();
@@ -162,12 +175,12 @@ public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
/*
* Test Case: 004
* Description: Test first page feature.
- * Verified Methods: loader.firstPage(), loader.fillCurrentPage(), loader.pagesCount(),
+ * Verified Methods: loader.firstPage(), loader.fillCurrentPage(), loader.pagesCount(),
* loader.hasNextPage(), loader.hasPrevPage(),
- * frame.syncMessagesCount, frame.lifeLinesCount
+ * frame.syncMessagesCount, frame.lifeLinesCount
* Expected result: Expected values are return.
*/
-
+
// First Page
fFacility.firstPage();
verifyPage(0, IUml2SDTestConstants.MAX_MESSEAGES_PER_PAGE, true, false);
@@ -179,7 +192,7 @@ public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
* Test Case: 005
* Description: Test last page feature.
* Verified Methods: loader.lastPage(), loader.pagesCount(), loader.hasNextPage(), loader.hasPrevPage()
- * frame.syncMessagesCount, frame.lifeLinesCount
+ * frame.syncMessagesCount, frame.lifeLinesCount
* Expected result: Expected values are return.
*/
fFacility.lastPage();
@@ -188,13 +201,13 @@ public class TmfUml2SDSyncLoaderPagesTest extends TestCase {
}
private void verifyPageNumberChanged() {
-
+
/*
* Test Case: 006
* Description: Test move to any page feature.
- * Verified Methods: loader.pageNumberChanged(), loader.fillCurrentPage(), loader.pagesCount(),
+ * Verified Methods: loader.pageNumberChanged(), loader.fillCurrentPage(), loader.pagesCount(),
* loader.hasNextPage(), loader.hasPrevPage(),
- * frame.syncMessagesCount, frame.lifeLinesCount
+ * frame.syncMessagesCount, frame.lifeLinesCount
* Expected result: Expected values are return.
*/
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderSignalTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderSignalTest.java
index c19fab97bd..c1c0b95388 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderSignalTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderSignalTest.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -20,6 +20,12 @@ import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
+/**
+ * Test cases for signal handling.
+ *
+ * @author Bernd Hufmann
+ *
+ */
public class TmfUml2SDSyncLoaderSignalTest extends TestCase {
// ------------------------------------------------------------------------
@@ -30,19 +36,22 @@ public class TmfUml2SDSyncLoaderSignalTest extends TestCase {
// ------------------------------------------------------------------------
// Static methods
- // ------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new Uml2SDTestSetup(new TestSuite(TmfUml2SDSyncLoaderSignalTest.class));
}
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ */
public TmfUml2SDSyncLoaderSignalTest() {
}
@@ -62,10 +71,13 @@ public class TmfUml2SDSyncLoaderSignalTest extends TestCase {
fFacility = null;
super.tearDown();
}
-
+
+ /**
+ * Main method with test cases.
+ */
@SuppressWarnings("nls")
public void testSignalHandling() {
-
+
TmfTimeRange range = new TmfTimeRange(new Uml2SDTestTimestamp(9789689220871L), new Uml2SDTestTimestamp(9789773881426L));
// Get range window for tests below
TmfTimestamp rangeWindow = (TmfTimestamp) range.getEndTime().getDelta(range.getStartTime());
@@ -78,13 +90,13 @@ public class TmfUml2SDSyncLoaderSignalTest extends TestCase {
/*
* Test Case: 001
- * Description: Verify that time range signal is send with correct values when going to first page
+ * Description: Verify that time range signal is send with correct values when going to first page
* Verified Methods: broadcast()
* Expected result: Time range sync signal is sent with correct range and current time.
*/
currentTime = new Uml2SDTestTimestamp(9788641608418L);
range = new TmfTimeRange(currentTime, new Uml2SDTestTimestamp(currentTime.getValue() + rangeWindow.getValue()));
-
+
fTmfComponent.setSignalError(false);
fTmfComponent.setSignalReceived(false);
fTmfComponent.setCurrentTimeError(false);
@@ -102,10 +114,10 @@ public class TmfUml2SDSyncLoaderSignalTest extends TestCase {
assertFalse("TmfRangeSynchSignal", fTmfComponent.isCurrentTimeError());
assertFalse("TmfRangeSynchSignal", fTmfComponent.isSourceError());
assertFalse("TmfRangeSynchSignal", fTmfComponent.isRangeError());
-
+
/*
* Test Case: 002
- * Description: Verify that time sync signal is sent correctly after selection
+ * Description: Verify that time sync signal is sent correctly after selection
* Verified Methods: loader.broadcast(), testSelectionChanged
* Expected result: Time sync signal is sent with correct current time.
*/
@@ -129,7 +141,7 @@ public class TmfUml2SDSyncLoaderSignalTest extends TestCase {
assertFalse("TmfTimeSynchSignal", fTmfComponent.isSourceError());
fTmfComponent.setSignalReceived(false);
-
+
fTmfComponent.dispose();
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderTimeTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderTimeTest.java
index 35555c1293..bae2f87658 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderTimeTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderTimeTest.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -24,6 +24,12 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.loader.TmfSyncMessage;
+/**
+ * Test cases for time synchronization handling.
+ *
+ * @author Bernd Hufmann
+ *
+ */
public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
// ------------------------------------------------------------------------
@@ -37,7 +43,7 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
final static private int TC_001_END_OCCURRANCE = TC_001_START_OCCURRANCE;
final static private String TC_001_START_LIFELINE = IUml2SDTestConstants.MASTER_PLAYER_NAME;
final static private String TC_001_END_LIFELINE = IUml2SDTestConstants.FIRST_PLAYER_NAME;
-
+
// Test case 002 expected values
final static private Uml2SDTestTimestamp TC_002_TIME_VALUE = new Uml2SDTestTimestamp(9789689830722L);
final static private String TC_002_MESSAGE_NAME = "PAUSE_GAME_REQUEST"; //$NON-NLS-1$
@@ -46,29 +52,29 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
final static private int TC_002_END_OCCURRANCE = TC_002_START_OCCURRANCE;
final static private String TC_002_START_LIFELINE = IUml2SDTestConstants.FIRST_PLAYER_NAME;
final static private String TC_002_END_LIFELINE = IUml2SDTestConstants.MASTER_PLAYER_NAME;
-
+
// Test case 003 expected values
final static private Uml2SDTestTimestamp TC_003_TIME_VALUE = new Uml2SDTestTimestamp(9790750000000L);
final static private int TC_003_PAGE_VALUE = 4;
// Test case 004 expected values
final static private int TC_004_PAGE_VALUE = 0;
-
+
// Test case 005 expected values
final static private int TC_005_PAGE_VALUE = IUml2SDTestConstants.TOTAL_NUMBER_OF_PAGES - 1;
-
+
// Test case 006 expected values
final static private Uml2SDTestTimestamp TC_006_TIME_VALUE = new Uml2SDTestTimestamp(9792420661655L);
final static private int TC_006_PAGE_VALUE = 4;
final static private int TC_006_START_OCCURRANCE = IUml2SDTestConstants.MAX_MESSEAGES_PER_PAGE;
final static private int TC_006_END_OCCURRANCE = TC_006_START_OCCURRANCE;
-
+
// Test case 007 expected values
final static private Uml2SDTestTimestamp TC_007_TIME_VALUE = new Uml2SDTestTimestamp(9792420756010L);
final static private int TC_007_PAGE_VALUE = 5;
final static private int TC_007_START_OCCURRANCE = 1;
final static private int TC_007_END_OCCURRANCE = TC_007_START_OCCURRANCE;
-
+
// Test case 008 expected values
final static private Uml2SDTestTimestamp TC_008_TIME_VALUE = new Uml2SDTestTimestamp(9788642228395L);
final static private int TC_008_PAGE_VALUE = 0;
@@ -80,7 +86,7 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
final static private int TC_009_PAGE_VALUE = 1;
final static private Uml2SDTestTimestamp TC_009_START_TIME_VALUE = TC_009_TIME_VALUE;
final static private Uml2SDTestTimestamp TC_009_END_TIME_VALUE = new Uml2SDTestTimestamp(9789773881426L);
-
+
private Uml2SDTestFacility fFacility;
// ------------------------------------------------------------------------
@@ -89,15 +95,18 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new Uml2SDTestSetup(new TestSuite(TmfUml2SDSyncLoaderTimeTest.class));
}
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ */
public TmfUml2SDSyncLoaderTimeTest() {
}
@@ -118,12 +127,15 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
fFacility = null;
super.tearDown();
}
-
+
+ /**
+ * Main method with test cases.
+ */
@SuppressWarnings("nls")
public void testTimeHandling() {
/*
* Test Case: 001
- * Description: Verify synchToTime (exact time in page), selection of message in page
+ * Description: Verify synchToTime (exact time in page), selection of message in page
* Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToMessageInPage()
* Expected result: Correct message is selected.
*/
@@ -142,10 +154,10 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
assertEquals("synchToTime", TC_001_END_OCCURRANCE, msg.getEndOccurrence());
assertEquals("synchToTime", TC_001_START_LIFELINE, msg.getStartLifeline().getName());
assertEquals("synchToTime", TC_001_END_LIFELINE, msg.getEndLifeline().getName());
-
+
/*
* Test Case: 002
- * Description: Verify synchToTime (exact time outside of page), selection of message in page
+ * Description: Verify synchToTime (exact time outside of page), selection of message in page
* Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage()
* Expected result: Correct message is selected.
*/
@@ -165,10 +177,10 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
assertEquals(TC_002_START_LIFELINE, msg.getStartLifeline().getName());
assertEquals(TC_002_END_LIFELINE, msg.getEndLifeline().getName());
-
+
/*
* Test Case: 003
- * Description: Verify synchToTime (timestamp doesn't exist in trace), no selection of message in page
+ * Description: Verify synchToTime (timestamp doesn't exist in trace), no selection of message in page
* Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage()
* Expected result: Move to correct page, currentTime is updated so that focus on the currentTime, but no selection.
*/
@@ -182,10 +194,10 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
selection = fFacility.getSdView().getSDWidget().getSelection();
assertNotNull("synchToTime", selection);
assertEquals("synchToTime", 0, selection.size());
-
+
/*
* Test Case: 004
- * Description: Verify synchToTime (timestamp < experiment time range start)
+ * Description: Verify synchToTime (timestamp < experiment time range start)
* Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage()
* Expected result: Move to first page, focus on the beginning of the page, but no selection.
*/
@@ -196,10 +208,10 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
selection = fFacility.getSdView().getSDWidget().getSelection();
assertNotNull("synchToTime", selection);
assertEquals("synchToTime", 0, selection.size());
-
+
/*
* Test Case: 005
- * Description: Verify synchToTime (timestamp > experiment time range end)
+ * Description: Verify synchToTime (timestamp > experiment time range end)
* Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage()
* Expected result: Move to last page, focus on the end of the page, but no selection.
*/
@@ -213,7 +225,7 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
/*
* Test Case: 006
- * Description: Verify synchToTime (timestamp of last message in page)
+ * Description: Verify synchToTime (timestamp of last message in page)
* Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage(), loader.moveToMessageInPage()
* Expected result: Move to correct page, selection of last message in page.
*/
@@ -227,10 +239,10 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
msg = (TmfSyncMessage) selection.get(0);
assertEquals("synchToTime", TC_006_START_OCCURRANCE, msg.getStartOccurrence());
assertEquals("synchToTime", TC_006_END_OCCURRANCE, msg.getEndOccurrence());
-
+
/*
* Test Case: 007
- * Description: Verify synchToTime (timestamp of first message in page)
+ * Description: Verify synchToTime (timestamp of first message in page)
* Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage()
* Expected result: Move to correct page, selection of last message in page.
*/
@@ -247,7 +259,7 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
/*
* Test Case: 008
- * Description: Verify time range signal (start, end time and current time are in same page)
+ * Description: Verify time range signal (start, end time and current time are in same page)
* Verified Methods: loader.synchToTimeRange(), loader.moveToMessage(), loader.moveToMessageInPage()
* Expected result: Move to correct page(=page of start time of range), set focus on start time of range, but no selection of message.
*/
@@ -264,10 +276,10 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
// We actually don't want something to be selected!!!
assertNotNull("synchToTimeRange", selection);
assertEquals("synchToTimeRange", 0, selection.size());
-
+
/*
* Test Case: 009
- * Description: Verify time range signal (start and end time are across 2 pages)
+ * Description: Verify time range signal (start and end time are across 2 pages)
* Verified Methods: loader.synchToTimeRange(), loader.moveToMessage(), loader.moveToPage()
* Expected result: Move to correct page (=page of start time of range), set focus on start time of range, but no selection of message.
*/
@@ -282,6 +294,6 @@ public class TmfUml2SDSyncLoaderTimeTest extends TestCase {
// We actually don't want something to be selected!!!
assertNotNull("synchToTimeRange", selection);
assertEquals("synchToTimeRange", 0, selection.size());
-
+
}
} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDSignalValidator.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDSignalValidator.java
index c35e6f28e2..dd83c3b66e 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDSignalValidator.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDSignalValidator.java
@@ -22,6 +22,8 @@ import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
/**
* Class to implement that certain signals are sent as well as are sent with correct content.
+ *
+ * @author Bernd Hufmann
*/
public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignalValidator {
@@ -42,12 +44,19 @@ public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignal
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ */
public Uml2SDSignalValidator() {
}
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
+ /**
+ * Signal handler for time synch signal.
+ * @param signal the signal to handle.
+ */
@TmfSignalHandler
public void synchToTime(TmfTimeSynchSignal signal) {
// Set results so that it can be validated in the test case
@@ -56,6 +65,10 @@ public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignal
setCurrentTimeError(!getCurrentTime().equals(signal.getCurrentTime()));
}
+ /**
+ * Signal handler for time range synch signal.
+ * @param signal the signal to handle.
+ */
@TmfSignalHandler
public void synchToTimeRange(TmfRangeSynchSignal signal) {
// Set results so that it can be validated in the test case
@@ -65,6 +78,10 @@ public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignal
setRangeError(!getCurrentRange().equals(signal.getCurrentRange()));
}
+ /**
+ * Signal handler for handling start synch signal.
+ * @param signal the signal to handle.
+ */
@TmfSignalHandler
public void startSynch(TmfStartSynchSignal signal) {
fSignalDepth++;
@@ -75,6 +92,10 @@ public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignal
setSignalError(fSignalDepth > 1);
}
+ /**
+ * Signal handler for handling end synch signal.
+ * @param signal the signal to handle.
+ */
@TmfSignalHandler
public void endSynch(TmfEndSynchSignal signal) {
fSignalDepth = fSignalDepth > 0 ? fSignalDepth - 1 : 0;
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestFacility.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestFacility.java
index 2821a55dca..ea19263650 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestFacility.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestFacility.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -44,6 +44,8 @@ import org.osgi.framework.FrameworkUtil;
/**
* Singleton class to facilitate the test cases. Creates UML2SD view and loader objects as well as provides
* utility methods for interacting with the loader/view.
+ *
+ * @author Bernd Hufmann
*/
public class Uml2SDTestFacility {
@@ -69,6 +71,9 @@ public class Uml2SDTestFacility {
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
+ /**
+ * @return the singleton instance.
+ */
public synchronized static Uml2SDTestFacility getInstance() {
if (fInstance == null) {
fInstance = new Uml2SDTestFacility();
@@ -157,7 +162,7 @@ public class Uml2SDTestFacility {
/**
* Sleeps current thread or GUI thread for a given time.
- * @param waitTimeMillis
+ * @param waitTimeMillis time in milliseconds to wait
*/
public void delay(final long waitTimeMillis) {
final Display display = Display.getCurrent();
@@ -268,7 +273,7 @@ public class Uml2SDTestFacility {
}
/**
- * @see org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.impl.selectExperiment(boolean)
+ * @see org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.loader.Uml2SDTestFacility#selectExperiment(boolean)
*/
public void selectExperiment() {
this.selectExperiment(true);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestSetup.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestSetup.java
index 4d85057fa3..d318b1659e 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestSetup.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestSetup.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -15,10 +15,14 @@ import junit.extensions.TestSetup;
import junit.framework.Test;
/**
- * Test setup class for one-time setUp() and tearDown() across test cases.
+ * Test setup class for one-time setUp() and tearDown() across test cases.
*/
public class Uml2SDTestSetup extends TestSetup {
+ /**
+ * Constructor
+ * @param test the test to use.
+ */
public Uml2SDTestSetup(Test test) {
super(test);
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestTimestamp.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestTimestamp.java
index 0484fde392..4f82fabeec 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestTimestamp.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestTimestamp.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -13,6 +13,12 @@ package org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.loader;
import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+/**
+ * Timestamp implementation for UML2SD test cases.
+ *
+ * @author Bernd Hufmann
+ *
+ */
public class Uml2SDTestTimestamp extends TmfTimestamp {
// ------------------------------------------------------------------------
// Attributes
@@ -22,6 +28,10 @@ public class Uml2SDTestTimestamp extends TmfTimestamp {
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ * @param value time as long value (nanoseconds)
+ */
public Uml2SDTestTimestamp(long value) {
super(value, IUml2SDTestConstants.TIME_SCALE);
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/tests/uml2sd/load/TestLoaders.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/tests/uml2sd/load/TestLoaders.java
index d399c88a76..6950636171 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/tests/uml2sd/load/TestLoaders.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/tests/uml2sd/load/TestLoaders.java
@@ -35,9 +35,10 @@ import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
-// Referenced classes of package org.eclipse.hyades.uml2sd.ztest:
-// OpenToolBox
-
+/**
+ * Test loader class.
+ */
+@SuppressWarnings("javadoc")
public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterProvider, ISDPagingProvider, ISelectionListener {
public SDView v;
@@ -52,6 +53,7 @@ public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterPro
this(""); //$NON-NLS-1$
}
+ @SuppressWarnings("unused")
public TestLoaders(String name) {
page = 1;
}
@@ -437,12 +439,12 @@ public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterPro
@SuppressWarnings("nls")
public Image getResourceImage(String _name) {
- ImageDescriptor img;
+ ImageDescriptor imgage;
try {
URL BASIC_URL = new URL("platform", "localhost", "plugin");
URL url = new URL(BASIC_URL, (new StringBuilder("plugin/org.eclipse.linuxtools.tmf.ui/icons/")).append(_name).toString());
- img = ImageDescriptor.createFromURL(url);
- return img.createImage();
+ imgage = ImageDescriptor.createFromURL(url);
+ return imgage.createImage();
} catch (Exception e) {
System.err.println(e);
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/tests/uml2sd/trace/TmfUml2SDTestTrace.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/tests/uml2sd/trace/TmfUml2SDTestTrace.java
index bdac6e010a..cef80258a8 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/tests/uml2sd/trace/TmfUml2SDTestTrace.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/tests/uml2sd/trace/TmfUml2SDTestTrace.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Bernd Hufmann - Initial API and implementation
*******************************************************************************/
@@ -26,23 +26,37 @@ import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
+/**
+ * Parser implementation for Uml2SD Test Traces.
+ *
+ */
public class TmfUml2SDTestTrace implements ITmfEventParser<TmfEvent> {
-
+
ITmfTrace<TmfEvent> fEventStream;
+ /**
+ * Default Constructor
+ */
public TmfUml2SDTestTrace() {
}
+ /**
+ * Constructor
+ * @param eventStream ITmfTrace implementation
+ */
public TmfUml2SDTestTrace(ITmfTrace<TmfEvent> eventStream) {
fEventStream = eventStream;
}
+ /**
+ * @param eventStream ITmfTrace implementation to set
+ */
public void setTrace(ITmfTrace<TmfEvent> eventStream) {
fEventStream = eventStream;
}
@Override
- @SuppressWarnings({ "unchecked", "nls" })
+ @SuppressWarnings({ "nls" })
public TmfEvent parseEvent(ITmfContext context) {
if (! (fEventStream instanceof TmfTraceStub)) {
return null;
@@ -55,8 +69,9 @@ public class TmfUml2SDTestTrace implements ITmfEventParser<TmfEvent> {
// name = name.substring(name.lastIndexOf('/') + 1);
long location = 0;
- if (context != null)
+ if (context != null) {
location = ((TmfLocation<Long>) (context.getLocation())).getLocation();
+ }
try {
stream.seek(location);
@@ -84,7 +99,7 @@ public class TmfUml2SDTestTrace implements ITmfEventParser<TmfEvent> {
fields[0] = new TmfEventField("sender", sender);
fields[1] = new TmfEventField("receiver", receiver);
fields[2] = new TmfEventField("signal", signal);
-
+
ITmfEventField tmfContent = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, content, fields);
TmfEvent tmfEvent = new TmfEvent(fEventStream, new TmfTimestamp(ts, -9), source, tmfEventType, tmfContent, reference);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/adaption/TsfImplProvider.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/adaption/TsfImplProvider.java
index 9c242682a1..2672ec0feb 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/adaption/TsfImplProvider.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/adaption/TsfImplProvider.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2009, 2010 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
*******************************************************************************/
@@ -18,6 +18,9 @@ import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.TimeGraphPresentationProv
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.test.stub.model.EventImpl;
+/**
+ * Time Graph Presentation Provider Stub.
+ */
@SuppressWarnings("nls")
public class TsfImplProvider extends TimeGraphPresentationProvider {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/EventImpl.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/EventImpl.java
index 6b5628593b..a557620b03 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/EventImpl.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/EventImpl.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2009, 2010 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
*******************************************************************************/
@@ -14,6 +14,10 @@ package org.eclipse.linuxtools.tmf.ui.widgets.timegraph.test.stub.model;
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
+/**
+ * ITimeEvent implementation for test purposes.
+ */
+@SuppressWarnings("javadoc")
public class EventImpl implements ITimeEvent {
// ========================================================================
// Data
@@ -22,9 +26,9 @@ public class EventImpl implements ITimeEvent {
private long time = 0;
private ITimeGraphEntry trace = null;
- private Type myType = Type.UNKNOWN;
- private long duration;
-
+ private Type myType = Type.UNKNOWN;
+ private long duration;
+
// ========================================================================
// Constructor
// ========================================================================
@@ -33,7 +37,7 @@ public class EventImpl implements ITimeEvent {
this.trace = trace;
this.myType = type;
}
-
+
// ========================================================================
// Methods
// ========================================================================
@@ -52,7 +56,7 @@ public class EventImpl implements ITimeEvent {
public void setTrace(ITimeGraphEntry trace) {
this.trace = trace;
}
-
+
@Override
public long getTime() {
return time;
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/TraceImpl.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/TraceImpl.java
index bbded10d3a..74e0c9fad2 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/TraceImpl.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/TraceImpl.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2009, 2010 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
*******************************************************************************/
@@ -17,7 +17,7 @@ import java.util.Vector;
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
-@SuppressWarnings("nls")
+@SuppressWarnings({"javadoc", "nls"})
public class TraceImpl implements ITimeGraphEntry {
// ========================================================================
// Data
@@ -89,7 +89,7 @@ public class TraceImpl implements ITimeGraphEntry {
}
@Override
- public Iterator<ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long maxDuration) {
+ public Iterator<ITimeEvent> getTimeEventsIterator(long aStartTime, long aStopTime, long maxDuration) {
return traceEvents.iterator();
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/TraceModelImplFactory.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/TraceModelImplFactory.java
index a1289ed4d0..b28d75b66b 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/TraceModelImplFactory.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/model/TraceModelImplFactory.java
@@ -13,7 +13,7 @@ package org.eclipse.linuxtools.tmf.ui.widgets.timegraph.test.stub.model;
import java.util.Date;
-@SuppressWarnings("nls")
+@SuppressWarnings({"javadoc", "nls"})
public class TraceModelImplFactory {
// ========================================================================
@@ -57,10 +57,10 @@ public class TraceModelImplFactory {
TraceImpl trace;
TraceImpl[] traceArr = new TraceImpl[number];
for (int i = 0; i < traceArr.length; i++) {
- int count = i%17;
+ int counter = i%17;
long sTime = i * (long) 1E6;
- trace = new TraceImpl(traceNames[count].name, sTime , sTime + 20000,
- traceNames[count].classNmme);
+ trace = new TraceImpl(traceNames[counter].name, sTime , sTime + 20000,
+ traceNames[counter].classNmme);
create5000Events(trace);
traceArr[i] = trace;
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/views/TsfTraceAnalysisView.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/views/TsfTraceAnalysisView.java
index a42c3dfc3d..6ef1b95ced 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/views/TsfTraceAnalysisView.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/views/TsfTraceAnalysisView.java
@@ -56,7 +56,7 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.DrillDownAdapter;
import org.eclipse.ui.part.ViewPart;
-@SuppressWarnings("nls")
+@SuppressWarnings({"javadoc", "nls"})
public class TsfTraceAnalysisView extends ViewPart implements
ITimeGraphSelectionListener, ITimeGraphTimeListener, ITimeGraphRangeListener {
@@ -122,7 +122,6 @@ public class TsfTraceAnalysisView extends ViewPart implements
}
@Override
- @SuppressWarnings("rawtypes")
public Object getAdapter(Class key) {
return null;
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java
index 082047942d..721abdc8ab 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java
@@ -1056,7 +1056,6 @@ public class SDView extends ViewPart {
* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class)
*/
- @SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Class adapter) {
Object obj = super.getAdapter(adapter);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java
index dbe4cdd09b..170f976d47 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/Frame.java
@@ -1091,7 +1091,7 @@ public class Frame extends BasicFrame {
if ((e.getStartOccurrence() < exec.fStartEventOccurrence) && (result == null)) {
result = e;
}
- if ((e.getStartOccurrence() < exec.fStartEventOccurrence) && (e.getStartOccurrence() >= result.getEndOccurrence())) {
+ if ((e.getStartOccurrence() < exec.fStartEventOccurrence) && (result != null) && (e.getStartOccurrence() >= result.getEndOccurrence())) {
result = e;
}
}
@@ -1122,7 +1122,7 @@ public class Frame extends BasicFrame {
if ((e.getStartOccurrence() > exec.fStartEventOccurrence) && (result == null)) {
result = e;
}
- if ((e.getStartOccurrence() > exec.fStartEventOccurrence) && (e.getStartOccurrence() <= result.getEndOccurrence())) {
+ if ((e.getStartOccurrence() > exec.fStartEventOccurrence) && (result != null) && (e.getStartOccurrence() <= result.getEndOccurrence())) {
result = e;
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java
index 95ae7b3e7e..7d8d5d49ab 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/core/GraphNode.java
@@ -167,7 +167,7 @@ public abstract class GraphNode {
fNodeList.add(nodeToAdd);
fNodes.put(nodeToAdd.getArrayId(), fNodeList);
fForwardNodes.put(nodeToAdd.getArrayId(), fNodeList);
- if (nodeToAdd.getBackComparator() != null) {
+ if ((bNodeList != null) && (nodeToAdd.getBackComparator() != null)) {
bNodeList.add(nodeToAdd);
fBackwardNodes.put(nodeToAdd.getArrayId(), bNodeList);
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/FilterListDialog.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/FilterListDialog.java
index 08bac589d6..934ce8f983 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/FilterListDialog.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/dialogs/FilterListDialog.java
@@ -386,11 +386,13 @@ public class FilterListDialog extends Dialog {
*
* @return the saved global filters
*/
+
public static List<FilterCriteria> getGlobalFilters() {
DialogSettings settings = (DialogSettings) Activator.getDefault().getDialogSettings().getSection(FILTERS_LIST_CRITERIA);
int i = 0;
DialogSettings section = null;
int size = 0;
+ List<FilterCriteria> globalFilters = new ArrayList<FilterCriteria>();
if (settings != null) {
try {
size = settings.getInt(FILTERS_LIST_SIZE);
@@ -399,16 +401,14 @@ public class FilterListDialog extends Dialog {
size = 0;
}
section = (DialogSettings) settings.getSection(FILTERS_LIST_CRITERIA + i);
- }
- List<FilterCriteria> globalFilters = new ArrayList<FilterCriteria>();
-
- while ((section != null) && (i < size)) {
- FilterCriteria criteria = new FilterCriteria();
- criteria.setCriteria(new Criteria());
- criteria.load(section);
- globalFilters.add(criteria);
- section = (DialogSettings) settings.getSection(FILTERS_LIST_CRITERIA + (++i));
+ while ((section != null) && (i < size)) {
+ FilterCriteria criteria = new FilterCriteria();
+ criteria.setCriteria(new Criteria());
+ criteria.load(section);
+ globalFilters.add(criteria);
+ section = (DialogSettings) settings.getSection(FILTERS_LIST_CRITERIA + (++i));
+ }
}
return globalFilters;
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/handlers/MoveToMessage.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/handlers/MoveToMessage.java
index 5c0ccea71f..60361dcd0a 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/handlers/MoveToMessage.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/handlers/MoveToMessage.java
@@ -1,13 +1,13 @@
/**********************************************************************
* Copyright (c) 2005, 2008 IBM Corporation and others.
* Copyright (c) 2011, 2012 Ericsson.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* IBM - Initial API and implementation
* Bernd Hufmann - Updated for TMF
**********************************************************************/
@@ -30,10 +30,10 @@ import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessageReturn;
/**
* Action Class implementation to move to selected message
- *
+ *
* @version 1.0
* @author sveyrier
- *
+ *
*/
public class MoveToMessage extends Action {
@@ -62,10 +62,10 @@ public class MoveToMessage extends Action {
public MoveToMessage() {
this(null);
}
-
+
/**
* Constructor
- *
+ *
* @param view a sequence diagram view reference
*/
public MoveToMessage(SDView view) {
@@ -99,7 +99,6 @@ public class MoveToMessage extends Action {
ISelectionProvider selProvider = sdWidget.getSelectionProvider();
ISelection sel = selProvider.getSelection();
Object selectedNode = null;
- @SuppressWarnings("unchecked")
Iterator<Object> it = ((StructuredSelection) sel).iterator();
while (it.hasNext()) {
Object node = it.next();
@@ -131,7 +130,7 @@ public class MoveToMessage extends Action {
/**
* Sets the active SD view.
- *
+ *
* @param view The SD view.
*/
public void setView(SDView view) {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
index d1aae15bc0..ca75216367 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
@@ -268,7 +268,6 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
*
* @param signal The experiment selected signal
*/
- @SuppressWarnings("unchecked")
@TmfSignalHandler
public void experimentSelected(TmfExperimentSelectedSignal<ITmfEvent> signal) {
@@ -470,7 +469,6 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
* (non-Javadoc)
* @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.load.IUml2SDLoader#setViewer(org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView)
*/
- @SuppressWarnings("unchecked")
@Override
public void setViewer(SDView viewer) {

Back to the top