* <p>
* Test suite for the TmfTrace class.
*/
+@SuppressWarnings("nls")
public class TmfTraceTest extends TestCase {
// ------------------------------------------------------------------------
// Dummy request to force the trace indexing
TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class) {
@Override
- public void handleData() {
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
}
};
fTrace.sendRequest(request);
assertEquals("getType", TmfEvent.class, trace.getType());
assertEquals("getPath", testfile.getPath(), trace.getPath());
assertEquals("getName", TEST_STREAM, trace.getName());
- assertEquals("getCacheSize", TmfTrace.DEFAULT_CACHE_SIZE, trace.getCacheSize());
+ assertEquals("getCacheSize", TmfTrace.DEFAULT_INDEX_PAGE_SIZE, trace.getCacheSize());
}
public void testTmfTraceDefaultCacheSize() throws Exception {
assertEquals("getType", TmfEvent.class, trace.getType());
assertEquals("getPath", testfile.getPath(), trace.getPath());
assertEquals("getName", TEST_STREAM, trace.getName());
- assertEquals("getCacheSize", TmfTrace.DEFAULT_CACHE_SIZE, trace.getCacheSize());
+ assertEquals("getCacheSize", TmfTrace.DEFAULT_INDEX_PAGE_SIZE, trace.getCacheSize());
}
public void testTmfTrace() throws Exception {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- }
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
};
ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
providers[0].sendRequest(request);
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- }
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
};
ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
providers[0].sendRequest(request);
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- // Cancel request after the first chunk is received
- cancel();
- }
+ int nbRead = 0;
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ if (++nbRead == BLOCK_SIZE)
+ cancel();
+ }
};
ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
providers[0].sendRequest(request);