Search in sources :

Example 1 with ValidatingPlugin

use of org.apache.logging.log4j.plugins.test.validation.ValidatingPlugin in project logging-log4j2 by apache.

the class RequiredValidatorTest method testNullDefaultValue.

@Test
public void testNullDefaultValue() throws Exception {
    final ValidatingPlugin validatingPlugin = (ValidatingPlugin) new PluginBuilder(plugin).setConfiguration(new NullConfiguration()).setConfigurationNode(node).build();
    assertNull(validatingPlugin);
}
Also used : ValidatingPlugin(org.apache.logging.log4j.plugins.test.validation.ValidatingPlugin) PluginBuilder(org.apache.logging.log4j.core.config.plugins.util.PluginBuilder) NullConfiguration(org.apache.logging.log4j.core.config.NullConfiguration) Test(org.junit.jupiter.api.Test)

Example 2 with ValidatingPlugin

use of org.apache.logging.log4j.plugins.test.validation.ValidatingPlugin in project logging-log4j2 by apache.

the class RequiredValidatorTest method testNonNullValue.

@Test
public void testNonNullValue() throws Exception {
    node.getAttributes().put("name", "foo");
    final ValidatingPlugin validatingPlugin = (ValidatingPlugin) new PluginBuilder(plugin).setConfiguration(new NullConfiguration()).setConfigurationNode(node).build();
    assertNotNull(validatingPlugin);
    assertEquals("foo", validatingPlugin.getName());
}
Also used : ValidatingPlugin(org.apache.logging.log4j.plugins.test.validation.ValidatingPlugin) PluginBuilder(org.apache.logging.log4j.core.config.plugins.util.PluginBuilder) NullConfiguration(org.apache.logging.log4j.core.config.NullConfiguration) Test(org.junit.jupiter.api.Test)

Example 3 with ValidatingPlugin

use of org.apache.logging.log4j.plugins.test.validation.ValidatingPlugin in project logging-log4j2 by apache.

the class RequiredValidatorTest method setUp.

@SuppressWarnings("unchecked")
@BeforeEach
public void setUp() throws Exception {
    final PluginManager manager = new PluginManager("Test");
    manager.collectPlugins();
    plugin = (PluginType<ValidatingPlugin>) manager.getPluginType("Validator");
    assertNotNull(plugin, "Rebuild this module to make sure annotation processing kicks in.");
    node = new Node(null, "Validator", plugin);
}
Also used : PluginManager(org.apache.logging.log4j.plugins.util.PluginManager) ValidatingPlugin(org.apache.logging.log4j.plugins.test.validation.ValidatingPlugin) Node(org.apache.logging.log4j.plugins.Node) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ValidatingPlugin (org.apache.logging.log4j.plugins.test.validation.ValidatingPlugin)3 NullConfiguration (org.apache.logging.log4j.core.config.NullConfiguration)2 PluginBuilder (org.apache.logging.log4j.core.config.plugins.util.PluginBuilder)2 Test (org.junit.jupiter.api.Test)2 Node (org.apache.logging.log4j.plugins.Node)1 PluginManager (org.apache.logging.log4j.plugins.util.PluginManager)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1