Repository: mina-sshd
Updated Branches:
  refs/heads/master 57c5ed623 -> a9d975b6d


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/a9d975b6/sshd-core/src/test/java/org/apache/sshd/common/PropertyResolverUtilsTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/common/PropertyResolverUtilsTest.java 
b/sshd-core/src/test/java/org/apache/sshd/common/PropertyResolverUtilsTest.java
new file mode 100644
index 0000000..9e90173
--- /dev/null
+++ 
b/sshd-core/src/test/java/org/apache/sshd/common/PropertyResolverUtilsTest.java
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sshd.common;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.sshd.common.session.Session;
+import org.apache.sshd.common.util.ValidateUtils;
+import org.apache.sshd.util.test.BaseTestSupport;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+import org.mockito.Mockito;
+
+/**
+ * @author <a href="mailto:[email protected]";>Apache MINA SSHD Project</a>
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class PropertyResolverUtilsTest extends BaseTestSupport {
+    public PropertyResolverUtilsTest() {
+        super();
+    }
+
+    @Test
+    public void testResolveAndUpdateClosestPropertyValue() {
+        final String NAME = getCurrentTestName();
+        final String ROOT_VALUE = getClass().getPackage().getName();
+        Session resolver = createMockSession();
+        FactoryManager root = 
ValidateUtils.checkNotNull(resolver.getFactoryManager(), "No manager");
+        assertNull("Unexpected root previous value", 
PropertyResolverUtils.updateProperty(root, NAME, ROOT_VALUE));
+        assertSame("Mismatched root value", ROOT_VALUE, 
PropertyResolverUtils.getString(resolver, NAME));
+
+        final String NODE_VALUE = getClass().getSimpleName();
+        assertNull("Unexpected node previous value", 
PropertyResolverUtils.updateProperty(resolver, NAME, NODE_VALUE));
+        assertSame("Mismatched node value", NODE_VALUE, 
PropertyResolverUtils.getString(resolver, NAME));
+    }
+
+    @Test
+    public void testLongProperty() {
+        final long expected = System.currentTimeMillis();
+        final String name = getCurrentTestName();
+
+        Session session = createMockSession();
+        assertEquals("Mismatched empty props value", expected, 
PropertyResolverUtils.getLongProperty(session, name, expected));
+
+        PropertyResolverUtils.updateProperty(session, name, expected);
+        testLongProperty(session, name, expected);
+
+        PropertyResolverUtils.updateProperty(session, name, 
Long.toString(expected));
+        testLongProperty(session, name, expected);
+    }
+
+    private void testLongProperty(PropertyResolver resolver, String name, long 
expected) {
+        Map<String, ?> props = resolver.getProperties();
+        Object value = props.get(name);
+        Class<?> type = value.getClass();
+        String storage = type.getSimpleName();
+
+        {
+            Long actual = PropertyResolverUtils.getLong(resolver, name);
+            assertNotNull("No actual Long value found for storage as " + 
storage, actual);
+            assertEquals("Mismatched values on Long retrieval for storage as " 
+ storage, expected, actual.longValue());
+        }
+
+        {
+            String actual = PropertyResolverUtils.getString(resolver, name);
+            assertNotNull("No actual String value found for storage as " + 
storage, actual);
+            assertEquals("Mismatched values on String retrieval for storage as 
" + storage, Long.toString(expected), actual.toString());
+        }
+    }
+
+    @Test
+    public void testIntegerProperty() {
+        final int expected = 3777347;
+        final String name = getCurrentTestName();
+
+        Session session = createMockSession();
+        assertEquals("Mismatched empty props value", expected, 
PropertyResolverUtils.getIntProperty(session, name, expected));
+
+        PropertyResolverUtils.updateProperty(session, name, expected);
+        testIntegerProperty(session, name, expected);
+
+        PropertyResolverUtils.updateProperty(session, name, 
Integer.toString(expected));
+        testIntegerProperty(session, name, expected);
+
+        // store as Long but retrieve as Integer
+        PropertyResolverUtils.updateProperty(session, name, 
Long.valueOf(expected));
+        testIntegerProperty(session, name, expected);
+    }
+
+    private void testIntegerProperty(PropertyResolver resolver, String name, 
int expected) {
+        Map<String, ?> props = resolver.getProperties();
+        Object value = props.get(name);
+        Class<?> type = value.getClass();
+        String storage = type.getSimpleName();
+
+        {
+            Integer actual = PropertyResolverUtils.getInteger(resolver, name);
+            assertNotNull("No actual Integer value found for storage as " + 
storage, actual);
+            assertEquals("Mismatched values on Integer retrieval for storage 
as " + storage, expected, actual.intValue());
+        }
+
+        {
+            String actual = PropertyResolverUtils.getString(resolver, name);
+            assertNotNull("No actual String value found for storage as " + 
storage, actual);
+            assertEquals("Mismatched values on String retrieval for storage as 
" + storage, Integer.toString(expected), actual.toString());
+        }
+    }
+
+    @Test
+    public void testBooleanProperty() {
+        for (final boolean expected : new boolean[]{false, true}) {
+            final String name = getCurrentTestName();
+
+            Session session = createMockSession();
+            assertEquals("Mismatched empty props value", expected, 
PropertyResolverUtils.getBooleanProperty(session, name, expected));
+
+            PropertyResolverUtils.updateProperty(session, name, expected);
+            testBooleanProperty(session, name, expected);
+
+            PropertyResolverUtils.updateProperty(session, name, 
Boolean.toString(expected));
+            testBooleanProperty(session, name, expected);
+        }
+    }
+
+    private void testBooleanProperty(PropertyResolver resolver, String name, 
boolean expected) {
+        Map<String, ?> props = resolver.getProperties();
+        Object value = props.get(name);
+        Class<?> type = value.getClass();
+        String storage = type.getSimpleName();
+
+        {
+            Boolean actual = PropertyResolverUtils.getBoolean(resolver, name);
+            assertNotNull("No actual Boolean value found for storage as " + 
storage, actual);
+            assertEquals("Mismatched values on Boolean retrieval for storage 
as " + storage, expected, actual.booleanValue());
+        }
+
+        {
+            String actual = PropertyResolverUtils.getString(resolver, name);
+            assertNotNull("No actual String value found for storage as " + 
storage, actual);
+            assertEquals("Mismatched values on String retrieval for storage as 
" + storage, Boolean.toString(expected), actual.toString());
+        }
+    }
+
+    private Session createMockSession() {
+        Map<String, Object> managerProps = new TreeMap<String, 
Object>(String.CASE_INSENSITIVE_ORDER);
+        FactoryManager manager = Mockito.mock(FactoryManager.class);
+        Mockito.when(manager.getProperties()).thenReturn(managerProps);
+        Mockito.when(manager.getParentPropertyResolver()).thenReturn(null);
+
+        Map<String, Object> sessionProps = new TreeMap<String, 
Object>(String.CASE_INSENSITIVE_ORDER);
+        Session session = Mockito.mock(Session.class);
+        Mockito.when(session.getUsername()).thenReturn(getCurrentTestName());
+        Mockito.when(session.getFactoryManager()).thenReturn(manager);
+        Mockito.when(session.getParentPropertyResolver()).thenReturn(manager);
+        Mockito.when(session.getProperties()).thenReturn(sessionProps);
+
+        return session;
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/a9d975b6/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java 
b/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
index 1f4d50a..0b873da 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
@@ -36,7 +36,7 @@ import org.apache.sshd.client.auth.UserInteraction;
 import org.apache.sshd.client.future.AuthFuture;
 import org.apache.sshd.client.session.ClientConnectionServiceFactory;
 import org.apache.sshd.client.session.ClientSession;
-import org.apache.sshd.common.FactoryManagerUtils;
+import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.io.IoSession;
 import org.apache.sshd.common.keyprovider.KeyPairProvider;
@@ -82,8 +82,8 @@ public class AuthenticationTest extends BaseTestSupport {
     @Before
     public void setUp() throws Exception {
         sshd = setupTestServer();
-        FactoryManagerUtils.updateProperty(sshd, 
ServerFactoryManager.WELCOME_BANNER, WELCOME);
-        FactoryManagerUtils.updateProperty(sshd, 
ServerFactoryManager.AUTH_METHODS, "publickey,password 
publickey,keyboard-interactive");
+        PropertyResolverUtils.updateProperty(sshd, 
ServerFactoryManager.WELCOME_BANNER, WELCOME);
+        PropertyResolverUtils.updateProperty(sshd, 
ServerFactoryManager.AUTH_METHODS, "publickey,password 
publickey,keyboard-interactive");
         sshd.setSessionFactory(new SessionFactory(sshd) {
             @Override
             protected ServerSessionImpl doCreateSession(IoSession ioSession) 
throws Exception {
@@ -179,7 +179,7 @@ public class AuthenticationTest extends BaseTestSupport {
                 }
             }
         ));
-        FactoryManagerUtils.updateProperty(sshd, 
ServerFactoryManager.AUTH_METHODS, UserAuthPasswordFactory.NAME);
+        PropertyResolverUtils.updateProperty(sshd, 
ServerFactoryManager.AUTH_METHODS, UserAuthPasswordFactory.NAME);
 
         try (SshClient client = setupTestClient()) {
             final AtomicInteger updatesCount = new AtomicInteger(0);
@@ -223,7 +223,7 @@ public class AuthenticationTest extends BaseTestSupport {
                         };
                     }
             }));
-            FactoryManagerUtils.updateProperty(client, 
ServerFactoryManager.AUTH_METHODS, UserAuthPasswordFactory.NAME);
+            PropertyResolverUtils.updateProperty(client, 
ServerFactoryManager.AUTH_METHODS, UserAuthPasswordFactory.NAME);
 
             client.start();
 
@@ -296,13 +296,13 @@ public class AuthenticationTest extends BaseTestSupport {
                 @Override
                 public InteractiveChallenge generateChallenge(ServerSession 
session, String username, String lang, String subMethods) {
                     assertEquals("Mismatched user language",
-                            FactoryManagerUtils.getStringProperty(
+                            PropertyResolverUtils.getStringProperty(
                                     client,
                                     
org.apache.sshd.client.auth.UserAuthKeyboardInteractive.INTERACTIVE_LANGUAGE_TAG,
                                     
org.apache.sshd.client.auth.UserAuthKeyboardInteractive.DEFAULT_INTERACTIVE_LANGUAGE_TAG),
                             lang);
                     assertEquals("Mismatched client sub-methods",
-                            FactoryManagerUtils.getStringProperty(
+                            PropertyResolverUtils.getStringProperty(
                                     client,
                                     
org.apache.sshd.client.auth.UserAuthKeyboardInteractive.INTERACTIVE_SUBMETHODS,
                                     
org.apache.sshd.client.auth.UserAuthKeyboardInteractive.DEFAULT_INTERACTIVE_SUBMETHODS),
@@ -367,7 +367,7 @@ public class AuthenticationTest extends BaseTestSupport {
             challenge.addPrompt(prompt, 
(GenericUtils.size(challenge.getPrompts()) & 0x1) != 0);
         }
 
-        FactoryManagerUtils.updateProperty(sshd, 
ServerFactoryManager.AUTH_METHODS, UserAuthKeyboardInteractiveFactory.NAME);
+        PropertyResolverUtils.updateProperty(sshd, 
ServerFactoryManager.AUTH_METHODS, UserAuthKeyboardInteractiveFactory.NAME);
         final AtomicInteger genCount = new AtomicInteger(0);
         final AtomicInteger authCount = new AtomicInteger(0);
         sshd.setKeyboardInteractiveAuthenticator(new 
KeyboardInteractiveAuthenticator() {
@@ -393,7 +393,7 @@ public class AuthenticationTest extends BaseTestSupport {
                 return true;
             }
         });
-        FactoryManagerUtils.updateProperty(sshd, 
ServerFactoryManager.AUTH_METHODS, UserAuthKeyboardInteractiveFactory.NAME);
+        PropertyResolverUtils.updateProperty(sshd, 
ServerFactoryManager.AUTH_METHODS, UserAuthKeyboardInteractiveFactory.NAME);
 
         try (SshClient client = setupTestClient()) {
             final AtomicInteger interactiveCount = new AtomicInteger(0);
@@ -430,7 +430,7 @@ public class AuthenticationTest extends BaseTestSupport {
                     throw new UnsupportedOperationException("Unexpected call");
                 }
             });
-            FactoryManagerUtils.updateProperty(client, 
ServerFactoryManager.AUTH_METHODS, UserAuthKeyboardInteractiveFactory.NAME);
+            PropertyResolverUtils.updateProperty(client, 
ServerFactoryManager.AUTH_METHODS, UserAuthKeyboardInteractiveFactory.NAME);
 
             client.start();
 
@@ -460,7 +460,7 @@ public class AuthenticationTest extends BaseTestSupport {
                 return delegate.authenticate(username, password, session);
             }
         });
-        FactoryManagerUtils.updateProperty(sshd, 
ServerFactoryManager.AUTH_METHODS, UserAuthPasswordFactory.NAME);
+        PropertyResolverUtils.updateProperty(sshd, 
ServerFactoryManager.AUTH_METHODS, UserAuthPasswordFactory.NAME);
 
         try (SshClient client = setupTestClient()) {
             final AtomicInteger updatesCount = new AtomicInteger(0);
@@ -483,7 +483,7 @@ public class AuthenticationTest extends BaseTestSupport {
                     return getCurrentTestName();
                 }
             });
-            FactoryManagerUtils.updateProperty(client, 
ServerFactoryManager.AUTH_METHODS, UserAuthPasswordFactory.NAME);
+            PropertyResolverUtils.updateProperty(client, 
ServerFactoryManager.AUTH_METHODS, UserAuthPasswordFactory.NAME);
 
             client.start();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/a9d975b6/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java
 
b/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java
index a6940d3..6c6cf0b 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java
@@ -23,6 +23,7 @@ import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Collections;
 
+import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.apache.sshd.util.test.BogusChannel;
 import org.junit.FixMethodOrder;
@@ -66,9 +67,10 @@ public class ChannelPipedInputStreamTest extends 
BaseTestSupport {
     }
 
     private static ChannelPipedInputStream createTestStream() {
-        Window window = new Window(new BogusChannel(), null, true, true);
-        window.init(Collections.<String,Object>emptyMap());
-        return new ChannelPipedInputStream(window);
+        AbstractChannel channel = new BogusChannel();
+        Window window = new Window(channel, null, true, true);
+        
window.init(PropertyResolverUtils.toPropertyResolver(Collections.<String, 
Object>emptyMap()));
+        return new ChannelPipedInputStream(channel, window);
     }
 
     private static void assertStreamEquals(byte[] expected, byte[] read) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/a9d975b6/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java 
b/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
index a42c3f4..f6a872f 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
@@ -36,7 +36,7 @@ import org.apache.sshd.client.channel.ClientChannel;
 import org.apache.sshd.client.future.OpenFuture;
 import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.FactoryManagerUtils;
+import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.RuntimeSshException;
 import org.apache.sshd.common.Service;
@@ -149,8 +149,8 @@ public class WindowTest extends BaseTestSupport {
     @Test
     public void testWindowConsumptionWithInvertedStreams() throws Exception {
         sshd.setShellFactory(new AsyncEchoShellFactory());
-        FactoryManagerUtils.updateProperty(sshd, FactoryManager.WINDOW_SIZE, 
1024);
-        FactoryManagerUtils.updateProperty(client, FactoryManager.WINDOW_SIZE, 
1024);
+        PropertyResolverUtils.updateProperty(sshd, FactoryManager.WINDOW_SIZE, 
1024);
+        PropertyResolverUtils.updateProperty(client, 
FactoryManager.WINDOW_SIZE, 1024);
         client.start();
 
         try (ClientSession session = client.connect(getCurrentTestName(), 
TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -196,8 +196,8 @@ public class WindowTest extends BaseTestSupport {
     @Test
     public void testWindowConsumptionWithDirectStreams() throws Exception {
         sshd.setShellFactory(new AsyncEchoShellFactory());
-        FactoryManagerUtils.updateProperty(sshd, FactoryManager.WINDOW_SIZE, 
1024);
-        FactoryManagerUtils.updateProperty(client, FactoryManager.WINDOW_SIZE, 
1024);
+        PropertyResolverUtils.updateProperty(sshd, FactoryManager.WINDOW_SIZE, 
1024);
+        PropertyResolverUtils.updateProperty(client, 
FactoryManager.WINDOW_SIZE, 1024);
 
         client.start();
 
@@ -250,8 +250,8 @@ public class WindowTest extends BaseTestSupport {
     @Test
     public void testWindowConsumptionWithAsyncStreams() throws Exception {
         sshd.setShellFactory(new AsyncEchoShellFactory());
-        FactoryManagerUtils.updateProperty(sshd, FactoryManager.WINDOW_SIZE, 
1024);
-        FactoryManagerUtils.updateProperty(client, FactoryManager.WINDOW_SIZE, 
1024);
+        PropertyResolverUtils.updateProperty(sshd, FactoryManager.WINDOW_SIZE, 
1024);
+        PropertyResolverUtils.updateProperty(client, 
FactoryManager.WINDOW_SIZE, 1024);
 
         client.start();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/a9d975b6/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTimeoutTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTimeoutTest.java 
b/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTimeoutTest.java
index 03b87b0..137e53b 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTimeoutTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTimeoutTest.java
@@ -24,6 +24,7 @@ import java.net.SocketTimeoutException;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.sshd.client.future.OpenFuture;
+import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.junit.After;
@@ -86,7 +87,7 @@ public class WindowTimeoutTest extends BaseTestSupport {
     @Test
     public void testWindowWaitForSpaceTimeout() throws Exception {
         try(Window window = channel.getLocalWindow()) {
-            window.init(AbstractChannel.DEFAULT_WINDOW_SIZE, 
AbstractChannel.DEFAULT_PACKET_SIZE, null);
+            window.init(FactoryManager.DEFAULT_WINDOW_SIZE, 
FactoryManager.DEFAULT_MAX_PACKET_SIZE, null);
             window.consume(window.getSize());
             assertEquals("Window not empty", 0, window.getSize());
 
@@ -115,7 +116,7 @@ public class WindowTimeoutTest extends BaseTestSupport {
     @Test
     public void testWindowWaitAndConsumeTimeout() throws Exception {
         try(Window window = channel.getLocalWindow()) {
-            window.init(AbstractChannel.DEFAULT_WINDOW_SIZE, 
AbstractChannel.DEFAULT_PACKET_SIZE, null);
+            window.init(FactoryManager.DEFAULT_WINDOW_SIZE, 
FactoryManager.DEFAULT_MAX_PACKET_SIZE, null);
 
             long waitStart = System.nanoTime();
             try

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/a9d975b6/sshd-core/src/test/java/org/apache/sshd/common/io/nio2/Nio2ServiceTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/common/io/nio2/Nio2ServiceTest.java 
b/sshd-core/src/test/java/org/apache/sshd/common/io/nio2/Nio2ServiceTest.java
index 0fe5ceb..bec174d 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/common/io/nio2/Nio2ServiceTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/common/io/nio2/Nio2ServiceTest.java
@@ -23,7 +23,7 @@ import java.net.Socket;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.FactoryManagerUtils;
+import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.junit.FixMethodOrder;
@@ -42,12 +42,12 @@ public class Nio2ServiceTest extends BaseTestSupport {
     @Test   // see SSHD-554
     public void testSetSocketOptions() throws Exception {
         try(SshServer sshd = setupTestServer()) {
-            FactoryManagerUtils.updateProperty(sshd, 
FactoryManager.SOCKET_KEEPALIVE, true);
-            FactoryManagerUtils.updateProperty(sshd, 
FactoryManager.SOCKET_LINGER, 5);
-            FactoryManagerUtils.updateProperty(sshd, 
FactoryManager.SOCKET_RCVBUF, 1024);
-            FactoryManagerUtils.updateProperty(sshd, 
FactoryManager.SOCKET_REUSEADDR, true);
-            FactoryManagerUtils.updateProperty(sshd, 
FactoryManager.SOCKET_SNDBUF, 1024);
-            FactoryManagerUtils.updateProperty(sshd, 
FactoryManager.TCP_NODELAY, true);
+            PropertyResolverUtils.updateProperty(sshd, 
FactoryManager.SOCKET_KEEPALIVE, true);
+            PropertyResolverUtils.updateProperty(sshd, 
FactoryManager.SOCKET_LINGER, 5);
+            PropertyResolverUtils.updateProperty(sshd, 
FactoryManager.SOCKET_RCVBUF, 1024);
+            PropertyResolverUtils.updateProperty(sshd, 
FactoryManager.SOCKET_REUSEADDR, true);
+            PropertyResolverUtils.updateProperty(sshd, 
FactoryManager.SOCKET_SNDBUF, 1024);
+            PropertyResolverUtils.updateProperty(sshd, 
FactoryManager.TCP_NODELAY, true);
 
             sshd.start();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/a9d975b6/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java 
b/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
index 257d98a..957ef5f 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/ServerTest.java
@@ -48,7 +48,7 @@ import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.client.session.ClientSessionImpl;
 import org.apache.sshd.client.session.SessionFactory;
 import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.FactoryManagerUtils;
+import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.channel.Channel;
 import org.apache.sshd.common.channel.TestChannelListener;
@@ -120,7 +120,7 @@ public class ServerTest extends BaseTestSupport {
     @Test
     public void testFailAuthenticationWithWaitFor() throws Exception {
         final int MAX_AUTH_REQUESTS = 10;
-        FactoryManagerUtils.updateProperty(sshd, 
ServerFactoryManager.MAX_AUTH_REQUESTS, MAX_AUTH_REQUESTS);
+        PropertyResolverUtils.updateProperty(sshd, 
ServerFactoryManager.MAX_AUTH_REQUESTS, MAX_AUTH_REQUESTS);
 
         client.setServiceFactories(Arrays.asList(
                 new ClientUserAuthServiceOld.Factory(),
@@ -149,7 +149,7 @@ public class ServerTest extends BaseTestSupport {
     @Test
     public void testFailAuthenticationWithFuture() throws Exception {
         final int MAX_AUTH_REQUESTS = 10;
-        FactoryManagerUtils.updateProperty(sshd, 
ServerFactoryManager.MAX_AUTH_REQUESTS, MAX_AUTH_REQUESTS);
+        PropertyResolverUtils.updateProperty(sshd, 
ServerFactoryManager.MAX_AUTH_REQUESTS, MAX_AUTH_REQUESTS);
 
         client.setServiceFactories(Arrays.asList(
                 new ClientUserAuthServiceOld.Factory(),
@@ -179,7 +179,7 @@ public class ServerTest extends BaseTestSupport {
     @Test
     public void testAuthenticationTimeout() throws Exception {
         final long AUTH_TIMEOUT = TimeUnit.SECONDS.toMillis(5L);
-        FactoryManagerUtils.updateProperty(sshd, FactoryManager.AUTH_TIMEOUT, 
AUTH_TIMEOUT);
+        PropertyResolverUtils.updateProperty(sshd, 
FactoryManager.AUTH_TIMEOUT, AUTH_TIMEOUT);
 
         client.start();
         try (ClientSession s = client.connect(getCurrentTestName(), 
TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -196,7 +196,7 @@ public class ServerTest extends BaseTestSupport {
         final CountDownLatch latch = new CountDownLatch(1);
         TestEchoShell.latch = new CountDownLatch(1);
         final long IDLE_TIMEOUT = 2500;
-        FactoryManagerUtils.updateProperty(sshd, FactoryManager.IDLE_TIMEOUT, 
IDLE_TIMEOUT);
+        PropertyResolverUtils.updateProperty(sshd, 
FactoryManager.IDLE_TIMEOUT, IDLE_TIMEOUT);
 
         sshd.addSessionListener(new SessionListener() {
             @Override
@@ -259,10 +259,10 @@ public class ServerTest extends BaseTestSupport {
         sshd.setCommandFactory(new StreamCommand.Factory());
 
         final long IDLE_TIMEOUT_VALUE = TimeUnit.SECONDS.toMillis(5L);
-        FactoryManagerUtils.updateProperty(sshd, FactoryManager.IDLE_TIMEOUT, 
IDLE_TIMEOUT_VALUE);
+        PropertyResolverUtils.updateProperty(sshd, 
FactoryManager.IDLE_TIMEOUT, IDLE_TIMEOUT_VALUE);
 
         final long DISCONNECT_TIMEOUT_VALUE = TimeUnit.SECONDS.toMillis(2L);
-        FactoryManagerUtils.updateProperty(sshd, 
FactoryManager.DISCONNECT_TIMEOUT, DISCONNECT_TIMEOUT_VALUE);
+        PropertyResolverUtils.updateProperty(sshd, 
FactoryManager.DISCONNECT_TIMEOUT, DISCONNECT_TIMEOUT_VALUE);
 
         sshd.addSessionListener(new SessionListener() {
             @Override
@@ -697,7 +697,7 @@ public class ServerTest extends BaseTestSupport {
 
     public static void main(String[] args) throws Exception {
         SshServer sshd = Utils.setupTestServer(ServerTest.class);
-        FactoryManagerUtils.updateProperty(sshd, FactoryManager.IDLE_TIMEOUT, 
TimeUnit.SECONDS.toMillis(10L));
+        PropertyResolverUtils.updateProperty(sshd, 
FactoryManager.IDLE_TIMEOUT, TimeUnit.SECONDS.toMillis(10L));
         sshd.setPort(8001);
         sshd.setSubsystemFactories(Arrays.<NamedFactory<Command>>asList(new 
SftpSubsystemFactory()));
         sshd.setCommandFactory(new ScpCommandFactory());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/a9d975b6/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
 
b/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
index 0a4f15d..4b30dec 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
@@ -23,6 +23,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.channel.ChannelAsyncOutputStream;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
@@ -50,7 +51,7 @@ public class ChannelSessionTest extends BaseTestSupport {
 
         try (ChannelSession channelSession = new ChannelSession() {
                 {
-                    
this.remoteWindow.init(Collections.<String,Object>emptyMap());
+                    
this.remoteWindow.init(PropertyResolverUtils.toPropertyResolver(Collections.<String,Object>emptyMap()));
                 }
         }) {
             final AtomicBoolean expanded = new AtomicBoolean(false);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/a9d975b6/sshd-core/src/test/java/org/apache/sshd/util/test/Utils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/util/test/Utils.java 
b/sshd-core/src/test/java/org/apache/sshd/util/test/Utils.java
index 5940b42..033be14 100644
--- a/sshd-core/src/test/java/org/apache/sshd/util/test/Utils.java
+++ b/sshd-core/src/test/java/org/apache/sshd/util/test/Utils.java
@@ -604,5 +604,4 @@ public class Utils {
             return bytes;
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/a9d975b6/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSession.java
----------------------------------------------------------------------
diff --git 
a/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSession.java 
b/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSession.java
index ff2191e..00a63b6 100644
--- a/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSession.java
+++ b/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSession.java
@@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.sshd.client.SshClient;
 import org.apache.sshd.client.channel.ChannelExec;
 import org.apache.sshd.client.session.ClientSession;
-import org.apache.sshd.common.FactoryManagerUtils;
+import org.apache.sshd.common.PropertyResolverUtils;
 import org.apache.sshd.common.util.logging.AbstractLoggingBean;
 import org.eclipse.jgit.transport.CredentialItem;
 import org.eclipse.jgit.transport.CredentialsProvider;
@@ -87,7 +87,7 @@ public class GitSshdSession extends AbstractLoggingBean 
implements RemoteSession
         client.start();
 
         session = client.connect(user, host, port)
-                        .verify(FactoryManagerUtils.getLongProperty(client, 
CONNECT_TIMEOUT_PROP, DEFAULT_CONNECT_TIMEOUT))
+                        .verify(PropertyResolverUtils.getLongProperty(client, 
CONNECT_TIMEOUT_PROP, DEFAULT_CONNECT_TIMEOUT))
                         .getSession();
         if (log.isDebugEnabled()) {
             log.debug("Connected to {}:{}", host, port);
@@ -98,7 +98,7 @@ public class GitSshdSession extends AbstractLoggingBean 
implements RemoteSession
         if (pass2 != null) {
             session.addPasswordIdentity(new String(pass2));
         }
-        session.auth().verify(FactoryManagerUtils.getLongProperty(session, 
AUTH_TIMEOUT_PROP, DEFAULT_AUTH_TIMEOUT));
+        session.auth().verify(PropertyResolverUtils.getLongProperty(session, 
AUTH_TIMEOUT_PROP, DEFAULT_AUTH_TIMEOUT));
         if (log.isDebugEnabled()) {
             log.debug("Authenticated: {}", session);
         }
@@ -111,7 +111,7 @@ public class GitSshdSession extends AbstractLoggingBean 
implements RemoteSession
         }
 
         ChannelExec channel = session.createExecChannel(commandName);
-        channel.open().verify(FactoryManagerUtils.getLongProperty(channel, 
CHANNEL_OPEN_TIMEOUT_PROPT, DEFAULT_CHANNEL_OPEN_TIMEOUT));
+        channel.open().verify(PropertyResolverUtils.getLongProperty(channel, 
CHANNEL_OPEN_TIMEOUT_PROPT, DEFAULT_CHANNEL_OPEN_TIMEOUT));
         return new GitSshdSessionProcess(channel, commandName, timeout);
     }
 

Reply via email to