@NotNull public String getUrl() { // Trim the config port. See bug #23 return getServerProtocol() + PROTOCOL_SEP + getServerPort().trim(); }
@NotNull public String getDisplayName() { if (getServerProtocol().isSecure()) { return "ssl:" + getServerPort(); } return getServerPort(); }
@Test void forPort_justPort() { P4ServerName name = P4ServerName.forPort("1667"); assertThat("null", name, notNullValue()); assertThat("secure", name.isSecure(), is(false)); assertThat("connection type", name.getServerProtocol(), is(IServerAddress.Protocol.P4JRPCNTS)); assertThat("port", name.getServerPort(), is("localhost:1667")); assertThat("display", name.getDisplayName(), is("localhost:1667")); assertThat("url", name.getUrl(), is("p4jrpcnts://localhost:1667")); assertThat("full port", name.getFullPort(), is("localhost:1667")); assertThat("protocol name", name.getProtocolName(), is("java")); }
@Test void forPort_ssl() { P4ServerName name = P4ServerName.forPort("ssl://host:1234"); assertThat("null", name, notNullValue()); assertThat("secure", name.isSecure(), is(true)); assertThat("connection type", name.getServerProtocol(), is(IServerAddress.Protocol.P4JRPCNTSSSL)); assertThat("port", name.getServerPort(), is("host:1234")); assertThat("display", name.getDisplayName(), is("ssl:host:1234")); assertThat("url", name.getUrl(), is("p4jrpcntsssl://host:1234")); assertThat("full port", name.getFullPort(), is("ssl://host:1234")); assertThat("protocol name", name.getProtocolName(), is("ssl")); }
@Test void forPort_simpleProtocolPort() { P4ServerName name = P4ServerName.forPort("tcp:host:1234"); assertThat("null", name, notNullValue()); assertThat("secure", name.isSecure(), is(false)); assertThat("connection type", name.getServerProtocol(), is(IServerAddress.Protocol.P4JRPCNTS)); assertThat("port", name.getServerPort(), is("host:1234")); assertThat("display", name.getDisplayName(), is("host:1234")); assertThat("url", name.getUrl(), is("p4jrpcnts://host:1234")); assertThat("full port", name.getFullPort(), is("host:1234")); assertThat("protocol name", name.getProtocolName(), is("java")); }
@ExtendWith(TemporaryFolderExtension.class) @Test void forPort_rsh(TemporaryFolder tmpDir) { // This is what the TestServer uses as the protocol. String port = "p4jrsh://" + tmpDir.newFile("p4d").getAbsolutePath() + " -r " + tmpDir.newFile("root").getAbsolutePath() + ' ' + " -L log -i --java"; P4ServerName name = P4ServerName.forPort(port); assertNotNull(name); assertThat(name.getServerProtocol(), is(IServerAddress.Protocol.P4JRSHNTS)); }
@Test void forPort_hostPort() { P4ServerName name = P4ServerName.forPort("host:1234"); assertThat("null", name, notNullValue()); assertThat("secure", name.isSecure(), is(false)); assertThat("connection type", name.getServerProtocol(), is(IServerAddress.Protocol.P4JRPCNTS)); assertThat("port", name.getServerPort(), is("host:1234")); assertThat("display", name.getDisplayName(), is("host:1234")); assertThat("url", name.getUrl(), is("p4jrpcnts://host:1234")); assertThat("full port", name.getFullPort(), is("host:1234")); assertThat("protocol name", name.getProtocolName(), is("java")); }
" is not the same ref as " + ref); LOG.debug("param ref: clientname: [" + ref.getClientName() + "]; server [" + ref.getServerName().getServerPort() + "]; protocol [" + ref.getServerName().getServerProtocol() + "]"); ClientServerRef rt = root.getClientConfig().getClientServerRef(); LOG.debug("root ref: clientname: [" + rt.getClientName() + "]; server [" + rt.getServerName().getServerPort() + "]; protocol [" + rt.getServerName().getServerProtocol() + "]");
} else { LOG.debug("isSameServerConnection: server doesn't match: " + getServerName().getServerPort() + "::" + getServerName().getServerProtocol() + " <> " + part.getServerName().getServerPort() + "::" + part.getServerName().getServerProtocol());