1 /*******************************************************************************
2 * Copyright (c) 2016 É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
.segmentstore
.core
.tests
.htStore
;
12 import java
.io
.IOException
;
13 import java
.util
.Arrays
;
15 import org
.eclipse
.jdt
.annotation
.NonNullByDefault
;
16 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.historytree
.AbstractHistoryTree
.IHTNodeFactory
;
17 import org
.eclipse
.tracecompass
.datastore
.core
.interval
.IHTIntervalReader
;
18 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.historytree
.HTNode
;
19 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.historytree
.HTNodeTest
;
20 import org
.eclipse
.tracecompass
.segmentstore
.core
.BasicSegment
;
21 import org
.eclipse
.tracecompass
.segmentstore
.core
.tests
.historytree
.SegmentTreeNodeStub
;
22 import org
.junit
.runner
.RunWith
;
23 import org
.junit
.runners
.Parameterized
;
24 import org
.junit
.runners
.Parameterized
.Parameters
;
27 * Tests the segment history tree leaf node. It extends the unit tests of the
28 * node from the datastore.
30 * @author Geneviève Bastien
33 @RunWith(Parameterized
.class)
34 public class SegmentTreeNodeTest
extends HTNodeTest
<BasicSegment
, SegmentTreeNodeStub
> {
37 * A factory to create base objects for test
39 private static final ObjectFactory
<BasicSegment
> BASE_SEGMENT_FACTORY
= (s
, e
) -> new BasicSegment(s
, e
);
45 * The name of the test
47 * The size of the header for this node type
49 * The node factory to use
51 * The factory to read element data from disk
53 * The factory to create objects for this tree
55 * Any exception occurring with the file
57 public SegmentTreeNodeTest(String name
,
59 IHTNodeFactory
<BasicSegment
, SegmentTreeNodeStub
> factory
,
60 IHTIntervalReader
<BasicSegment
> objReader
,
61 ObjectFactory
<BasicSegment
> objFactory
) throws IOException
{
62 super(name
, headerSize
, factory
, objReader
, objFactory
);
66 * @return The arrays of parameters
68 @Parameters(name
= "{index}: {0}")
69 public static Iterable
<Object
[]> getParameters() {
70 return Arrays
.asList(new Object
[][] {
71 { "Segment tree node",
72 HTNode
.COMMON_HEADER_SIZE
,
73 SegmentTreeNodeStub
.NODE_FACTORY
,
74 BasicSegment
.BASIC_SEGMENT_READ_FACTORY
,