Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Chouinard2012-04-19 22:14:00 +0000
committerFrancois Chouinard2012-04-19 22:14:00 +0000
commit158958cd00ae29696057beb52cfe42b731f41ab5 (patch)
tree1525c76be9b8971d6cdf2d9a347855276edfc078 /lttng/org.eclipse.linuxtools.tmf.ui.tests
parentf6de7355226acbadca75758ea427e3848278090e (diff)
downloadorg.eclipse.linuxtools-158958cd00ae29696057beb52cfe42b731f41ab5.tar.gz
org.eclipse.linuxtools-158958cd00ae29696057beb52cfe42b731f41ab5.tar.xz
org.eclipse.linuxtools-158958cd00ae29696057beb52cfe42b731f41ab5.zip
Refactor TmfTrace and dependencies - introduce ITmfTraceIndexer
Diffstat (limited to 'lttng/org.eclipse.linuxtools.tmf.ui.tests')
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/META-INF/MANIFEST.MF1
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/impl/Uml2SDTestFacility.java102
2 files changed, 52 insertions, 51 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/META-INF/MANIFEST.MF b/lttng/org.eclipse.linuxtools.tmf.ui.tests/META-INF/MANIFEST.MF
index 2b4a9cef4b..a503ce17d1 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/META-INF/MANIFEST.MF
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/META-INF/MANIFEST.MF
@@ -10,6 +10,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.junit;bundle-version="3.8.2",
org.eclipse.ui;bundle-version="3.7.0",
org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.core.resources;bundle-version="3.7.100",
org.eclipse.linuxtools.tmf.core;bundle-version="0.4.0",
org.eclipse.linuxtools.tmf.ui;bundle-version="0.4.0",
org.eclipse.linuxtools.tmf.core.tests;bundle-version="0.4.0"
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/impl/Uml2SDTestFacility.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/impl/Uml2SDTestFacility.java
index 2c1637f8d9..f5f254677f 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/impl/Uml2SDTestFacility.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/impl/Uml2SDTestFacility.java
@@ -42,23 +42,23 @@ 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.
+ * utility methods for interacting with the loader/view.
*/
public class Uml2SDTestFacility {
-
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
private static Uml2SDTestFacility fInstance = null;
-
+
private TmfUml2SDSyncLoader fLoader;
private SDView fSdView;
private TmfTraceStub fTrace = null;
private TmfUml2SDTestTrace fParser = null;
private TmfExperiment<TmfEvent> fExperiment = null;
-
+
private boolean fIsInitialized = false;
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
@@ -80,12 +80,12 @@ public class Uml2SDTestFacility {
* Initial the test facility.
*/
public void init() {
-
+
if (!fIsInitialized) {
fParser = new TmfUml2SDTestTrace();
fTrace = setupTrace(fParser);
-
+
IViewPart view;
try {
// Remove welcome view to avoid interference during test execution
@@ -93,19 +93,19 @@ public class Uml2SDTestFacility {
.getActiveWorkbenchWindow()
.getActivePage()
.findView("org.eclipse.ui.internal.introview"); //$NON-NLS-1$
-
+
if (view != null) {
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
- .getActivePage().hideView(view);
+ .getActivePage().hideView(view);
}
-
+
view = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getActivePage()
- .showView("org.eclipse.linuxtools.tmf.ui.tmfUml2SDSyncView"); //$NON-NLS-1$
-
- } catch (PartInitException e) {
+ .getActiveWorkbenchWindow()
+ .getActivePage()
+ .showView("org.eclipse.linuxtools.tmf.ui.tmfUml2SDSyncView"); //$NON-NLS-1$
+
+ } catch (final PartInitException e) {
throw new RuntimeException(e);
}
@@ -118,23 +118,23 @@ public class Uml2SDTestFacility {
}
}
-
- private TmfTraceStub setupTrace(ITmfEventParser<TmfEvent> parser) {
-
- try {
- // Create test trace object
- URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path("tracesets/sdEvents"), null); //$NON-NLS-1$
- File test = new File(FileLocator.toFileURL(location).toURI());
- return new TmfTraceStub(test.getPath(), 500, true, parser);
- } catch (URISyntaxException e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- } catch (IOException e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
+
+ private TmfTraceStub setupTrace(final ITmfEventParser<TmfEvent> parser) {
+
+ try {
+ // Create test trace object
+ final URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path("tracesets/sdEvents"), null); //$NON-NLS-1$
+ final File test = new File(FileLocator.toFileURL(location).toURI());
+ return new TmfTraceStub(test.getPath(), 500, true, parser, null);
+ } catch (final URISyntaxException e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ } catch (final IOException e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
}
-
+
/**
* Dispose the resource
*/
@@ -149,15 +149,15 @@ public class Uml2SDTestFacility {
fIsInitialized = false;
}
}
-
+
/**
- * Sleeps current thread or GUI thread for a given time.
+ * Sleeps current thread or GUI thread for a given time.
* @param waitTimeMillis
*/
- public void delay(long waitTimeMillis) {
- Display display = Display.getCurrent();
+ public void delay(final long waitTimeMillis) {
+ final Display display = Display.getCurrent();
if (display != null) {
- long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
+ final long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
while(System.currentTimeMillis() < endTimeMillis) {
if (!display.readAndDispatch()) {
display.sleep();
@@ -167,7 +167,7 @@ public class Uml2SDTestFacility {
} else {
try {
Thread.sleep(waitTimeMillis);
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
// Ignored
}
}
@@ -216,7 +216,7 @@ public class Uml2SDTestFacility {
public TmfExperiment<TmfEvent> getExperiment() {
return fExperiment;
}
-
+
/**
* Go to next page;
*/
@@ -234,7 +234,7 @@ public class Uml2SDTestFacility {
fLoader.waitForCompletion();
delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
}
-
+
/**
* Go to last page.
*/
@@ -252,32 +252,32 @@ public class Uml2SDTestFacility {
fLoader.waitForCompletion();
delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
}
-
+
/**
* @param page number to set
*/
- public void setPage(int page) {
+ public void setPage(final int page) {
fLoader.pageNumberChanged(page);;
fLoader.waitForCompletion();
delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
}
-
+
/**
* @see org.eclipse.linuxtools.tmf.ui.tests.views.uml2sd.impl.selectExperiment(boolean)
*/
public void selectExperiment() {
this.selectExperiment(true);
}
-
+
/**
- * Selects the experiment.
+ * Selects the experiment.
* @param wait true to wait for indexing to finish else false
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
- public void selectExperiment(boolean wait) {
+ public void selectExperiment(final boolean wait) {
fTrace = setupTrace(fParser);
- ITmfTrace traces[] = new ITmfTrace[1];
+ final ITmfTrace traces[] = new ITmfTrace[1];
traces[0] = fTrace;
fExperiment = new TmfExperiment<TmfEvent>(TmfEvent.class, "TestExperiment", traces); //$NON-NLS-1$
fTrace.broadcast(new TmfExperimentSelectedSignal<TmfEvent>(this, fExperiment));
@@ -289,7 +289,7 @@ public class Uml2SDTestFacility {
delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
}
}
-
+
/**
* Disposes the experiment.
*/
@@ -297,18 +297,18 @@ public class Uml2SDTestFacility {
fExperiment.dispose();
delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
}
-
+
/**
- * Creates some global filter criteria and saves them to disk.
+ * Creates some global filter criteria and saves them to disk.
*/
public void createFilterCriteria() {
// Create Filter Criteria and save tme
- List<FilterCriteria> filterToSave = new ArrayList<FilterCriteria>();
+ final List<FilterCriteria> filterToSave = new ArrayList<FilterCriteria>();
Criteria criteria = new Criteria();
criteria.setLifeLineSelected(true);
criteria.setExpression(IUml2SDTestConstants.FIRST_PLAYER_NAME);
filterToSave.add(new FilterCriteria(criteria, true, false));
-
+
criteria = new Criteria();
criteria.setSyncMessageSelected(true);
criteria.setExpression("BALL_.*"); //$NON-NLS-1$

Back to the top