Search in sources :

Example 11 with LamiTableEntry

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));
}
Also used : LamiTableEntryAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTableEntryAspect) LamiTimestampAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTimestampAspect) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) Test(org.junit.Test)

Example 12 with LamiTableEntry

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));
}
Also used : LamiTableEntryAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTableEntryAspect) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) LamiTimeRangeBeginAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTimeRangeBeginAspect) Test(org.junit.Test)

Example 13 with LamiTableEntry

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);
}
Also used : JSONObject(org.json.JSONObject) LamiData(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiData) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) ArrayList(java.util.ArrayList) JSONObject(org.json.JSONObject) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 14 with LamiTableEntry

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));
}
Also used : LamiTableEntryAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTableEntryAspect) LamiTimeRangeEndAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTimeRangeEndAspect) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) Test(org.junit.Test)

Example 15 with LamiTableEntry

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));
}
Also used : LamiTimeRangeDurationAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTimeRangeDurationAspect) LamiTableEntryAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTableEntryAspect) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) Test(org.junit.Test)

Aggregations

LamiTableEntry (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry)21 LamiTableEntryAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTableEntryAspect)15 Test (org.junit.Test)15 TableViewer (org.eclipse.jface.viewers.TableViewer)3 HashSet (java.util.HashSet)2 Nullable (org.eclipse.jdt.annotation.Nullable)2 LamiResultTable (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiResultTable)2 LamiData (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiData)2 LamiTimeRange (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiTimeRange)2 OutputStream (java.io.OutputStream)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Set (java.util.Set)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 NonNull (org.eclipse.jdt.annotation.NonNull)1 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 SWT (org.eclipse.swt.SWT)1