1 /*******************************************************************************
2 * Copyright (c) 2017 École Polytechnique de Montréal
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 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.historytree
.classic
;
13 import java
.io
.IOException
;
15 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.historytree
.AbstractHistoryTree
;
16 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.historytree
.AbstractHistoryTreeTestBase
;
17 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.historytree
.classic
.ClassicHistoryTreeStub
;
18 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.historytree
.classic
.ClassicNode
;
19 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.interval
.HTInterval
;
22 * Test the classic history tree
24 * @author Geneviève Bastien
26 public class ClassicHistoryTreeTest
27 extends AbstractHistoryTreeTestBase
<HTInterval
, ClassicNode
<HTInterval
>> {
29 private static final HTInterval DEFAULT_OBJECT
= new HTInterval(0, 0);
33 protected ClassicHistoryTreeStub
createHistoryTree(
34 File stateHistoryFile
,
38 long treeStart
) throws IOException
{
40 return new ClassicHistoryTreeStub(stateHistoryFile
,
48 protected ClassicHistoryTreeStub
createHistoryTree(
49 File existingStateFile
, int expectedProviderVersion
) throws IOException
{
50 return new ClassicHistoryTreeStub(existingStateFile
, expectedProviderVersion
);
54 protected HTInterval
createInterval(long start
, long end
) {
55 return new HTInterval(start
, end
);
59 protected long fillValues(AbstractHistoryTree
<HTInterval
, ClassicNode
<HTInterval
>> ht
,
60 int fillSize
, long start
) {
62 int nbValues
= fillSize
/ DEFAULT_OBJECT
.getSizeOnDisk();
63 for (int i
= 0; i
< nbValues
; i
++) {
64 ht
.insert(new HTInterval(start
+ i
, start
+ i
+ 1));
66 return start
+ nbValues
;