DESCRIPTION

tmf: Rework test trace classes

Currently, test traces are accessed using array indices, which is simple
but scales very badly. It's also very confusing when writing a new trace
and wanting to decided which test trace to use.

Rework the test trace classes by replacing them with enum's that do the
same thing. Unfortunately, you cannot extend enums, so duplication of the
names is needed, but everything else is centralized in one place.

Change-Id: I6e598048531682428c1142c18d1760c21de5aeac
Signed-off-by: Braxton Mccarthy xxx@xxx.xxx


COMMENTS

author: Brenden Conley
date: 2013-09-04 22:00:26.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/3376/

-------------------------------------
author: Brenden Conley
date: 2013-09-04 22:03:29.000000000

Patch Set 1: Verified+1

Build Successful 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/3376/ : SUCCESS

-------------------------------------
author: Kaeden Tapia
date: 2013-09-10 17:08:37.000000000

Patch Set 1:

(2 comments)

Line:27, lttng/org.eclipse.linuxtools.ctf.core.tests/shared/org/eclipse/linuxtools/ctf/core/tests/shared/CtfTestTraces.java -> I think this should lose the plural and become CtfTestTrace since now it's instantiated and represents one trace.

Line:28, lttng/org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/CtfTmfTestTraces.java -> Drop plural? See other comment.

-------------------------------------
author: Ricky Reeves
date: 2013-09-10 17:49:21.000000000

Patch Set 1:

(1 comment)

Line:16, /COMMIT_MSG -> Could you use a maps (name to path and name to CtfTrace) instead?

-------------------------------------
author: Braxton Mccarthy
date: 2013-09-10 18:50:17.000000000

Patch Set 1:

(2 comments)

Line:16, /COMMIT_MSG -> Me and Marc-André went over several possibilities. This seems like the least bad of the bunch ;)

enum is a bit simpler than a statically-defined-and-filled Map. You also have the compile-time guarantee that you are asking for a valid trace (You don't type getTrace("krenel") and then wonder for hours why it doesn't work...)

The big question is whether to have a duplicate enum/map in CtfTmfTestTraces or not. If we re-use the values from CtfTestTraces, then all test cases have to import and depend on both files. If we duplicate, then test cases get all their information in one place.

So it's either more work when creating a new test case, or when adding a new test trace. Since we typically add new tests more often than new test trace (hopefully), we were leaning more towards this approach.

Line:27, lttng/org.eclipse.linuxtools.ctf.core.tests/shared/org/eclipse/linuxtools/ctf/core/tests/shared/CtfTestTraces.java -> True, it's always been confusing when typing CtfTestTraces.KERNEL... that should be only one trace!

-------------------------------------
author: Ricky Reeves
date: 2013-09-10 19:46:08.000000000

Patch Set 1:

(1 comment)

Line:16, /COMMIT_MSG -> Fine with me.

-------------------------------------
