You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/06/01 14:59:04 UTC

[jira] [Commented] (KARAF-5173) Some tests could benefit from a common CallbackHandler

    [ https://issues.apache.org/jira/browse/KARAF-5173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16033110#comment-16033110 ] 

ASF GitHub Bot commented on KARAF-5173:
---------------------------------------

GitHub user skitt opened a pull request:

    https://github.com/apache/karaf/pull/310

    [KARAF-5173] Provide an impl of CallbackHandler

    A number of tests use an anonymous class implementing CallbackHandler
    with the same pattern, username and password. This patch introduces
    NamePasswordCallbackHandler and uses it where appropriate.
    
    Signed-off-by: Stephen Kitt <sk...@redhat.com>

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/skitt/karaf name-password-callback-handler

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/karaf/pull/310.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #310
    
----
commit 724af841f4f1d8c4cf47eae07002c838e562a30b
Author: Stephen Kitt <sk...@redhat.com>
Date:   2017-06-01T06:57:42Z

    [KARAF-5173] Provide an impl of CallbackHandler
    
    A number of tests use an anonymous class implementing CallbackHandler
    with the same pattern, username and password. This patch introduces
    NamePasswordCallbackHandler and uses it where appropriate.
    
    Signed-off-by: Stephen Kitt <sk...@redhat.com>

----


> Some tests could benefit from a common CallbackHandler
> ------------------------------------------------------
>
>                 Key: KARAF-5173
>                 URL: https://issues.apache.org/jira/browse/KARAF-5173
>             Project: Karaf
>          Issue Type: Improvement
>          Components: karaf-core
>    Affects Versions: 4.2.0
>            Reporter: Stephen Kitt
>            Priority: Trivial
>
> I’ve noticed that a number of tests contain code like
>         CallbackHandler cb = new CallbackHandler() {
>             public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
>                 for (Callback cb : callbacks) {
>                     if (cb instanceof NameCallback) {
>                         ((NameCallback) cb).setName("hnelson");
>                     } else if (cb instanceof PasswordCallback) {
>                         ((PasswordCallback) cb).setPassword("secret".toCharArray());
>                     }
>                 }
>             }
>         };
> It might make sense to introduce a concrete implementation of CallbackHandler to provide this.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)