throws BadFencingConfigurationException { Args args = new Args(argsStr); InetSocketAddress serviceAddr = target.getAddress(); String host = serviceAddr.getHostName();
public Args(String arg) throws BadFencingConfigurationException { user = System.getProperty("user.name"); sshPort = DEFAULT_SSH_PORT; // Parse optional user and ssh port if (arg != null && !arg.isEmpty()) { Matcher m = USER_PORT_RE.matcher(arg); if (!m.matches()) { throw new BadFencingConfigurationException( "Unable to parse user and SSH port: "+ arg); } if (m.group(1) != null) { user = m.group(1); } if (m.group(2) != null) { sshPort = parseConfiggedPort(m.group(2)); } } }
throws BadFencingConfigurationException { Args args = new Args(argsStr); InetSocketAddress serviceAddr = target.getAddress(); String host = serviceAddr.getHostName();
throws BadFencingConfigurationException { Args args = new Args(argsStr); InetSocketAddress serviceAddr = target.getAddress(); String host = serviceAddr.getHostName();
throws BadFencingConfigurationException { Args args = new Args(argsStr); InetSocketAddress serviceAddr = target.getAddress(); String host = serviceAddr.getHostName();
throws BadFencingConfigurationException { Args args = new Args(argsStr); InetSocketAddress serviceAddr = target.getAddress(); String host = serviceAddr.getHostName();
public Args(String arg) throws BadFencingConfigurationException { user = System.getProperty("user.name"); sshPort = DEFAULT_SSH_PORT; // Parse optional user and ssh port if (arg != null && !arg.isEmpty()) { Matcher m = USER_PORT_RE.matcher(arg); if (!m.matches()) { throw new BadFencingConfigurationException( "Unable to parse user and SSH port: "+ arg); } if (m.group(1) != null) { user = m.group(1); } if (m.group(2) != null) { sshPort = parseConfiggedPort(m.group(2)); } } }
@Test public void testArgsParsing() throws BadFencingConfigurationException { Args args = new SshFenceByTcpPort.Args(null); assertEquals(System.getProperty("user.name"), args.user); assertEquals(22, args.sshPort); args = new SshFenceByTcpPort.Args(""); assertEquals(System.getProperty("user.name"), args.user); assertEquals(22, args.sshPort); args = new SshFenceByTcpPort.Args("12345"); assertEquals("12345", args.user); assertEquals(22, args.sshPort); args = new SshFenceByTcpPort.Args(":12345"); assertEquals(System.getProperty("user.name"), args.user); assertEquals(12345, args.sshPort); args = new SshFenceByTcpPort.Args("foo:2222"); assertEquals("foo", args.user); assertEquals(2222, args.sshPort); }
@Test public void testArgsParsing() throws BadFencingConfigurationException { Args args = new SshFenceByTcpPort.Args(null); assertEquals(System.getProperty("user.name"), args.user); assertEquals(22, args.sshPort); args = new SshFenceByTcpPort.Args(""); assertEquals(System.getProperty("user.name"), args.user); assertEquals(22, args.sshPort); args = new SshFenceByTcpPort.Args("12345"); assertEquals("12345", args.user); assertEquals(22, args.sshPort); args = new SshFenceByTcpPort.Args(":12345"); assertEquals(System.getProperty("user.name"), args.user); assertEquals(12345, args.sshPort); args = new SshFenceByTcpPort.Args("foo:2222"); assertEquals("foo", args.user); assertEquals(2222, args.sshPort); }
public Args(String arg) throws BadFencingConfigurationException { user = System.getProperty("user.name"); sshPort = DEFAULT_SSH_PORT; // Parse optional user and ssh port if (arg != null && !arg.isEmpty()) { Matcher m = USER_PORT_RE.matcher(arg); if (!m.matches()) { throw new BadFencingConfigurationException( "Unable to parse user and SSH port: "+ arg); } if (m.group(1) != null) { user = m.group(1); } if (m.group(2) != null) { sshPort = parseConfiggedPort(m.group(2)); } } }
public Args(String arg) throws BadFencingConfigurationException { user = System.getProperty("user.name"); sshPort = DEFAULT_SSH_PORT; // Parse optional user and ssh port if (arg != null && !arg.isEmpty()) { Matcher m = USER_PORT_RE.matcher(arg); if (!m.matches()) { throw new BadFencingConfigurationException( "Unable to parse user and SSH port: "+ arg); } if (m.group(1) != null) { user = m.group(1); } if (m.group(2) != null) { sshPort = parseConfiggedPort(m.group(2)); } } }
public Args(String arg) throws BadFencingConfigurationException { user = System.getProperty("user.name"); sshPort = DEFAULT_SSH_PORT; // Parse optional user and ssh port if (arg != null && !arg.isEmpty()) { Matcher m = USER_PORT_RE.matcher(arg); if (!m.matches()) { throw new BadFencingConfigurationException( "Unable to parse user and SSH port: "+ arg); } if (m.group(1) != null) { user = m.group(1); } if (m.group(2) != null) { sshPort = parseConfiggedPort(m.group(2)); } } }
private void assertBadArgs(String argStr) { try { new Args(argStr); fail("Did not fail on bad args: " + argStr); } catch (BadFencingConfigurationException e) { // Expected } }
/** * Verify that the argument, if given, in the conf is parseable. */ @Override public void checkArgs(String argStr) throws BadFencingConfigurationException { if (argStr != null) { new Args(argStr); } }
/** * Verify that the argument, if given, in the conf is parseable. */ @Override public void checkArgs(String argStr) throws BadFencingConfigurationException { if (argStr != null) { new Args(argStr); } }
/** * Verify that the argument, if given, in the conf is parseable. */ @Override public void checkArgs(String argStr) throws BadFencingConfigurationException { if (argStr != null) { new Args(argStr); } }
/** * Verify that the argument, if given, in the conf is parseable. */ @Override public void checkArgs(String argStr) throws BadFencingConfigurationException { if (argStr != null) { new Args(argStr); } }
private void assertBadArgs(String argStr) { try { new Args(argStr); fail("Did not fail on bad args: " + argStr); } catch (BadFencingConfigurationException e) { // Expected } }
/** * Verify that the argument, if given, in the conf is parseable. */ @Override public void checkArgs(String argStr) throws BadFencingConfigurationException { if (argStr != null) { new Args(argStr); } }