use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.IDataEntry in project linuxtools by eclipse.
the class TestCreateSystemtapScript method createAndViewDummyData.
private static void createAndViewDummyData(String[] titles, Object[] data) {
if (data.length % titles.length != 0) {
throw new IllegalArgumentException("data.length must be a multiple of titles.length.");
}
final int numRows = data.length / titles.length;
IFilteredDataSet dataset = new FilteredRowDataSet(titles);
for (int i = 0; i < numRows; i++) {
IDataEntry dataEntry = new RowEntry();
Object[] values = new Object[titles.length];
for (int v = 0; v < titles.length; v++) {
values[v] = data[titles.length * i + v];
}
dataEntry.putRow(0, values);
dataset.setData(dataEntry);
}
final File dataFile;
try {
dataFile = File.createTempFile("testSet", ".set");
dataFile.deleteOnExit();
if (!dataset.writeToFile(dataFile)) {
throw new IOException();
}
} catch (IOException e) {
fail("Could not create dummy data set.");
return;
}
UIThreadRunnable.syncExec(() -> {
new ImportDataSetHandler().execute(dataFile.getPath());
});
String editorName = dataFile.getName().concat(" Graphs");
bot.waitUntil(new EditorIsActive(editorName));
}
use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.IDataEntry in project linuxtools by eclipse.
the class FilteredRowDataSetTest method testRemove.
@Test
public void testRemove() {
assertFalse(fdata.remove(null));
assertFalse(fdata.remove(new RowEntry()));
assertFalse(fdata.remove(-1));
assertFalse(fdata.remove(10));
assertEquals(2, fdata.getEntryCount());
IDataEntry entry = data.getEntry(0);
assertTrue(fdata.remove(entry));
assertEquals(1, fdata.getEntryCount());
assertFalse(fdata.remove(entry));
assertTrue(fdata.remove(0));
}
use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.IDataEntry in project linuxtools by eclipse.
the class RowParserTest method testParse.
@Test
public void testParse() {
assertNull(parser.parse(null));
assertNull(parser.parse(new StringBuilder("")));
assertNull(parser.parse(new StringBuilder("asdf")));
assertNull(parser.parse(new StringBuilder("1, ")));
assertNull(parser.parse(new StringBuilder("1, 3")));
IDataEntry entry = parser.parse(new StringBuilder("1, (2), 3, 4, 5"));
assertNotNull(entry);
assertEquals(2, entry.getColCount());
assertEquals(1, entry.getRowCount());
assertEquals("1", entry.getRow(0)[0]);
}
use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.IDataEntry in project linuxtools by eclipse.
the class TableEntryTest method testCopy.
@Test
public void testCopy() {
IDataEntry entry2 = entry.copy();
assertEquals(entry2.getRowCount(), entry.getRowCount());
assertEquals(entry2.getColCount(), entry.getColCount());
assertSame(entry2.getRow(0)[1], entry.getRow(0)[1]);
}
use of org.eclipse.linuxtools.systemtap.graphing.core.datasets.IDataEntry in project linuxtools by eclipse.
the class TableParserTest method testParse.
@Test
public void testParse() {
assertNull(parser.parse(null));
assertNull(parser.parse(new StringBuilder("")));
assertNull(parser.parse(new StringBuilder("asdf")));
assertNull(parser.parse(new StringBuilder("1, ")));
assertNull(parser.parse(new StringBuilder("1, 3")));
IDataEntry entry = parser.parse(new StringBuilder("1, (2), 3, 4, 5\n\n"));
assertNotNull(entry);
assertEquals(2, entry.getColCount());
assertEquals(2, entry.getRowCount());
assertEquals("1", entry.getRow(0)[0]);
}
Aggregations