use of org.apache.logging.log4j.plugins.test.validation.HostAndPort in project logging-log4j2 by apache.
the class ValidPortValidatorTest method setUp.
@SuppressWarnings("unchecked")
@BeforeEach
public void setUp() throws Exception {
final PluginManager manager = new PluginManager("Test");
manager.collectPlugins();
plugin = (PluginType<HostAndPort>) manager.getPluginType("HostAndPort");
assertNotNull(plugin, "Rebuild this module to ensure annotation processing has been done.");
node = new Node(null, "HostAndPort", plugin);
node.getAttributes().put("host", "localhost");
}
use of org.apache.logging.log4j.plugins.test.validation.HostAndPort in project logging-log4j2 by apache.
the class ValidHostValidatorTest method testLocalhost.
@Test
public void testLocalhost() throws Exception {
node.getAttributes().put("host", "localhost");
node.getAttributes().put("port", "1");
final HostAndPort hostAndPort = buildPlugin();
assertNotNull(hostAndPort);
assertTrue(hostAndPort.isValid());
}
use of org.apache.logging.log4j.plugins.test.validation.HostAndPort in project logging-log4j2 by apache.
the class ValidHostValidatorTest method setUp.
@SuppressWarnings("unchecked")
@BeforeEach
public void setUp() throws Exception {
final PluginManager manager = new PluginManager("Test");
manager.collectPlugins();
plugin = (PluginType<HostAndPort>) manager.getPluginType("HostAndPort");
assertNotNull(plugin, "Rebuild this module to ensure annotation processing has been done.");
node = new Node(null, "HostAndPort", plugin);
}
use of org.apache.logging.log4j.plugins.test.validation.HostAndPort in project logging-log4j2 by apache.
the class ValidHostValidatorTest method testInvalidIpAddress.
@Test
public void testInvalidIpAddress() throws Exception {
node.getAttributes().put("host", "256.256.256.256");
node.getAttributes().put("port", "1");
final HostAndPort plugin = buildPlugin();
assertNull(plugin, "Expected null, but got: " + plugin);
}
Aggregations