summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2020-03-13 16:19:41 +0100
committerJon Bratseth <bratseth@verizonmedia.com>2020-03-13 16:19:41 +0100
commit5a696133c325048ec2a29c9a971e8ab7d82fd362 (patch)
tree47da9207b0b499e3c40cca252cc94ba24dbb2c98
parent113dc59f57e101f226327829ae5b66cf5cb8e51a (diff)
searchdefinitions -> schemas
-rw-r--r--config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java12
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidatorTest.java10
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StreamingSearchClusterChangeValidatorTest.java10
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/utils/ApplicationPackageBuilder.java8
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterUtils.java26
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java6
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithMockPkg.java4
7 files changed, 43 insertions, 33 deletions
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 c803e4d9d35..fe82f2406f2 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
@@ -187,7 +187,7 @@ public class ApplicationDeployTest {
IOUtils.copyDirectory(new File(TESTDIR, "app1"), tmpDir);
ApplicationPackageTester tester = ApplicationPackageTester.create(tmpDir.getAbsolutePath());
assertEquals(5, tester.getSchemas().size());
- File sdDir = new File(tmpDir, "searchdefinitions");
+ File sdDir = new File(tmpDir, "schemas");
File sd = new File(sdDir, "testfoo.sd");
IOUtils.writeFile(sd, "search testfoo { document testfoo { field bar type string { } } }", false);
assertEquals(6, tester.getSchemas().size());
@@ -296,6 +296,16 @@ public class ApplicationDeployTest {
@Test
public void testGetJarEntryName() {
+ JarEntry e = new JarEntry("/schemas/foo.sd");
+ assertEquals(ApplicationPackage.getFileName(e), "foo.sd");
+ e = new JarEntry("bar");
+ assertEquals(ApplicationPackage.getFileName(e), "bar");
+ e = new JarEntry("");
+ assertEquals(ApplicationPackage.getFileName(e), "");
+ }
+
+ @Test
+ public void testGetJarEntryNameForLegacyPath() {
JarEntry e = new JarEntry("/searchdefinitions/foo.sd");
assertEquals(ApplicationPackage.getFileName(e), "foo.sd");
e = new JarEntry("bar");
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidatorTest.java
index 45cba298276..80127ac6854 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidatorTest.java
@@ -41,7 +41,7 @@ public class IndexedSearchClusterChangeValidatorTest {
public static VespaModel newOneDocModel(String sdContent) {
return new ApplicationPackageBuilder().
addCluster(new ContentClusterBuilder().name("foo").docTypes("d1")).
- addSearchDefinition(new SchemaBuilder().
+ addSchemas(new SchemaBuilder().
name("d1").content(sdContent).build()).buildCreator().create();
}
@@ -52,9 +52,9 @@ public class IndexedSearchClusterChangeValidatorTest {
public static VespaModel newTwoDocModel(String d1Content, String d2Content) {
return new ApplicationPackageBuilder().
addCluster(new ContentClusterBuilder().name("foo").docTypes("d1", "d2")).
- addSearchDefinition(new SchemaBuilder().
+ addSchemas(new SchemaBuilder().
name("d1").content(d1Content).build()).
- addSearchDefinition(new SchemaBuilder().
+ addSchemas(new SchemaBuilder().
name("d2").content(d2Content).build()).
buildCreator().create();
}
@@ -67,9 +67,9 @@ public class IndexedSearchClusterChangeValidatorTest {
return new ApplicationPackageBuilder().
addCluster(new ContentClusterBuilder().name("foo").docTypes("d1")).
addCluster(new ContentClusterBuilder().name("bar").docTypes("d2")).
- addSearchDefinition(new SchemaBuilder().
+ addSchemas(new SchemaBuilder().
name("d1").content(d1Content).build()).
- addSearchDefinition(new SchemaBuilder().
+ addSchemas(new SchemaBuilder().
name("d2").content(d2Content).build()).
buildCreator().create();
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StreamingSearchClusterChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StreamingSearchClusterChangeValidatorTest.java
index 3654a4163d6..8edbc964bfb 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StreamingSearchClusterChangeValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StreamingSearchClusterChangeValidatorTest.java
@@ -40,7 +40,7 @@ public class StreamingSearchClusterChangeValidatorTest {
public static VespaModel createOneDocModel(String sdContent) {
return new ApplicationPackageBuilder()
.addCluster(new ContentClusterBuilder().name("foo").docTypes(Arrays.asList(DocType.streaming("d1"))))
- .addSearchDefinition(new SchemaBuilder().name("d1").content(sdContent).build())
+ .addSchemas(new SchemaBuilder().name("d1").content(sdContent).build())
.buildCreator().create();
}
@@ -51,8 +51,8 @@ public class StreamingSearchClusterChangeValidatorTest {
public static VespaModel createTwoDocModel(String d1Content, String d2Content) {
return new ApplicationPackageBuilder()
.addCluster(new ContentClusterBuilder().name("foo").docTypes(Arrays.asList(DocType.streaming("d1"), DocType.streaming("d2"))))
- .addSearchDefinition(new SchemaBuilder().name("d1").content(d1Content).build())
- .addSearchDefinition(new SchemaBuilder().name("d2").content(d2Content).build())
+ .addSchemas(new SchemaBuilder().name("d1").content(d1Content).build())
+ .addSchemas(new SchemaBuilder().name("d2").content(d2Content).build())
.buildCreator().create();
}
@@ -64,8 +64,8 @@ public class StreamingSearchClusterChangeValidatorTest {
return new ApplicationPackageBuilder()
.addCluster(new ContentClusterBuilder().name("foo").docTypes(Arrays.asList(DocType.streaming("d1"))))
.addCluster(new ContentClusterBuilder().name("bar").docTypes(Arrays.asList(DocType.streaming("d2"))))
- .addSearchDefinition(new SchemaBuilder().name("d1").content(d1Content).build())
- .addSearchDefinition(new SchemaBuilder().name("d2").content(d2Content).build())
+ .addSchemas(new SchemaBuilder().name("d1").content(d1Content).build())
+ .addSchemas(new SchemaBuilder().name("d2").content(d2Content).build())
.buildCreator().create();
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ApplicationPackageBuilder.java b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ApplicationPackageBuilder.java
index 1b7f3e9b14d..5fc213fad1d 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ApplicationPackageBuilder.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ApplicationPackageBuilder.java
@@ -14,7 +14,7 @@ import java.util.List;
public class ApplicationPackageBuilder {
private List<ContentClusterBuilder> contentClusters = new ArrayList<>();
- private List<String> searchDefinitions = new ArrayList<>();
+ private List<String> schemas = new ArrayList<>();
public ApplicationPackageBuilder() {
}
@@ -24,13 +24,13 @@ public class ApplicationPackageBuilder {
return this;
}
- public ApplicationPackageBuilder addSearchDefinition(String searchDefinition) {
- searchDefinitions.add(searchDefinition);
+ public ApplicationPackageBuilder addSchemas(String schemas) {
+ this.schemas.add(schemas);
return this;
}
public VespaModelCreatorWithMockPkg buildCreator() {
- return new VespaModelCreatorWithMockPkg(null, getServices(), searchDefinitions);
+ return new VespaModelCreatorWithMockPkg(null, getServices(), schemas);
}
private String getServices() {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterUtils.java b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterUtils.java
index 782d9a27569..db9153fcf23 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterUtils.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterUtils.java
@@ -33,28 +33,28 @@ public class ContentClusterUtils {
return createMockRoot(hosts, SchemaBuilder.createSchemas("test"));
}
- private static MockRoot createMockRoot(HostProvisioner provisioner, List<String> searchDefinitions) {
- return createMockRoot(provisioner, searchDefinitions, new DeployState.Builder());
+ private static MockRoot createMockRoot(HostProvisioner provisioner, List<String> schemas) {
+ return createMockRoot(provisioner, schemas, new DeployState.Builder());
}
- private static MockRoot createMockRoot(HostProvisioner provisioner, List<String> searchDefinitions, DeployState.Builder deployStateBuilder) {
- ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withSchemas(searchDefinitions).build();
+ private static MockRoot createMockRoot(HostProvisioner provisioner, List<String> schemas, DeployState.Builder deployStateBuilder) {
+ ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withSchemas(schemas).build();
DeployState deployState = deployStateBuilder.applicationPackage(applicationPackage)
.modelHostProvisioner(provisioner)
.build();
return new MockRoot("", deployState);
}
- public static MockRoot createMockRoot(String[] hosts, List<String> searchDefinitions) {
- return createMockRoot(new InMemoryProvisioner(true, hosts), searchDefinitions);
+ public static MockRoot createMockRoot(String[] hosts, List<String> schemas) {
+ return createMockRoot(new InMemoryProvisioner(true, hosts), schemas);
}
- public static MockRoot createMockRoot(List<String> searchDefinitions) {
- return createMockRoot(new SingleNodeProvisioner(), searchDefinitions);
+ public static MockRoot createMockRoot(List<String> schemas) {
+ return createMockRoot(new SingleNodeProvisioner(), schemas);
}
- public static MockRoot createMockRoot(List<String> searchDefinitions, DeployState.Builder deployStateBuilder) {
- return createMockRoot(new SingleNodeProvisioner(), searchDefinitions, deployStateBuilder);
+ public static MockRoot createMockRoot(List<String> schemas, DeployState.Builder deployStateBuilder) {
+ return createMockRoot(new SingleNodeProvisioner(), schemas, deployStateBuilder);
}
public static ContentCluster createCluster(String clusterXml, MockRoot root) {
@@ -63,13 +63,13 @@ public class ContentClusterUtils {
new FileDistributionConfigProducer(root, new MockFileRegistry(), null),
root.getDeployState().isHosted());
ConfigModelContext context = ConfigModelContext.create(null, root.getDeployState(),
- null,null, root, null);
+ null,null, root, null);
return new ContentCluster.Builder(admin).build(Collections.emptyList(), context, doc.getDocumentElement());
}
- public static ContentCluster createCluster(String clusterXml, List<String> searchDefinitions) throws Exception {
- MockRoot root = createMockRoot(searchDefinitions);
+ public static ContentCluster createCluster(String clusterXml, List<String> schemas) throws Exception {
+ MockRoot root = createMockRoot(schemas);
ContentCluster cluster = createCluster(clusterXml, root);
root.freezeModelTopology();
cluster.validate();
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java
index bb769549868..97417f5a522 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java
@@ -211,10 +211,10 @@ public class DocumentDatabaseTestCase {
}
@Test
- public void requireThatWeCanHaveMultipleSearchDefinitions() {
- final List<String> sds = Arrays.asList("type1", "type2", "type3");
+ public void testMultipleSchemas() {
+ List<String> sds = List.of("type1", "type2", "type3");
VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(sds, "index"),
- ApplicationPackageUtils.generateSchemas(sds)).create();
+ ApplicationPackageUtils.generateSchemas(sds)).create();
IndexedSearchCluster indexedSearchCluster = (IndexedSearchCluster)model.getSearchClusters().get(0);
ContentSearchCluster contentSearchCluster = model.getContentClusters().get("test").getSearch();
String type1Id = "test/search/cluster.test/type1";
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithMockPkg.java b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithMockPkg.java
index ec58fa7f86f..70ce588bec1 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithMockPkg.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithMockPkg.java
@@ -31,8 +31,8 @@ public class VespaModelCreatorWithMockPkg {
this(new MockApplicationPackage.Builder().withHosts(hosts).withServices(services).build());
}
- public VespaModelCreatorWithMockPkg(String hosts, String services, List<String> searchDefinitions) {
- this(new MockApplicationPackage.Builder().withHosts(hosts).withServices(services).withSchemas(searchDefinitions).build());
+ public VespaModelCreatorWithMockPkg(String hosts, String services, List<String> schemas) {
+ this(new MockApplicationPackage.Builder().withHosts(hosts).withServices(services).withSchemas(schemas).build());
}
public VespaModelCreatorWithMockPkg(ApplicationPackage appPkg) {