segStore: Merge ISegment and ISegment2
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.segmentstore.core.tests / src / org / eclipse / tracecompass / segmentstore / core / tests / htStore / SegmentTreeNodeTest.java
1 /*******************************************************************************
2 * Copyright (c) 2016 École Polytechnique de Montréal
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
10 package org.eclipse.tracecompass.segmentstore.core.tests.htStore;
11
12 import java.io.IOException;
13 import java.util.Arrays;
14
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;
25
26 /**
27 * Tests the segment history tree leaf node. It extends the unit tests of the
28 * node from the datastore.
29 *
30 * @author Geneviève Bastien
31 */
32 @NonNullByDefault
33 @RunWith(Parameterized.class)
34 public class SegmentTreeNodeTest extends HTNodeTest<BasicSegment, SegmentTreeNodeStub> {
35
36 /**
37 * A factory to create base objects for test
38 */
39 private static final ObjectFactory<BasicSegment> BASE_SEGMENT_FACTORY = (s, e) -> new BasicSegment(s, e);
40
41 /**
42 * Constructor
43 *
44 * @param name
45 * The name of the test
46 * @param headerSize
47 * The size of the header for this node type
48 * @param factory
49 * The node factory to use
50 * @param objReader
51 * The factory to read element data from disk
52 * @param objFactory
53 * The factory to create objects for this tree
54 * @throws IOException
55 * Any exception occurring with the file
56 */
57 public SegmentTreeNodeTest(String name,
58 int headerSize,
59 IHTNodeFactory<BasicSegment, SegmentTreeNodeStub> factory,
60 IHTIntervalReader<BasicSegment> objReader,
61 ObjectFactory<BasicSegment> objFactory) throws IOException {
62 super(name, headerSize, factory, objReader, objFactory);
63 }
64
65 /**
66 * @return The arrays of parameters
67 */
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,
75 BASE_SEGMENT_FACTORY
76 },
77 });
78 }
79
80 }
This page took 0.031223 seconds and 5 git commands to generate.