Search in sources :

Example 1 with FileReader

use of com.tvd12.properties.file.reader.FileReader in project properties-file by tvd12.

the class MultiFileReaderTest method readNoProfiles.

@Test
public void readNoProfiles() {
    FileReader reader = new MultiFileReader();
    Properties properties = reader.read("application1.properties");
    Asserts.assertNull(properties.get("include.profiles"));
}
Also used : MultiFileReader(com.tvd12.properties.file.reader.MultiFileReader) FileReader(com.tvd12.properties.file.reader.FileReader) MultiFileReader(com.tvd12.properties.file.reader.MultiFileReader) Properties(java.util.Properties) Test(org.testng.annotations.Test)

Example 2 with FileReader

use of com.tvd12.properties.file.reader.FileReader in project properties-file by tvd12.

the class MultiFileReaderTest method readEmptyProfiles.

@Test
public void readEmptyProfiles() {
    FileReader reader = new MultiFileReader("alpha,");
    Properties properties = reader.read("application1.properties");
    Asserts.assertNull(properties.get("include.profiles"));
}
Also used : MultiFileReader(com.tvd12.properties.file.reader.MultiFileReader) FileReader(com.tvd12.properties.file.reader.FileReader) MultiFileReader(com.tvd12.properties.file.reader.MultiFileReader) Properties(java.util.Properties) Test(org.testng.annotations.Test)

Example 3 with FileReader

use of com.tvd12.properties.file.reader.FileReader in project properties-file by tvd12.

the class MultiFileReaderTest method readClassPathFiles.

@Test
public void readClassPathFiles() {
    FileReader reader = new MultiFileReader(Arrays.asList("alpha", ""));
    Properties properties = reader.read("application.yaml");
    System.out.println(properties);
    Asserts.assertNull(properties.get("include.profiles"));
    assert properties.get("cors.allow_origin").equals("*");
    assert properties.get("cors.enable").equals("true");
    assert properties.get("server.port").equals("3005");
    assert properties.get("server.host").equals("1.1.1.1");
    assert properties.get("server.admin.username").equals("admin");
    assert properties.get("server.admin.password").equals("123456");
    assert properties.get("hello").equals("world");
    assert properties.get("foo").equals("bar");
}
Also used : MultiFileReader(com.tvd12.properties.file.reader.MultiFileReader) FileReader(com.tvd12.properties.file.reader.FileReader) MultiFileReader(com.tvd12.properties.file.reader.MultiFileReader) Properties(java.util.Properties) Test(org.testng.annotations.Test)

Example 4 with FileReader

use of com.tvd12.properties.file.reader.FileReader in project properties-file by tvd12.

the class MultiFileReaderTest method readSystemFiles.

@Test
public void readSystemFiles() {
    FileReader reader = new MultiFileReader(Arrays.asList("alpha", ""));
    Properties properties = reader.read(new File("test/config/application.yaml"));
    System.out.println(properties);
    Asserts.assertNull(properties.get("include.profiles"));
    assert properties.get("cors.allow_origin").equals("*");
    assert properties.get("cors.enable").equals("true");
    Asserts.assertEquals("3006", properties.get("server.port"));
    assert properties.get("server.host").equals("2.2.2.2");
    assert properties.get("server.admin.username").equals("admin");
    assert properties.get("server.admin.password").equals("123456");
    assert properties.get("hello").equals("world");
    assert properties.get("foo").equals("bar");
}
Also used : MultiFileReader(com.tvd12.properties.file.reader.MultiFileReader) FileReader(com.tvd12.properties.file.reader.FileReader) MultiFileReader(com.tvd12.properties.file.reader.MultiFileReader) Properties(java.util.Properties) File(java.io.File) Test(org.testng.annotations.Test)

Example 5 with FileReader

use of com.tvd12.properties.file.reader.FileReader in project properties-file by tvd12.

the class MultiFileReaderTest method readNoProfiles.

@Test
public void readNoProfiles() {
    FileReader reader = new MultiFileReader();
    Properties properties = reader.read("application1.properties");
    Asserts.assertNull(properties.get("include.profiles"));
}
Also used : MultiFileReader(com.tvd12.properties.file.reader.MultiFileReader) FileReader(com.tvd12.properties.file.reader.FileReader) MultiFileReader(com.tvd12.properties.file.reader.MultiFileReader) Properties(java.util.Properties) Test(org.testng.annotations.Test)

Aggregations

FileReader (com.tvd12.properties.file.reader.FileReader)9 Properties (java.util.Properties)9 MultiFileReader (com.tvd12.properties.file.reader.MultiFileReader)8 Test (org.testng.annotations.Test)8 File (java.io.File)3 EzyFileUtil.getFileName (com.tvd12.ezyfox.util.EzyFileUtil.getFileName)1 ResourceFile (com.tvd12.ezyhttp.server.core.resources.ResourceFile)1 ResourceLoader (com.tvd12.ezyhttp.server.core.resources.ResourceLoader)1 BaseFileReader (com.tvd12.properties.file.reader.BaseFileReader)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 AllArgsConstructor (lombok.AllArgsConstructor)1