This repository was archived by the owner on Mar 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy pathTestSPO.java
More file actions
110 lines (77 loc) · 2.83 KB
/
TestSPO.java
File metadata and controls
110 lines (77 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
Copyright (C) SYSTAP, LLC 2006-2015. All rights reserved.
Contact:
SYSTAP, LLC
2501 Calvert ST NW #106
Washington, DC 20008
licenses@systap.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Created on Sep 18, 2009
*/
package com.bigdata.rdf.spo;
import junit.framework.TestCase2;
import com.bigdata.io.SerializerUtil;
import com.bigdata.rdf.internal.IV;
import com.bigdata.rdf.internal.VTE;
import com.bigdata.rdf.internal.impl.TermId;
import com.bigdata.rdf.model.BigdataURI;
import com.bigdata.rdf.model.StatementEnum;
/**
* Test suite for the {@link SPO} class.
*
* @author <a href="mailto:thompsonbry@users.sourceforge.net">Bryan Thompson</a>
* @version $Id$
*/
public class TestSPO extends TestCase2 {
/**
*
*/
public TestSPO() {
}
/**
* @param name
*/
public TestSPO(String name) {
super(name);
}
public void test1() {
// TODO: write tests for SPO
}
public void test_serializable() {
final IV<?,?> s = new TermId<BigdataURI>(VTE.URI, 1);
final IV<?,?> p = new TermId<BigdataURI>(VTE.URI, 2);
final IV<?,?> o = new TermId<BigdataURI>(VTE.URI, 3);
final SPO expected = new SPO(s, p, o);
doRoundTripTest(expected);
}
public void test_serializable_sidIV() {
final IV<?,?> s = new TermId<BigdataURI>(VTE.URI, 1);
final IV<?,?> p = new TermId<BigdataURI>(VTE.URI, 2);
final IV<?,?> o = new TermId<BigdataURI>(VTE.URI, 3);
final SPO expected = new SPO(s, p, o, StatementEnum.Explicit);
doRoundTripTest(expected);
// expected.setStatementIdentifier(true);
doRoundTripTest(expected);
final IV<?,?> p1 = new TermId<BigdataURI>(VTE.URI, 4);
final IV<?,?> o1 = new TermId<BigdataURI>(VTE.URI, 5);
final SPO expected2 = new SPO(expected.c(), p1, o1,
StatementEnum.Explicit);
doRoundTripTest(expected2);
}
private void doRoundTripTest(final SPO expected) {
final byte[] b = SerializerUtil.serialize(expected);
final SPO actual = (SPO)SerializerUtil.deserialize(b);
assertEquals(expected, actual);
}
}