Commit | Line | Data |
---|---|---|
d18dd09b ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2009, 2010 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: | |
10 | * Francois Chouinard - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.tmf.tests.request; | |
14 | ||
15 | import junit.framework.TestCase; | |
16 | ||
17 | import org.eclipse.linuxtools.tmf.event.TmfEvent; | |
d18dd09b ASL |
18 | import org.eclipse.linuxtools.tmf.event.TmfTimeRange; |
19 | import org.eclipse.linuxtools.tmf.event.TmfTimestamp; | |
20 | import org.eclipse.linuxtools.tmf.request.TmfDataRequest; | |
21 | import org.eclipse.linuxtools.tmf.request.TmfEventRequest; | |
d18dd09b ASL |
22 | |
23 | /** | |
24 | * <b><u>TmfEventRequestTest</u></b> | |
25 | * <p> | |
e31e01e8 | 26 | * TODO: Implement me. Please. |
d18dd09b ASL |
27 | */ |
28 | public class TmfEventRequestTest extends TestCase { | |
29 | ||
d18dd09b ASL |
30 | // ------------------------------------------------------------------------ |
31 | // Housekeeping | |
32 | // ------------------------------------------------------------------------ | |
33 | ||
34 | public TmfEventRequestTest(String name) { | |
35 | super(name); | |
36 | } | |
37 | ||
38 | @Override | |
39 | protected void setUp() throws Exception { | |
40 | super.setUp(); | |
d18dd09b ASL |
41 | } |
42 | ||
43 | @Override | |
44 | protected void tearDown() throws Exception { | |
45 | super.tearDown(); | |
46 | } | |
47 | ||
d18dd09b ASL |
48 | // ------------------------------------------------------------------------ |
49 | // Constructors | |
50 | // ------------------------------------------------------------------------ | |
51 | ||
e31e01e8 FC |
52 | public void testTmfDataRequest() { |
53 | TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class); | |
d18dd09b ASL |
54 | |
55 | assertEquals("StartTime", TmfTimestamp.BigBang, request.getRange().getStartTime()); | |
56 | assertEquals("EndTime", TmfTimestamp.BigCrunch, request.getRange().getEndTime()); | |
57 | ||
e31e01e8 | 58 | assertEquals("getIndex", 0, request.getIndex()); |
d18dd09b ASL |
59 | assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested()); |
60 | assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize()); | |
d18dd09b ASL |
61 | } |
62 | ||
e31e01e8 | 63 | public void testTmfDataRequestTimeRange() { |
d18dd09b | 64 | TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(), TmfTimestamp.BigCrunch); |
e31e01e8 | 65 | TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range); |
d18dd09b | 66 | |
e31e01e8 FC |
67 | assertEquals("StartTime", range.getStartTime(), request.getRange().getStartTime()); |
68 | assertEquals("EndTime", range.getEndTime(), request.getRange().getEndTime()); | |
d18dd09b | 69 | |
e31e01e8 | 70 | assertEquals("getIndex", 0, request.getIndex()); |
d18dd09b ASL |
71 | assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested()); |
72 | assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize()); | |
d18dd09b ASL |
73 | } |
74 | ||
e31e01e8 | 75 | public void testTmfDataRequestTimeRangeNbRequested() { |
d18dd09b | 76 | TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(), TmfTimestamp.BigCrunch); |
e31e01e8 | 77 | TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, 100); |
d18dd09b | 78 | |
e31e01e8 FC |
79 | assertEquals("StartTime", range.getStartTime(), request.getRange().getStartTime()); |
80 | assertEquals("EndTime", range.getEndTime(), request.getRange().getEndTime()); | |
d18dd09b | 81 | |
e31e01e8 | 82 | assertEquals("getIndex", 0, request.getIndex()); |
d18dd09b ASL |
83 | assertEquals("getNbRequestedEvents", 100, request.getNbRequested()); |
84 | assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize()); | |
d18dd09b ASL |
85 | } |
86 | ||
e31e01e8 | 87 | public void testTmfDataRequestTimeRangeNbRequestedBlocksize() { |
d18dd09b | 88 | TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(), TmfTimestamp.BigCrunch); |
e31e01e8 | 89 | TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, 100, 200); |
d18dd09b | 90 | |
e31e01e8 FC |
91 | assertEquals("StartTime", range.getStartTime(), request.getRange().getStartTime()); |
92 | assertEquals("EndTime", range.getEndTime(), request.getRange().getEndTime()); | |
d18dd09b | 93 | |
e31e01e8 | 94 | assertEquals("getIndex", 0, request.getIndex()); |
d18dd09b | 95 | assertEquals("getNbRequestedEvents", 100, request.getNbRequested()); |
e31e01e8 | 96 | assertEquals("getBlockize", 200, request.getBlockize()); |
d18dd09b ASL |
97 | } |
98 | ||
d18dd09b | 99 | } |