id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
160999_133 | {
"fields": [
{
"declarator": "testData = new File(System.getProperty(\"test.data.dir\", \"src/test/resources/data\"))",
"modifier": "private static final",
"original_string": "private static final File testData = new File(System.getProperty(\"test.data.dir\", \"src/test/resources/data\"));",
... | {
"body": "@Test\n public void testDumpWithCrcError() throws Exception {\n // Arrange\n File logfile = new File(new File(mySnapDir, \"version-2\"), \"log.42\");\n TxnLogToolkit lt = new TxnLogToolkit(false, false, logfile.toString(), true);\n\n // Act\n lt.dump(null);\n\n ... | {
"fields": [
{
"declarator": "txnLogFile",
"modifier": "private",
"original_string": "private File txnLogFile;",
"type": "File",
"var_name": "txnLogFile"
},
{
"declarator": "recoveryMode = false",
"modifier": "private",
"original_string": "private boolean r... | {
"body": "public void dump(Scanner scanner) throws Exception {\n crcFixed = 0;\n\n FileHeader fhdr = new FileHeader();\n fhdr.deserialize(logStream, \"fileheader\");\n if (fhdr.getMagic() != TXNLOG_MAGIC) {\n throw new TxnLogToolkitException(\n ExitCode.INVALID_I... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_82 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/util/ConfigUtilsTest.java",
"identifier": "ConfigUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetHostAndPortWithoutBracket() {\n assertThrows(ConfigException.class, () -> {\n String[] nsa = ConfigUtils.getHostAndPort(\"[2001:db8:85a3:8d3:1319:8a2e:370:7348\");\n });\n }",
"class_method_signature": "ConfigUtilsTest.testGetHostAndPortWithoutBra... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/util/ConfigUtils.java",
"identifier": "ConfigUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "ConfigUtils.getClientConfigStr(String configData)",
"constructor": false,
"full_signature":... | {
"body": "public static String[] getHostAndPort(String s) throws ConfigException {\n if (s.startsWith(\"[\")) {\n int i = s.indexOf(\"]\");\n if (i < 0) {\n throw new ConfigException(s + \" starts with '[' but has no matching ']:'\");\n }\n if (i + 2 ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_125 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class)",
"modifier": "protected static final",
"original_string": "protected static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "@Test\n public void testMetricsProviderConfiguration() throws Exception {\n ClientBase.setupTestEnv();\n\n final int CLIENT_PORT = PortAssignment.unique();\n MetricsProviderWithConfiguration.httpPort.set(0);\n final String configs = \"metricsProvider.className=\"\n ... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class);",
"type": "Logger",
"var_name": "LOG"
},
{
... | {
"body": "protected void shutdown() {\n if (containerManager != null) {\n containerManager.stop();\n }\n if (cnxnFactory != null) {\n cnxnFactory.shutdown();\n }\n if (secureCnxnFactory != null) {\n secureCnxnFactory.shutdown();\n }\n ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_172 | {
"fields": [
{
"declarator": "testData = new File(System.getProperty(\"test.data.dir\", \"src/test/resources/data\"))",
"modifier": "private static final",
"original_string": "private static final File testData = new File(System.getProperty(\"test.data.dir\", \"src/test/resources/data\"));",
... | {
"body": "@Test\n public void connectionRetryTimeoutTest() throws Exception {\n assertThrows(IOException.class, () -> {\n Learner learner = new TestLearner();\n learner.self = new QuorumPeer();\n learner.self.setTickTime(2000);\n learner.self.setInitLimit(5);\n ... | {
"fields": [
{
"declarator": "self",
"modifier": "",
"original_string": "QuorumPeer self;",
"type": "QuorumPeer",
"var_name": "self"
},
{
"declarator": "zk",
"modifier": "",
"original_string": "LearnerZooKeeperServer zk;",
"type": "LearnerZooKeeperSer... | {
"body": "protected void connectToLeader(MultipleAddresses multiAddr, String hostname) throws IOException {\n\n this.leaderAddr = multiAddr;\n Set<InetSocketAddress> addresses;\n if (self.isMultiAddressReachabilityCheckEnabled()) {\n // even if none of the addresses are reachable, we ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_220 | {
"fields": [],
"file": "zookeeper-jute/src/test/java/org/apache/jute/BinaryInputArchiveTest.java",
"identifier": "BinaryInputArchiveTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testReadStringForRecordsHavingLengthMoreThanMaxAllowedSize() {\n int maxBufferSize = 2000;\n int extraMaxBufferSize = 1025;\n //this record size is more than the max allowed size\n int recordSize = maxBufferSize + extraMaxBufferSize + 100;\n BinaryInputArchive ia =\n ... | {
"fields": [
{
"declarator": "UNREASONBLE_LENGTH = \"Unreasonable length = \"",
"modifier": "public static final",
"original_string": "public static final String UNREASONBLE_LENGTH = \"Unreasonable length = \";",
"type": "String",
"var_name": "UNREASONBLE_LENGTH"
},
{
... | {
"body": "public String readString(String tag) throws IOException {\n int len = in.readInt();\n if (len == -1) {\n return null;\n }\n checkLength(len);\n byte[] b = new byte[len];\n in.readFully(b);\n return new String(b, StandardCharsets.UTF_8);\n }",
... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_109 | {
"fields": [
{
"declarator": "m",
"modifier": "private",
"original_string": "private Map<String, Set<Long>> m;",
"type": "Map<String, Set<Long>>",
"var_name": "m"
},
{
"declarator": "r",
"modifier": "private",
"original_string": "private WatchesPathReport r... | {
"body": "@Test\n public void testHasSessions() {\n assertTrue(r.hasSessions(\"path1\"));\n assertTrue(r.hasSessions(\"path2\"));\n assertFalse(r.hasSessions(\"path3\"));\n }",
"class_method_signature": "WatchesPathReportTest.testHasSessions()",
"constructor": false,
"full_signature"... | {
"fields": [
{
"declarator": "path2Ids",
"modifier": "private final",
"original_string": "private final Map<String, Set<Long>> path2Ids;",
"type": "Map<String, Set<Long>>",
"var_name": "path2Ids"
}
],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/watch/... | {
"body": "public boolean hasSessions(String path) {\n return path2Ids.containsKey(path);\n }",
"class_method_signature": "WatchesPathReport.hasSessions(String path)",
"constructor": false,
"full_signature": "public boolean hasSessions(String path)",
"identifier": "hasSessions",
"invocations": [
... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_41 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathUtilsTest.java",
"identifier": "PathUtilsTest",
"interfaces": "",
"superclass": "extends ZKTestCase"
} | {
"body": "@Test\n public void testValidatePath_DoubleSlash() {\n assertThrows(IllegalArgumentException.class, () -> {\n PathUtils.validatePath(\"/double//slash\");\n });\n }",
"class_method_signature": "PathUtilsTest.testValidatePath_DoubleSlash()",
"constructor": false,
"full_si... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/PathUtils.java",
"identifier": "PathUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": ... | {
"body": "public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException {\n validatePath(isSequential ? path + \"1\" : path);\n }",
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": "pu... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_16 | {
"fields": [
{
"declarator": "port = 1234",
"modifier": "private",
"original_string": "private Integer port = 1234;",
"type": "Integer",
"var_name": "port"
},
{
"declarator": "v4addr = \"127.0.0.1\"",
"modifier": "private",
"original_string": "private Strin... | {
"body": "@Test\n public void tetGetIPV6HostAndPort_WhenHostIsEmpty() {\n assertThrows(IllegalArgumentException.class, () -> {\n NetUtils.getIPV6HostAndPort(\"[]:2181\");\n });\n }",
"class_method_signature": "NetUtilsTest.tetGetIPV6HostAndPort_WhenHostIsEmpty()",
"constructor": fa... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/NetUtils.java",
"identifier": "NetUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "NetUtils.formatInetAddr(InetSocketAddress addr)",
"constructor": false,
"full_signature": "public stat... | {
"body": "public static String[] getIPV6HostAndPort(String hostPort) {\n if (hostPort.startsWith(\"[\")) {\n int i = hostPort.lastIndexOf(']');\n if (i < 0) {\n throw new IllegalArgumentException(\n hostPort + \" starts with '[' but has no matching ']'\"... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_148 | {
"fields": [
{
"declarator": "testCounter",
"modifier": "private",
"original_string": "private AvgMinMaxPercentileCounter testCounter;",
"type": "AvgMinMaxPercentileCounter",
"var_name": "testCounter"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/m... | {
"body": "@Test\n public void testValues() {\n addDataPoints();\n Map<String, Object> values = testCounter.values();\n\n assertEquals(9, values.size(), \"There should be 9 values in the set\");\n\n assertEquals(999D / 2, values.get(\"avg_test\"), \"should avg=499.5\");\n assertE... | {
"fields": [
{
"declarator": "name",
"modifier": "private final",
"original_string": "private final String name;",
"type": "String",
"var_name": "name"
},
{
"declarator": "counter",
"modifier": "private final",
"original_string": "private final AvgMinMaxCou... | {
"body": "public Map<String, Object> values() {\n Map<String, Object> m = new LinkedHashMap<>();\n m.putAll(counter.values());\n m.put(\"p50_\" + name, Math.round(this.histogram.getSnapshot().getMedian()));\n m.put(\"p95_\" + name, Math.round(this.histogram.getSnapshot().get95thPercentile... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_57 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/FileKeyStoreLoaderBuilderProviderTest.java",
"identifier": "FileKeyStoreLoaderBuilderProviderTest",
"interfaces": "",
"superclass": "extends ZKTestCase"
} | {
"body": "@Test\n public void testGetBuilderForPKCS12FileType() {\n FileKeyStoreLoader.Builder<?> builder = FileKeyStoreLoaderBuilderProvider.getBuilderForKeyStoreFileType(KeyStoreFileType.PKCS12);\n assertTrue(builder instanceof PKCS12FileLoader.Builder);\n }",
"class_method_signature": "FileK... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/FileKeyStoreLoaderBuilderProvider.java",
"identifier": "FileKeyStoreLoaderBuilderProvider",
"interfaces": "",
"methods": [
{
"class_method_signature": "FileKeyStoreLoaderBuilderProvider.getBuilderForKeyStoreFileType(... | {
"body": "static FileKeyStoreLoader.Builder<? extends FileKeyStoreLoader> getBuilderForKeyStoreFileType(KeyStoreFileType type) {\n switch (Objects.requireNonNull(type)) {\n case JKS:\n return new JKSFileLoader.Builder();\n case PEM:\n return new PEMFileLoader.Builder();\n ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_114 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(PrepRequestProcessorTest.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(PrepRequestProcessorTest.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "@Test\n public void testInvalidPath() throws Exception {\n pLatch = new CountDownLatch(1);\n processor = new PrepRequestProcessor(zks, new MyRequestProcessor());\n\n SetDataRequest record = new SetDataRequest(\"\", new byte[0], -1);\n Request req = createRequest(record, OpCod... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(PrepRequestProcessor.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(PrepRequestProcessor.class);",
"type": "Logger",
"var_name": "LOG"
},
{... | {
"body": "protected void pRequest(Request request) throws RequestProcessorException {\n // LOG.info(\"Prep>>> cxid = \" + request.cxid + \" type = \" +\n // request.type + \" id = 0x\" + Long.toHexString(request.sessionId));\n request.setHdr(null);\n request.setTxn(null);\n\n if (!... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_143 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(DataTreeTest.class)",
"modifier": "protected static final",
"original_string": "protected static final Logger LOG = LoggerFactory.getLogger(DataTreeTest.class);",
"type": "Logger",
"var_name": "LOG"
}
],
"file": "zo... | {
"body": "@Test\n public void testDeserializeZxidDigest() throws Exception {\n try {\n ZooKeeperServer.setDigestEnabled(true);\n DataTree dt = new DataTree();\n dt.processTxn(new TxnHeader(13, 1000, 1, 30, ZooDefs.OpCode.create),\n new CreateTxn(\"/foo\",... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(DataTree.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(DataTree.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "RA... | {
"body": "public boolean deserializeZxidDigest(InputArchive ia, long startZxidOfSnapshot) throws IOException {\n if (!ZooKeeperServer.isDigestEnabled()) {\n return false;\n }\n\n try {\n ZxidDigest zxidDigest = new ZxidDigest();\n zxidDigest.deserialize(ia);\n ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_4 | {
"fields": [
{
"declarator": "testData = new File(System.getProperty(\"test.data.dir\", \"build/test/data\"))",
"modifier": "private static final",
"original_string": "private static final File testData = new File(System.getProperty(\"test.data.dir\", \"build/test/data\"));",
"type": "Fil... | {
"body": "@Test\n public void testValidateFileInputNotExist() {\n String fileName = UUID.randomUUID().toString();\n File file = new File(testData, fileName);\n String absolutePath = file.getAbsolutePath();\n String error = ZKUtil.validateFileInput(absolutePath);\n assertNotNull(... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZKUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ZKUtil.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "permCa... | {
"body": "public static String validateFileInput(String filePath) {\n File file = new File(filePath);\n if (!file.exists()) {\n return \"File '\" + file.getAbsolutePath() + \"' does not exist.\";\n }\n if (!file.canRead()) {\n return \"Read permission is denied on th... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_155 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/QuorumPeerConfigTest.java",
"identifier": "QuorumPeerConfigTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testErrorMessageWhensecureClientPortNotSetButsecureClientPortAddressSet() throws IOException, ConfigException {\n QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();\n try {\n Properties zkProp = getDefaultZKProperties();\n zkProp.setProper... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(QuorumPeerConfig.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(QuorumPeerConfig.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"... | {
"body": "public void parseProperties(Properties zkProp) throws IOException, ConfigException {\n int clientPort = 0;\n int secureClientPort = 0;\n int observerMasterPort = 0;\n String clientPortAddress = null;\n String secureClientPortAddress = null;\n VerifyingFileFactory v... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_102 | {
"fields": [
{
"declarator": "m",
"modifier": "private",
"original_string": "private Map<Long, Set<String>> m;",
"type": "Map<Long, Set<String>>",
"var_name": "m"
},
{
"declarator": "r",
"modifier": "private",
"original_string": "private WatchesReport r;",
... | {
"body": "@Test\n public void testHasPaths() {\n assertTrue(r.hasPaths(1L));\n assertTrue(r.hasPaths(2L));\n assertFalse(r.hasPaths(3L));\n }",
"class_method_signature": "WatchesReportTest.testHasPaths()",
"constructor": false,
"full_signature": "@Test public void testHasPaths()",
... | {
"fields": [
{
"declarator": "id2paths",
"modifier": "private final",
"original_string": "private final Map<Long, Set<String>> id2paths;",
"type": "Map<Long, Set<String>>",
"var_name": "id2paths"
}
],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/watch/... | {
"body": "public boolean hasPaths(long sessionId) {\n return id2paths.containsKey(sessionId);\n }",
"class_method_signature": "WatchesReport.hasPaths(long sessionId)",
"constructor": false,
"full_signature": "public boolean hasPaths(long sessionId)",
"identifier": "hasPaths",
"invocations": [
... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_196 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(NIOServerCnxnTest.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(NIOServerCnxnTest.class);",
"type": "Logger",
"var_name": "LOG"
}
],
"file... | {
"body": "@Test\n public void testClientResponseStatsUpdate() throws IOException, InterruptedException, KeeperException {\n try (ZooKeeper zk = createClient()) {\n BufferStats clientResponseStats = serverFactory.getZooKeeperServer().serverStats().getClientResponseStats();\n assertThat... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(NIOServerCnxn.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(NIOServerCnxn.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declar... | {
"body": "@Override\n protected ServerStats serverStats() {\n if (zkServer == null) {\n return null;\n }\n return zkServer.serverStats();\n }",
"class_method_signature": "NIOServerCnxn.serverStats()",
"constructor": false,
"full_signature": "@Override protected ServerStats... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_179 | {
"fields": [
{
"declarator": "PORTS_AMOUNT = 10",
"modifier": "public static final",
"original_string": "public static final int PORTS_AMOUNT = 10;",
"type": "int",
"var_name": "PORTS_AMOUNT"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/Mul... | {
"body": "@Test\n public void testGetValidAddress() throws NoRouteToHostException {\n List<InetSocketAddress> addresses = getAddressList();\n MultipleAddresses multipleAddresses = new MultipleAddresses(addresses);\n\n assertTrue(addresses.contains(multipleAddresses.getReachableAddress()));\n ... | {
"fields": [
{
"declarator": "DEFAULT_TIMEOUT = Duration.ofMillis(1000)",
"modifier": "public static final",
"original_string": "public static final Duration DEFAULT_TIMEOUT = Duration.ofMillis(1000);",
"type": "Duration",
"var_name": "DEFAULT_TIMEOUT"
},
{
"declarator... | {
"body": "public InetSocketAddress getReachableAddress() throws NoRouteToHostException {\n // using parallelStream() + findAny() will help to minimize the time spent on network operations\n return addresses.parallelStream()\n .filter(this::checkIfAddressIsReachable)\n .findAny()\n ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_31 | {
"fields": [
{
"declarator": "pathTrie",
"modifier": "private",
"original_string": "private PathTrie pathTrie;",
"type": "PathTrie",
"var_name": "pathTrie"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathTrieTest.java",
"identifier": "PathTrieT... | {
"body": "@Test\n public void deleteNullPath() {\n assertThrows(NullPointerException.class, () -> {\n this.pathTrie.deletePath(null);\n });\n }",
"class_method_signature": "PathTrieTest.deleteNullPath()",
"constructor": false,
"full_signature": "@Test public void deleteNullPath()... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(PathTrie.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(PathTrie.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "ro... | {
"body": "public void deletePath(final String path) {\n Objects.requireNonNull(path, \"Path cannot be null\");\n\n if (path.length() == 0) {\n throw new IllegalArgumentException(\"Invalid path: \" + path);\n }\n final String[] pathComponents = split(path);\n\n\n wr... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_207 | {
"fields": [
{
"declarator": "DATA_BYTES_0 = \"Apache ZooKeeper\".getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] DATA_BYTES_0 = \"Apache ZooKeeper\".getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_nam... | {
"body": "@Test\n public void testReadArrayOffsetLength_HitEndOfStream() throws Exception {\n for (int i = 0; i < DATA_BYTES.length - 1; i++) {\n in.read();\n }\n assertEquals(1, in.read(bs, 2, 2));\n byte[] expected = new byte[]{(byte) 1, (byte) 2, DATA_BYTES[DATA_BYTES.len... | {
"fields": [
{
"declarator": "bb",
"modifier": "",
"original_string": "ByteBuffer bb;",
"type": "ByteBuffer",
"var_name": "bb"
}
],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/ByteBufferInputStream.java",
"identifier": "ByteBufferInputStream",
"in... | {
"body": "@Override\n public int read() throws IOException {\n if (bb.remaining() == 0) {\n return -1;\n }\n return bb.get() & 0xff;\n }",
"class_method_signature": "ByteBufferInputStream.read()",
"constructor": false,
"full_signature": "@Override public int read()",
"id... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_89 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/util/SerializeUtilsTest.java",
"identifier": "SerializeUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testSerializeRequestRequestIsNull() {\n byte[] data = SerializeUtils.serializeRequest(null);\n assertNull(data);\n }",
"class_method_signature": "SerializeUtilsTest.testSerializeRequestRequestIsNull()",
"constructor": false,
"full_signature": "@Test public void... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(SerializeUtils.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(SerializeUtils.class);",
"type": "Logger",
"var_name": "LOG"
}
],
"file": "zo... | {
"body": "public static byte[] serializeRequest(Request request) {\n if (request == null || request.getHdr() == null) {\n return null;\n }\n byte[] data = new byte[32];\n try {\n data = Util.marshallTxnEntry(request.getHdr(), request.getTxn(), request.getTxnDigest())... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_66 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/ReferenceCountedACLCacheTest.java",
"identifier": "ReferenceCountedACLCacheTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testSameACLGivesSameID() {\n List<ACL> testACL = createACL(\"myid\");\n\n ReferenceCountedACLCache cache = new ReferenceCountedACLCache();\n Long aclId = cache.convertAcls(testACL);\n\n List<ACL> testACL2 = createACL(\"myid\");\n\n assertEquals(aclI... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ReferenceCountedACLCache.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ReferenceCountedACLCache.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "public synchronized Long convertAcls(List<ACL> acls) {\n if (acls == null) {\n return OPEN_UNSAFE_ACL_ID;\n }\n\n // get the value from the map\n Long ret = aclKeyMap.get(acls);\n if (ret == null) {\n ret = incrementIndex();\n longKeyMap.p... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_211 | {
"fields": [
{
"declarator": "DATA_BYTES_0 = \"Apache ZooKeeper\".getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] DATA_BYTES_0 = \"Apache ZooKeeper\".getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_nam... | {
"body": "@Test\n public void testSkip() throws Exception {\n in.read();\n assertEquals(2L, in.skip(2L));\n assertEquals(DATA_BYTES[3], in.read());\n assertEquals(DATA_BYTES[4], in.read());\n }",
"class_method_signature": "ByteBufferInputStreamTest.testSkip()",
"constructor": fa... | {
"fields": [
{
"declarator": "bb",
"modifier": "",
"original_string": "ByteBuffer bb;",
"type": "ByteBuffer",
"var_name": "bb"
}
],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/ByteBufferInputStream.java",
"identifier": "ByteBufferInputStream",
"in... | {
"body": "@Override\n public long skip(long n) throws IOException {\n if (n < 0L) {\n return 0;\n }\n n = Math.min(n, bb.remaining());\n bb.position(bb.position() + (int) n);\n return n;\n }",
"class_method_signature": "ByteBufferInputStream.skip(long n)",
"con... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_138 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/persistence/SnapStreamTest.java",
"identifier": "SnapStreamTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetStreamMode() {\n assertEquals(StreamMode.CHECKED, SnapStream.getStreamMode(\"snapshot.180000e3a2\"), \"expected to return un-compressed stream\");\n assertEquals(StreamMode.SNAPPY, SnapStream.getStreamMode(\"snapshot.180000e3a2.snappy\"), \"expected to return sna... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(SnapStream.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(SnapStream.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator":... | {
"body": "public static StreamMode getStreamMode() {\n return streamMode;\n }",
"class_method_signature": "SnapStream.getStreamMode()",
"constructor": false,
"full_signature": "public static StreamMode getStreamMode()",
"identifier": "getStreamMode",
"invocations": [],
"modifiers": "public stat... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_70 | {
"fields": [
{
"declarator": "listenAddress",
"modifier": "private",
"original_string": "private InetSocketAddress listenAddress;",
"type": "InetSocketAddress",
"var_name": "listenAddress"
},
{
"declarator": "factory",
"modifier": "private",
"original_strin... | {
"body": "@Test\n public void testStartupWithStart_SocketAlreadyBound() throws IOException {\n assertThrows(SocketException.class, () -> {\n factory.start();\n ServerSocket ss = new ServerSocket(listenAddress.getPort());\n });\n }",
"class_method_signature": "NIOServerCnxn... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(NIOServerCnxnFactory.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(NIOServerCnxnFactory.class);",
"type": "Logger",
"var_name": "LOG"
},
{... | {
"body": "@Override\n public void start() {\n stopped = false;\n if (workerPool == null) {\n workerPool = new WorkerService(\"NIOWorker\", numWorkerThreads, false);\n }\n for (SelectorThread thread : selectorThreads) {\n if (thread.getState() == Thread.State.NEW) ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_180 | {
"fields": [
{
"declarator": "PORTS_AMOUNT = 10",
"modifier": "public static final",
"original_string": "public static final int PORTS_AMOUNT = 10;",
"type": "int",
"var_name": "PORTS_AMOUNT"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/Mul... | {
"body": "@Test\n public void testGetValidAddressWithNotValid() {\n assertThrows(NoRouteToHostException.class, () -> {\n MultipleAddresses multipleAddresses = new MultipleAddresses(new InetSocketAddress(\"10.0.0.1\", 22));\n multipleAddresses.getReachableAddress();\n });\n }... | {
"fields": [
{
"declarator": "DEFAULT_TIMEOUT = Duration.ofMillis(1000)",
"modifier": "public static final",
"original_string": "public static final Duration DEFAULT_TIMEOUT = Duration.ofMillis(1000);",
"type": "Duration",
"var_name": "DEFAULT_TIMEOUT"
},
{
"declarator... | {
"body": "public InetSocketAddress getReachableAddress() throws NoRouteToHostException {\n // using parallelStream() + findAny() will help to minimize the time spent on network operations\n return addresses.parallelStream()\n .filter(this::checkIfAddressIsReachable)\n .findAny()\n ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_27 | {
"fields": [
{
"declarator": "keyPair",
"modifier": "private static",
"original_string": "private static KeyPair keyPair;",
"type": "KeyPair",
"var_name": "keyPair"
},
{
"declarator": "mockX509ExtendedTrustManager",
"modifier": "private",
"original_string":... | {
"body": "@Test\n public void testClientHostnameVerificationWithIPAddress() throws Exception {\n ZKTrustManager zkTrustManager = new ZKTrustManager(mockX509ExtendedTrustManager, true, true);\n\n X509Certificate[] certificateChain = createSelfSignedCertifcateChain(IP_ADDRESS, null);\n zkTrustM... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZKTrustManager.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ZKTrustManager.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"decl... | {
"body": "@Override\n public void checkClientTrusted(\n X509Certificate[] chain,\n String authType,\n Socket socket) throws CertificateException {\n x509ExtendedTrustManager.checkClientTrusted(chain, authType, socket);\n if (clientHostnameVerificationEnabled) {\n perf... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_118 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class)",
"modifier": "protected static final",
"original_string": "protected static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "@Test\n @Timeout(value = 30)\n public void testReadOnlyTxnLogDir() throws Exception {\n ClientBase.setupTestEnv();\n final int CLIENT_PORT = PortAssignment.unique();\n\n // Start up the ZK server to automatically create the necessary directories\n // and capture the direct... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class);",
"type": "Logger",
"var_name": "LOG"
},
{
... | {
"body": "protected void shutdown() {\n if (containerManager != null) {\n containerManager.stop();\n }\n if (cnxnFactory != null) {\n cnxnFactory.shutdown();\n }\n if (secureCnxnFactory != null) {\n secureCnxnFactory.shutdown();\n }\n ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_50 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathUtilsTest.java",
"identifier": "PathUtilsTest",
"interfaces": "",
"superclass": "extends ZKTestCase"
} | {
"body": "@Test\n public void testValidatePath_0x9f() {\n assertThrows(IllegalArgumentException.class, () -> {\n PathUtils.validatePath(\"/test\\u009f\");\n });\n }",
"class_method_signature": "PathUtilsTest.testValidatePath_0x9f()",
"constructor": false,
"full_signature": "@Test... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/PathUtils.java",
"identifier": "PathUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": ... | {
"body": "public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException {\n validatePath(isSequential ? path + \"1\" : path);\n }",
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": "pu... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_159 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/QuorumPeerConfigTest.java",
"identifier": "QuorumPeerConfigTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testSamePortConfiguredForClientAndElection() {\n assertThrows(ConfigException.class, () -> {\n QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();\n Properties zkProp = getDefaultZKProperties();\n zkProp.setProperty(\"server.1\", \"loca... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(QuorumPeerConfig.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(QuorumPeerConfig.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"... | {
"body": "public void parseProperties(Properties zkProp) throws IOException, ConfigException {\n int clientPort = 0;\n int secureClientPort = 0;\n int observerMasterPort = 0;\n String clientPortAddress = null;\n String secureClientPortAddress = null;\n VerifyingFileFactory v... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_11 | {
"fields": [
{
"declarator": "port = 1234",
"modifier": "private",
"original_string": "private Integer port = 1234;",
"type": "Integer",
"var_name": "port"
},
{
"declarator": "v4addr = \"127.0.0.1\"",
"modifier": "private",
"original_string": "private Strin... | {
"body": "@Test\n public void testFormatInetAddrGoodHostname() {\n InetSocketAddress isa = new InetSocketAddress(\"localhost\", 1234);\n\n assertThat(NetUtils.formatInetAddr(isa), anyOf(equalTo(v4local), equalTo(v6local)));\n }",
"class_method_signature": "NetUtilsTest.testFormatInetAddrGoodHos... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/NetUtils.java",
"identifier": "NetUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "NetUtils.formatInetAddr(InetSocketAddress addr)",
"constructor": false,
"full_signature": "public stat... | {
"body": "public static String formatInetAddr(InetSocketAddress addr) {\n InetAddress ia = addr.getAddress();\n\n if (ia == null) {\n return String.format(\"%s:%s\", addr.getHostString(), addr.getPort());\n }\n\n if (ia instanceof Inet6Address) {\n return String.form... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_8 | {
"fields": [
{
"declarator": "port = 1234",
"modifier": "private",
"original_string": "private Integer port = 1234;",
"type": "Integer",
"var_name": "port"
},
{
"declarator": "v4addr = \"127.0.0.1\"",
"modifier": "private",
"original_string": "private Strin... | {
"body": "@Test\n public void testFormatInetAddrGoodIpv4() {\n InetSocketAddress isa = new InetSocketAddress(v4addr, port);\n assertEquals(\"127.0.0.1:1234\", NetUtils.formatInetAddr(isa));\n }",
"class_method_signature": "NetUtilsTest.testFormatInetAddrGoodIpv4()",
"constructor": false,
"f... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/NetUtils.java",
"identifier": "NetUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "NetUtils.formatInetAddr(InetSocketAddress addr)",
"constructor": false,
"full_signature": "public stat... | {
"body": "public static String formatInetAddr(InetSocketAddress addr) {\n InetAddress ia = addr.getAddress();\n\n if (ia == null) {\n return String.format(\"%s:%s\", addr.getHostString(), addr.getPort());\n }\n\n if (ia instanceof Inet6Address) {\n return String.form... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_46 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathUtilsTest.java",
"identifier": "PathUtilsTest",
"interfaces": "",
"superclass": "extends ZKTestCase"
} | {
"body": "@Test\n public void testValidatePath_0x1F() {\n assertThrows(IllegalArgumentException.class, () -> {\n PathUtils.validatePath(\"/test\\u001F\");\n });\n }",
"class_method_signature": "PathUtilsTest.testValidatePath_0x1F()",
"constructor": false,
"full_signature": "@Test... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/PathUtils.java",
"identifier": "PathUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": ... | {
"body": "public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException {\n validatePath(isSequential ? path + \"1\" : path);\n }",
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": "pu... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_175 | {
"fields": [
{
"declarator": "PORTS_AMOUNT = 10",
"modifier": "public static final",
"original_string": "public static final int PORTS_AMOUNT = 10;",
"type": "int",
"var_name": "PORTS_AMOUNT"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/Mul... | {
"body": "@Test\n public void testGetAllAddresses() {\n List<InetSocketAddress> addresses = getAddressList();\n MultipleAddresses multipleAddresses = new MultipleAddresses(addresses);\n\n assertTrue(CollectionUtils.isEqualCollection(addresses, multipleAddresses.getAllAddresses()));\n\n ... | {
"fields": [
{
"declarator": "DEFAULT_TIMEOUT = Duration.ofMillis(1000)",
"modifier": "public static final",
"original_string": "public static final Duration DEFAULT_TIMEOUT = Duration.ofMillis(1000);",
"type": "Duration",
"var_name": "DEFAULT_TIMEOUT"
},
{
"declarator... | {
"body": "public Set<InetSocketAddress> getAllAddresses() {\n return Collections.unmodifiableSet(addresses);\n }",
"class_method_signature": "MultipleAddresses.getAllAddresses()",
"constructor": false,
"full_signature": "public Set<InetSocketAddress> getAllAddresses()",
"identifier": "getAllAddress... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_85 | {
"fields": [
{
"declarator": "log",
"modifier": "private",
"original_string": "private Logger log;",
"type": "Logger",
"var_name": "log"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/util/VerifyingFileFactoryTest.java",
"identifier": "VerifyingFi... | {
"body": "@Test\n public void testForWarningOnRelativePath() {\n VerifyingFileFactory vff = new VerifyingFileFactory.Builder(log).warnForRelativePath().build();\n vff.create(\"a/relative/path\");\n // assertTrue(log.hasWarned);\n }",
"class_method_signature": "VerifyingFileFactoryTest.te... | {
"fields": [
{
"declarator": "warnForRelativePath",
"modifier": "private final",
"original_string": "private final boolean warnForRelativePath;",
"type": "boolean",
"var_name": "warnForRelativePath"
},
{
"declarator": "failForNonExistingPath",
"modifier": "privat... | {
"body": "public File create(String path) {\n File file = new File(path);\n return validate(file);\n }",
"class_method_signature": "VerifyingFileFactory.create(String path)",
"constructor": false,
"full_signature": "public File create(String path)",
"identifier": "create",
"invocations": [... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_122 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class)",
"modifier": "protected static final",
"original_string": "protected static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "@Test\n public void testFaultyMetricsProviderOnStart() throws Exception {\n ClientBase.setupTestEnv();\n\n final int CLIENT_PORT = PortAssignment.unique();\n final String configs = \"metricsProvider.className=\" + MetricsProviderWithErrorInStart.class.getName() + \"\\n\";\n M... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class);",
"type": "Logger",
"var_name": "LOG"
},
{
... | {
"body": "protected void initializeAndRun(String[] args) throws ConfigException, IOException, AdminServerException {\n try {\n ManagedUtil.registerLog4jMBeans();\n } catch (JMException e) {\n LOG.warn(\"Unable to register log4j JMX control\", e);\n }\n\n ServerConfig... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_93 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/util/CircularBufferTest.java",
"identifier": "CircularBufferTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testCircularBuffer() {\n final int capacity = 3;\n CircularBuffer<String> buffer = new CircularBuffer<>(String.class, capacity);\n\n assertTrue(buffer.isEmpty());\n assertFalse(buffer.isFull());\n\n // write to the buffer\n buffer.write(\"A\"... | {
"fields": [
{
"declarator": "buffer",
"modifier": "private final",
"original_string": "private final T[] buffer;",
"type": "T[]",
"var_name": "buffer"
},
{
"declarator": "capacity",
"modifier": "private final",
"original_string": "private final int capacit... | {
"body": "@SuppressWarnings(\"unchecked\")\n public CircularBuffer(Class<T> clazz, int capacity) {\n if (capacity <= 0) {\n throw new IllegalArgumentException(\"CircularBuffer capacity should be greater than 0\");\n }\n this.buffer = (T[]) Array.newInstance(clazz, capacity);\n ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_134 | {
"fields": [
{
"declarator": "testData = new File(System.getProperty(\"test.data.dir\", \"src/test/resources/data\"))",
"modifier": "private static final",
"original_string": "private static final File testData = new File(System.getProperty(\"test.data.dir\", \"src/test/resources/data\"));",
... | {
"body": "@Test\n public void testRecoveryFixBrokenFile() throws Exception {\n // Arrange\n File logfile = new File(new File(mySnapDir, \"version-2\"), \"log.42\");\n TxnLogToolkit lt = new TxnLogToolkit(true, false, logfile.toString(), true);\n\n // Act\n lt.dump(null);\n\n ... | {
"fields": [
{
"declarator": "txnLogFile",
"modifier": "private",
"original_string": "private File txnLogFile;",
"type": "File",
"var_name": "txnLogFile"
},
{
"declarator": "recoveryMode = false",
"modifier": "private",
"original_string": "private boolean r... | {
"body": "public void dump(Scanner scanner) throws Exception {\n crcFixed = 0;\n\n FileHeader fhdr = new FileHeader();\n fhdr.deserialize(logStream, \"fileheader\");\n if (fhdr.getMagic() != TXNLOG_MAGIC) {\n throw new TxnLogToolkitException(\n ExitCode.INVALID_I... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_163 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/LocalPeerBeanTest.java",
"identifier": "LocalPeerBeanTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testLocalPeerIsLeader() throws Exception {\n long localPeerId = 7;\n QuorumPeer peer = mock(QuorumPeer.class);\n when(peer.getId()).thenReturn(localPeerId);\n when(peer.isLeader(eq(localPeerId))).thenReturn(true);\n LocalPeerBean localPeerBean = new... | {
"fields": [
{
"declarator": "peer",
"modifier": "private final",
"original_string": "private final QuorumPeer peer;",
"type": "QuorumPeer",
"var_name": "peer"
}
],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/LocalPeerBean.java",
"identifier"... | {
"body": "@Override\n public boolean isLeader() {\n return peer.isLeader(peer.getId());\n }",
"class_method_signature": "LocalPeerBean.isLeader()",
"constructor": false,
"full_signature": "@Override public boolean isLeader()",
"identifier": "isLeader",
"invocations": [
"isLeader",
"get... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_162 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/LocalPeerBeanTest.java",
"identifier": "LocalPeerBeanTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testClientAddress() throws Exception {\n QuorumPeer quorumPeer = new QuorumPeer();\n LocalPeerBean remotePeerBean = new LocalPeerBean(quorumPeer);\n\n /**\n * Case 1: When cnxnFactory is null\n */\n String result = remotePeerBean.getClientA... | {
"fields": [
{
"declarator": "peer",
"modifier": "private final",
"original_string": "private final QuorumPeer peer;",
"type": "QuorumPeer",
"var_name": "peer"
}
],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/LocalPeerBean.java",
"identifier"... | {
"body": "public String getClientAddress() {\n if (null != peer.cnxnFactory) {\n return formatInetAddr(peer.cnxnFactory.getLocalAddress());\n } else {\n return \"\";\n }\n }",
"class_method_signature": "LocalPeerBean.getClientAddress()",
"constructor": false,
"full... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_92 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/util/SerializeUtilsTest.java",
"identifier": "SerializeUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testSerializeRequestWithTxn() throws IOException {\n // Arrange\n TxnHeader header = mock(TxnHeader.class);\n doAnswer(new Answer() {\n @Override\n public Object answer(InvocationOnMock invocation) throws Throwable {\n Object[... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(SerializeUtils.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(SerializeUtils.class);",
"type": "Logger",
"var_name": "LOG"
}
],
"file": "zo... | {
"body": "public static byte[] serializeRequest(Request request) {\n if (request == null || request.getHdr() == null) {\n return null;\n }\n byte[] data = new byte[32];\n try {\n data = Util.marshallTxnEntry(request.getHdr(), request.getTxn(), request.getTxnDigest())... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_135 | {
"fields": [
{
"declarator": "testData = new File(System.getProperty(\"test.data.dir\", \"src/test/resources/data\"))",
"modifier": "private static final",
"original_string": "private static final File testData = new File(System.getProperty(\"test.data.dir\", \"src/test/resources/data\"));",
... | {
"body": "@Test\n public void testRecoveryInteractiveMode() throws Exception {\n // Arrange\n File logfile = new File(new File(mySnapDir, \"version-2\"), \"log.42\");\n TxnLogToolkit lt = new TxnLogToolkit(true, false, logfile.toString(), false);\n\n // Act\n lt.dump(new Scanner... | {
"fields": [
{
"declarator": "txnLogFile",
"modifier": "private",
"original_string": "private File txnLogFile;",
"type": "File",
"var_name": "txnLogFile"
},
{
"declarator": "recoveryMode = false",
"modifier": "private",
"original_string": "private boolean r... | {
"body": "public void dump(Scanner scanner) throws Exception {\n crcFixed = 0;\n\n FileHeader fhdr = new FileHeader();\n fhdr.deserialize(logStream, \"fileheader\");\n if (fhdr.getMagic() != TXNLOG_MAGIC) {\n throw new TxnLogToolkitException(\n ExitCode.INVALID_I... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_84 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/util/ConfigUtilsTest.java",
"identifier": "ConfigUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetHostAndPortWithoutPort() throws ConfigException {\n String[] nsa = ConfigUtils.getHostAndPort(\"127.0.0.1\");\n assertEquals(nsa[0], \"127.0.0.1\");\n assertEquals(nsa.length, 1);\n\n nsa = ConfigUtils.getHostAndPort(\"[2001:db8:1::242:ac11:2]\");\n... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/util/ConfigUtils.java",
"identifier": "ConfigUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "ConfigUtils.getClientConfigStr(String configData)",
"constructor": false,
"full_signature":... | {
"body": "public static String[] getHostAndPort(String s) throws ConfigException {\n if (s.startsWith(\"[\")) {\n int i = s.indexOf(\"]\");\n if (i < 0) {\n throw new ConfigException(s + \" starts with '[' but has no matching ']:'\");\n }\n if (i + 2 ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_123 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class)",
"modifier": "protected static final",
"original_string": "protected static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "@Test\n public void testFaultyMetricsProviderOnConfigure() throws Exception {\n ClientBase.setupTestEnv();\n\n final int CLIENT_PORT = PortAssignment.unique();\n final String configs = \"metricsProvider.className=\"\n + MetricsProviderWithErrorI... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class);",
"type": "Logger",
"var_name": "LOG"
},
{
... | {
"body": "protected void initializeAndRun(String[] args) throws ConfigException, IOException, AdminServerException {\n try {\n ManagedUtil.registerLog4jMBeans();\n } catch (JMException e) {\n LOG.warn(\"Unable to register log4j JMX control\", e);\n }\n\n ServerConfig... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_174 | {
"fields": [
{
"declarator": "PORTS_AMOUNT = 10",
"modifier": "public static final",
"original_string": "public static final int PORTS_AMOUNT = 10;",
"type": "int",
"var_name": "PORTS_AMOUNT"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/Mul... | {
"body": "@Test\n public void testIsEmpty() {\n MultipleAddresses multipleAddresses = new MultipleAddresses();\n assertTrue(multipleAddresses.isEmpty());\n\n multipleAddresses.addAddress(new InetSocketAddress(22));\n assertFalse(multipleAddresses.isEmpty());\n }",
"class_method_si... | {
"fields": [
{
"declarator": "DEFAULT_TIMEOUT = Duration.ofMillis(1000)",
"modifier": "public static final",
"original_string": "public static final Duration DEFAULT_TIMEOUT = Duration.ofMillis(1000);",
"type": "Duration",
"var_name": "DEFAULT_TIMEOUT"
},
{
"declarator... | {
"body": "public boolean isEmpty() {\n return addresses.isEmpty();\n }",
"class_method_signature": "MultipleAddresses.isEmpty()",
"constructor": false,
"full_signature": "public boolean isEmpty()",
"identifier": "isEmpty",
"invocations": [
"isEmpty"
],
"modifiers": "public",
"parameters... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_47 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathUtilsTest.java",
"identifier": "PathUtilsTest",
"interfaces": "",
"superclass": "extends ZKTestCase"
} | {
"body": "@Test // The first allowable character\n public void testValidatePath_0x20() {\n PathUtils.validatePath(\"/test\\u0020\");\n }",
"class_method_signature": "PathUtilsTest.testValidatePath_0x20()",
"constructor": false,
"full_signature": "@Test // The first allowable character public void ... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/PathUtils.java",
"identifier": "PathUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": ... | {
"body": "public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException {\n validatePath(isSequential ? path + \"1\" : path);\n }",
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": "pu... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_9 | {
"fields": [
{
"declarator": "port = 1234",
"modifier": "private",
"original_string": "private Integer port = 1234;",
"type": "Integer",
"var_name": "port"
},
{
"declarator": "v4addr = \"127.0.0.1\"",
"modifier": "private",
"original_string": "private Strin... | {
"body": "@Test\n public void testFormatInetAddrGoodIpv6Local() {\n // Have to use the expanded address here, hence not using v6addr in instantiation\n InetSocketAddress isa = new InetSocketAddress(\"::1\", port);\n assertEquals(v6local, NetUtils.formatInetAddr(isa));\n }",
"class_method... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/NetUtils.java",
"identifier": "NetUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "NetUtils.formatInetAddr(InetSocketAddress addr)",
"constructor": false,
"full_signature": "public stat... | {
"body": "public static String formatInetAddr(InetSocketAddress addr) {\n InetAddress ia = addr.getAddress();\n\n if (ia == null) {\n return String.format(\"%s:%s\", addr.getHostString(), addr.getPort());\n }\n\n if (ia instanceof Inet6Address) {\n return String.form... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_158 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/QuorumPeerConfigTest.java",
"identifier": "QuorumPeerConfigTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testCustomSSLAuth() throws IOException {\n try (ClientX509Util x509Util = new ClientX509Util()) {\n System.setProperty(x509Util.getSslAuthProviderProperty(), \"y509\");\n QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();\n try {\n ... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(QuorumPeerConfig.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(QuorumPeerConfig.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"... | {
"body": "public void parseProperties(Properties zkProp) throws IOException, ConfigException {\n int clientPort = 0;\n int secureClientPort = 0;\n int observerMasterPort = 0;\n String clientPortAddress = null;\n String secureClientPortAddress = null;\n VerifyingFileFactory v... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_10 | {
"fields": [
{
"declarator": "port = 1234",
"modifier": "private",
"original_string": "private Integer port = 1234;",
"type": "Integer",
"var_name": "port"
},
{
"declarator": "v4addr = \"127.0.0.1\"",
"modifier": "private",
"original_string": "private Strin... | {
"body": "@Test\n public void testFormatInetAddrGoodIpv6Ext() {\n // Have to use the expanded address here, hence not using v6addr in instantiation\n InetSocketAddress isa = new InetSocketAddress(\"2600::\", port);\n assertEquals(v6ext, NetUtils.formatInetAddr(isa));\n }",
"class_method_... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/NetUtils.java",
"identifier": "NetUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "NetUtils.formatInetAddr(InetSocketAddress addr)",
"constructor": false,
"full_signature": "public stat... | {
"body": "public static String formatInetAddr(InetSocketAddress addr) {\n InetAddress ia = addr.getAddress();\n\n if (ia == null) {\n return String.format(\"%s:%s\", addr.getHostString(), addr.getPort());\n }\n\n if (ia instanceof Inet6Address) {\n return String.form... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_119 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class)",
"modifier": "protected static final",
"original_string": "protected static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "@Test\n public void testStandalone() throws Exception {\n ClientBase.setupTestEnv();\n\n final int CLIENT_PORT = PortAssignment.unique();\n\n MainThread main = new MainThread(CLIENT_PORT, true, null);\n main.start();\n\n assertTrue(ClientBase.waitForServerUp(\"127.0.0.... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class);",
"type": "Logger",
"var_name": "LOG"
},
{
... | {
"body": "protected void shutdown() {\n if (containerManager != null) {\n containerManager.stop();\n }\n if (cnxnFactory != null) {\n cnxnFactory.shutdown();\n }\n if (secureCnxnFactory != null) {\n secureCnxnFactory.shutdown();\n }\n ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_51 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathUtilsTest.java",
"identifier": "PathUtilsTest",
"interfaces": "",
"superclass": "extends ZKTestCase"
} | {
"body": "@Test\n public void testValidatePath_ud800() {\n assertThrows(IllegalArgumentException.class, () -> {\n PathUtils.validatePath(\"/test\\ud800\");\n });\n }",
"class_method_signature": "PathUtilsTest.testValidatePath_ud800()",
"constructor": false,
"full_signature": "@Te... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/PathUtils.java",
"identifier": "PathUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": ... | {
"body": "public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException {\n validatePath(isSequential ? path + \"1\" : path);\n }",
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": "pu... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_181 | {
"fields": [
{
"declarator": "PORTS_AMOUNT = 10",
"modifier": "public static final",
"original_string": "public static final int PORTS_AMOUNT = 10;",
"type": "int",
"var_name": "PORTS_AMOUNT"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/Mul... | {
"body": "@Test\n public void testGetReachableOrOneWithSingleReachableAddress() {\n InetSocketAddress reachableAddress = new InetSocketAddress(\"127.0.0.1\", PortAssignment.unique());\n\n MultipleAddresses multipleAddresses = new MultipleAddresses(Collections.singletonList(reachableAddress));\n ... | {
"fields": [
{
"declarator": "DEFAULT_TIMEOUT = Duration.ofMillis(1000)",
"modifier": "public static final",
"original_string": "public static final Duration DEFAULT_TIMEOUT = Duration.ofMillis(1000);",
"type": "Duration",
"var_name": "DEFAULT_TIMEOUT"
},
{
"declarator... | {
"body": "public InetSocketAddress getReachableOrOne() {\n InetSocketAddress address;\n\n // if there is only a single address provided then we don't do any reachability check\n if (addresses.size() == 1) {\n return getOne();\n }\n\n try {\n address = getReach... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_26 | {
"fields": [
{
"declarator": "keyPair",
"modifier": "private static",
"original_string": "private static KeyPair keyPair;",
"type": "KeyPair",
"var_name": "keyPair"
},
{
"declarator": "mockX509ExtendedTrustManager",
"modifier": "private",
"original_string":... | {
"body": "@Test\n public void testClientHostnameVerificationWithClientHostnameVerificationDisabled() throws Exception {\n ZKTrustManager zkTrustManager = new ZKTrustManager(mockX509ExtendedTrustManager, true, false);\n\n X509Certificate[] certificateChain = createSelfSignedCertifcateChain(null, HOST... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZKTrustManager.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ZKTrustManager.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"decl... | {
"body": "@Override\n public void checkClientTrusted(\n X509Certificate[] chain,\n String authType,\n Socket socket) throws CertificateException {\n x509ExtendedTrustManager.checkClientTrusted(chain, authType, socket);\n if (clientHostnameVerificationEnabled) {\n perf... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_139 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/persistence/SnapStreamTest.java",
"identifier": "SnapStreamTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testInvalidSnapshot() throws IOException {\n assertFalse(SnapStream.isValidSnapshot(null));\n\n checkInvalidSnapshot(\"snapshot.180000e3a2\");\n checkInvalidSnapshot(\"snapshot.180000e3a2.gz\");\n checkInvalidSnapshot(\"snapshot.180000e3a2.snappy\");\n ... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(SnapStream.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(SnapStream.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator":... | {
"body": "public static boolean isValidSnapshot(File file) throws IOException {\n if (file == null || Util.getZxidFromName(file.getName(), FileSnap.SNAPSHOT_FILE_PREFIX) == -1) {\n return false;\n }\n\n boolean isValid = false;\n switch (getStreamMode(file.getName())) {\n ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_71 | {
"fields": [
{
"declarator": "listenAddress",
"modifier": "private",
"original_string": "private InetSocketAddress listenAddress;",
"type": "InetSocketAddress",
"var_name": "listenAddress"
},
{
"declarator": "factory",
"modifier": "private",
"original_strin... | {
"body": "@Test\n public void testShutdownWithoutStart_SocketReleased() throws IOException {\n factory.shutdown();\n factory = null;\n\n ServerSocket ss = new ServerSocket(listenAddress.getPort());\n ss.close();\n }",
"class_method_signature": "NIOServerCnxnFactoryTest.testShutdow... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(NIOServerCnxnFactory.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(NIOServerCnxnFactory.class);",
"type": "Logger",
"var_name": "LOG"
},
{... | {
"body": "public void shutdown() {\n try {\n // close listen socket and signal selector threads to stop\n stop();\n\n // wait for selector and worker threads to shutdown\n join();\n\n // close all open connections\n closeAll(ServerCnxn.Disconne... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_210 | {
"fields": [
{
"declarator": "DATA_BYTES_0 = \"Apache ZooKeeper\".getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] DATA_BYTES_0 = \"Apache ZooKeeper\".getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_nam... | {
"body": "@Test\n public void testReadArray() throws Exception {\n byte[] expected = Arrays.copyOf(DATA_BYTES, 4);\n assertEquals(4, in.read(bs));\n assertArrayEquals(expected, bs);\n }",
"class_method_signature": "ByteBufferInputStreamTest.testReadArray()",
"constructor": false,
"fu... | {
"fields": [
{
"declarator": "bb",
"modifier": "",
"original_string": "ByteBuffer bb;",
"type": "ByteBuffer",
"var_name": "bb"
}
],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/ByteBufferInputStream.java",
"identifier": "ByteBufferInputStream",
"in... | {
"body": "@Override\n public int read() throws IOException {\n if (bb.remaining() == 0) {\n return -1;\n }\n return bb.get() & 0xff;\n }",
"class_method_signature": "ByteBufferInputStream.read()",
"constructor": false,
"full_signature": "@Override public int read()",
"id... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_88 | {
"fields": [
{
"declarator": "log",
"modifier": "private",
"original_string": "private Logger log;",
"type": "Logger",
"var_name": "log"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/util/VerifyingFileFactoryTest.java",
"identifier": "VerifyingFi... | {
"body": "@Test\n public void testFileHasCorrectPath() {\n File file = new File(\"/some/path\");\n VerifyingFileFactory vff = new VerifyingFileFactory.Builder(log).build();\n assertEquals(file, vff.create(file.getPath()));\n }",
"class_method_signature": "VerifyingFileFactoryTest.testFil... | {
"fields": [
{
"declarator": "warnForRelativePath",
"modifier": "private final",
"original_string": "private final boolean warnForRelativePath;",
"type": "boolean",
"var_name": "warnForRelativePath"
},
{
"declarator": "failForNonExistingPath",
"modifier": "privat... | {
"body": "public File create(String path) {\n File file = new File(path);\n return validate(file);\n }",
"class_method_signature": "VerifyingFileFactory.create(String path)",
"constructor": false,
"full_signature": "public File create(String path)",
"identifier": "create",
"invocations": [... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_67 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/ReferenceCountedACLCacheTest.java",
"identifier": "ReferenceCountedACLCacheTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testWhetherOrderingMatters() {\n List<ACL> testACL = new ArrayList<ACL>();\n testACL.add(new ACL(ZooDefs.Perms.READ, new Id(\"scheme\", \"ro\")));\n testACL.add(new ACL(ZooDefs.Perms.WRITE, new Id(\"scheme\", \"rw\")));\n\n ReferenceCountedACLCache cache =... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ReferenceCountedACLCache.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ReferenceCountedACLCache.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "public synchronized Long convertAcls(List<ACL> acls) {\n if (acls == null) {\n return OPEN_UNSAFE_ACL_ID;\n }\n\n // get the value from the map\n Long ret = aclKeyMap.get(acls);\n if (ret == null) {\n ret = incrementIndex();\n longKeyMap.p... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_206 | {
"fields": [
{
"declarator": "DATA_BYTES_0 = \"Apache ZooKeeper\".getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] DATA_BYTES_0 = \"Apache ZooKeeper\".getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_nam... | {
"body": "@Test\n public void testReadArrayOffsetLength_LengthTooLarge() throws Exception {\n assertThrows(IndexOutOfBoundsException.class, () -> {\n in.read(bs, 2, 3);\n });\n }",
"class_method_signature": "ByteBufferInputStreamTest.testReadArrayOffsetLength_LengthTooLarge()",
"co... | {
"fields": [
{
"declarator": "bb",
"modifier": "",
"original_string": "ByteBuffer bb;",
"type": "ByteBuffer",
"var_name": "bb"
}
],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/ByteBufferInputStream.java",
"identifier": "ByteBufferInputStream",
"in... | {
"body": "@Override\n public int read() throws IOException {\n if (bb.remaining() == 0) {\n return -1;\n }\n return bb.get() & 0xff;\n }",
"class_method_signature": "ByteBufferInputStream.read()",
"constructor": false,
"full_signature": "@Override public int read()",
"id... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_197 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/ZooKeeperServerBeanTest.java",
"identifier": "ZooKeeperServerBeanTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testTxnLogElapsedSyncTime() throws IOException {\n\n File tmpDir = ClientBase.createEmptyTestDir();\n FileTxnSnapLog fileTxnSnapLog = new FileTxnSnapLog(new File(tmpDir, \"data\"), new File(tmpDir, \"data_txnlog\"));\n\n ZooKeeperServer zks = new ZooKeeperServer(... | {
"fields": [
{
"declarator": "startTime",
"modifier": "private final",
"original_string": "private final Date startTime;",
"type": "Date",
"var_name": "startTime"
},
{
"declarator": "name",
"modifier": "private final",
"original_string": "private final Stri... | {
"body": "@Override\n public long getTxnLogElapsedSyncTime() {\n return zks.getTxnLogElapsedSyncTime();\n }",
"class_method_signature": "ZooKeeperServerBean.getTxnLogElapsedSyncTime()",
"constructor": false,
"full_signature": "@Override public long getTxnLogElapsedSyncTime()",
"identifier": "get... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_178 | {
"fields": [
{
"declarator": "PORTS_AMOUNT = 10",
"modifier": "public static final",
"original_string": "public static final int PORTS_AMOUNT = 10;",
"type": "int",
"var_name": "PORTS_AMOUNT"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/Mul... | {
"body": "@Test\n public void testGetWildcardAddresses() {\n List<Integer> ports = getPortList();\n List<InetSocketAddress> addresses = getAddressList(ports);\n MultipleAddresses multipleAddresses = new MultipleAddresses(addresses);\n List<InetSocketAddress> allAddresses = ports.stream... | {
"fields": [
{
"declarator": "DEFAULT_TIMEOUT = Duration.ofMillis(1000)",
"modifier": "public static final",
"original_string": "public static final Duration DEFAULT_TIMEOUT = Duration.ofMillis(1000);",
"type": "Duration",
"var_name": "DEFAULT_TIMEOUT"
},
{
"declarator... | {
"body": "public Set<InetSocketAddress> getWildcardAddresses() {\n return addresses.stream().map(a -> new InetSocketAddress(a.getPort())).collect(Collectors.toSet());\n }",
"class_method_signature": "MultipleAddresses.getWildcardAddresses()",
"constructor": false,
"full_signature": "public Set<InetSo... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_30 | {
"fields": [
{
"declarator": "pathTrie",
"modifier": "private",
"original_string": "private PathTrie pathTrie;",
"type": "PathTrie",
"var_name": "pathTrie"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathTrieTest.java",
"identifier": "PathTrieT... | {
"body": "@Test\n public void addIllegalPath() {\n assertThrows(IllegalArgumentException.class, () -> {\n this.pathTrie.addPath(\"\");\n });\n }",
"class_method_signature": "PathTrieTest.addIllegalPath()",
"constructor": false,
"full_signature": "@Test public void addIllegalPath(... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(PathTrie.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(PathTrie.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "ro... | {
"body": "public void addPath(final String path) {\n Objects.requireNonNull(path, \"Path cannot be null\");\n\n if (path.length() == 0) {\n throw new IllegalArgumentException(\"Invalid path: \" + path);\n }\n final String[] pathComponents = split(path);\n\n writeLo... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_103 | {
"fields": [
{
"declarator": "m",
"modifier": "private",
"original_string": "private Map<Long, Set<String>> m;",
"type": "Map<Long, Set<String>>",
"var_name": "m"
},
{
"declarator": "r",
"modifier": "private",
"original_string": "private WatchesReport r;",
... | {
"body": "@Test\n public void testGetPaths() {\n Set<String> s = r.getPaths(1L);\n assertEquals(2, s.size());\n assertTrue(s.contains(\"path1a\"));\n assertTrue(s.contains(\"path1b\"));\n s = r.getPaths(2L);\n assertEquals(1, s.size());\n assertTrue(s.contains(\"pa... | {
"fields": [
{
"declarator": "id2paths",
"modifier": "private final",
"original_string": "private final Map<Long, Set<String>> id2paths;",
"type": "Map<Long, Set<String>>",
"var_name": "id2paths"
}
],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/watch/... | {
"body": "public Set<String> getPaths(long sessionId) {\n Set<String> s = id2paths.get(sessionId);\n return s != null ? Collections.unmodifiableSet(s) : null;\n }",
"class_method_signature": "WatchesReport.getPaths(long sessionId)",
"constructor": false,
"full_signature": "public Set<String> g... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_154 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(LearnerHandlerTest.class)",
"modifier": "protected static final",
"original_string": "protected static final Logger LOG = LoggerFactory.getLogger(LearnerHandlerTest.class);",
"type": "Logger",
"var_name": "LOG"
},
{... | {
"body": "@Test\n public void testTxnLogGap() throws Exception {\n long peerZxid;\n db.txnLog.add(createProposal(2));\n db.txnLog.add(createProposal(3));\n db.txnLog.add(createProposal(4));\n\n db.lastProcessedZxid = 8;\n db.committedLog.add(createProposal(7));\n d... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(LearnerHandler.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(LearnerHandler.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"decl... | {
"body": "boolean syncFollower(long peerLastZxid, LearnerMaster learnerMaster) {\n /*\n * When leader election is completed, the leader will set its\n * lastProcessedZxid to be (epoch < 32). There will be no txn associated\n * with this zxid.\n *\n * The learner will se... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_5 | {
"fields": [
{
"declarator": "testData = new File(System.getProperty(\"test.data.dir\", \"build/test/data\"))",
"modifier": "private static final",
"original_string": "private static final File testData = new File(System.getProperty(\"test.data.dir\", \"build/test/data\"));",
"type": "Fil... | {
"body": "@Test\n public void testValidateFileInputDirectory() throws Exception {\n File file = File.createTempFile(\"test\", \".junit\", testData);\n file.deleteOnExit();\n // delete file, as we need directory not file\n file.delete();\n file.mkdir();\n String absolutePa... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZKUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ZKUtil.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "permCa... | {
"body": "public static String validateFileInput(String filePath) {\n File file = new File(filePath);\n if (!file.exists()) {\n return \"File '\" + file.getAbsolutePath() + \"' does not exist.\";\n }\n if (!file.canRead()) {\n return \"Read permission is denied on th... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_142 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(DataTreeTest.class)",
"modifier": "protected static final",
"original_string": "protected static final Logger LOG = LoggerFactory.getLogger(DataTreeTest.class);",
"type": "Logger",
"var_name": "LOG"
}
],
"file": "zo... | {
"body": "@Test\n public void testGetAllChildrenNumber() throws Exception {\n DataTree dt = new DataTree();\n // create a node\n dt.createNode(\"/all_children_test\", new byte[20], null, -1, 1, 1, 1);\n dt.createNode(\"/all_children_test/nodes\", new byte[20], null, -1, 1, 1, 1);\n ... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(DataTree.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(DataTree.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "RA... | {
"body": "public int getAllChildrenNumber(String path) {\n //cull out these two keys:\"\", \"/\"\n if (\"/\".equals(path)) {\n return nodes.size() - 2;\n }\n\n return (int) nodes.entrySet().parallelStream().filter(entry -> entry.getKey().startsWith(path + \"/\")).count();\n ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_115 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(BlueThrottleTest.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(BlueThrottleTest.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"... | {
"body": "@Test\n public void testThrottleDisabled() {\n BlueThrottle throttler = new BlueThrottle();\n assertTrue(throttler.checkLimit(1), \"Throttle should be disabled by default\");\n }",
"class_method_signature": "BlueThrottleTest.testThrottleDisabled()",
"constructor": false,
"full_sig... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(BlueThrottle.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(BlueThrottle.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarat... | {
"body": "public synchronized boolean checkLimit(int need) {\n // A maxTokens setting of zero disables throttling\n if (maxTokens == 0) {\n return true;\n }\n\n long now = Time.currentElapsedTime();\n long diff = now - lastTime;\n\n if (diff > fillTime) {\n ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_25 | {
"fields": [
{
"declarator": "keyPair",
"modifier": "private static",
"original_string": "private static KeyPair keyPair;",
"type": "KeyPair",
"var_name": "keyPair"
},
{
"declarator": "mockX509ExtendedTrustManager",
"modifier": "private",
"original_string":... | {
"body": "@Test\n public void testClientHostnameVerificationWithHostnameVerificationDisabled() throws Exception {\n ZKTrustManager zkTrustManager = new ZKTrustManager(mockX509ExtendedTrustManager, false, true);\n\n X509Certificate[] certificateChain = createSelfSignedCertifcateChain(null, HOSTNAME);... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZKTrustManager.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ZKTrustManager.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"decl... | {
"body": "@Override\n public void checkClientTrusted(\n X509Certificate[] chain,\n String authType,\n Socket socket) throws CertificateException {\n x509ExtendedTrustManager.checkClientTrusted(chain, authType, socket);\n if (clientHostnameVerificationEnabled) {\n perf... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_182 | {
"fields": [
{
"declarator": "PORTS_AMOUNT = 10",
"modifier": "public static final",
"original_string": "public static final int PORTS_AMOUNT = 10;",
"type": "int",
"var_name": "PORTS_AMOUNT"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/Mul... | {
"body": "@Test\n public void testGetReachableOrOneWithSingleUnreachableAddress() {\n InetSocketAddress unreachableAddress = new InetSocketAddress(\"unreachable.address.zookeeper.apache.com\", 1234);\n\n MultipleAddresses multipleAddresses = new MultipleAddresses(Collections.singletonList(unreachabl... | {
"fields": [
{
"declarator": "DEFAULT_TIMEOUT = Duration.ofMillis(1000)",
"modifier": "public static final",
"original_string": "public static final Duration DEFAULT_TIMEOUT = Duration.ofMillis(1000);",
"type": "Duration",
"var_name": "DEFAULT_TIMEOUT"
},
{
"declarator... | {
"body": "public InetSocketAddress getReachableOrOne() {\n InetSocketAddress address;\n\n // if there is only a single address provided then we don't do any reachability check\n if (addresses.size() == 1) {\n return getOne();\n }\n\n try {\n address = getReach... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_72 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(NettyServerCnxnTest.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(NettyServerCnxnTest.class);",
"type": "Logger",
"var_name": "LOG"
}
],
"... | {
"body": "@Test\n @Timeout(value = 40)\n public void testSendCloseSession() throws Exception {\n assertTrue(serverFactory instanceof NettyServerCnxnFactory, \"Didn't instantiate ServerCnxnFactory with NettyServerCnxnFactory!\");\n\n final ZooKeeper zk = createClient();\n final ZooKeeperSer... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(NettyServerCnxn.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(NettyServerCnxn.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"de... | {
"body": "@Override\n public void sendCloseSession() {\n sendBuffer(ServerCnxnFactory.closeConn);\n }",
"class_method_signature": "NettyServerCnxn.sendCloseSession()",
"constructor": false,
"full_signature": "@Override public void sendCloseSession()",
"identifier": "sendCloseSession",
"invocat... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_213 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/cli/CommandFactoryTest.java",
"identifier": "CommandFactoryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testCommandCreation() {\n CliCommand cliCommand =\n CommandFactory.getInstance(CommandFactory.Command.CREATE);\n assertTrue(cliCommand instanceof CreateCommand);\n }",
"class_method_signature": "CommandFactoryTest.testCommandCreation()",
"construct... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/cli/CommandFactory.java",
"identifier": "CommandFactory",
"interfaces": "",
"methods": [
{
"class_method_signature": "CommandFactory.getInstance(Command command)",
"constructor": false,
"full_signature": "public... | {
"body": "public static CliCommand getInstance (Command command) {\n return command.getInstance();\n }",
"class_method_signature": "CommandFactory.getInstance(Command command)",
"constructor": false,
"full_signature": "public static CliCommand getInstance(Command command)",
"identifier": "getInstan... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_64 | {
"fields": [
{
"declarator": "LINE_SEPARATOR = System.getProperty(\"line.separator\", \"\\n\")",
"modifier": "private static final",
"original_string": "private static final String LINE_SEPARATOR = System.getProperty(\"line.separator\", \"\\n\");",
"type": "String",
"var_name": "LIN... | {
"body": "@Test\n public void testInsufficientPermission() throws Exception {\n final ZooKeeper zk = createClient();\n zk.create(\"/permZNode\", \"\".getBytes(), Ids.READ_ACL_UNSAFE, CreateMode.PERSISTENT);\n ZooKeeperMain zkMain = new ZooKeeperMain(zk);\n String zNodeToBeCreated = \"/... | {
"fields": [
{
"declarator": "ZOOKEEPER_CLIENT_CNXN_SOCKET = \"zookeeper.clientCnxnSocket\"",
"modifier": "@Deprecated\n public static final",
"original_string": "@Deprecated\n public static final String ZOOKEEPER_CLIENT_CNXN_SOCKET = \"zookeeper.clientCnxnSocket\";",
"type": "Strin... | {
"body": "public String create(\n final String path,\n byte[] data,\n List<ACL> acl,\n CreateMode createMode) throws KeeperException, InterruptedException {\n final String clientPath = path;\n PathUtils.validatePath(clientPath, createMode.isSequential());\n EphemeralT... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_205 | {
"fields": [
{
"declarator": "DATA_BYTES_0 = \"Apache ZooKeeper\".getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] DATA_BYTES_0 = \"Apache ZooKeeper\".getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_nam... | {
"body": "@Test\n public void testReadArrayOffsetLength() throws Exception {\n assertEquals(1, in.read(bs, 2, 1));\n byte[] expected = new byte[]{(byte) 1, (byte) 2, DATA_BYTES[0], (byte) 4};\n assertArrayEquals(expected, bs);\n }",
"class_method_signature": "ByteBufferInputStreamTest.te... | {
"fields": [
{
"declarator": "bb",
"modifier": "",
"original_string": "ByteBuffer bb;",
"type": "ByteBuffer",
"var_name": "bb"
}
],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/ByteBufferInputStream.java",
"identifier": "ByteBufferInputStream",
"in... | {
"body": "@Override\n public int read() throws IOException {\n if (bb.remaining() == 0) {\n return -1;\n }\n return bb.get() & 0xff;\n }",
"class_method_signature": "ByteBufferInputStream.read()",
"constructor": false,
"full_signature": "@Override public int read()",
"id... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_33 | {
"fields": [
{
"declarator": "pathTrie",
"modifier": "private",
"original_string": "private PathTrie pathTrie;",
"type": "PathTrie",
"var_name": "pathTrie"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathTrieTest.java",
"identifier": "PathTrieT... | {
"body": "@Test\n public void findMaxPrefixNullPath() {\n assertThrows(NullPointerException.class, () -> {\n this.pathTrie.findMaxPrefix(null);\n });\n }",
"class_method_signature": "PathTrieTest.findMaxPrefixNullPath()",
"constructor": false,
"full_signature": "@Test public void... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(PathTrie.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(PathTrie.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "ro... | {
"body": "public String findMaxPrefix(final String path) {\n Objects.requireNonNull(path, \"Path cannot be null\");\n\n final String[] pathComponents = split(path);\n\n readLock.lock();\n try {\n TrieNode parent = rootNode;\n TrieNode deepestPropertyNode = null... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_194 | {
"fields": [
{
"declarator": "leader",
"modifier": "private",
"original_string": "private Leader leader;",
"type": "Leader",
"var_name": "leader"
},
{
"declarator": "leaderBean",
"modifier": "private",
"original_string": "private LeaderBean leaderBean;",
... | {
"body": "@Test\n public void testGetElectionTimeTaken() {\n // Arrange\n qp.setElectionTimeTaken(1);\n\n // Assert\n assertEquals(1, leaderBean.getElectionTimeTaken());\n }",
"class_method_signature": "LeaderBeanTest.testGetElectionTimeTaken()",
"constructor": false,
"full_si... | {
"fields": [
{
"declarator": "leader",
"modifier": "private final",
"original_string": "private final Leader leader;",
"type": "Leader",
"var_name": "leader"
}
],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/LeaderBean.java",
"identifier": "Le... | {
"body": "@Override\n public long getElectionTimeTaken() {\n return leader.self.getElectionTimeTaken();\n }",
"class_method_signature": "LeaderBean.getElectionTimeTaken()",
"constructor": false,
"full_signature": "@Override public long getElectionTimeTaken()",
"identifier": "getElectionTimeTaken... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_48 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathUtilsTest.java",
"identifier": "PathUtilsTest",
"interfaces": "",
"superclass": "extends ZKTestCase"
} | {
"body": "@Test\n public void testValidatePath_0x7e() {\n // The last valid ASCII character\n PathUtils.validatePath(\"/test\\u007e\");\n }",
"class_method_signature": "PathUtilsTest.testValidatePath_0x7e()",
"constructor": false,
"full_signature": "@Test public void testValidatePath_0x7e()... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/PathUtils.java",
"identifier": "PathUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": ... | {
"body": "public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException {\n validatePath(isSequential ? path + \"1\" : path);\n }",
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": "pu... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_100 | {
"fields": [
{
"declarator": "s",
"modifier": "private",
"original_string": "private WatchesSummary s;",
"type": "WatchesSummary",
"var_name": "s"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/watch/WatchesSummaryTest.java",
"identifier": "Watche... | {
"body": "@Test\n public void testToMap() {\n Map<String, Object> m = s.toMap();\n assertEquals(3, m.size());\n assertEquals(Integer.valueOf(1), m.get(WatchesSummary.KEY_NUM_CONNECTIONS));\n assertEquals(Integer.valueOf(2), m.get(WatchesSummary.KEY_NUM_PATHS));\n assertEquals(In... | {
"fields": [
{
"declarator": "KEY_NUM_CONNECTIONS = \"num_connections\"",
"modifier": "public static final",
"original_string": "public static final String KEY_NUM_CONNECTIONS = \"num_connections\";",
"type": "String",
"var_name": "KEY_NUM_CONNECTIONS"
},
{
"declarator... | {
"body": "public Map<String, Object> toMap() {\n Map<String, Object> summary = new LinkedHashMap<String, Object>();\n summary.put(KEY_NUM_CONNECTIONS, numConnections);\n summary.put(KEY_NUM_PATHS, numPaths);\n summary.put(KEY_NUM_TOTAL_WATCHES, totalWatches);\n return summary;\n ... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_157 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/QuorumPeerConfigTest.java",
"identifier": "QuorumPeerConfigTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testConfigureSSLAuthGetsConfiguredIfSecurePortConfigured() throws IOException, ConfigException {\n String sslAuthProp = \"zookeeper.authProvider.x509\";\n QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();\n Properties zkProp = getDefaultZKProperties();\... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(QuorumPeerConfig.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(QuorumPeerConfig.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"... | {
"body": "public void parseProperties(Properties zkProp) throws IOException, ConfigException {\n int clientPort = 0;\n int secureClientPort = 0;\n int observerMasterPort = 0;\n String clientPortAddress = null;\n String secureClientPortAddress = null;\n VerifyingFileFactory v... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_6 | {
"fields": [
{
"declarator": "testData = new File(System.getProperty(\"test.data.dir\", \"build/test/data\"))",
"modifier": "private static final",
"original_string": "private static final File testData = new File(System.getProperty(\"test.data.dir\", \"build/test/data\"));",
"type": "Fil... | {
"body": "@Test\n public void testUnreadableFileInput() throws Exception {\n //skip this test on Windows, coverage on Linux\n assumeTrue(!org.apache.zookeeper.Shell.WINDOWS);\n File file = File.createTempFile(\"test\", \".junit\", testData);\n file.setReadable(false, false);\n f... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZKUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ZKUtil.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "permCa... | {
"body": "public static String validateFileInput(String filePath) {\n File file = new File(filePath);\n if (!file.exists()) {\n return \"File '\" + file.getAbsolutePath() + \"' does not exist.\";\n }\n if (!file.canRead()) {\n return \"Read permission is denied on th... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_141 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(DataTreeTest.class)",
"modifier": "protected static final",
"original_string": "protected static final Logger LOG = LoggerFactory.getLogger(DataTreeTest.class);",
"type": "Logger",
"var_name": "LOG"
}
],
"file": "zo... | {
"body": "@Test\n public void testCachedApproximateDataSize() throws Exception {\n DataTree dt = new DataTree();\n long initialSize = dt.approximateDataSize();\n assertEquals(dt.cachedApproximateDataSize(), dt.approximateDataSize());\n\n // create a node\n dt.createNode(\"/testA... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(DataTree.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(DataTree.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "RA... | {
"body": "public long cachedApproximateDataSize() {\n return nodeDataSize.get();\n }",
"class_method_signature": "DataTree.cachedApproximateDataSize()",
"constructor": false,
"full_signature": "public long cachedApproximateDataSize()",
"identifier": "cachedApproximateDataSize",
"invocations": [
... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_116 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(BlueThrottleTest.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(BlueThrottleTest.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"... | {
"body": "@Test\n public void testNoThrottling() throws Exception {\n quorumUtil.startAll();\n\n //disable throttling\n quorumUtil.getPeer(1).peer.getActiveServer().connThrottle().setMaxTokens(0);\n\n int connected = connect(10);\n\n assertEquals(10, connected);\n shutdow... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(BlueThrottle.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(BlueThrottle.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarat... | {
"body": "public synchronized void setMaxTokens(int max) {\n int deficit = maxTokens - tokens;\n maxTokens = max;\n tokens = max - deficit;\n }",
"class_method_signature": "BlueThrottle.setMaxTokens(int max)",
"constructor": false,
"full_signature": "public synchronized void setMaxToken... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_29 | {
"fields": [
{
"declarator": "pathTrie",
"modifier": "private",
"original_string": "private PathTrie pathTrie;",
"type": "PathTrie",
"var_name": "pathTrie"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathTrieTest.java",
"identifier": "PathTrieT... | {
"body": "@Test\n public void addNullPath() {\n assertThrows(NullPointerException.class, () -> {\n this.pathTrie.addPath(null);\n });\n }",
"class_method_signature": "PathTrieTest.addNullPath()",
"constructor": false,
"full_signature": "@Test public void addNullPath()",
"identi... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(PathTrie.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(PathTrie.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "ro... | {
"body": "public void addPath(final String path) {\n Objects.requireNonNull(path, \"Path cannot be null\");\n\n if (path.length() == 0) {\n throw new IllegalArgumentException(\"Invalid path: \" + path);\n }\n final String[] pathComponents = split(path);\n\n writeLo... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_161 | {
"fields": [
{
"declarator": "electionAlg = 3",
"modifier": "private",
"original_string": "private int electionAlg = 3;",
"type": "int",
"var_name": "electionAlg"
},
{
"declarator": "tickTime = 2000",
"modifier": "private",
"original_string": "private int t... | {
"body": "@Test\n public void testQuorumPeerListendOnSpecifiedClientIP() throws IOException {\n long myId = 1;\n File dataDir = ClientBase.createTmpDir();\n int clientPort = PortAssignment.unique();\n Map<Long, QuorumServer> peersView = new HashMap<Long, QuorumServer>();\n InetA... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(QuorumPeer.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(QuorumPeer.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator":... | {
"body": "public void shutdown() {\n running = false;\n x509Util.close();\n if (leader != null) {\n leader.shutdown(\"quorum Peer shutdown\");\n }\n if (follower != null) {\n follower.shutdown();\n }\n shutdownServerCnxnFactory();\n if (ud... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_136 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(FileTxnLogTest.class)",
"modifier": "protected static final",
"original_string": "protected static final Logger LOG = LoggerFactory.getLogger(FileTxnLogTest.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"... | {
"body": "@Test\n public void testSetPreallocSize() {\n long customPreallocSize = 10101;\n FileTxnLog.setPreallocSize(customPreallocSize);\n assertThat(FilePadding.getPreAllocSize(), is(equalTo(customPreallocSize)));\n }",
"class_method_signature": "FileTxnLogTest.testSetPreallocSize()",... | {
"fields": [
{
"declarator": "LOG",
"modifier": "private static final",
"original_string": "private static final Logger LOG;",
"type": "Logger",
"var_name": "LOG"
},
{
"declarator": "TXNLOG_MAGIC = ByteBuffer.wrap(\"ZKLG\".getBytes()).getInt()",
"modifier": "publ... | {
"body": "public static void setPreallocSize(long size) {\n FilePadding.setPreallocSize(size);\n }",
"class_method_signature": "FileTxnLog.setPreallocSize(long size)",
"constructor": false,
"full_signature": "public static void setPreallocSize(long size)",
"identifier": "setPreallocSize",
"invoca... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_91 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/util/SerializeUtilsTest.java",
"identifier": "SerializeUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testSerializeRequestWithoutTxn() throws IOException {\n // Arrange\n TxnHeader header = mock(TxnHeader.class);\n doAnswer(new Answer() {\n @Override\n public Object answer(InvocationOnMock invocation) throws Throwable {\n Obje... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(SerializeUtils.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(SerializeUtils.class);",
"type": "Logger",
"var_name": "LOG"
}
],
"file": "zo... | {
"body": "public static byte[] serializeRequest(Request request) {\n if (request == null || request.getHdr() == null) {\n return null;\n }\n byte[] data = new byte[32];\n try {\n data = Util.marshallTxnEntry(request.getHdr(), request.getTxn(), request.getTxnDigest())... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_209 | {
"fields": [
{
"declarator": "DATA_BYTES_0 = \"Apache ZooKeeper\".getBytes(StandardCharsets.UTF_8)",
"modifier": "private static final",
"original_string": "private static final byte[] DATA_BYTES_0 = \"Apache ZooKeeper\".getBytes(StandardCharsets.UTF_8);",
"type": "byte[]",
"var_nam... | {
"body": "@Test\n public void testReadArrayOffsetLength_0Length() throws Exception {\n byte[] expected = Arrays.copyOf(bs, bs.length);\n assertEquals(0, in.read(bs, 2, 0));\n assertArrayEquals(expected, bs);\n }",
"class_method_signature": "ByteBufferInputStreamTest.testReadArrayOffsetLe... | {
"fields": [
{
"declarator": "bb",
"modifier": "",
"original_string": "ByteBuffer bb;",
"type": "ByteBuffer",
"var_name": "bb"
}
],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/server/ByteBufferInputStream.java",
"identifier": "ByteBufferInputStream",
"in... | {
"body": "@Override\n public int read() throws IOException {\n if (bb.remaining() == 0) {\n return -1;\n }\n return bb.get() & 0xff;\n }",
"class_method_signature": "ByteBufferInputStream.read()",
"constructor": false,
"full_signature": "@Override public int read()",
"id... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_68 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/ReferenceCountedACLCacheTest.java",
"identifier": "ReferenceCountedACLCacheTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testAddUsage() {\n List<ACL> testACL = createACL(\"myid\");\n\n ReferenceCountedACLCache cache = new ReferenceCountedACLCache();\n Long aclId = cache.convertAcls(testACL);\n assertEquals(1, cache.size());\n\n cache.addUsage(aclId);\n assertEq... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ReferenceCountedACLCache.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ReferenceCountedACLCache.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "public synchronized void addUsage(Long acl) {\n if (acl == OPEN_UNSAFE_ACL_ID) {\n return;\n }\n\n if (!longKeyMap.containsKey(acl)) {\n LOG.info(\"Ignoring acl {} as it does not exist in the cache\", acl);\n return;\n }\n\n AtomicLong cou... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_120 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class)",
"modifier": "protected static final",
"original_string": "protected static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "@Test\n public void testWithMinSessionTimeoutGreaterThanMaxSessionTimeout() throws Exception {\n ClientBase.setupTestEnv();\n\n final int CLIENT_PORT = PortAssignment.unique();\n final int tickTime = 2000;\n final int minSessionTimeout = 20 * tickTime + 1000; // min is higher... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class);",
"type": "Logger",
"var_name": "LOG"
},
{
... | {
"body": "protected void initializeAndRun(String[] args) throws ConfigException, IOException, AdminServerException {\n try {\n ManagedUtil.registerLog4jMBeans();\n } catch (JMException e) {\n LOG.warn(\"Unable to register log4j JMX control\", e);\n }\n\n ServerConfig... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_87 | {
"fields": [
{
"declarator": "log",
"modifier": "private",
"original_string": "private Logger log;",
"type": "Logger",
"var_name": "log"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/util/VerifyingFileFactoryTest.java",
"identifier": "VerifyingFi... | {
"body": "@Test\n public void testForFailForNonExistingPath() {\n assertThrows(IllegalArgumentException.class, () -> {\n VerifyingFileFactory vff = new VerifyingFileFactory.Builder(log).failForNonExistingPath().build();\n vff.create(\"/I/H0p3/this/path/d035/n0t/ex15t\");\n });\... | {
"fields": [
{
"declarator": "warnForRelativePath",
"modifier": "private final",
"original_string": "private final boolean warnForRelativePath;",
"type": "boolean",
"var_name": "warnForRelativePath"
},
{
"declarator": "failForNonExistingPath",
"modifier": "privat... | {
"body": "public File create(String path) {\n File file = new File(path);\n return validate(file);\n }",
"class_method_signature": "VerifyingFileFactory.create(String path)",
"constructor": false,
"full_signature": "public File create(String path)",
"identifier": "create",
"invocations": [... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_177 | {
"fields": [
{
"declarator": "PORTS_AMOUNT = 10",
"modifier": "public static final",
"original_string": "public static final int PORTS_AMOUNT = 10;",
"type": "int",
"var_name": "PORTS_AMOUNT"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/Mul... | {
"body": "@Test\n public void testGetAllPorts() {\n List<Integer> ports = getPortList();\n MultipleAddresses multipleAddresses = new MultipleAddresses(getAddressList(ports));\n\n assertTrue(CollectionUtils.isEqualCollection(ports, multipleAddresses.getAllPorts()));\n\n multipleAddresse... | {
"fields": [
{
"declarator": "DEFAULT_TIMEOUT = Duration.ofMillis(1000)",
"modifier": "public static final",
"original_string": "public static final Duration DEFAULT_TIMEOUT = Duration.ofMillis(1000);",
"type": "Duration",
"var_name": "DEFAULT_TIMEOUT"
},
{
"declarator... | {
"body": "public List<Integer> getAllPorts() {\n return addresses.stream().map(InetSocketAddress::getPort).distinct().collect(Collectors.toList());\n }",
"class_method_signature": "MultipleAddresses.getAllPorts()",
"constructor": false,
"full_signature": "public List<Integer> getAllPorts()",
"ident... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_198 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/ZooKeeperServerBeanTest.java",
"identifier": "ZooKeeperServerBeanTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetSecureClientPort() throws IOException {\n ZooKeeperServer zks = new ZooKeeperServer();\n /**\n * case 1: When secure client is not configured GetSecureClientPort\n * should return empty string\n */\n ZooKeeperServerBean serverBean =... | {
"fields": [
{
"declarator": "startTime",
"modifier": "private final",
"original_string": "private final Date startTime;",
"type": "Date",
"var_name": "startTime"
},
{
"declarator": "name",
"modifier": "private final",
"original_string": "private final Stri... | {
"body": "@Override\n public String getSecureClientPort() {\n if (zks.secureServerCnxnFactory != null) {\n return Integer.toString(zks.secureServerCnxnFactory.getLocalPort());\n }\n return \"\";\n }",
"class_method_signature": "ZooKeeperServerBean.getSecureClientPort()",
"co... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_44 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathUtilsTest.java",
"identifier": "PathUtilsTest",
"interfaces": "",
"superclass": "extends ZKTestCase"
} | {
"body": "@Test\n public void testValidatePath_NameContainingPeriod() {\n // A period that isn't on its own is ok\n PathUtils.validatePath(\"/name/with.period.\");\n }",
"class_method_signature": "PathUtilsTest.testValidatePath_NameContainingPeriod()",
"constructor": false,
"full_signature"... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/PathUtils.java",
"identifier": "PathUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": ... | {
"body": "public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException {\n validatePath(isSequential ? path + \"1\" : path);\n }",
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": "pu... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_13 | {
"fields": [
{
"declarator": "port = 1234",
"modifier": "private",
"original_string": "private Integer port = 1234;",
"type": "Integer",
"var_name": "port"
},
{
"declarator": "v4addr = \"127.0.0.1\"",
"modifier": "private",
"original_string": "private Strin... | {
"body": "@Test\n public void tetGetIPV6HostAndPort_WhenHostDoesNotEndWithBracket() {\n assertThrows(IllegalArgumentException.class, () -> {\n NetUtils.getIPV6HostAndPort(\"[2001:0db8:85a3:0000:0000:8a2e:0370:7334:443\");\n });\n }",
"class_method_signature": "NetUtilsTest.tetGetIPV6... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/NetUtils.java",
"identifier": "NetUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "NetUtils.formatInetAddr(InetSocketAddress addr)",
"constructor": false,
"full_signature": "public stat... | {
"body": "public static String[] getIPV6HostAndPort(String hostPort) {\n if (hostPort.startsWith(\"[\")) {\n int i = hostPort.lastIndexOf(']');\n if (i < 0) {\n throw new IllegalArgumentException(\n hostPort + \" starts with '[' but has no matching ']'\"... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_52 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathUtilsTest.java",
"identifier": "PathUtilsTest",
"interfaces": "",
"superclass": "extends ZKTestCase"
} | {
"body": "@Test\n public void testValidatePath_uf8ff() {\n assertThrows(IllegalArgumentException.class, () -> {\n PathUtils.validatePath(\"/test\\uf8ff\");\n });\n }",
"class_method_signature": "PathUtilsTest.testValidatePath_uf8ff()",
"constructor": false,
"full_signature": "@Te... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/PathUtils.java",
"identifier": "PathUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": ... | {
"body": "public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException {\n validatePath(isSequential ? path + \"1\" : path);\n }",
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": "pu... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_53 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathUtilsTest.java",
"identifier": "PathUtilsTest",
"interfaces": "",
"superclass": "extends ZKTestCase"
} | {
"body": "@Test\n public void testValidatePath_HighestAllowableChar() {\n PathUtils.validatePath(\"/test\\uffef\");\n }",
"class_method_signature": "PathUtilsTest.testValidatePath_HighestAllowableChar()",
"constructor": false,
"full_signature": "@Test public void testValidatePath_HighestAllowableC... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/PathUtils.java",
"identifier": "PathUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": ... | {
"body": "public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException {\n validatePath(isSequential ? path + \"1\" : path);\n }",
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": "pu... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_12 | {
"fields": [
{
"declarator": "port = 1234",
"modifier": "private",
"original_string": "private Integer port = 1234;",
"type": "Integer",
"var_name": "port"
},
{
"declarator": "v4addr = \"127.0.0.1\"",
"modifier": "private",
"original_string": "private Strin... | {
"body": "@Test\n public void testFormatAddrUnresolved() {\n InetSocketAddress isa = InetSocketAddress.createUnresolved(\"doesnt.exist.com\", 1234);\n assertEquals(\"doesnt.exist.com:1234\", NetUtils.formatInetAddr(isa));\n }",
"class_method_signature": "NetUtilsTest.testFormatAddrUnresolved()"... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/NetUtils.java",
"identifier": "NetUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "NetUtils.formatInetAddr(InetSocketAddress addr)",
"constructor": false,
"full_signature": "public stat... | {
"body": "public static String formatInetAddr(InetSocketAddress addr) {\n InetAddress ia = addr.getAddress();\n\n if (ia == null) {\n return String.format(\"%s:%s\", addr.getHostString(), addr.getPort());\n }\n\n if (ia instanceof Inet6Address) {\n return String.form... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_45 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/common/PathUtilsTest.java",
"identifier": "PathUtilsTest",
"interfaces": "",
"superclass": "extends ZKTestCase"
} | {
"body": "@Test\n public void testValidatePath_0x01() {\n assertThrows(IllegalArgumentException.class, () -> {\n PathUtils.validatePath(\"/test\\u0001\");\n });\n }",
"class_method_signature": "PathUtilsTest.testValidatePath_0x01()",
"constructor": false,
"full_signature": "@Test... | {
"fields": [],
"file": "zookeeper-server/src/main/java/org/apache/zookeeper/common/PathUtils.java",
"identifier": "PathUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": ... | {
"body": "public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException {\n validatePath(isSequential ? path + \"1\" : path);\n }",
"class_method_signature": "PathUtils.validatePath(String path, boolean isSequential)",
"constructor": false,
"full_signature": "pu... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_176 | {
"fields": [
{
"declarator": "PORTS_AMOUNT = 10",
"modifier": "public static final",
"original_string": "public static final int PORTS_AMOUNT = 10;",
"type": "int",
"var_name": "PORTS_AMOUNT"
}
],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/Mul... | {
"body": "@Test\n public void testGetAllHostStrings() {\n List<InetSocketAddress> addresses = getAddressList();\n List<String> hostStrings = getHostStrings(addresses);\n MultipleAddresses multipleAddresses = new MultipleAddresses(addresses);\n\n assertTrue(CollectionUtils.isEqualCollec... | {
"fields": [
{
"declarator": "DEFAULT_TIMEOUT = Duration.ofMillis(1000)",
"modifier": "public static final",
"original_string": "public static final Duration DEFAULT_TIMEOUT = Duration.ofMillis(1000);",
"type": "Duration",
"var_name": "DEFAULT_TIMEOUT"
},
{
"declarator... | {
"body": "public List<String> getAllHostStrings() {\n return addresses.stream().map(InetSocketAddress::getHostString).distinct().collect(Collectors.toList());\n }",
"class_method_signature": "MultipleAddresses.getAllHostStrings()",
"constructor": false,
"full_signature": "public List<String> getAllHo... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_199 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/ZooKeeperServerBeanTest.java",
"identifier": "ZooKeeperServerBeanTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetSecureClientAddress() throws IOException {\n ZooKeeperServer zks = new ZooKeeperServer();\n /**\n * case 1: When secure client is not configured getSecureClientAddress\n * should return empty string\n */\n ZooKeeperServerBean server... | {
"fields": [
{
"declarator": "startTime",
"modifier": "private final",
"original_string": "private final Date startTime;",
"type": "Date",
"var_name": "startTime"
},
{
"declarator": "name",
"modifier": "private final",
"original_string": "private final Stri... | {
"body": "@Override\n public String getSecureClientAddress() {\n if (zks.secureServerCnxnFactory != null) {\n return String.format(\"%s:%d\",\n zks.secureServerCnxnFactory.getLocalAddress().getHostString(),\n zks.secureServerCnxnFac... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_69 | {
"fields": [],
"file": "zookeeper-server/src/test/java/org/apache/zookeeper/server/ReferenceCountedACLCacheTest.java",
"identifier": "ReferenceCountedACLCacheTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testPurgeUnused() throws IOException {\n ReferenceCountedACLCache cache = new ReferenceCountedACLCache();\n\n List<ACL> acl1 = createACL(\"one\");\n List<ACL> acl2 = createACL(\"two\");\n List<ACL> acl3 = createACL(\"three\");\n List<ACL> acl4 = cre... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ReferenceCountedACLCache.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ReferenceCountedACLCache.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "public synchronized void purgeUnused() {\n Iterator<Map.Entry<Long, AtomicLongWithEquals>> refCountIter = referenceCounter.entrySet().iterator();\n while (refCountIter.hasNext()) {\n Map.Entry<Long, AtomicLongWithEquals> entry = refCountIter.next();\n if (entry.getValue(... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
160999_121 | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class)",
"modifier": "protected static final",
"original_string": "protected static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMainTest.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "@Test\n public void testInvalidMetricsProvider() throws Exception {\n ClientBase.setupTestEnv();\n\n final int CLIENT_PORT = PortAssignment.unique();\n final String configs = \"metricsProvider.className=BadClass\\n\";\n MainThread main = new MainThread(CLIENT_PORT, true, conf... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperServerMain.class);",
"type": "Logger",
"var_name": "LOG"
},
{
... | {
"body": "protected void initializeAndRun(String[] args) throws ConfigException, IOException, AdminServerException {\n try {\n ManagedUtil.registerLog4jMBeans();\n } catch (JMException e) {\n LOG.warn(\"Unable to register log4j JMX control\", e);\n }\n\n ServerConfig... | {
"created": "3/27/2009 3:41:56 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 160999,
"size": null,
"stargazer_count": null,
"stars": 7612,
"updates": "2020-01-27T13:06:42+00:00",
"url": "https://github.com/apache/zookeeper"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.