You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by an...@apache.org on 2018/10/24 09:32:52 UTC
[36/36] zookeeper git commit: ZOOKEEPER-3032: MAVEN MIGRATION -
branch-3.4 - zookeeper-server
ZOOKEEPER-3032: MAVEN MIGRATION - branch-3.4 - zookeeper-server
Author: Norbert Kalmar <nk...@yahoo.com>
Reviewers: andor@apache.org
Closes #675 from nkalmar/ZOOKEEPER-3032r-3.4
Project: http://git-wip-us.apache.org/repos/asf/zookeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/zookeeper/commit/7291e47c
Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/7291e47c
Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/7291e47c
Branch: refs/heads/branch-3.4
Commit: 7291e47cb8a41f369a41e30e16f7780d419fb832
Parents: f0c8683
Author: Norbert Kalmar <nk...@yahoo.com>
Authored: Wed Oct 24 11:32:09 2018 +0200
Committer: Andor Molnar <an...@apache.org>
Committed: Wed Oct 24 11:32:09 2018 +0200
----------------------------------------------------------------------
.gitignore | 4 +-
bin/zkEnv.sh | 2 +-
build.xml | 115 +-
.../zookeeper-client-c/tests/zkServer.sh | 2 +-
.../zookeeper/client/ConnectStringParser.java | 87 -
.../zookeeper/client/FourLetterWordMain.java | 107 -
.../apache/zookeeper/client/HostProvider.java | 66 -
.../zookeeper/client/StaticHostProvider.java | 179 --
.../zookeeper/client/ZooKeeperSaslClient.java | 439 ---
.../org/apache/zookeeper/AsyncCallback.java | 309 --
.../java/org/apache/zookeeper/ClientCnxn.java | 1481 ----------
.../org/apache/zookeeper/ClientCnxnSocket.java | 175 --
.../apache/zookeeper/ClientCnxnSocketNIO.java | 431 ---
.../apache/zookeeper/ClientWatchManager.java | 40 -
.../java/org/apache/zookeeper/CreateMode.java | 94 -
.../java/org/apache/zookeeper/Environment.java | 103 -
.../org/apache/zookeeper/KeeperException.java | 728 -----
.../main/java/org/apache/zookeeper/Login.java | 407 ---
.../org/apache/zookeeper/MultiResponse.java | 166 --
.../zookeeper/MultiTransactionRecord.java | 160 --
.../src/main/java/org/apache/zookeeper/Op.java | 351 ---
.../java/org/apache/zookeeper/OpResult.java | 185 --
.../main/java/org/apache/zookeeper/Quotas.java | 68 -
.../zookeeper/SaslClientCallbackHandler.java | 104 -
.../org/apache/zookeeper/ServerAdminClient.java | 316 --
.../main/java/org/apache/zookeeper/Shell.java | 477 ---
.../java/org/apache/zookeeper/StatsTrack.java | 101 -
.../java/org/apache/zookeeper/Testable.java | 29 -
.../java/org/apache/zookeeper/Transaction.java | 70 -
.../main/java/org/apache/zookeeper/Version.java | 90 -
.../java/org/apache/zookeeper/WatchedEvent.java | 81 -
.../main/java/org/apache/zookeeper/Watcher.java | 155 -
.../main/java/org/apache/zookeeper/ZKUtil.java | 124 -
.../main/java/org/apache/zookeeper/ZooDefs.java | 125 -
.../java/org/apache/zookeeper/ZooKeeper.java | 1857 ------------
.../org/apache/zookeeper/ZooKeeperMain.java | 871 ------
.../org/apache/zookeeper/ZooKeeperTestable.java | 47 -
.../common/AtomicFileOutputStream.java | 126 -
.../org/apache/zookeeper/common/IOUtils.java | 123 -
.../org/apache/zookeeper/common/PathTrie.java | 293 --
.../org/apache/zookeeper/common/PathUtils.java | 103 -
.../java/org/apache/zookeeper/common/Time.java | 52 -
.../apache/zookeeper/util/SecurityUtils.java | 298 --
.../apache/zookeeper/version/util/VerGen.java | 178 --
.../src/main/resources/lib/cobertura/README.txt | 3 -
.../resources/lib/jdiff/zookeeper_3.1.1.xml | 2717 ------------------
.../main/resources/lib/log4j-1.2.17.LICENSE.txt | 202 --
.../main/resources/lib/slf4j-1.7.25.LICENSE.txt | 24 -
.../apache/zookeeper/ClientReconnectTest.java | 78 -
.../apache/zookeeper/JUnit4ZKTestRunner.java | 86 -
.../org/apache/zookeeper/JaasConfiguration.java | 75 -
.../java/org/apache/zookeeper/MockPacket.java | 46 -
.../org/apache/zookeeper/MultiResponseTest.java | 72 -
.../zookeeper/MultiTransactionRecordTest.java | 68 -
.../org/apache/zookeeper/PortAssignment.java | 35 -
.../java/org/apache/zookeeper/SaslAuthTest.java | 213 --
.../org/apache/zookeeper/ServerConfigTest.java | 74 -
.../org/apache/zookeeper/TestableZooKeeper.java | 133 -
.../java/org/apache/zookeeper/VerGenTest.java | 78 -
.../java/org/apache/zookeeper/ZKTestCase.java | 88 -
.../org/apache/zookeeper/ZooKeeperTest.java | 281 --
.../org/apache/zookeeper/common/TimeTest.java | 109 -
.../org/apache/zookeeper/test/ACLCountTest.java | 136 -
.../org/apache/zookeeper/test/ACLRootTest.java | 98 -
.../java/org/apache/zookeeper/test/ACLTest.java | 186 --
.../apache/zookeeper/test/AsyncHammerTest.java | 245 --
.../org/apache/zookeeper/test/AsyncOps.java | 655 -----
.../org/apache/zookeeper/test/AsyncOpsTest.java | 227 --
.../org/apache/zookeeper/test/AsyncTest.java | 172 --
.../test/AtomicFileOutputStreamTest.java | 200 --
.../org/apache/zookeeper/test/AuthTest.java | 174 --
.../apache/zookeeper/test/BufferSizeTest.java | 132 -
.../apache/zookeeper/test/ChrootAsyncTest.java | 47 -
.../apache/zookeeper/test/ChrootClientTest.java | 54 -
.../org/apache/zookeeper/test/ChrootTest.java | 136 -
.../org/apache/zookeeper/test/ClientBase.java | 757 -----
.../apache/zookeeper/test/ClientHammerTest.java | 246 --
.../zookeeper/test/ClientPortBindTest.java | 127 -
.../org/apache/zookeeper/test/ClientRetry.java | 72 -
.../org/apache/zookeeper/test/ClientTest.java | 805 ------
.../zookeeper/test/ConnectStringParserTest.java | 68 -
.../apache/zookeeper/test/CreateModeTest.java | 81 -
.../zookeeper/test/DisconnectableZooKeeper.java | 58 -
.../zookeeper/test/DisconnectedWatcherTest.java | 258 --
.../apache/zookeeper/test/EventTypeTest.java | 50 -
.../apache/zookeeper/test/FLENewEpochTest.java | 192 --
.../apache/zookeeper/test/FLEPredicateTest.java | 104 -
.../apache/zookeeper/test/FLERestartTest.java | 203 --
.../java/org/apache/zookeeper/test/FLETest.java | 473 ---
.../zookeeper/test/FLEZeroWeightTest.java | 181 --
.../test/FollowerResyncConcurrencyTest.java | 607 ----
.../org/apache/zookeeper/test/FollowerTest.java | 140 -
.../test/FourLetterWordsQuorumTest.java | 113 -
.../zookeeper/test/FourLetterWordsTest.java | 238 --
.../test/FourLetterWordsWhiteListTest.java | 253 --
.../apache/zookeeper/test/GetChildren2Test.java | 136 -
.../zookeeper/test/HierarchicalQuorumTest.java | 309 --
.../apache/zookeeper/test/IntegrityCheck.java | 232 --
.../zookeeper/test/InvalidSnapshotTest.java | 125 -
.../java/org/apache/zookeeper/test/JMXEnv.java | 325 ---
.../apache/zookeeper/test/KeeperStateTest.java | 76 -
.../zookeeper/test/LENonTerminateTest.java | 378 ---
.../java/org/apache/zookeeper/test/LETest.java | 137 -
.../zookeeper/test/LoadFromLogNoServerTest.java | 175 --
.../apache/zookeeper/test/LoadFromLogTest.java | 223 --
.../org/apache/zookeeper/test/MaxCnxnsTest.java | 139 -
.../zookeeper/test/MultiTransactionTest.java | 805 ------
.../zookeeper/test/NioNettySuiteBase.java | 43 -
.../zookeeper/test/NioNettySuiteHammerTest.java | 30 -
.../zookeeper/test/NioNettySuiteTest.java | 37 -
.../zookeeper/test/NonRecoverableErrorTest.java | 183 --
.../org/apache/zookeeper/test/NullDataTest.java | 75 -
.../java/org/apache/zookeeper/test/OOMTest.java | 161 --
.../org/apache/zookeeper/test/OSMXBeanTest.java | 70 -
.../test/ObserverHierarchicalQuorumTest.java | 43 -
.../apache/zookeeper/test/ObserverLETest.java | 76 -
.../test/ObserverQuorumHammerTest.java | 39 -
.../org/apache/zookeeper/test/ObserverTest.java | 233 --
.../org/apache/zookeeper/test/QuorumBase.java | 341 ---
.../apache/zookeeper/test/QuorumHammerTest.java | 51 -
.../apache/zookeeper/test/QuorumQuotaTest.java | 63 -
.../org/apache/zookeeper/test/QuorumTest.java | 296 --
.../org/apache/zookeeper/test/QuorumUtil.java | 261 --
.../zookeeper/test/QuorumZxidSyncTest.java | 171 --
.../apache/zookeeper/test/ReadOnlyModeTest.java | 291 --
.../org/apache/zookeeper/test/RecoveryTest.java | 209 --
.../zookeeper/test/RepeatStartupTest.java | 69 -
.../zookeeper/test/RestoreCommittedLogTest.java | 91 -
.../test/SaslAuthDesignatedClientTest.java | 104 -
.../test/SaslAuthDesignatedServerTest.java | 104 -
.../test/SaslAuthFailDesignatedClientTest.java | 108 -
.../zookeeper/test/SaslAuthFailNotifyTest.java | 98 -
.../apache/zookeeper/test/SaslAuthFailTest.java | 76 -
.../test/SaslAuthMissingClientConfigTest.java | 97 -
.../apache/zookeeper/test/SaslClientTest.java | 62 -
.../zookeeper/test/SessionInvalidationTest.java | 105 -
.../org/apache/zookeeper/test/SessionTest.java | 394 ---
.../zookeeper/test/SessionTimeoutTest.java | 129 -
.../org/apache/zookeeper/test/SledgeHammer.java | 115 -
.../apache/zookeeper/test/StandaloneTest.java | 65 -
.../org/apache/zookeeper/test/StatTest.java | 205 --
.../zookeeper/test/StaticHostProviderTest.java | 362 ---
.../org/apache/zookeeper/test/SyncCallTest.java | 108 -
.../org/apache/zookeeper/test/TestHammer.java | 63 -
.../org/apache/zookeeper/test/TestUtils.java | 60 -
.../org/apache/zookeeper/test/TruncateTest.java | 256 --
.../org/apache/zookeeper/test/UpgradeTest.java | 105 -
.../zookeeper/test/WatchEventWhenAutoReset.java | 212 --
.../apache/zookeeper/test/WatchedEventTest.java | 95 -
.../apache/zookeeper/test/WatcherFuncTest.java | 478 ---
.../org/apache/zookeeper/test/WatcherTest.java | 408 ---
.../test/ZkDatabaseCorruptionTest.java | 161 --
.../zookeeper/test/ZooKeeperQuotaTest.java | 85 -
.../zookeeper/test/ZooKeeperTestClient.java | 422 ---
.../src/test/resources/check_compatibility.py | 204 --
.../resources/checkstyle-noframes-sorted.xsl | 178 --
.../src/test/resources/checkstyle.xml | 187 --
.../data/buffersize/create/version-2/log.1 | Bin 51216 -> 0 bytes
.../data/buffersize/create/version-2/snapshot.0 | Bin 296 -> 0 bytes
.../data/buffersize/set/version-2/log.1 | Bin 51216 -> 0 bytes
.../data/buffersize/set/version-2/snapshot.0 | Bin 296 -> 0 bytes
.../data/buffersize/snapshot/version-2/log.1 | Bin 51216 -> 0 bytes
.../buffersize/snapshot/version-2/snapshot.0 | Bin 296 -> 0 bytes
.../buffersize/snapshot/version-2/snapshot.2 | Bin 5429 -> 0 bytes
.../resources/data/invalidsnap/version-2/log.1 | Bin 59360 -> 0 bytes
.../data/invalidsnap/version-2/log.274 | Bin 91616 -> 0 bytes
.../resources/data/invalidsnap/version-2/log.42 | Bin 184 -> 0 bytes
.../data/invalidsnap/version-2/log.63b | Bin 49008 -> 0 bytes
.../data/invalidsnap/version-2/snapshot.0 | Bin 296 -> 0 bytes
.../data/invalidsnap/version-2/snapshot.272 | Bin 56408 -> 0 bytes
.../data/invalidsnap/version-2/snapshot.273 | Bin 56521 -> 0 bytes
.../data/invalidsnap/version-2/snapshot.639 | Bin 143163 -> 0 bytes
.../data/invalidsnap/version-2/snapshot.83f | Bin 4824 -> 0 bytes
.../resources/data/kerberos/minikdc-krb5.conf | 30 -
.../test/resources/data/kerberos/minikdc.ldiff | 52 -
.../test/resources/data/upgrade/log.100000001 | Bin 2458624 -> 0 bytes
.../test/resources/data/upgrade/log.100001bf0 | Bin 1025024 -> 0 bytes
.../resources/data/upgrade/snapshot.100000000 | Bin 73 -> 0 bytes
.../resources/data/upgrade/snapshot.100001bec | Bin 2567595 -> 0 bytes
.../src/test/resources/findbugsExcludeFile.xml | 166 --
.../src/test/resources/test-github-pr.sh | 616 ----
.../src/test/resources/test-patch.properties | 18 -
.../src/test/resources/test-patch.sh | 637 ----
zookeeper-contrib/build-contrib.xml | 4 +-
.../zookeeper-contrib-fatjar/build.xml | 2 +-
.../zookeeper-contrib-rest/build.xml | 4 +-
.../zookeeper-contrib-rest/src/test/zkServer.sh | 2 +-
.../src/test/zkServer.sh | 2 +-
zookeeper-recipes/build-recipes.xml | 2 +-
.../src/main/c/tests/zkServer.sh | 2 +-
.../src/main/c/tests/zkServer.sh | 2 +-
.../org/apache/zookeeper/AsyncCallback.java | 309 ++
.../java/org/apache/zookeeper/ClientCnxn.java | 1481 ++++++++++
.../org/apache/zookeeper/ClientCnxnSocket.java | 175 ++
.../apache/zookeeper/ClientCnxnSocketNIO.java | 431 +++
.../apache/zookeeper/ClientWatchManager.java | 40 +
.../java/org/apache/zookeeper/CreateMode.java | 94 +
.../java/org/apache/zookeeper/Environment.java | 103 +
.../org/apache/zookeeper/KeeperException.java | 728 +++++
.../main/java/org/apache/zookeeper/Login.java | 407 +++
.../org/apache/zookeeper/MultiResponse.java | 166 ++
.../zookeeper/MultiTransactionRecord.java | 160 ++
.../src/main/java/org/apache/zookeeper/Op.java | 351 +++
.../java/org/apache/zookeeper/OpResult.java | 185 ++
.../main/java/org/apache/zookeeper/Quotas.java | 68 +
.../zookeeper/SaslClientCallbackHandler.java | 104 +
.../org/apache/zookeeper/ServerAdminClient.java | 316 ++
.../main/java/org/apache/zookeeper/Shell.java | 477 +++
.../java/org/apache/zookeeper/StatsTrack.java | 101 +
.../java/org/apache/zookeeper/Testable.java | 29 +
.../java/org/apache/zookeeper/Transaction.java | 70 +
.../main/java/org/apache/zookeeper/Version.java | 90 +
.../java/org/apache/zookeeper/WatchedEvent.java | 81 +
.../main/java/org/apache/zookeeper/Watcher.java | 155 +
.../main/java/org/apache/zookeeper/ZKUtil.java | 124 +
.../main/java/org/apache/zookeeper/ZooDefs.java | 125 +
.../java/org/apache/zookeeper/ZooKeeper.java | 1857 ++++++++++++
.../org/apache/zookeeper/ZooKeeperMain.java | 871 ++++++
.../org/apache/zookeeper/ZooKeeperTestable.java | 47 +
.../zookeeper/client/ConnectStringParser.java | 87 +
.../zookeeper/client/FourLetterWordMain.java | 107 +
.../apache/zookeeper/client/HostProvider.java | 66 +
.../zookeeper/client/StaticHostProvider.java | 179 ++
.../zookeeper/client/ZooKeeperSaslClient.java | 439 +++
.../common/AtomicFileOutputStream.java | 126 +
.../org/apache/zookeeper/common/IOUtils.java | 123 +
.../org/apache/zookeeper/common/PathTrie.java | 293 ++
.../org/apache/zookeeper/common/PathUtils.java | 103 +
.../java/org/apache/zookeeper/common/Time.java | 52 +
.../apache/zookeeper/util/SecurityUtils.java | 298 ++
.../apache/zookeeper/version/util/VerGen.java | 178 ++
.../src/main/resources/lib/cobertura/README.txt | 3 +
.../resources/lib/jdiff/zookeeper_3.1.1.xml | 2717 ++++++++++++++++++
.../main/resources/lib/log4j-1.2.17.LICENSE.txt | 202 ++
.../main/resources/lib/slf4j-1.7.25.LICENSE.txt | 24 +
.../apache/zookeeper/ClientReconnectTest.java | 78 +
.../apache/zookeeper/JUnit4ZKTestRunner.java | 86 +
.../org/apache/zookeeper/JaasConfiguration.java | 75 +
.../java/org/apache/zookeeper/MockPacket.java | 46 +
.../org/apache/zookeeper/MultiResponseTest.java | 72 +
.../zookeeper/MultiTransactionRecordTest.java | 68 +
.../org/apache/zookeeper/PortAssignment.java | 35 +
.../java/org/apache/zookeeper/SaslAuthTest.java | 213 ++
.../org/apache/zookeeper/ServerConfigTest.java | 74 +
.../org/apache/zookeeper/TestableZooKeeper.java | 133 +
.../java/org/apache/zookeeper/VerGenTest.java | 78 +
.../java/org/apache/zookeeper/ZKTestCase.java | 88 +
.../org/apache/zookeeper/ZooKeeperTest.java | 281 ++
.../org/apache/zookeeper/common/TimeTest.java | 109 +
.../org/apache/zookeeper/test/ACLCountTest.java | 136 +
.../org/apache/zookeeper/test/ACLRootTest.java | 98 +
.../java/org/apache/zookeeper/test/ACLTest.java | 186 ++
.../apache/zookeeper/test/AsyncHammerTest.java | 245 ++
.../org/apache/zookeeper/test/AsyncOps.java | 655 +++++
.../org/apache/zookeeper/test/AsyncOpsTest.java | 227 ++
.../org/apache/zookeeper/test/AsyncTest.java | 172 ++
.../test/AtomicFileOutputStreamTest.java | 200 ++
.../org/apache/zookeeper/test/AuthTest.java | 174 ++
.../apache/zookeeper/test/BufferSizeTest.java | 132 +
.../apache/zookeeper/test/ChrootAsyncTest.java | 47 +
.../apache/zookeeper/test/ChrootClientTest.java | 54 +
.../org/apache/zookeeper/test/ChrootTest.java | 136 +
.../org/apache/zookeeper/test/ClientBase.java | 757 +++++
.../apache/zookeeper/test/ClientHammerTest.java | 246 ++
.../zookeeper/test/ClientPortBindTest.java | 127 +
.../org/apache/zookeeper/test/ClientRetry.java | 72 +
.../org/apache/zookeeper/test/ClientTest.java | 805 ++++++
.../zookeeper/test/ConnectStringParserTest.java | 68 +
.../apache/zookeeper/test/CreateModeTest.java | 81 +
.../zookeeper/test/DisconnectableZooKeeper.java | 58 +
.../zookeeper/test/DisconnectedWatcherTest.java | 258 ++
.../apache/zookeeper/test/EventTypeTest.java | 50 +
.../apache/zookeeper/test/FLENewEpochTest.java | 192 ++
.../apache/zookeeper/test/FLEPredicateTest.java | 104 +
.../apache/zookeeper/test/FLERestartTest.java | 203 ++
.../java/org/apache/zookeeper/test/FLETest.java | 473 +++
.../zookeeper/test/FLEZeroWeightTest.java | 181 ++
.../test/FollowerResyncConcurrencyTest.java | 607 ++++
.../org/apache/zookeeper/test/FollowerTest.java | 140 +
.../test/FourLetterWordsQuorumTest.java | 113 +
.../zookeeper/test/FourLetterWordsTest.java | 238 ++
.../test/FourLetterWordsWhiteListTest.java | 253 ++
.../apache/zookeeper/test/GetChildren2Test.java | 136 +
.../zookeeper/test/HierarchicalQuorumTest.java | 309 ++
.../apache/zookeeper/test/IntegrityCheck.java | 232 ++
.../zookeeper/test/InvalidSnapshotTest.java | 125 +
.../java/org/apache/zookeeper/test/JMXEnv.java | 325 +++
.../apache/zookeeper/test/KeeperStateTest.java | 76 +
.../zookeeper/test/LENonTerminateTest.java | 378 +++
.../java/org/apache/zookeeper/test/LETest.java | 137 +
.../zookeeper/test/LoadFromLogNoServerTest.java | 175 ++
.../apache/zookeeper/test/LoadFromLogTest.java | 223 ++
.../org/apache/zookeeper/test/MaxCnxnsTest.java | 139 +
.../zookeeper/test/MultiTransactionTest.java | 805 ++++++
.../zookeeper/test/NioNettySuiteBase.java | 43 +
.../zookeeper/test/NioNettySuiteHammerTest.java | 30 +
.../zookeeper/test/NioNettySuiteTest.java | 37 +
.../zookeeper/test/NonRecoverableErrorTest.java | 183 ++
.../org/apache/zookeeper/test/NullDataTest.java | 75 +
.../java/org/apache/zookeeper/test/OOMTest.java | 161 ++
.../org/apache/zookeeper/test/OSMXBeanTest.java | 70 +
.../test/ObserverHierarchicalQuorumTest.java | 43 +
.../apache/zookeeper/test/ObserverLETest.java | 76 +
.../test/ObserverQuorumHammerTest.java | 39 +
.../org/apache/zookeeper/test/ObserverTest.java | 233 ++
.../org/apache/zookeeper/test/QuorumBase.java | 341 +++
.../apache/zookeeper/test/QuorumHammerTest.java | 51 +
.../apache/zookeeper/test/QuorumQuotaTest.java | 63 +
.../org/apache/zookeeper/test/QuorumTest.java | 296 ++
.../org/apache/zookeeper/test/QuorumUtil.java | 261 ++
.../zookeeper/test/QuorumZxidSyncTest.java | 171 ++
.../apache/zookeeper/test/ReadOnlyModeTest.java | 291 ++
.../org/apache/zookeeper/test/RecoveryTest.java | 209 ++
.../zookeeper/test/RepeatStartupTest.java | 69 +
.../zookeeper/test/RestoreCommittedLogTest.java | 91 +
.../test/SaslAuthDesignatedClientTest.java | 104 +
.../test/SaslAuthDesignatedServerTest.java | 104 +
.../test/SaslAuthFailDesignatedClientTest.java | 108 +
.../zookeeper/test/SaslAuthFailNotifyTest.java | 98 +
.../apache/zookeeper/test/SaslAuthFailTest.java | 76 +
.../test/SaslAuthMissingClientConfigTest.java | 97 +
.../apache/zookeeper/test/SaslClientTest.java | 62 +
.../zookeeper/test/SessionInvalidationTest.java | 105 +
.../org/apache/zookeeper/test/SessionTest.java | 394 +++
.../zookeeper/test/SessionTimeoutTest.java | 129 +
.../org/apache/zookeeper/test/SledgeHammer.java | 115 +
.../apache/zookeeper/test/StandaloneTest.java | 65 +
.../org/apache/zookeeper/test/StatTest.java | 205 ++
.../zookeeper/test/StaticHostProviderTest.java | 362 +++
.../org/apache/zookeeper/test/SyncCallTest.java | 108 +
.../org/apache/zookeeper/test/TestHammer.java | 63 +
.../org/apache/zookeeper/test/TestUtils.java | 60 +
.../org/apache/zookeeper/test/TruncateTest.java | 256 ++
.../org/apache/zookeeper/test/UpgradeTest.java | 105 +
.../zookeeper/test/WatchEventWhenAutoReset.java | 212 ++
.../apache/zookeeper/test/WatchedEventTest.java | 95 +
.../apache/zookeeper/test/WatcherFuncTest.java | 478 +++
.../org/apache/zookeeper/test/WatcherTest.java | 408 +++
.../test/ZkDatabaseCorruptionTest.java | 161 ++
.../zookeeper/test/ZooKeeperQuotaTest.java | 85 +
.../zookeeper/test/ZooKeeperTestClient.java | 422 +++
.../src/test/resources/check_compatibility.py | 204 ++
.../resources/checkstyle-noframes-sorted.xsl | 178 ++
.../src/test/resources/checkstyle.xml | 187 ++
.../data/buffersize/create/version-2/log.1 | Bin 0 -> 51216 bytes
.../data/buffersize/create/version-2/snapshot.0 | Bin 0 -> 296 bytes
.../data/buffersize/set/version-2/log.1 | Bin 0 -> 51216 bytes
.../data/buffersize/set/version-2/snapshot.0 | Bin 0 -> 296 bytes
.../data/buffersize/snapshot/version-2/log.1 | Bin 0 -> 51216 bytes
.../buffersize/snapshot/version-2/snapshot.0 | Bin 0 -> 296 bytes
.../buffersize/snapshot/version-2/snapshot.2 | Bin 0 -> 5429 bytes
.../resources/data/invalidsnap/version-2/log.1 | Bin 0 -> 59360 bytes
.../data/invalidsnap/version-2/log.274 | Bin 0 -> 91616 bytes
.../resources/data/invalidsnap/version-2/log.42 | Bin 0 -> 184 bytes
.../data/invalidsnap/version-2/log.63b | Bin 0 -> 49008 bytes
.../data/invalidsnap/version-2/snapshot.0 | Bin 0 -> 296 bytes
.../data/invalidsnap/version-2/snapshot.272 | Bin 0 -> 56408 bytes
.../data/invalidsnap/version-2/snapshot.273 | Bin 0 -> 56521 bytes
.../data/invalidsnap/version-2/snapshot.639 | Bin 0 -> 143163 bytes
.../data/invalidsnap/version-2/snapshot.83f | Bin 0 -> 4824 bytes
.../resources/data/kerberos/minikdc-krb5.conf | 30 +
.../test/resources/data/kerberos/minikdc.ldiff | 52 +
.../test/resources/data/upgrade/log.100000001 | Bin 0 -> 2458624 bytes
.../test/resources/data/upgrade/log.100001bf0 | Bin 0 -> 1025024 bytes
.../resources/data/upgrade/snapshot.100000000 | Bin 0 -> 73 bytes
.../resources/data/upgrade/snapshot.100001bec | Bin 0 -> 2567595 bytes
.../src/test/resources/findbugsExcludeFile.xml | 166 ++
.../src/test/resources/test-github-pr.sh | 616 ++++
.../src/test/resources/test-patch.properties | 18 +
.../src/test/resources/test-patch.sh | 637 ++++
370 files changed, 35558 insertions(+), 35633 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/7291e47c/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 3544456..ab54763 100644
--- a/.gitignore
+++ b/.gitignore
@@ -66,8 +66,8 @@ zookeeper-client/zookeeper-client-c/*.lo
zookeeper-client/zookeeper-client-c/*.o
zookeeper-client/zookeeper-client-c/generated/
src/java/generated/
-zookeeper-common/src/main/resources/lib/ant-eclipse-*
-zookeeper-common/src/main/resources/lib/ivy-*
+zookeeper-server/src/main/resources/lib/ant-eclipse-*
+zookeeper-server/src/main/resources/lib/ivy-*
zookeeper-client/zookeeper-client-c/Makefile.in
zookeeper-client/zookeeper-client-c/aclocal.m4
zookeeper-client/zookeeper-client-c/autom4te.cache/
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/7291e47c/bin/zkEnv.sh
----------------------------------------------------------------------
diff --git a/bin/zkEnv.sh b/bin/zkEnv.sh
index 4e6fb97..5c860ce 100755
--- a/bin/zkEnv.sh
+++ b/bin/zkEnv.sh
@@ -70,7 +70,7 @@ fi
#add the zoocfg dir to classpath
CLASSPATH="$ZOOCFGDIR:$CLASSPATH"
-for i in "$ZOOBINDIR"/../zookeeper-common/src/main/resources/lib/*.jar
+for i in "$ZOOBINDIR"/../zookeeper-server/src/main/resources/lib/*.jar
do
CLASSPATH="$i:$CLASSPATH"
done
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/7291e47c/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 6a1ef2b..01a2a9f 100644
--- a/build.xml
+++ b/build.xml
@@ -86,12 +86,9 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<property name="src.dir" value="${basedir}/src" />
<property name="java.server.src.dir" value="${basedir}/zookeeper-server/src/main/java" />
<property name="java.server.resources.dir" value="${basedir}/zookeeper-server/src/main/resources" />
- <property name="java.common.src.dir" value="${basedir}/zookeeper-common/src/main/java" />
- <property name="java.common.resources.dir" value="${basedir}/zookeeper-common/src/main/resources" />
- <property name="java.client.src.dir" value="${basedir}/zookeeper-client/zookeeper-client-java/src/main/java" />
<property name="jute.src.dir" value="${basedir}/zookeeper-jute/src/main/java" />
- <property name="lib.dir" value="${java.common.resources.dir}/lib" />
+ <property name="lib.dir" value="${java.server.resources.dir}/lib" />
<property name="lib.dir.includes" value="**/*.jar" />
<property name="lib.dir.excludes" value="**/excluded/" />
@@ -118,8 +115,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<property name="test.java.build.dir" value="${build.dir}/test"/>
<property name="test.java.classes" value="${test.java.build.dir}/classes"/>
<property name="java.server.test.dir" value="${basedir}/zookeeper-server/src/test/java"/>
- <property name="java.common.test.dir" value="${basedir}/zookeeper-common/src/test/java"/>
- <property name="common.test.resource.dir" value="${basedir}/zookeeper-common/src/test/resources"/>
+ <property name="server.test.resource.dir" value="${basedir}/zookeeper-server/src/test/resources"/>
<property name="jute.test.src.dir" value="${basedir}/zookeeper-jute/src/test/java" />
<property name="systest.src.dir" value="${basedir}/zookeeper-it/src/test/java"/>
<property name="test.log.dir" value="${test.java.build.dir}/logs" />
@@ -146,12 +142,6 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
value="http://docs.oracle.com/javase/6/docs/api/" />
<property name="javadoc.packages" value="org.apache.*" />
- <path id="java.src.dir">
- <pathelement path="${java.server.src.dir}"/>
- <pathelement path="${java.common.src.dir}"/>
- <pathelement path="${java.client.src.dir}"/>
- </path>
-
<property name="dist.dir" value="${build.dir}/${final.name}"/>
<property name="dist.maven.dir" value="${dist.dir}/dist-maven"/>
@@ -201,8 +191,8 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<property name="grep.cmd" value="grep"/>
<property name="patch.cmd" value="patch"/>
<property name="make.cmd" value="make"/>
- <property name="test_patch_sh" value="${common.test.resource.dir}/test-patch.sh"/>
- <property name="test_pullrequest_sh" value="${common.test.resource.dir}/test-github-pr.sh"/>
+ <property name="test_patch_sh" value="${server.test.resource.dir}/test-patch.sh"/>
+ <property name="test_pullrequest_sh" value="${server.test.resource.dir}/test-github-pr.sh"/>
<!-- jdiff.home property set -->
<property name="jdiff.home" value="${ivy.jdiff.lib}"/>
@@ -365,7 +355,6 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
target="${javac.target}" source="${javac.source}"
includes="org/apache/zookeeper/version/util/**" debug="on">
<src path="${java.server.src.dir}" />
- <src path="${java.common.src.dir}" />
</javac>
</target>
@@ -474,8 +463,6 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<javac destdir="${build.classes}" includeantruntime="false"
target="${javac.target}" source="${javac.source}" debug="on">
<src path="${java.server.src.dir}"/>
- <src path="${java.common.src.dir}"/>
- <src path="${java.client.src.dir}"/>
<src path="${jute.src.dir}"/>
<classpath refid="java.classpath"/>
<compilerarg value="-Xlint:all"/>
@@ -488,7 +475,6 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<javac destdir="${test.java.classes}" includeantruntime="false"
target="${javac.target}" source="${javac.source}" debug="on">
<src path="${java.server.test.dir}"/>
- <src path="${java.common.test.dir}"/>
<src path="${jute.test.src.dir}"/>
<classpath refid="test.java.classpath"/>
</javac>
@@ -565,12 +551,6 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<include name="org/apache/**"/>
<exclude name="org/apache/jute/**"/>
</packageset>
- <packageset dir="${java.common.src.dir}">
- <include name="org/apache/**"/>
- </packageset>
- <packageset dir="${java.client.src.dir}">
- <include name="org/apache/**"/>
- </packageset>
<packageset dir="${src_generated.dir}"/>
<link href="${javadoc.link.java}"/>
<classpath refid="java.classpath"/>
@@ -606,14 +586,6 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<include name="org/apache/**"/>
<exclude name="org/apache/zookeeper/server/**"/>
</packageset>
- <packageset dir="${java.common.src.dir}">
- <include name="org/apache/**"/>
- <exclude name="org/apache/zookeeper/server/**"/>
- </packageset>
- <packageset dir="${java.client.src.dir}">
- <include name="org/apache/**"/>
- <exclude name="org/apache/zookeeper/server/**"/>
- </packageset>
<packageset dir="${jute.src.dir}">
<include name="org/apache/**"/>
</packageset>
@@ -651,8 +623,6 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<fileset file="LICENSE.txt" />
<fileset dir="${build.classes}" excludes="**/.generated"/>
<fileset dir="${java.server.src.dir}"/>
- <fileset dir="${java.common.src.dir}"/>
- <fileset dir="${java.client.src.dir}"/>
<fileset dir="${jute.src.dir}"/>
<fileset dir="${src_generated.dir}" excludes="**/.generated"/>
<manifest>
@@ -728,8 +698,6 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<jar jarfile="${build.dir}/${final.name}-sources.jar">
<fileset file="LICENSE.txt" />
<fileset dir="${java.server.src.dir}"/>
- <fileset dir="${java.common.src.dir}"/>
- <fileset dir="${java.client.src.dir}"/>
<fileset dir="${jute.src.dir}"/>
<fileset dir="${src_generated.dir}" excludes="**/.generated"/>
<manifest>
@@ -883,7 +851,6 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<include name="zookeeper-contrib/**"/>
<include name="zookeeper-client/**"/>
<include name="zookeeper-jute/**"/>
- <include name="zookeeper-common/**"/>
<include name="zookeeper-server/**"/>
</fileset>
<fileset file="${java.server.resources.dir}/pom.template"/>
@@ -1378,18 +1345,18 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<mkdir dir="${test.data.upgrade.dir}" />
<mkdir dir="${test.data.invalid.dir}" />
<copy todir="${test.data.upgrade.dir}">
- <fileset dir="${common.test.resource.dir}/data/upgrade"/>
+ <fileset dir="${server.test.resource.dir}/data/upgrade"/>
</copy>
<copy todir="${test.data.invalid.dir}">
- <fileset dir="${common.test.resource.dir}/data/invalidsnap"/>
+ <fileset dir="${server.test.resource.dir}/data/invalidsnap"/>
</copy>
<mkdir dir="${test.data.buffersize.dir}" />
<copy todir="${test.data.buffersize.dir}">
- <fileset dir="${common.test.resource.dir}/data/buffersize"/>
+ <fileset dir="${server.test.resource.dir}/data/buffersize"/>
</copy>
<mkdir dir="${test.data.kerberos.dir}" />
<copy todir="${test.data.kerberos.dir}">
- <fileset dir="${common.test.resource.dir}/data/kerberos"/>
+ <fileset dir="${server.test.resource.dir}/data/kerberos"/>
</copy>
</target>
@@ -1439,10 +1406,6 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<include name="**/*${test.category}Test.java"/>
<exclude name="**/*HammerTest.java"/>
</fileset>
- <fileset dir="${java.common.test.dir}">
- <include name="**/*${test.category}Test.java"/>
- <exclude name="**/*HammerTest.java"/>
- </fileset>
<fileset dir="${jute.test.src.dir}">
<include name="**/*${test.category}Test.java" />
</fileset>
@@ -1451,16 +1414,12 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<fileset dir="${java.server.test.dir}">
<include name="**/*${test.category}Test.java"/>
</fileset>
- <fileset dir="${java.common.test.dir}">
- <include name="**/*${test.category}Test.java"/>
- </fileset>
<fileset dir="${jute.test.src.dir}">
<include name="**/*${test.category}Test.java" />
</fileset>
</batchtest>
<batchtest todir="${test.log.dir}" if="testcase">
<fileset dir="${java.server.test.dir}" includes="**/${testcase}.java"/>
- <fileset dir="${java.common.test.dir}" includes="**/${testcase}.java"/>
<fileset dir="${jute.test.src.dir}" includes="**/${testcase}.java"/>
</batchtest>
</junit>
@@ -1631,24 +1590,11 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
includes="org/apache/zookeeper/**/*"
excludes="org/apache/zookeeper/version/**/*">
</fileset>
- <fileset dir="${java.common.src.dir}"
- includes="org/apache/zookeeper/**/*"
- excludes="org/apache/zookeeper/version/**/*">
- </fileset>
- <fileset dir="${java.client.src.dir}"
- includes="org/apache/zookeeper/**/*"
- excludes="org/apache/zookeeper/version/**/*">
- </fileset>
<testsources dir="${java.server.test.dir}">
<testclass package="org.apache.zookeeper.*" name=".*Test">
<testmethod annotation="Test"/>
</testclass>
</testsources>
- <testsources dir="${java.common.test.dir}">
- <testclass package="org.apache.zookeeper.*" name=".*Test">
- <testmethod annotation="Test"/>
- </testclass>
- </testsources>
</clover-setup>
</target>
@@ -1695,7 +1641,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<property name="findbugs.home" value="" />
<target name="findbugs" depends="check-for-findbugs, jar" if="findbugs.present">
<property name="findbugs.out.dir" value="${test.java.build.dir}/findbugs" />
- <property name="findbugs.exclude.file" value="${common.test.resource.dir}/findbugsExcludeFile.xml" />
+ <property name="findbugs.exclude.file" value="${server.test.resource.dir}/findbugsExcludeFile.xml" />
<property name="findbugs.report.htmlfile" value="${findbugs.out.dir}/zookeeper-findbugs-report.html" />
<property name="findbugs.report.xmlfile" value="${findbugs.out.dir}/zookeeper-findbugs-report.xml" />
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
@@ -1709,8 +1655,6 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
</fileset>
</auxClasspath>
<sourcePath path="${java.server.src.dir}" />
- <sourcePath path="${java.common.src.dir}" />
- <sourcePath path="${java.client.src.dir}" />
<class location="${build.dir}/${final.name}.jar" />
</findbugs>
<xslt style="${findbugs.home}/src/xsl/default.xsl" in="${findbugs.report.xmlfile}"
@@ -1776,13 +1720,10 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<formatter type="${test.junit.output.format}" />
<batchtest todir="${test.log.dir}" unless="testcase">
- <fileset dir="${java.common.test.dir}"
- includes="**/*Test.java"/>
<fileset dir="${java.server.test.dir}"
includes="**/*Test.java"/>
</batchtest>
<batchtest todir="${test.log.dir}" if="testcase">
- <fileset dir="${java.common.test.dir}" includes="**/${testcase}.java"/>
<fileset dir="${java.server.test.dir}" includes="**/${testcase}.java"/>
</batchtest>
</junit>
@@ -1811,13 +1752,11 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
</classpath>
</taskdef>
<mkdir dir="${test.java.build.dir}"/>
- <cs:checkstyle config="${common.test.resource.dir}/checkstyle.xml" failOnViolation="false">
- <fileset dir="${basedir}/zookeeper-common" includes="**/*.java" excludes="**/generated/**"/>
- <fileset dir="${basedir}/zookeeper-client" includes="**/*.java" excludes="**/generated/**"/>
+ <cs:checkstyle config="${server.test.resource.dir}/checkstyle.xml" failOnViolation="false">
<fileset dir="${basedir}/zookeeper-server" includes="**/*.java" excludes="**/generated/**"/>
<formatter type="xml" toFile="${test.java.build.dir}/checkstyle-errors.xml"/>
</cs:checkstyle>
- <xslt style="${common.test.resource.dir}/checkstyle-noframes-sorted.xsl" in="${test.java.build.dir}/checkstyle-errors.xml"
+ <xslt style="${server.test.resource.dir}/checkstyle-noframes-sorted.xsl" in="${test.java.build.dir}/checkstyle-errors.xml"
out="${test.java.build.dir}/checkstyle-errors.html"/>
</target>
@@ -1906,9 +1845,9 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<exclude name="src/zookeeper-client/zookeeper-client-c/config**"/>
<exclude name="src/zookeeper-client/zookeeper-client-c/src/hashtable/"/>
<exclude name="src/zookeeper-jute/target/main/java/.generated/"/>
- <exclude name="src/zookeeper-common/src/test/resources/checkstyle*.xml"/>
- <exclude name="src/zookeeper-common/src/test/resources/checkstyle*.xsl"/>
- <exclude name="src/zookeeper-common/src/test/resources/findbugs*.xml"/>
+ <exclude name="src/zookeeper-server/src/test/resources/checkstyle*.xml"/>
+ <exclude name="src/zookeeper-server/src/test/resources/checkstyle*.xsl"/>
+ <exclude name="src/zookeeper-server/src/test/resources/findbugs*.xml"/>
<exclude name="src/**/*.vcproj"/>
<exclude name="src/**/*.sln"/>
</fileset>
@@ -1997,12 +1936,6 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<include name="org/apache/zookeeper"/>
<exclude name="org/apache/jute"/>
</packageset>
- <packageset dir="${java.common.src.dir}">
- <include name="org/apache/zookeeper"/>
- </packageset>
- <packageset dir="${java.client.src.dir}">
- <include name="org/apache/zookeeper"/>
- </packageset>
<classpath>
<pathelement location="${build.classes}"/>
<fileset dir="${lib.dir}">
@@ -2028,8 +1961,6 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
excludepackagenames="org.apache.jute"
sourceFiles="${jdiff.home}/Null.java">
<fileset dir="${java.server.src.dir}"/>
- <fileset dir="${java.common.src.dir}"/>
- <fileset dir="${java.client.src.dir}"/>
<doclet name="jdiff.JDiff"
path="${ivy.jdiff.lib}/jdiff-1.0.9.jar:${ivy.jdiff.lib}/xerces-1.4.4.jar">
<param name="-oldapi" value="${name} ${jdiff.stable}"/>
@@ -2059,19 +1990,19 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<target name="ant-eclipse-download" unless="ant-eclipse.jar.exists">
<get src="https://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2"
- dest="${java.common.resources.dir}/ant-eclipse-1.0.bin.tar.bz2" usetimestamp="false" />
+ dest="${java.server.resources.dir}/ant-eclipse-1.0.bin.tar.bz2" usetimestamp="false" />
- <bunzip2 src="${java.common.resources.dir}/ant-eclipse-1.0.bin.tar.bz2"/>
+ <bunzip2 src="${java.server.resources.dir}/ant-eclipse-1.0.bin.tar.bz2"/>
- <untar src="${java.common.resources.dir}/ant-eclipse-1.0.bin.tar"
- dest="${java.common.resources.dir}">
+ <untar src="${java.server.resources.dir}/ant-eclipse-1.0.bin.tar"
+ dest="${java.server.resources.dir}">
<patternset>
<include name="lib/ant-eclipse-1.0-jvm1.2.jar"/>
</patternset>
</untar>
- <delete file="${java.common.resources.dir}/ant-eclipse-1.0.bin.tar" />
- <delete file="${java.common.resources.dir}/ant-eclipse-1.0.bin.tar.bz2" />
+ <delete file="${java.server.resources.dir}/ant-eclipse-1.0.bin.tar" />
+ <delete file="${java.server.resources.dir}/ant-eclipse-1.0.bin.tar.bz2" />
</target>
<target name="eclipse"
@@ -2092,16 +2023,10 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<classpath>
<source path="${java.server.src.dir}"
output="${build.dir.eclipse-main-classes}" />
- <source path="${java.common.src.dir}"
- output="${build.dir.eclipse-main-classes}" />
- <source path="${java.client.src.dir}"
- output="${build.dir.eclipse-main-classes}" />
<source path="${jute.src.dir}"
output="${build.dir.eclipse-main-classes}" />
<source path="${src_generated.dir}"
output="${build.dir.eclipse-main-classes}" />
- <source path="${java.common.test.dir}"
- output="${build.dir.eclipse-test-classes}" />
<source path="${java.server.test.dir}"
output="${build.dir.eclipse-test-classes}" />
<source path="${systest.src.dir}"
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/7291e47c/zookeeper-client/zookeeper-client-c/tests/zkServer.sh
----------------------------------------------------------------------
diff --git a/zookeeper-client/zookeeper-client-c/tests/zkServer.sh b/zookeeper-client/zookeeper-client-c/tests/zkServer.sh
index 9c84738..f06e338 100755
--- a/zookeeper-client/zookeeper-client-c/tests/zkServer.sh
+++ b/zookeeper-client/zookeeper-client-c/tests/zkServer.sh
@@ -90,7 +90,7 @@ do
CLASSPATH="$CLASSPATH:$i"
done
-for i in "${zk_base}"/zookeeper-common/src/main/resource/lib/*.jar
+for i in "${zk_base}"/zookeeper-server/src/main/resource/lib/*.jar
do
CLASSPATH="$CLASSPATH:$i"
done
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/7291e47c/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/ConnectStringParser.java
----------------------------------------------------------------------
diff --git a/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/ConnectStringParser.java b/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/ConnectStringParser.java
deleted file mode 100644
index ff0425a..0000000
--- a/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/ConnectStringParser.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * 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.zookeeper.client;
-
-import java.net.InetSocketAddress;
-import java.util.ArrayList;
-
-import org.apache.zookeeper.common.PathUtils;
-
-/**
- * A parser for ZooKeeper Client connect strings.
- *
- * This class is not meant to be seen or used outside of ZooKeeper itself.
- *
- * The chrootPath member should be replaced by a Path object in issue
- * ZOOKEEPER-849.
- *
- * @see org.apache.zookeeper.ZooKeeper
- */
-public final class ConnectStringParser {
- private static final int DEFAULT_PORT = 2181;
-
- private final String chrootPath;
-
- private final ArrayList<InetSocketAddress> serverAddresses = new ArrayList<InetSocketAddress>();
-
- /**
- *
- * @throws IllegalArgumentException
- * for an invalid chroot path.
- */
- public ConnectStringParser(String connectString) {
- // parse out chroot, if any
- int off = connectString.indexOf('/');
- if (off >= 0) {
- String chrootPath = connectString.substring(off);
- // ignore "/" chroot spec, same as null
- if (chrootPath.length() == 1) {
- this.chrootPath = null;
- } else {
- PathUtils.validatePath(chrootPath);
- this.chrootPath = chrootPath;
- }
- connectString = connectString.substring(0, off);
- } else {
- this.chrootPath = null;
- }
-
- String hostsList[] = connectString.split(",");
- for (String host : hostsList) {
- int port = DEFAULT_PORT;
- int pidx = host.lastIndexOf(':');
- if (pidx >= 0) {
- // otherwise : is at the end of the string, ignore
- if (pidx < host.length() - 1) {
- port = Integer.parseInt(host.substring(pidx + 1));
- }
- host = host.substring(0, pidx);
- }
- serverAddresses.add(InetSocketAddress.createUnresolved(host, port));
- }
- }
-
- public String getChrootPath() {
- return chrootPath;
- }
-
- public ArrayList<InetSocketAddress> getServerAddresses() {
- return serverAddresses;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/7291e47c/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/FourLetterWordMain.java
----------------------------------------------------------------------
diff --git a/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/FourLetterWordMain.java b/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/FourLetterWordMain.java
deleted file mode 100644
index a4175e4..0000000
--- a/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/FourLetterWordMain.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * 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.zookeeper.client;
-
-import org.apache.log4j.Logger;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.net.SocketTimeoutException;
-
-import org.apache.yetus.audience.InterfaceAudience;
-
-@InterfaceAudience.Public
-public class FourLetterWordMain {
- //in milliseconds, socket should connect/read within this period otherwise SocketTimeoutException
- private static final int DEFAULT_SOCKET_TIMEOUT = 5000;
- protected static final Logger LOG = Logger.getLogger(FourLetterWordMain.class);
-
- /**
- * Send the 4letterword
- * @param host the destination host
- * @param port the destination port
- * @param cmd the 4letterword
- * @return server response
- * @throws java.io.IOException
- */
- public static String send4LetterWord(String host, int port, String cmd)
- throws IOException
- {
- return send4LetterWord(host, port, cmd, DEFAULT_SOCKET_TIMEOUT);
- }
- /**
- * Send the 4letterword
- * @param host the destination host
- * @param port the destination port
- * @param cmd the 4letterword
- * @param timeout in milliseconds, maximum time to wait while connecting/reading data
- * @return server response
- * @throws java.io.IOException
- */
- public static String send4LetterWord(String host, int port, String cmd, int timeout)
- throws IOException
- {
- LOG.info("connecting to " + host + " " + port);
- Socket sock = new Socket();
- InetSocketAddress hostaddress= host != null ? new InetSocketAddress(host, port) :
- new InetSocketAddress(InetAddress.getByName(null), port);
- BufferedReader reader = null;
- try {
- sock.setSoTimeout(timeout);
- sock.connect(hostaddress, timeout);
- OutputStream outstream = sock.getOutputStream();
- outstream.write(cmd.getBytes());
- outstream.flush();
- // this replicates NC - close the output stream before reading
- sock.shutdownOutput();
-
- reader =
- new BufferedReader(
- new InputStreamReader(sock.getInputStream()));
- StringBuilder sb = new StringBuilder();
- String line;
- while((line = reader.readLine()) != null) {
- sb.append(line + "\n");
- }
- return sb.toString();
- } catch (SocketTimeoutException e) {
- throw new IOException("Exception while executing four letter word: " + cmd, e);
- } finally {
- sock.close();
- if (reader != null) {
- reader.close();
- }
- }
- }
-
- public static void main(String[] args)
- throws IOException
- {
- if (args.length != 3) {
- System.out.println("Usage: FourLetterWordMain <host> <port> <cmd>");
- } else {
- System.out.println(send4LetterWord(args[0], Integer.parseInt(args[1]), args[2]));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/7291e47c/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/HostProvider.java
----------------------------------------------------------------------
diff --git a/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/HostProvider.java b/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/HostProvider.java
deleted file mode 100644
index 61d9108..0000000
--- a/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/HostProvider.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * 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.zookeeper.client;
-
-import org.apache.yetus.audience.InterfaceAudience;
-
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-
-/**
- * A set of hosts a ZooKeeper client should connect to.
- *
- * Classes implementing this interface must guarantee the following:
- *
- * * Every call to next() returns an InetSocketAddress. So the iterator never
- * ends.
- *
- * * The size() of a HostProvider may never be zero.
- *
- * A HostProvider must return resolved InetSocketAddress instances on next(),
- * but it's up to the HostProvider, when it wants to do the resolving.
- *
- * Different HostProvider could be imagined:
- *
- * * A HostProvider that loads the list of Hosts from an URL or from DNS
- * * A HostProvider that re-resolves the InetSocketAddress after a timeout.
- * * A HostProvider that prefers nearby hosts.
- */
-@InterfaceAudience.Public
-public interface HostProvider {
- public int size();
-
- /**
- * The next host to try to connect to.
- *
- * For a spinDelay of 0 there should be no wait.
- *
- * @param spinDelay Milliseconds to wait if all hosts have been tried once.
- * @return The next host to try to connect to with resolved address. If the host is not resolvable, the unresolved
- * address will be returned.
- */
- public InetSocketAddress next(long spinDelay);
-
- /**
- * Notify the HostProvider of a successful connection.
- *
- * The HostProvider may use this notification to reset it's inner state.
- */
- public void onConnected();
-}
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/7291e47c/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/StaticHostProvider.java
----------------------------------------------------------------------
diff --git a/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/StaticHostProvider.java b/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/StaticHostProvider.java
deleted file mode 100644
index 0005942..0000000
--- a/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/StaticHostProvider.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * 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.zookeeper.client;
-
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.yetus.audience.InterfaceAudience;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Most simple HostProvider, resolves on every next() call.
- *
- * Please be aware that although this class doesn't do any DNS caching, there're multiple levels of caching already
- * present across the stack like in JVM, OS level, hardware, etc. The best we could do here is to get the most recent
- * address from the underlying system which is considered up-to-date.
- *
- */
-@InterfaceAudience.Public
-public final class StaticHostProvider implements HostProvider {
- public interface Resolver {
- InetAddress[] getAllByName(String name) throws UnknownHostException;
- }
-
- private static final Logger LOG = LoggerFactory
- .getLogger(StaticHostProvider.class);
-
- private final List<InetSocketAddress> serverAddresses = new ArrayList<InetSocketAddress>(5);
-
- private int lastIndex = -1;
-
- private int currentIndex = -1;
-
- private Resolver resolver;
-
- /**
- * Constructs a SimpleHostSet.
- *
- * @param serverAddresses
- * possibly unresolved ZooKeeper server addresses
- * @throws IllegalArgumentException
- * if serverAddresses is empty or resolves to an empty list
- */
- public StaticHostProvider(Collection<InetSocketAddress> serverAddresses) {
- this.resolver = new Resolver() {
- @Override
- public InetAddress[] getAllByName(String name) throws UnknownHostException {
- return InetAddress.getAllByName(name);
- }
- };
- init(serverAddresses);
- }
-
- /**
- * Introduced for testing purposes. getAllByName() is a static method of InetAddress, therefore cannot be easily mocked.
- * By abstraction of Resolver interface we can easily inject a mocked implementation in tests.
- *
- * @param serverAddresses
- * possibly unresolved ZooKeeper server addresses
- * @param resolver
- * custom resolver implementation
- * @throws IllegalArgumentException
- * if serverAddresses is empty or resolves to an empty list
- */
- public StaticHostProvider(Collection<InetSocketAddress> serverAddresses, Resolver resolver) {
- this.resolver = resolver;
- init(serverAddresses);
- }
-
- /**
- * Common init method for all constructors.
- * Resolve all unresolved server addresses, put them in a list and shuffle.
- */
- private void init(Collection<InetSocketAddress> serverAddresses) {
- if (serverAddresses.isEmpty()) {
- throw new IllegalArgumentException(
- "A HostProvider may not be empty!");
- }
-
- this.serverAddresses.addAll(serverAddresses);
- Collections.shuffle(this.serverAddresses);
- }
-
- /**
- * Evaluate to a hostname if one is available and otherwise it returns the
- * string representation of the IP address.
- *
- * In Java 7, we have a method getHostString, but earlier versions do not support it.
- * This method is to provide a replacement for InetSocketAddress.getHostString().
- *
- * @param addr
- * @return Hostname string of address parameter
- */
- private String getHostString(InetSocketAddress addr) {
- String hostString = "";
-
- if (addr == null) {
- return hostString;
- }
- if (!addr.isUnresolved()) {
- InetAddress ia = addr.getAddress();
-
- // If the string starts with '/', then it has no hostname
- // and we want to avoid the reverse lookup, so we return
- // the string representation of the address.
- if (ia.toString().startsWith("/")) {
- hostString = ia.getHostAddress();
- } else {
- hostString = addr.getHostName();
- }
- } else {
- // According to the Java 6 documentation, if the hostname is
- // unresolved, then the string before the colon is the hostname.
- String addrString = addr.toString();
- hostString = addrString.substring(0, addrString.lastIndexOf(':'));
- }
-
- return hostString;
- }
-
- public int size() {
- return serverAddresses.size();
- }
-
- public InetSocketAddress next(long spinDelay) {
- currentIndex = ++currentIndex % serverAddresses.size();
- if (currentIndex == lastIndex && spinDelay > 0) {
- try {
- Thread.sleep(spinDelay);
- } catch (InterruptedException e) {
- LOG.warn("Unexpected exception", e);
- }
- } else if (lastIndex == -1) {
- // We don't want to sleep on the first ever connect attempt.
- lastIndex = 0;
- }
-
- InetSocketAddress curAddr = serverAddresses.get(currentIndex);
- try {
- String curHostString = getHostString(curAddr);
- List<InetAddress> resolvedAddresses = new ArrayList<InetAddress>(Arrays.asList(this.resolver.getAllByName(curHostString)));
- if (resolvedAddresses.isEmpty()) {
- return curAddr;
- }
- Collections.shuffle(resolvedAddresses);
- return new InetSocketAddress(resolvedAddresses.get(0), curAddr.getPort());
- } catch (UnknownHostException e) {
- return curAddr;
- }
- }
-
- @Override
- public void onConnected() {
- lastIndex = currentIndex;
- }
-}
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/7291e47c/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/ZooKeeperSaslClient.java
----------------------------------------------------------------------
diff --git a/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/ZooKeeperSaslClient.java b/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/ZooKeeperSaslClient.java
deleted file mode 100644
index af3303c..0000000
--- a/zookeeper-client/zookeeper-client-java/src/main/java/org/apache/zookeeper/client/ZooKeeperSaslClient.java
+++ /dev/null
@@ -1,439 +0,0 @@
-/**
- * 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.zookeeper.client;
-
-import java.io.IOException;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.security.auth.Subject;
-import javax.security.auth.login.AppConfigurationEntry;
-import javax.security.auth.login.Configuration;
-import javax.security.auth.login.LoginException;
-import javax.security.sasl.SaslClient;
-import javax.security.sasl.SaslException;
-
-import org.apache.zookeeper.AsyncCallback;
-import org.apache.zookeeper.ClientCnxn;
-import org.apache.zookeeper.Environment;
-import org.apache.zookeeper.Login;
-import org.apache.zookeeper.SaslClientCallbackHandler;
-import org.apache.zookeeper.Watcher.Event.KeeperState;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.Stat;
-import org.apache.zookeeper.proto.GetSASLRequest;
-import org.apache.zookeeper.proto.SetSASLResponse;
-import org.apache.zookeeper.util.SecurityUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class manages SASL authentication for the client. It
- * allows ClientCnxn to authenticate using SASL with a Zookeeper server.
- */
-public class ZooKeeperSaslClient {
- public static final String LOGIN_CONTEXT_NAME_KEY = "zookeeper.sasl.clientconfig";
- public static final String ENABLE_CLIENT_SASL_KEY = "zookeeper.sasl.client";
- public static final String ENABLE_CLIENT_SASL_DEFAULT = "true";
- private static volatile boolean initializedLogin = false;
-
- /**
- * Returns true if the SASL client is enabled. By default, the client
- * is enabled but can be disabled by setting the system property
- * <code>zookeeper.sasl.client</code> to <code>false</code>. See
- * ZOOKEEPER-1657 for more information.
- *
- * @return If the SASL client is enabled.
- */
- public static boolean isEnabled() {
- return Boolean.valueOf(System.getProperty(ENABLE_CLIENT_SASL_KEY, ENABLE_CLIENT_SASL_DEFAULT));
- }
-
- private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperSaslClient.class);
- private static Login login = null;
- private SaslClient saslClient;
- private boolean isSASLConfigured = true;
-
- private byte[] saslToken = new byte[0];
-
- public enum SaslState {
- INITIAL,INTERMEDIATE,COMPLETE,FAILED
- }
-
- private SaslState saslState = SaslState.INITIAL;
-
- private boolean gotLastPacket = false;
- /** informational message indicating the current configuration status */
- private final String configStatus;
-
- public SaslState getSaslState() {
- return saslState;
- }
-
- public String getLoginContext() {
- if (login != null)
- return login.getLoginContextName();
- return null;
- }
-
- public ZooKeeperSaslClient(final String serverPrincipal)
- throws LoginException {
- /**
- * ZOOKEEPER-1373: allow system property to specify the JAAS
- * configuration section that the zookeeper client should use.
- * Default to "Client".
- */
- String clientSection = System.getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, "Client");
- // Note that 'Configuration' here refers to javax.security.auth.login.Configuration.
- AppConfigurationEntry entries[] = null;
- RuntimeException runtimeException = null;
- try {
- entries = Configuration.getConfiguration().getAppConfigurationEntry(clientSection);
- } catch (SecurityException e) {
- // handle below: might be harmless if the user doesn't intend to use JAAS authentication.
- runtimeException = e;
- } catch (IllegalArgumentException e) {
- // third party customized getAppConfigurationEntry could throw IllegalArgumentException when JAAS
- // configuration isn't set. We can reevaluate whether to catch RuntimeException instead when more
- // different types of RuntimeException found
- runtimeException = e;
- }
- if (entries != null) {
- this.configStatus = "Will attempt to SASL-authenticate using Login Context section '" + clientSection + "'";
- this.saslClient = createSaslClient(serverPrincipal, clientSection);
- } else {
- // Handle situation of clientSection's being null: it might simply because the client does not intend to
- // use SASL, so not necessarily an error.
- saslState = SaslState.FAILED;
- String explicitClientSection = System.getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY);
- if (explicitClientSection != null) {
- // If the user explicitly overrides the default Login Context, they probably expected SASL to
- // succeed. But if we got here, SASL failed.
- if (runtimeException != null) {
- throw new LoginException("Zookeeper client cannot authenticate using the " + explicitClientSection +
- " section of the supplied JAAS configuration: '" +
- System.getProperty(Environment.JAAS_CONF_KEY) + "' because of a " +
- "RuntimeException: " + runtimeException);
- } else {
- throw new LoginException("Client cannot SASL-authenticate because the specified JAAS configuration " +
- "section '" + explicitClientSection + "' could not be found.");
- }
- } else {
- // The user did not override the default context. It might be that they just don't intend to use SASL,
- // so log at INFO, not WARN, since they don't expect any SASL-related information.
- String msg = "Will not attempt to authenticate using SASL ";
- if (runtimeException != null) {
- msg += "(" + runtimeException + ")";
- } else {
- msg += "(unknown error)";
- }
- this.configStatus = msg;
- this.isSASLConfigured = false;
- }
- if (System.getProperty(Environment.JAAS_CONF_KEY) != null) {
- // Again, the user explicitly set something SASL-related, so they probably expected SASL to succeed.
- if (runtimeException != null) {
- throw new LoginException("Zookeeper client cannot authenticate using the '" +
- System.getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, "Client") +
- "' section of the supplied JAAS configuration: '" +
- System.getProperty(Environment.JAAS_CONF_KEY) + "' because of a " +
- "RuntimeException: " + runtimeException);
- } else {
- throw new LoginException("No JAAS configuration section named '" +
- System.getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, "Client") +
- "' was found in specified JAAS configuration file: '" +
- System.getProperty(Environment.JAAS_CONF_KEY) + "'.");
- }
- }
- }
- }
-
- /**
- * @return informational message indicating the current configuration status.
- */
- public String getConfigStatus() {
- return configStatus;
- }
-
- public boolean isComplete() {
- return (saslState == SaslState.COMPLETE);
- }
-
- public boolean isFailed() {
- return (saslState == SaslState.FAILED);
- }
-
- public static class ServerSaslResponseCallback implements AsyncCallback.DataCallback {
- public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
- // processResult() is used by ClientCnxn's sendThread to respond to
- // data[] contains the Zookeeper Server's SASL token.
- // ctx is the ZooKeeperSaslClient object. We use this object's respondToServer() method
- // to reply to the Zookeeper Server's SASL token
- ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslClient;
- if (client == null) {
- LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
- return;
- }
- byte[] usedata = data;
- if (data != null) {
- LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
- }
- else {
- usedata = new byte[0];
- LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
- }
- client.respondToServer(usedata, (ClientCnxn)ctx);
- }
- }
-
- private SaslClient createSaslClient(final String servicePrincipal,
- final String loginContext) throws LoginException {
- try {
- if (!initializedLogin) {
- synchronized (ZooKeeperSaslClient.class) {
- if (login == null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("JAAS loginContext is: " + loginContext);
- }
- // note that the login object is static: it's shared amongst all zookeeper-related connections.
- // in order to ensure the login is initialized only once, it must be synchronized the code snippet.
- login = new Login(loginContext, new SaslClientCallbackHandler(null, "Client"));
- login.startThreadIfNeeded();
- initializedLogin = true;
- }
- }
- }
- return SecurityUtils.createSaslClient(login.getSubject(),
- servicePrincipal, "zookeeper", "zk-sasl-md5", LOG, "Client");
- } catch (LoginException e) {
- // We throw LoginExceptions...
- throw e;
- } catch (Exception e) {
- // ..but consume (with a log message) all other types of exceptions.
- LOG.error("Exception while trying to create SASL client: " + e);
- return null;
- }
- }
-
- public void respondToServer(byte[] serverToken, ClientCnxn cnxn) {
- if (saslClient == null) {
- LOG.error("saslClient is unexpectedly null. Cannot respond to server's SASL message; ignoring.");
- return;
- }
-
- if (!(saslClient.isComplete())) {
- try {
- saslToken = createSaslToken(serverToken);
- if (saslToken != null) {
- sendSaslPacket(saslToken, cnxn);
- }
- } catch (SaslException e) {
- LOG.error("SASL authentication failed using login context '" +
- this.getLoginContext() + "' with exception: {}", e);
- saslState = SaslState.FAILED;
- gotLastPacket = true;
- }
- }
-
- if (saslClient.isComplete()) {
- // GSSAPI: server sends a final packet after authentication succeeds
- // or fails.
- if ((serverToken == null) && (saslClient.getMechanismName().equals("GSSAPI")))
- gotLastPacket = true;
- // non-GSSAPI: no final packet from server.
- if (!saslClient.getMechanismName().equals("GSSAPI")) {
- gotLastPacket = true;
- }
- // SASL authentication is completed, successfully or not:
- // enable the socket's writable flag so that any packets waiting for authentication to complete in
- // the outgoing queue will be sent to the Zookeeper server.
- cnxn.enableWrite();
- }
- }
-
- private byte[] createSaslToken() throws SaslException {
- saslState = SaslState.INTERMEDIATE;
- return createSaslToken(saslToken);
- }
-
- private byte[] createSaslToken(final byte[] saslToken) throws SaslException {
- if (saslToken == null) {
- // TODO: introspect about runtime environment (such as jaas.conf)
- saslState = SaslState.FAILED;
- throw new SaslException("Error in authenticating with a Zookeeper Quorum member: the quorum member's saslToken is null.");
- }
-
- Subject subject = login.getSubject();
- if (subject != null) {
- synchronized(login) {
- try {
- final byte[] retval =
- Subject.doAs(subject, new PrivilegedExceptionAction<byte[]>() {
- public byte[] run() throws SaslException {
- LOG.debug("saslClient.evaluateChallenge(len="+saslToken.length+")");
- return saslClient.evaluateChallenge(saslToken);
- }
- });
- return retval;
- }
- catch (PrivilegedActionException e) {
- String error = "An error: (" + e + ") occurred when evaluating Zookeeper Quorum Member's " +
- " received SASL token.";
- // Try to provide hints to use about what went wrong so they can fix their configuration.
- // TODO: introspect about e: look for GSS information.
- final String UNKNOWN_SERVER_ERROR_TEXT =
- "(Mechanism level: Server not found in Kerberos database (7) - UNKNOWN_SERVER)";
- if (e.toString().indexOf(UNKNOWN_SERVER_ERROR_TEXT) > -1) {
- error += " This may be caused by Java's being unable to resolve the Zookeeper Quorum Member's" +
- " hostname correctly. You may want to try to adding" +
- " '-Dsun.net.spi.nameservice.provider.1=dns,sun' to your client's JVMFLAGS environment.";
- }
- error += " Zookeeper Client will go to AUTH_FAILED state.";
- LOG.error(error);
- saslState = SaslState.FAILED;
- throw new SaslException(error);
- }
- }
- }
- else {
- throw new SaslException("Cannot make SASL token without subject defined. " +
- "For diagnosis, please look for WARNs and ERRORs in your log related to the Login class.");
- }
- }
-
- private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
- throws SaslException{
- if (LOG.isDebugEnabled()) {
- LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
- }
-
- GetSASLRequest request = new GetSASLRequest();
- request.setToken(saslToken);
- SetSASLResponse response = new SetSASLResponse();
- ServerSaslResponseCallback cb = new ServerSaslResponseCallback();
-
- try {
- cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
- } catch (IOException e) {
- throw new SaslException("Failed to send SASL packet to server.",
- e);
- }
- }
-
- private void sendSaslPacket(ClientCnxn cnxn) throws SaslException {
- if (LOG.isDebugEnabled()) {
- LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
- }
- GetSASLRequest request = new GetSASLRequest();
- request.setToken(createSaslToken());
- SetSASLResponse response = new SetSASLResponse();
- ServerSaslResponseCallback cb = new ServerSaslResponseCallback();
- try {
- cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
- } catch (IOException e) {
- throw new SaslException("Failed to send SASL packet to server due " +
- "to IOException:", e);
- }
- }
-
- // used by ClientCnxn to know whether to emit a SASL-related event: either AuthFailed or SaslAuthenticated,
- // or none, if not ready yet. Sets saslState to COMPLETE as a side-effect.
- public KeeperState getKeeperState() {
- if (saslClient != null) {
- if (saslState == SaslState.FAILED) {
- return KeeperState.AuthFailed;
- }
- if (saslClient.isComplete()) {
- if (saslState == SaslState.INTERMEDIATE) {
- saslState = SaslState.COMPLETE;
- return KeeperState.SaslAuthenticated;
- }
- }
- }
- // No event ready to emit yet.
- return null;
- }
-
- // Initialize the client's communications with the Zookeeper server by sending the server the first
- // authentication packet.
- public void initialize(ClientCnxn cnxn) throws SaslException {
- if (saslClient == null) {
- saslState = SaslState.FAILED;
- throw new SaslException("saslClient failed to initialize properly: it's null.");
- }
- if (saslState == SaslState.INITIAL) {
- if (saslClient.hasInitialResponse()) {
- sendSaslPacket(cnxn);
- }
- else {
- byte[] emptyToken = new byte[0];
- sendSaslPacket(emptyToken, cnxn);
- }
- saslState = SaslState.INTERMEDIATE;
- }
- }
-
- public boolean clientTunneledAuthenticationInProgress() {
- if (!isSASLConfigured) {
- return false;
- }
- // TODO: Rather than checking a disjunction here, should be a single member
- // variable or method in this class to determine whether the client is
- // configured to use SASL. (see also ZOOKEEPER-1455).
- try {
- if ((System.getProperty(Environment.JAAS_CONF_KEY) != null) ||
- ((javax.security.auth.login.Configuration.getConfiguration() != null) &&
- (javax.security.auth.login.Configuration.getConfiguration().
- getAppConfigurationEntry(System.
- getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY,"Client"))
- != null))) {
- // Client is configured to use a valid login Configuration, so
- // authentication is either in progress, successful, or failed.
-
- // 1. Authentication hasn't finished yet: we must wait for it to do so.
- if ((isComplete() == false) &&
- (isFailed() == false)) {
- return true;
- }
-
- // 2. SASL authentication has succeeded or failed..
- if (isComplete() || isFailed()) {
- if (gotLastPacket == false) {
- // ..but still in progress, because there is a final SASL
- // message from server which must be received.
- return true;
- }
- }
- }
- // Either client is not configured to use a tunnelled authentication
- // scheme, or tunnelled authentication has completed (successfully or
- // not), and all server SASL messages have been received.
- return false;
- } catch (SecurityException e) {
- // Thrown if the caller does not have permission to retrieve the Configuration.
- // In this case, simply returning false is correct.
- if (LOG.isDebugEnabled() == true) {
- LOG.debug("Could not retrieve login configuration: " + e);
- }
- return false;
- }
- }
-
-
-}