aboutsummaryrefslogtreecommitdiffstats
path: root/config-application-package/src/test/java/com/yahoo/config/model/application/AbstractApplicationPackageTest.java
blob: 62cd4919c634afe1830fef16be564256411b4295 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.model.application;

import org.junit.Test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

/**
 * @author arnej
 */
public class AbstractApplicationPackageTest {

    private static void checkValid(String fn) {
        assertTrue(AbstractApplicationPackage.validSchemaFilename(fn));
    }

    private static void checkInvalid(String fn) {
        assertFalse(AbstractApplicationPackage.validSchemaFilename(fn));
    }

    @Test
    public void testValidSchemaFilename() {
        checkValid("foo.sd");
        checkValid("schemas/foo.sd");
        checkValid("./foo.sd");
        checkValid("./schemas/foo.sd");
        checkInvalid("foo");
        checkInvalid("foo.ds");
        checkInvalid(".foo.sd");
        checkInvalid("schemas/.foo.sd");
        checkInvalid("schemas/subdir/._foo.sd");
    }
}