@Test void getServerIdForDataPart_empty() { MockConfigPart data = new MockConfigPart() .withNoPassword(); assertEquals("null" + SEP + "null" + SEP + "null" + SEP + "null" + SEP + "null", ServerConfig.getServerIdForDataPart(data)); }
private static MockConfigPart createConfigPart() { return new MockConfigPart() // By using the RSH port, it means that the connection will be kept open // (NTS connection). By keeping the connection open until explicitly // disconnected, this will indirectly be testing that the // SimpleConnectionManager closes the connection. .withServerName("1234") .withUsername("u") .withNoPassword() .withClientname("client1"); }
private ClientConfig createClientConfig() { MockConfigPart part = new MockConfigPart() // By using the RSH port, it means that the connection will be kept open // (NTS connection). By keeping the connection open until explicitly // disconnected, this will indirectly be testing that the // SimpleConnectionManager closes the connection. .withServerName(p4.getPort()) .withUsername(p4.getUser()) .withClientname("client") .withNoPassword(); final ServerConfig serverConfig = ServerConfig.createFrom(part); return ClientConfig.createFrom(serverConfig, part); } }
.withNoPassword() ); final MockP4RequestErrorHandler errorHandler = new MockP4RequestErrorHandler();
public MockConfigPart copy() { MockConfigPart ret = new MockConfigPart() .withSourceName(sourceName) .withP4ServerName(serverName) .withClientname(clientname) .withUsername(username) .withAuthTicketFile(authTicketFile) .withTrustTicketFile(trustTicketFile) .withServerFingerprint(serverFingerprint) .withClientHostname(clientHostname) .withIgnoreFileName(ignoreFileName) .withDefaultCharset(defaultCharset) .withLoginSso(loginSso) .withReloadValue(reloadValue) .withRequiresUserEnteredPassword(requiresUserEnteredPassword); if (hasPasswordSet) { ret.withPassword(password); } else { ret.withNoPassword(); } return ret; }
.withNoPassword() .withClientname("client1"); final ServerConfig serverConfig = ServerConfig.createFrom(part);
.withNoPassword() .withClientname("client1"); final ServerConfig serverConfig = ServerConfig.createFrom(part);
.withNoPassword() .withClientname("client1"); final ServerConfig serverConfig = ServerConfig.createFrom(part);
.withNoPassword() .withClientname("client1"); final ServerConfig serverConfig = ServerConfig.createFrom(part);
.withNoPassword() .withClientname("client1"); final ServerConfig serverConfig = ServerConfig.createFrom(part);
.withNoPassword() .withClientname("client1"); final ServerConfig serverConfig = ServerConfig.createFrom(part);
.withNoPassword() .withClientname("client1"); final ServerConfig serverConfig = ServerConfig.createFrom(part);
.withNoPassword() .withClientname("client1"); final ServerConfig serverConfig = ServerConfig.createFrom(part);
.withNoPassword() .withClientname("client1"); final ServerConfig serverConfig = ServerConfig.createFrom(part);
.withNoPassword() .withClientname("client1"); final ServerConfig serverConfig = ServerConfig.createFrom(part);
.withNoPassword() .withClientname("client1"); final ServerConfig serverConfig = ServerConfig.createFrom(part);
.withNoPassword() ); final MockP4RequestErrorHandler errorHandler = new MockP4RequestErrorHandler();
.withNoPassword() .withClientname("client1"); final ServerConfig serverConfig = ServerConfig.createFrom(part);
@Test void isSameServer_empty() { MockConfigPart part1 = new MockConfigPart() .withUsername("u1") .withServerName("n1:1"); ServerConfig sc = ServerConfig.createFrom(part1); assertTrue(sc.isSameServerConnection(part1)); // Change it in the client ways, and it's still the same server. part1.withClientHostname("h1").withClientname("cc") .withDefaultCharset("a1").withIgnoreFileName("i") .withReloadValue(false); assertTrue(sc.isSameServerConnection(part1)); // Change the user MockConfigPart part2 = part1.copy() .withUsername("u2"); assertFalse(sc.isSameServerConnection(part2)); // change the server name MockConfigPart part3 = part1.copy() .withServerName("n2:1"); assertFalse(sc.isSameServerConnection(part3)); // change the password MockConfigPart part4 = part1.copy() .withPassword("a"); assertFalse(sc.isSameServerConnection(part4)); part4.withNoPassword().withRequiresUserEnteredPassword(true); assertFalse(sc.isSameServerConnection(part4)); }
.withNoPassword() .withClientname("client1"); final ServerConfig serverConfig = ServerConfig.createFrom(part);