Search in sources :

Example 1 with EzyXmlReader

use of com.tvd12.ezyfox.mapping.jaxb.EzyXmlReader in project ezyfox-server by youngmonkeys.

the class EzySimpleXmlReaderTest method test2.

@Test(expectedExceptions = { IllegalArgumentException.class })
public void test2() {
    EzyXmlReader reader = EzySimpleXmlMapper.builder().contextPath("com.tvd12.ezyfoxserver.mapping").classLoader(getClass().getClassLoader()).build();
    reader.read(new File("pom.xml"), ClassB.class);
}
Also used : EzyXmlReader(com.tvd12.ezyfox.mapping.jaxb.EzyXmlReader) File(java.io.File) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Example 2 with EzyXmlReader

use of com.tvd12.ezyfox.mapping.jaxb.EzyXmlReader in project ezyfox-server by youngmonkeys.

the class EzySimpleXmlReaderTest method test1.

@Test(expectedExceptions = { IllegalArgumentException.class })
public void test1() {
    EzyXmlReader reader = EzySimpleXmlMapper.builder().contextClass(ClassA.class).build();
    reader.read(new File("pom.xml"), ClassB.class);
}
Also used : EzyXmlReader(com.tvd12.ezyfox.mapping.jaxb.EzyXmlReader) ClassA(com.tvd12.ezyfoxserver.testing.jaxberror.ClassA) File(java.io.File) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Example 3 with EzyXmlReader

use of com.tvd12.ezyfox.mapping.jaxb.EzyXmlReader in project ezyfox-server by youngmonkeys.

the class EzySimpleXmlReaderTest method test3.

@Test
public void test3() {
    EzyXmlReader reader = EzySimpleXmlMapper.builder().contextPath("com.tvd12.ezyfoxserver").classLoader(getClass().getClassLoader()).build();
    EzySimpleSettings settings = reader.read(new File("src/main/resources/ezy-settings.xml"), EzySimpleSettings.class);
    System.out.println(new EzySimpleJsonWriter().writeAsString(settings));
}
Also used : EzyXmlReader(com.tvd12.ezyfox.mapping.jaxb.EzyXmlReader) EzySimpleJsonWriter(com.tvd12.ezyfox.json.EzySimpleJsonWriter) EzySimpleSettings(com.tvd12.ezyfoxserver.setting.EzySimpleSettings) File(java.io.File) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Example 4 with EzyXmlReader

use of com.tvd12.ezyfox.mapping.jaxb.EzyXmlReader in project ezyfox-server by youngmonkeys.

the class EzySimpleSettingsReader method readSettings.

protected EzySettings readSettings() {
    logger.info("read setting file: {}", getSettingsFilePath());
    EzyXmlReader xmlReader = newXmlReader();
    EzySimpleSettings settings = readSettingsFile(xmlReader);
    EzySimpleZoneFilesSetting zoneFiles = settings.getZoneFiles();
    zoneFiles.forEach(zf -> {
        if (!zf.isActive()) {
            return;
        }
        EzySimpleZoneSetting zoneSetting = readZoneConfigFile(xmlReader, zf.getConfigFile());
        postReadZoneSettings(zoneSetting);
        zoneSetting.setName(zf.getName());
        zoneSetting.setConfigFile(zf.getConfigFile());
        zoneSetting.init();
        settings.addZone(zoneSetting);
    });
    if (settingsDecorator != null) {
        settingsDecorator.decorate(homePath, settings);
    }
    return settings;
}
Also used : EzyXmlReader(com.tvd12.ezyfox.mapping.jaxb.EzyXmlReader)

Aggregations

EzyXmlReader (com.tvd12.ezyfox.mapping.jaxb.EzyXmlReader)4 BaseTest (com.tvd12.test.base.BaseTest)3 File (java.io.File)3 Test (org.testng.annotations.Test)3 EzySimpleJsonWriter (com.tvd12.ezyfox.json.EzySimpleJsonWriter)1 EzySimpleSettings (com.tvd12.ezyfoxserver.setting.EzySimpleSettings)1 ClassA (com.tvd12.ezyfoxserver.testing.jaxberror.ClassA)1