aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2020-03-13 15:03:16 +0100
committerJon Bratseth <bratseth@verizonmedia.com>2020-03-13 15:03:16 +0100
commitd1dc33f47cb35a0542f10f60309a3d24b7a85a29 (patch)
treea9076d1c5d0aa699e7f5a9131cb0d0c90646ef39 /config-model/src
parent8afe53c8d43910621ce19ad7d278b601dd85eaa1 (diff)
searchdefinitions -> schemas
Diffstat (limited to 'config-model/src')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java20
-rw-r--r--config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java17
2 files changed, 14 insertions, 23 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
index a9b4e06ae1b..23983fda413 100644
--- a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
+++ b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
@@ -417,20 +417,18 @@ public class DeployState implements ConfigDefinitionStore {
for (NamedReader reader : readers) {
try {
String readerName = reader.getName();
- String searchName = builder.importReader(reader, readerName, logger);
+ String topLevelName = builder.importReader(reader, readerName, logger);
String sdName = stripSuffix(readerName, ApplicationPackage.SD_NAME_SUFFIX);
- names.put(searchName, sdName);
- if ( ! sdName.equals(searchName)) {
- throw new IllegalArgumentException("Search definition file name ('" + sdName + "') and name of " +
- "search element ('" + searchName +
+ names.put(topLevelName, sdName);
+ if ( ! sdName.equals(topLevelName)) {
+ throw new IllegalArgumentException("Schema definition file name ('" + sdName + "') and name of " +
+ "top level element ('" + topLevelName +
"') are not equal for file '" + readerName + "'");
}
} catch (ParseException e) {
- throw new IllegalArgumentException("Could not parse search definition file '" +
- getSearchDefinitionRelativePath(reader.getName()) + "': " + e.getMessage(), e);
+ throw new IllegalArgumentException("Could not parse sd file '" + reader.getName(), e);
} catch (IOException e) {
- throw new IllegalArgumentException("Could not read search definition file '" +
- getSearchDefinitionRelativePath(reader.getName()) + "': " + e.getMessage(), e);
+ throw new IllegalArgumentException("Could not read sd file '" + reader.getName(), e);
} finally {
closeIgnoreException(reader.getReader());
}
@@ -439,10 +437,6 @@ public class DeployState implements ConfigDefinitionStore {
return SearchDocumentModel.fromBuilderAndNames(builder, names);
}
- private String getSearchDefinitionRelativePath(String name) {
- return ApplicationPackage.SEARCH_DEFINITIONS_DIR + File.separator + name;
- }
-
private static String stripSuffix(String nodeName, String postfix) {
assert (nodeName.endsWith(postfix));
return nodeName.substring(0, nodeName.length() - postfix.length());
diff --git a/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java b/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java
index cb1577417b4..099ff83774f 100644
--- a/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java
+++ b/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java
@@ -72,21 +72,18 @@ public class ApplicationDeployTest {
break;
case "product":
assertTrue(s instanceof DocumentOnlySearch);
- assertEquals(s.getDocument().getField("title").getDataType(), DataType.STRING);
+ assertEquals(DataType.STRING, s.getDocument().getField("title").getDataType());
break;
default:
fail();
}
}
- File[] truth = new File[]{new File(TESTSDDIR + "laptop.sd"),
- new File(TESTSDDIR + "music.sd"),
- new File(TESTSDDIR + "pc.sd"),
- new File(TESTSDDIR + "product.sd"),
- new File(TESTSDDIR + "sock.sd")};
- Arrays.sort(truth);
- List<File> appSdFiles = tester.app().getSearchDefinitionFiles();
- Collections.sort(appSdFiles);
- assertEquals(appSdFiles, Arrays.asList(truth));
+ assertEquals(Set.of(new File(TESTSDDIR + "laptop.sd"),
+ new File(TESTSDDIR + "music.sd"),
+ new File(TESTSDDIR + "pc.sd"),
+ new File(TESTSDDIR + "product.sd"),
+ new File(TESTSDDIR + "sock.sd")),
+ new HashSet<>(tester.app().getSearchDefinitionFiles()));
List<FilesApplicationPackage.Component> components = tester.app().getComponents();
assertEquals(1, components.size());