zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arshadmohammad <...@git.apache.org>
Subject [GitHub] zookeeper pull request #254: ZOOKEEPER-2775: ZK Client not able to connect w...
Date Wed, 17 May 2017 14:43:46 GMT
Github user arshadmohammad commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/254#discussion_r117021379
  
    --- Diff: src/java/test/org/apache/zookeeper/SaslAuthTest.java ---
    @@ -16,54 +16,58 @@
      * limitations under the License.
      */
     
    -package org.apache.zookeeper.test;
    +package org.apache.zookeeper;
    +
    +import static org.junit.Assert.assertTrue;
     
     import java.io.File;
     import java.io.FileWriter;
     import java.io.IOException;
    +import java.lang.reflect.Field;
     import java.util.ArrayList;
     import java.util.List;
     import java.util.concurrent.atomic.AtomicInteger;
     
    -import org.apache.zookeeper.CreateMode;
    -import org.apache.zookeeper.KeeperException;
    -import org.apache.zookeeper.TestableZooKeeper;
    -import org.apache.zookeeper.WatchedEvent;
    -import org.apache.zookeeper.ZooKeeper;
    +import org.apache.zookeeper.ClientCnxn.SendThread;
     import org.apache.zookeeper.Watcher.Event.KeeperState;
     import org.apache.zookeeper.ZooDefs.Ids;
     import org.apache.zookeeper.data.ACL;
     import org.apache.zookeeper.data.Id;
    +import org.apache.zookeeper.test.ClientBase;
    +import org.junit.AfterClass;
     import org.junit.Assert;
    +import org.junit.BeforeClass;
     import org.junit.Test;
     
     public class SaslAuthTest extends ClientBase {
    -    static {
    -        System.setProperty("zookeeper.authProvider.1","org.apache.zookeeper.server.auth.SASLAuthenticationProvider");
    -
    +    @BeforeClass
    +    public static void init() {
    +        System.setProperty("zookeeper.authProvider.1",
    +                "org.apache.zookeeper.server.auth.SASLAuthenticationProvider");
             try {
                 File tmpDir = createTmpDir();
                 File saslConfFile = new File(tmpDir, "jaas.conf");
                 FileWriter fwriter = new FileWriter(saslConfFile);
     
    -            fwriter.write("" +
    -                    "Server {\n" +
    -                    "          org.apache.zookeeper.server.auth.DigestLoginModule required\n"
+
    -                    "          user_super=\"test\";\n" +
    -                    "};\n" +
    -                    "Client {\n" +
    -                    "       org.apache.zookeeper.server.auth.DigestLoginModule required\n"
+
    -                    "       username=\"super\"\n" +
    -                    "       password=\"test\";\n" +
    -                    "};" + "\n");
    +            fwriter.write("" + "Server {\n"
    --- End diff --
    
    Same content was already present, I tried to format it which could not help to clean.
    Now moved jaas config file content generation to new method.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message