Commit | Line | Data |
---|---|---|
4ab33d2b AO |
1 | /******************************************************************************* |
2 | * Copyright (c) 2009 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
165c977c | 10 | * Francois Chouinard - Initial API and implementation |
4ab33d2b AO |
11 | *******************************************************************************/ |
12 | ||
165c977c | 13 | package org.eclipse.linuxtools.tmf.request; |
4ab33d2b | 14 | |
28b94d61 | 15 | import junit.framework.TestCase; |
4ab33d2b AO |
16 | |
17 | import org.eclipse.linuxtools.tmf.event.TmfEvent; | |
1f506a43 | 18 | import org.eclipse.linuxtools.tmf.event.TmfTimeRange; |
4ab33d2b | 19 | import org.eclipse.linuxtools.tmf.event.TmfTimestamp; |
4ab33d2b AO |
20 | |
21 | /** | |
165c977c | 22 | * <b><u>TmfDataRequestTest</u></b> |
4ab33d2b AO |
23 | * <p> |
24 | * TODO: Implement me. Please. | |
25 | */ | |
28b94d61 | 26 | public class TmfDataRequestTest extends TestCase { |
4ab33d2b | 27 | |
28b94d61 FC |
28 | // ======================================================================== |
29 | // Housekeeping | |
30 | // ======================================================================== | |
4ab33d2b | 31 | |
28b94d61 FC |
32 | public TmfDataRequestTest(String name) { |
33 | super(name); | |
34 | } | |
4ab33d2b | 35 | |
28b94d61 FC |
36 | @Override |
37 | protected void setUp() throws Exception { | |
38 | super.setUp(); | |
39 | } | |
4ab33d2b | 40 | |
28b94d61 FC |
41 | @Override |
42 | protected void tearDown() throws Exception { | |
43 | super.tearDown(); | |
44 | } | |
4ab33d2b | 45 | |
28b94d61 FC |
46 | // ======================================================================== |
47 | // Constructors | |
48 | // ======================================================================== | |
4ab33d2b | 49 | |
28b94d61 FC |
50 | public void testTmfDataRequestIndexNbEvents() { |
51 | TmfDataRequest<TmfEvent> request = new TmfDataRequest<TmfEvent>(10, 100); | |
4ab33d2b | 52 | |
28b94d61 FC |
53 | assertEquals("getRange", null, request.getRange()); |
54 | assertEquals("getIndex", 10, request.getIndex()); | |
55 | assertEquals("getNbRequestedEvents", 100, request.getNbRequestedEvents()); | |
56 | assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize()); | |
57 | } | |
4ab33d2b | 58 | |
28b94d61 FC |
59 | public void testTmfDataRequestIndexNbEventsBlocksize() { |
60 | TmfDataRequest<TmfEvent> request = new TmfDataRequest<TmfEvent>(10, 100, 200); | |
4ab33d2b | 61 | |
28b94d61 FC |
62 | assertEquals("getRange", null, request.getRange()); |
63 | assertEquals("getIndex", 10, request.getIndex()); | |
64 | assertEquals("getNbRequestedEvents", 100, request.getNbRequestedEvents()); | |
65 | assertEquals("getBlockize", 200, request.getBlockize()); | |
66 | } | |
4ab33d2b | 67 | |
28b94d61 | 68 | public void testTmfDataRequestTimeRange() { |
1f506a43 | 69 | TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch); |
28b94d61 | 70 | TmfDataRequest<TmfEvent> request = new TmfDataRequest<TmfEvent>(range); |
4ab33d2b AO |
71 | |
72 | assertEquals("StartTime", TmfTimestamp.BigBang, request.getRange().getStartTime()); | |
73 | assertEquals("EndTime", TmfTimestamp.BigCrunch, request.getRange().getEndTime()); | |
28b94d61 FC |
74 | assertEquals("getIndex", 0, request.getIndex()); |
75 | assertEquals("getNbRequestedEvents", -1, request.getNbRequestedEvents()); | |
76 | assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize()); | |
77 | } | |
4ab33d2b | 78 | |
28b94d61 | 79 | public void testTmfDataRequestTimeRangeNbEvents() { |
1f506a43 | 80 | TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch); |
28b94d61 | 81 | TmfDataRequest<TmfEvent> request = new TmfDataRequest<TmfEvent>(range, 10); |
4ab33d2b | 82 | |
28b94d61 FC |
83 | assertEquals("StartTime", TmfTimestamp.BigBang, request.getRange().getStartTime()); |
84 | assertEquals("EndTime", TmfTimestamp.BigCrunch, request.getRange().getEndTime()); | |
85 | assertEquals("getIndex", 0, request.getIndex()); | |
86 | assertEquals("getNbRequestedEvents", 10, request.getNbRequestedEvents()); | |
87 | assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize()); | |
88 | } | |
4ab33d2b | 89 | |
28b94d61 | 90 | public void testTmfDataRequestTimeRangeNbEventsBlockSize() { |
1f506a43 | 91 | TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch); |
28b94d61 | 92 | TmfDataRequest<TmfEvent> request = new TmfDataRequest<TmfEvent>(range, 10, 100); |
4ab33d2b | 93 | |
28b94d61 FC |
94 | assertEquals("StartTime", TmfTimestamp.BigBang, request.getRange().getStartTime()); |
95 | assertEquals("EndTime", TmfTimestamp.BigCrunch, request.getRange().getEndTime()); | |
96 | assertEquals("getIndex", 0, request.getIndex()); | |
97 | assertEquals("getNbRequestedEvents", 10, request.getNbRequestedEvents()); | |
98 | assertEquals("getBlockize", 100, request.getBlockize()); | |
99 | } | |
4ab33d2b AO |
100 | |
101 | } |