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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchdefinition.derived;
import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.searchdefinition.parser.ParseException;
import org.junit.Test;
import java.io.IOException;
/**
* @author Einar M R Rosenvinge
*/
public class AnnotationsTestCase extends AbstractExportingTestCase {
@Test
public void requireThatStructRegistersIfOnlyUsedByAnnotation() throws IOException, ParseException {
assertCorrectDeriving("annotationsstruct",
new TestProperties().setExperimentalSdParsing(true));
}
@Test
public void requireThatStructRegistersIfOnlyUsedAsArrayByAnnotation() throws IOException, ParseException {
assertCorrectDeriving("annotationsstructarray",
new TestProperties().setExperimentalSdParsing(true));
}
@Test
public void testSimpleAnnotationDeriving() throws IOException, ParseException {
assertCorrectDeriving("annotationssimple",
new TestProperties().setExperimentalSdParsing(true));
}
@Test
public void testAnnotationDerivingWithImplicitStruct() throws IOException, ParseException {
assertCorrectDeriving("annotationsimplicitstruct",
new TestProperties().setExperimentalSdParsing(true));
}
@Test
public void testAnnotationDerivingInheritance() throws IOException, ParseException {
assertCorrectDeriving("annotationsinheritance",
new TestProperties().setExperimentalSdParsing(true));
}
@Test
public void testAnnotationDerivingInheritance2() throws IOException, ParseException {
assertCorrectDeriving("annotationsinheritance2",
new TestProperties().setExperimentalSdParsing(true));
}
@Test
public void testSimpleReference() throws IOException, ParseException {
assertCorrectDeriving("annotationsreference",
new TestProperties().setExperimentalSdParsing(true));
}
@Test
public void testAdvancedReference() throws IOException, ParseException {
assertCorrectDeriving("annotationsreference2",
new TestProperties().setExperimentalSdParsing(true));
}
@Test
public void testAnnotationsPolymorphy() throws IOException, ParseException {
assertCorrectDeriving("annotationspolymorphy",
new TestProperties().setExperimentalSdParsing(true));
}
/**
* An annotation declared before document {} won't work, no doc type to add it to.
*/
@Test(expected = IllegalArgumentException.class)
public void testAnnotationOutsideOfDocumentOld() throws IOException, ParseException {
assertCorrectDeriving("annotationsoutsideofdocument",
new TestProperties().setExperimentalSdParsing(false));
}
/**
* An annotation declared before document {} should work.
*/
@Test
public void testAnnotationOutsideOfDocumentNew() throws IOException, ParseException {
assertCorrectDeriving("annotationsoutsideofdocument",
new TestProperties().setExperimentalSdParsing(true));
}
}
|