- @Test
- public void testStandardConstructorCacheSize() throws TmfTraceException {
- try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
- File testfile = new File(FileLocator.toFileURL(location).toURI());
- TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), 0, false, null, null);
- trace.indexTrace(true);
-
- assertEquals("getType", ITmfEvent.class, trace.getType());
- assertNull("getResource", trace.getResource());
- assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
- assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, trace.getCacheSize());
- assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
- assertEquals("getName", TEST_STREAM, trace.getName());
-
- assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
- assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
- assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
- assertEquals("getStartTime", 1, trace.getStartTime().getValue());
- assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
-
- } catch (final URISyntaxException e) {
- fail("URISyntaxException");
- } catch (final IOException e) {
- fail("IOException");
- }
-
- try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
- File testfile = new File(FileLocator.toFileURL(location).toURI());
- TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null);
- trace.indexTrace(true);
-
- assertEquals("getType", ITmfEvent.class, trace.getType());
- assertNull("getResource", trace.getResource());
- assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
- assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize());
- assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
- assertEquals("getName", TEST_STREAM, trace.getName());
-
- assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
- assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
- assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
- assertEquals("getStartTime", 1, trace.getStartTime().getValue());
- assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
-
- } catch (final URISyntaxException e) {
- fail("URISyntaxException");
- } catch (final IOException e) {
- fail("IOException");
- }
- }
-
- @Test
- public void testFullConstructor() throws TmfTraceException {
- try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
- File testfile = new File(FileLocator.toFileURL(location).toURI());
- TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, false, null, null);
- trace.indexTrace(true);
-
- assertEquals("getType", ITmfEvent.class, trace.getType());
- assertNull("getResource", trace.getResource());
- assertEquals("getPath", testfile.toURI().getPath(), trace.getPath());
- assertEquals("getCacheSize", BLOCK_SIZE, trace.getCacheSize());
- assertEquals("getStreamingInterval", 0, trace.getStreamingInterval());
- assertEquals("getName", TEST_STREAM, trace.getName());
-
- assertEquals("getNbEvents", NB_EVENTS, trace.getNbEvents());
- assertEquals("getRange-start", 1, trace.getTimeRange().getStartTime().getValue());
- assertEquals("getRange-end", NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
- assertEquals("getStartTime", 1, trace.getStartTime().getValue());
- assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
-
- } catch (final URISyntaxException e) {
- fail("URISyntaxException");
- } catch (final IOException e) {
- fail("IOException");
- }
- }
-