aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/vespa/model/application/validation/SchemaDataTypeValidatorTestCase.java
blob: b7b83dbf68cad61919048624bb21eede01b70a42 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.application.validation;

import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

/**
 * @author Simon Thoresen Hult
 */
public class SchemaDataTypeValidatorTestCase {

    @Test
    public void requireThatSupportedTypesAreValidated() {
        new VespaModelCreatorWithFilePkg("src/test/cfg/application/validation/search_alltypes/").create();
    }

    @Test
    public void requireThatStructsAreLegalInSearchClusters() {
        new VespaModelCreatorWithFilePkg("src/test/cfg/application/validation/search_struct/").create();
    }

    @Test
    public void requireThatEmptyContentFieldIsLegalInSearchClusters() {
        new VespaModelCreatorWithFilePkg("src/test/cfg/application/validation/search_empty_content/").create();
    }

    @Test
    public void requireThatIndexingMapsInNonStreamingClusterIsIllegal() {
        try {
            new VespaModelCreatorWithFilePkg("src/test/cfg/application/validation/index_struct/").create();
            fail();
        } catch (IllegalArgumentException e) {
            assertEquals("Field type 'Map<string,string>' cannot be indexed for search clusters (field 'baz' in definition " +
                    "'simple' for cluster 'content').", e.getMessage());
        }
    }

}