sshd: use PropertyResolver in test
Improve the SshTestGitServer API for accessing the server properties. Instead of returning the raw property map, return the proper sshd API abstraction PropertyResolver. This makes the interface more resilient against upstream changes. Change-Id: Ie5b685bddc4e59f3eb6c121026d3658d57618ca4 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
This commit is contained in:
parent
eb67862cba
commit
835e3225a8
|
@ -22,9 +22,9 @@
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.sshd.common.NamedResource;
|
import org.apache.sshd.common.NamedResource;
|
||||||
|
import org.apache.sshd.common.PropertyResolver;
|
||||||
import org.apache.sshd.common.PropertyResolverUtils;
|
import org.apache.sshd.common.PropertyResolverUtils;
|
||||||
import org.apache.sshd.common.SshConstants;
|
import org.apache.sshd.common.SshConstants;
|
||||||
import org.apache.sshd.common.config.keys.AuthorizedKeyEntry;
|
import org.apache.sshd.common.config.keys.AuthorizedKeyEntry;
|
||||||
|
@ -349,14 +349,14 @@ public void enableKeyboardInteractiveAuthentication() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the server's property map. This is a live map; changing it
|
* Retrieves the server's {@link PropertyResolver}, giving access to server
|
||||||
* affects the server.
|
* properties.
|
||||||
*
|
*
|
||||||
* @return a live map of the server's properties
|
* @return the {@link PropertyResolver}
|
||||||
* @since 5.9
|
* @since 5.9
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> getProperties() {
|
public PropertyResolver getPropertyResolver() {
|
||||||
return server.getProperties();
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.apache.sshd.client.config.hosts.KnownHostEntry;
|
import org.apache.sshd.client.config.hosts.KnownHostEntry;
|
||||||
|
import org.apache.sshd.common.PropertyResolverUtils;
|
||||||
import org.apache.sshd.server.ServerFactoryManager;
|
import org.apache.sshd.server.ServerFactoryManager;
|
||||||
import org.eclipse.jgit.api.Git;
|
import org.eclipse.jgit.api.Git;
|
||||||
import org.eclipse.jgit.api.errors.TransportException;
|
import org.eclipse.jgit.api.errors.TransportException;
|
||||||
|
@ -189,8 +190,8 @@ public void testHugePreamble() throws Exception {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCloneAndFetchWithSessionLimit() throws Exception {
|
public void testCloneAndFetchWithSessionLimit() throws Exception {
|
||||||
server.getProperties().put(ServerFactoryManager.MAX_CONCURRENT_SESSIONS,
|
PropertyResolverUtils.updateProperty(server.getPropertyResolver(),
|
||||||
Integer.valueOf(2));
|
ServerFactoryManager.MAX_CONCURRENT_SESSIONS, 2);
|
||||||
File localClone = cloneWith("ssh://localhost/doesntmatter",
|
File localClone = cloneWith("ssh://localhost/doesntmatter",
|
||||||
defaultCloneDir, null, //
|
defaultCloneDir, null, //
|
||||||
"Host localhost", //
|
"Host localhost", //
|
||||||
|
|
Loading…
Reference in New Issue