blob: c0f2b6887d2ca902376720da01ace8409a586d66 (
plain) (
blame)
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
|
// 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.searchdefinition.Schema;
import com.yahoo.searchdefinition.SchemaBuilder;
import com.yahoo.searchdefinition.parser.ParseException;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
/**
* Tests really simple inheriting
*/
public class SimpleInheritTestCase extends AbstractExportingTestCase {
@Test
public void testEmptyChild() throws IOException, ParseException {
String name = "emptychild";
final String expectedResultsDirName = "src/test/derived/" + name + "/";
SchemaBuilder builder = new SchemaBuilder();
builder.importFile(expectedResultsDirName + "parent.sd");
builder.importFile(expectedResultsDirName + "child.sd");
builder.build();
Schema schema = builder.getSchema("child");
String toDirName = "temp/" + name;
File toDir = new File(toDirName);
toDir.mkdirs();
deleteContent(toDir);
DerivedConfiguration config = new DerivedConfiguration(schema, builder.getRankProfileRegistry());
config.export(toDirName);
checkDir(toDirName, expectedResultsDirName);
}
private void checkDir(String toDirName, String expectedResultsDirName) throws IOException {
File[] files = new File(expectedResultsDirName).listFiles();
for (File file : files) {
if ( ! file.getName().endsWith(".cfg")) continue;
assertEqualFiles(file.getPath(), toDirName + "/" + file.getName(), false);
}
}
}
|