aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/vespa/model/application/validation/SchemaDataTypeValidatorTestCase.java
blob: 2327c986be00404cb365bffdaf1649bc8e97dd64 (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.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;

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

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

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

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

    @Test
    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());
        }
    }

}