Search in sources :

Example 1 with ValidatingPluginWithGenericBuilder

use of org.apache.logging.log4j.core.config.plugins.validation.ValidatingPluginWithGenericBuilder in project logging-log4j2 by apache.

the class ValidatingPluginWithGenericBuilderTest method testNonNullValue.

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

Example 2 with ValidatingPluginWithGenericBuilder

use of org.apache.logging.log4j.core.config.plugins.validation.ValidatingPluginWithGenericBuilder in project logging-log4j2 by apache.

the class ValidatingPluginWithGenericBuilderTest method testNullDefaultValue.

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

Example 3 with ValidatingPluginWithGenericBuilder

use of org.apache.logging.log4j.core.config.plugins.validation.ValidatingPluginWithGenericBuilder in project logging-log4j2 by apache.

the class ValidatingPluginWithGenericBuilderTest method setUp.

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

Aggregations

ValidatingPluginWithGenericBuilder (org.apache.logging.log4j.core.config.plugins.validation.ValidatingPluginWithGenericBuilder)3 NullConfiguration (org.apache.logging.log4j.core.config.NullConfiguration)2 PluginBuilder (org.apache.logging.log4j.core.config.plugins.util.PluginBuilder)2 Test (org.junit.Test)2 Node (org.apache.logging.log4j.core.config.Node)1 PluginManager (org.apache.logging.log4j.core.config.plugins.util.PluginManager)1 Before (org.junit.Before)1