final String username = remote.getUserName(); final String password = remote.getPassword(); if (username != null && password != null) {
/** * Writes the response for the {@link RemoteManagement} command to the stream. * * @param remotes the list of the {@link Remote}s of this repository * @throws StreamWriterException */ public void writeRemoteListResponse(List<Remote> remotes, boolean verbose) throws StreamWriterException { out.writeStartArray("Remote"); for (Remote remote : remotes) { out.writeStartArrayElement("Remote"); writeElement("name", remote.getName()); if (verbose) { writeElement("url", remote.getFetchURL()); if (remote.getUserName() != null) { writeElement("username", remote.getUserName()); } } out.writeEndArrayElement(); } out.writeEndArray(); }
public static RemoteInfo create(Remote remote) { RemoteInfo ri = new RemoteInfo(); String name = remote.getName(); ri.setName(name); String url = remote.getFetchURL(); ri.setURL(url); String userName = remote.getUserName(); ri.setUserName(userName); String password = remote.getPassword(); if (password != null) { password = Remote.decryptPassword(password); } ri.setPassword(password); ri.id = ri.hashCode(); return ri; }
assertEquals(true, remote.getMapped()); assertEquals("mappedBranch", remote.getMappedBranch()); assertEquals("username", remote.getUserName()); assertEquals("password", remote.getPassword()); assertEquals(false, remote2.getMapped()); assertEquals("*", remote2.getMappedBranch()); assertEquals(null, remote2.getUserName()); assertEquals(null, remote2.getPassword());