use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry in project tracecompass by tracecompass.
the class LamiAspectTest method lamiTimestampAspectTest.
/**
* Test the timestamp aspect
*
* @throws JSONException
* won't happen
*/
@Test
public void lamiTimestampAspectTest() throws JSONException {
LamiTableEntryAspect aspect = new LamiTimestampAspect(ASPECT_NAME, 0);
LamiTableEntry entry1 = createLamiData(1);
LamiTableEntry entry2 = createLamiData(2);
assertEquals(ASPECT_NAME, aspect.getLabel());
assertEquals(ASPECT_NAME, aspect.getName());
assertEquals(0, aspect.getComparator().compare(entry1, entry2));
assertNull(aspect.resolveString(entry1));
assertNull(aspect.resolveNumber(entry1));
}
use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry in project tracecompass by tracecompass.
the class LamiAspectTest method lamiTimeRangeBeginAspectTest.
/**
* Test the time range begin aspect
*
* @throws JSONException
* won't happen
*/
@Test
public void lamiTimeRangeBeginAspectTest() throws JSONException {
LamiTableEntryAspect aspect = new LamiTimeRangeBeginAspect(ASPECT_NAME, 5);
LamiTableEntry entry1 = createLamiData(1);
LamiTableEntry entry2 = createLamiData(2);
assertEquals(ASPECT_NAME + " (begin)", aspect.getLabel());
assertEquals(ASPECT_NAME + " (begin)", aspect.getName());
assertEquals(-1, aspect.getComparator().compare(entry1, entry2));
String timeRangeString = aspect.resolveString(entry1);
assertNotNull(timeRangeString);
timeRangeString = timeRangeString.substring(timeRangeString.indexOf(".") + 1, timeRangeString.length());
assertEquals("000 000 001", timeRangeString);
assertEquals(1L, aspect.resolveNumber(entry1));
}
use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry in project tracecompass by tracecompass.
the class LamiAspectTest method createLamiData.
@NonNull
private static LamiTableEntry createLamiData(int i) throws JSONException {
List<@NonNull LamiData> data = new ArrayList<>();
Object nullObject = JSONObject.NULL;
assertNotNull(nullObject);
data.add(LamiData.createFromObject(nullObject));
data.add(LamiData.createFromObject(i % 2 == 1 ? "hot" : "cold"));
Boolean boolValue = Boolean.valueOf(i % 2 == 1);
assertNotNull(boolValue);
data.add(LamiData.createFromObject(boolValue));
Integer intValue = Integer.valueOf(i);
assertNotNull(intValue);
data.add(LamiData.createFromObject(intValue));
Double doubleValue = Double.valueOf(i);
assertNotNull(doubleValue);
data.add(LamiData.createFromObject(doubleValue));
/* note, this is x10 + 2, this is deliberate. */
String timerangeString = "{\n" + " \"begin\": " + i + ",\n" + " \"class\": \"time-range\",\n" + " \"end\": " + i + 2 + "\n" + "}";
data.add(LamiData.createFromObject(new JSONObject(timerangeString)));
return new LamiTableEntry(data);
}
use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry in project tracecompass by tracecompass.
the class LamiAspectTest method lamiTimeRangeEndAspectTest.
/**
* Test the time range end aspect
*
* @throws JSONException
* won't happen
*/
@Test
public void lamiTimeRangeEndAspectTest() throws JSONException {
LamiTableEntryAspect aspect = new LamiTimeRangeEndAspect(ASPECT_NAME, 5);
LamiTableEntry entry1 = createLamiData(1);
LamiTableEntry entry2 = createLamiData(2);
assertEquals(ASPECT_NAME + " (end)", aspect.getLabel());
assertEquals(ASPECT_NAME + " (end)", aspect.getName());
assertEquals(-1, aspect.getComparator().compare(entry1, entry2));
String timeRangeString = aspect.resolveString(entry1);
assertNotNull(timeRangeString);
timeRangeString = timeRangeString.substring(timeRangeString.indexOf(".") + 1, timeRangeString.length());
assertEquals("000 000 012", timeRangeString);
assertEquals(12L, aspect.resolveNumber(entry1));
}
use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry in project tracecompass by tracecompass.
the class LamiAspectTest method lamiTimeRangeDurationAspectTest.
/**
* Test the time range duration aspect
*
* @throws JSONException
* won't happen
*/
@Test
public void lamiTimeRangeDurationAspectTest() throws JSONException {
LamiTableEntryAspect aspect = new LamiTimeRangeDurationAspect(ASPECT_NAME, 5);
LamiTableEntry entry1 = createLamiData(1);
LamiTableEntry entry2 = createLamiData(2);
assertEquals(ASPECT_NAME + " (duration) (ns)", aspect.getLabel());
assertEquals(ASPECT_NAME + " (duration)", aspect.getName());
assertEquals(-1, aspect.getComparator().compare(entry1, entry2));
String timeRangeString = aspect.resolveString(entry1);
assertNotNull(timeRangeString);
assertEquals("11", timeRangeString);
assertEquals(11L, aspect.resolveNumber(entry1));
}
Aggregations