diff options
Diffstat (limited to 'config-application-package/src/test/java/com/yahoo/config')
-rw-r--r-- | config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java b/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java index dcc75fff540..2a1ba3adc36 100644 --- a/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java +++ b/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java @@ -1,4 +1,4 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config.model.application.provider; import com.yahoo.config.application.TestBase; @@ -9,25 +9,30 @@ import com.yahoo.config.provision.Zone; import com.yahoo.io.IOUtils; import org.junit.Rule; import org.junit.Test; +import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.nio.file.Files; +import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** * @author Ulf Lilleengen - * @since 5.25 */ public class FilesApplicationPackageTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); + @Rule + public ExpectedException expectedException = ExpectedException.none(); + @Test public void testPreprocessing() throws IOException { File appDir = temporaryFolder.newFolder(); @@ -101,4 +106,15 @@ public class FilesApplicationPackageTest { assertEquals(IOUtils.readAll(app.getDeployment().get()), IOUtils.readAll(new FileReader(deployment))); } + @Test + public void failOnEmptyServicesXml() throws IOException { + File appDir = temporaryFolder.newFolder(); + IOUtils.copyDirectory(new File("src/test/resources/multienvapp"), appDir); + Files.delete(new File(appDir, "services.xml").toPath()); + FilesApplicationPackage app = FilesApplicationPackage.fromFile(appDir); + expectedException.expect(IllegalArgumentException.class); + expectedException.expectMessage(containsString("services.xml in application package is empty")); + app.preprocess(new Zone(Environment.dev, RegionName.defaultName()), new BaseDeployLogger()); + } + } |