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
CommitLineData
7182d50c
GB
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
10package org.eclipse.tracecompass.segmentstore.core.tests.htStore;
11
12import java.io.IOException;
13import java.util.Arrays;
14
15import org.eclipse.jdt.annotation.NonNullByDefault;
16import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.AbstractHistoryTree.IHTNodeFactory;
dad84716 17import org.eclipse.tracecompass.datastore.core.interval.IHTIntervalReader;
7182d50c
GB
18import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.HTNode;
19import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.HTNodeTest;
3866be8e 20import org.eclipse.tracecompass.segmentstore.core.BasicSegment;
7182d50c
GB
21import org.eclipse.tracecompass.segmentstore.core.tests.historytree.SegmentTreeNodeStub;
22import org.junit.runner.RunWith;
23import org.junit.runners.Parameterized;
24import 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)
3866be8e 34public class SegmentTreeNodeTest extends HTNodeTest<BasicSegment, SegmentTreeNodeStub> {
7182d50c
GB
35
36 /**
37 * A factory to create base objects for test
38 */
3866be8e 39 private static final ObjectFactory<BasicSegment> BASE_SEGMENT_FACTORY = (s, e) -> new BasicSegment(s, e);
7182d50c
GB
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,
3866be8e
GB
59 IHTNodeFactory<BasicSegment, SegmentTreeNodeStub> factory,
60 IHTIntervalReader<BasicSegment> objReader,
61 ObjectFactory<BasicSegment> objFactory) throws IOException {
7182d50c
GB
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,
3866be8e 74 BasicSegment.BASIC_SEGMENT_READ_FACTORY,
7182d50c
GB
75 BASE_SEGMENT_FACTORY
76 },
77 });
78 }
79
80}
This page took 0.027435 seconds and 5 git commands to generate.