Search in sources :

Example 1 with ValidatingPluginWithTypedBuilder

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

the class ValidatingPluginWithTypedBuilderTest method testNullDefaultValue.

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

Example 2 with ValidatingPluginWithTypedBuilder

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

the class ValidatingPluginWithTypedBuilderTest method testNonNullValue.

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

Example 3 with ValidatingPluginWithTypedBuilder

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

the class ValidatingPluginWithTypedBuilderTest method setUp.

@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
    final PluginManager manager = new PluginManager("Test");
    manager.collectPlugins();
    plugin = (PluginType<ValidatingPluginWithTypedBuilder>) manager.getPluginType("ValidatingPluginWithTypedBuilder");
    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) ValidatingPluginWithTypedBuilder(org.apache.logging.log4j.core.config.plugins.validation.ValidatingPluginWithTypedBuilder) Node(org.apache.logging.log4j.core.config.Node) Before(org.junit.Before)

Aggregations

ValidatingPluginWithTypedBuilder (org.apache.logging.log4j.core.config.plugins.validation.ValidatingPluginWithTypedBuilder)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