id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
128018428_183 | {
"fields": [
{
"declarator": "filter = new SentinelDubboProviderFilter()",
"modifier": "private",
"original_string": "private SentinelDubboProviderFilter filter = new SentinelDubboProviderFilter();",
"type": "SentinelDubboProviderFilter",
"var_name": "filter"
}
],
"file": "s... | {
"body": "@Test\n public void testInvoke() {\n\n final String originApplication = \"consumerA\";\n\n URL url = DubboTestUtil.getDefaultTestURL();\n url = url.addParameter(CommonConstants.SIDE_KEY, CommonConstants.PROVIDER_SIDE);\n Invoker invoker = DubboTestUtil.getMockInvoker(url, Dem... | {
"fields": [],
"file": "sentinel-adapter/sentinel-apache-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/SentinelDubboProviderFilter.java",
"identifier": "SentinelDubboProviderFilter",
"interfaces": "",
"methods": [
{
"class_method_signature": "SentinelDubboProviderFilter.Sentine... | {
"body": "@Override\n public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {\n // Get origin caller.\n String origin = DubboAdapterGlobalConfig.getOriginParser().parse(invoker, invocation);\n if (null == origin) {\n origin = \"\";\n }\n ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_195 | {
"fields": [],
"file": "sentinel-adapter/sentinel-sofa-rpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/sofa/rpc/SofaRpcUtilsTest.java",
"identifier": "SofaRpcUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetInterfaceResourceName() {\n SofaRequest request = new SofaRequest();\n request.setInterfaceName(\"com.alibaba.csp.sentinel.adapter.sofa.rpc.service.DemoService\");\n String interfaceResourceName = SofaRpcUtils.getInterfaceResourceName(request);\n as... | {
"fields": [],
"file": "sentinel-adapter/sentinel-sofa-rpc-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/sofa/rpc/SofaRpcUtils.java",
"identifier": "SofaRpcUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "SofaRpcUtils.getApplicationName(SofaRequest request)",
"cons... | {
"body": "public static String getInterfaceResourceName(SofaRequest request) {\n return request.getInterfaceName();\n }",
"class_method_signature": "SofaRpcUtils.getInterfaceResourceName(SofaRequest request)",
"constructor": false,
"full_signature": "public static String getInterfaceResourceName(Sofa... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_85 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/SphUTest.java",
"identifier": "SphUTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMethodEntryNormal() throws BlockException, NoSuchMethodException, SecurityException {\n Method method = SphUTest.class.getMethod(\"testMethodEntryNormal\");\n Entry e = SphU.entry(method);\n\n assertNotNull(e);\n assertTrue(StringUtil\n .equ... | {
"fields": [
{
"declarator": "OBJECTS0 = new Object[0]",
"modifier": "private static final",
"original_string": "private static final Object[] OBJECTS0 = new Object[0];",
"type": "Object[]",
"var_name": "OBJECTS0"
}
],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sen... | {
"body": "public static Entry entry(String name) throws BlockException {\n return Env.sph.entry(name, EntryType.OUT, 1, OBJECTS0);\n }",
"class_method_signature": "SphU.entry(String name)",
"constructor": false,
"full_signature": "public static Entry entry(String name)",
"identifier": "entry",
"i... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_204 | {
"fields": [],
"file": "sentinel-adapter/sentinel-zuul-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/gateway/zuul/filters/SentinelZuulErrorFilterTest.java",
"identifier": "SentinelZuulErrorFilterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testFilterType() throws Exception {\n SentinelZuulErrorFilter sentinelZuulErrorFilter = new SentinelZuulErrorFilter();\n Assert.assertEquals(sentinelZuulErrorFilter.filterType(), ERROR_TYPE);\n }",
"class_method_signature": "SentinelZuulErrorFilterTest.testFilterTy... | {
"fields": [
{
"declarator": "order",
"modifier": "private final",
"original_string": "private final int order;",
"type": "int",
"var_name": "order"
}
],
"file": "sentinel-adapter/sentinel-zuul-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/gateway/zuul/filters/Senti... | {
"body": "@Override\n public String filterType() {\n return ZuulConstant.ERROR_TYPE;\n }",
"class_method_signature": "SentinelZuulErrorFilter.filterType()",
"constructor": false,
"full_signature": "@Override public String filterType()",
"identifier": "filterType",
"invocations": [],
"modifie... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_156 | {
"fields": [],
"file": "sentinel-extension/sentinel-datasource-zookeeper/src/test/java/com/alibaba/csp/sentinel/datasource/zookeeper/ZookeeperDataSourceTest.java",
"identifier": "ZookeeperDataSourceTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testZooKeeperDataSourceSameZkClient() throws Exception {\n TestingServer server = new TestingServer(21813);\n server.start();\n\n final String remoteAddress = server.getConnectString();\n final String flowPath = \"/sentinel-zk-ds-demo/flow-HK\";\n f... | {
"fields": [
{
"declarator": "RETRY_TIMES = 3",
"modifier": "private static final",
"original_string": "private static final int RETRY_TIMES = 3;",
"type": "int",
"var_name": "RETRY_TIMES"
},
{
"declarator": "SLEEP_TIME = 1000",
"modifier": "private static final"... | {
"body": "protected CuratorFramework getZkClient() {\n return this.zkClient;\n }",
"class_method_signature": "ZookeeperDataSource.getZkClient()",
"constructor": false,
"full_signature": "protected CuratorFramework getZkClient()",
"identifier": "getZkClient",
"invocations": [],
"modifiers": "pro... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_11 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
}
],
"file": "sentine... | {
"body": "@Test\n public void testTrim() {\n Assert.assertNull(EagleEyeCoreUtils.trim(null));\n\n Assert.assertEquals(\"\", EagleEyeCoreUtils.trim(\"\"));\n Assert.assertEquals(\"\", EagleEyeCoreUtils.trim(\" \"));\n Assert.assertEquals(\"foo\", EagleEyeCoreUtils.trim(\"foo\"));\n ... | {
"fields": [
{
"declarator": "EMPTY_STRING = \"\"",
"modifier": "public static final",
"original_string": "public static final String EMPTY_STRING = \"\";",
"type": "String",
"var_name": "EMPTY_STRING"
},
{
"declarator": "NEWLINE = \"\\r\\n\"",
"modifier": "publi... | {
"body": "public static String trim(String str) {\n return str == null ? null : str.trim();\n }",
"class_method_signature": "EagleEyeCoreUtils.trim(String str)",
"constructor": false,
"full_signature": "public static String trim(String str)",
"identifier": "trim",
"invocations": [
"trim"
],... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_101 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/node/metric/MetricWriterTest.java",
"identifier": "MetricWriterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testFileNameMatches(){\n String baseFileName = \"Sentinel-SDK-Demo-metrics.log\";\n String fileName = \"Sentinel-SDK-Demo-metrics.log.2018-03-06\";\n assertTrue(MetricWriter.fileNameMatches(fileName, baseFileName));\n\n String baseFileName2 = \"Sentinel-Ad... | {
"fields": [
{
"declarator": "CHARSET = SentinelConfig.charset()",
"modifier": "private static final",
"original_string": "private static final String CHARSET = SentinelConfig.charset();",
"type": "String",
"var_name": "CHARSET"
},
{
"declarator": "METRIC_BASE_DIR = Lo... | {
"body": "public static boolean fileNameMatches(String fileName, String baseFileName) {\n if (fileName.startsWith(baseFileName)) {\n String part = fileName.substring(baseFileName.length());\n // part is like: \".yyyy-MM-dd.number\", eg. \".2018-12-24.11\"\n return part.matches... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_46 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/CtEntryTest.java",
"identifier": "CtEntryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testExitNotMatchCurEntry() {\n String contextName = \"context-rpc\";\n ContextUtil.enter(contextName);\n Context context = ContextUtil.getContext();\n CtEntry entry1 = null;\n CtEntry entry2 = null;\n try {\n entry1 = new CtEntry(n... | {
"fields": [
{
"declarator": "parent = null",
"modifier": "protected",
"original_string": "protected Entry parent = null;",
"type": "Entry",
"var_name": "parent"
},
{
"declarator": "child = null",
"modifier": "protected",
"original_string": "protected Entry... | {
"body": "@Override\n public void exit(int count, Object... args) throws ErrorEntryFreeException {\n trueExit(count, args);\n }",
"class_method_signature": "CtEntry.exit(int count, Object... args)",
"constructor": false,
"full_signature": "@Override public void exit(int count, Object... args)",
... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_117 | {
"fields": [],
"file": "sentinel-cluster/sentinel-cluster-client-default/src/test/java/com/alibaba/csp/sentinel/cluster/client/codec/data/FlowResponseDataDecoderTest.java",
"identifier": "FlowResponseDataDecoderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testDecode() {\n ByteBuf buf = Unpooled.buffer();\n FlowResponseDataDecoder decoder = new FlowResponseDataDecoder();\n FlowTokenResponseData data = new FlowTokenResponseData();\n data.setRemainingCount(12);\n data.setWaitInMs(13);\n buf.write... | {
"fields": [],
"file": "sentinel-cluster/sentinel-cluster-client-default/src/main/java/com/alibaba/csp/sentinel/cluster/client/codec/data/FlowResponseDataDecoder.java",
"identifier": "FlowResponseDataDecoder",
"interfaces": "implements EntityDecoder<ByteBuf, FlowTokenResponseData>",
"methods": [
{
... | {
"body": "@Override\n public FlowTokenResponseData decode(ByteBuf source) {\n FlowTokenResponseData data = new FlowTokenResponseData();\n\n if (source.readableBytes() == 8) {\n data.setRemainingCount(source.readInt());\n data.setWaitInMs(source.readInt());\n }\n r... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_50 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/CtEntryTest.java",
"identifier": "CtEntryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetLastNode() {\n Context context = new NullContext();\n CtEntry entry = new CtEntry(new StringResourceWrapper(\"testGetLastNode\", EntryType.IN),\n null, context);\n assertNull(entry.parent);\n assertNull(entry.getLastNode());\n Entr... | {
"fields": [
{
"declarator": "parent = null",
"modifier": "protected",
"original_string": "protected Entry parent = null;",
"type": "Entry",
"var_name": "parent"
},
{
"declarator": "child = null",
"modifier": "protected",
"original_string": "protected Entry... | {
"body": "@Override\n public Node getLastNode() {\n return parent == null ? null : parent.getCurNode();\n }",
"class_method_signature": "CtEntry.getLastNode()",
"constructor": false,
"full_signature": "@Override public Node getLastNode()",
"identifier": "getLastNode",
"invocations": [
"get... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_140 | {
"fields": [],
"file": "sentinel-extension/sentinel-parameter-flow-control/src/test/java/com/alibaba/csp/sentinel/slots/block/flow/param/ParamFlowRuleManagerTest.java",
"identifier": "ParamFlowRuleManagerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testLoadParamRulesClearingUnusedMetricsForRule() {\n final String resA = \"resA\";\n ParamFlowRule ruleA1 = new ParamFlowRule(resA)\n .setCount(1)\n .setParamIdx(0);\n ParamFlowRule ruleA2 = new ParamFlowRule(resA)\n .... | {
"fields": [
{
"declarator": "PARAM_FLOW_RULES = new ConcurrentHashMap<>()",
"modifier": "private static final",
"original_string": "private static final Map<String, List<ParamFlowRule>> PARAM_FLOW_RULES = new ConcurrentHashMap<>();",
"type": "Map<String, List<ParamFlowRule>>",
"var... | {
"body": "public static void loadRules(List<ParamFlowRule> rules) {\n try {\n currentProperty.updateValue(rules);\n } catch (Throwable e) {\n RecordLog.info(\"[ParamFlowRuleManager] Failed to load rules\", e);\n }\n }",
"class_method_signature": "ParamFlowRuleManager.l... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_70 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/util/IdUtilTest.java",
"identifier": "IdUtilTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void truncate() {\n assertEquals(\"(foo),(bar),(baz)\", IdUtil.truncate(\".(foo).,(bar).,(baz)\"));\n }",
"class_method_signature": "IdUtilTest.truncate()",
"constructor": false,
"full_signature": "@Test public void truncate()",
"identifier": "truncate",
"invocations": [
... | {
"fields": [],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/IdUtil.java",
"identifier": "IdUtil",
"interfaces": "",
"methods": [
{
"class_method_signature": "IdUtil.truncate(String id)",
"constructor": false,
"full_signature": "public static String truncate(String ... | {
"body": "public static String truncate(String id) {\n IdLexer lexer = new IdLexer(id);\n StringBuilder sb = new StringBuilder();\n String r;\n String temp = \"\";\n while ((r = lexer.nextToken()) != null) {\n if (\"(\".equals(r) || \")\".equals(r) || \",\".equals(r)) {\... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_137 | {
"fields": [],
"file": "sentinel-extension/sentinel-parameter-flow-control/src/test/java/com/alibaba/csp/sentinel/slots/statistic/metric/HotParameterLeapArrayTest.java",
"identifier": "HotParameterLeapArrayTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetRollingSum() {\n HotParameterLeapArray leapArray = mock(HotParameterLeapArray.class);\n String v1 = \"a\", v2 = \"B\", v3 = \"Cc\";\n int p1a = 19, p1b = 3;\n int p2a = 6, p2c = 17;\n RollingParamEvent passEvent = RollingParamEvent.REQUEST_PA... | {
"fields": [],
"file": "sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/slots/statistic/metric/HotParameterLeapArray.java",
"identifier": "HotParameterLeapArray",
"interfaces": "",
"methods": [
{
"class_method_signature": "HotParameterLeapArray.HotParameter... | {
"body": "public long getRollingSum(RollingParamEvent event, Object value) {\n currentWindow();\n\n long sum = 0;\n\n List<ParamMapBucket> buckets = this.values();\n for (ParamMapBucket b : buckets) {\n sum += b.get(event, value);\n }\n\n return sum;\n }",
"c... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_27 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/slots/block/flow/FlowSlotTest.java",
"identifier": "FlowSlotTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n @SuppressWarnings(\"unchecked\")\n public void testCheckFlowPass() throws Exception {\n FlowRuleChecker checker = mock(FlowRuleChecker.class);\n FlowSlot flowSlot = new FlowSlot(checker);\n Context context = mock(Context.class);\n DefaultNode node = mock(DefaultNod... | {
"fields": [
{
"declarator": "checker",
"modifier": "private final",
"original_string": "private final FlowRuleChecker checker;",
"type": "FlowRuleChecker",
"var_name": "checker"
},
{
"declarator": "ruleProvider = new Function<String, Collection<FlowRule>>() {\n ... | {
"body": "void checkFlow(ResourceWrapper resource, Context context, DefaultNode node, int count, boolean prioritized)\n throws BlockException {\n checker.checkFlow(ruleProvider, resource, context, node, count, prioritized);\n }",
"class_method_signature": "FlowSlot.checkFlow(ResourceWrapper resour... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_160 | {
"fields": [],
"file": "sentinel-extension/sentinel-annotation-aspectj/src/test/java/com/alibaba/csp/sentinel/annotation/aspectj/AbstractSentinelAspectSupportTest.java",
"identifier": "AbstractSentinelAspectSupportTest",
"interfaces": "",
"superclass": "extends AbstractSentinelAspectSupport"
} | {
"body": "@Test\n public void testGetResourceName() throws Exception {\n Method method = FooService.class.getMethod(\"random\");\n String resourceName = \"someRandom\";\n String expectedResolvedName = FooService.class.getName() + \":random()\";\n assertThat(getResourceName(resourceName... | {
"fields": [],
"file": "sentinel-extension/sentinel-annotation-aspectj/src/main/java/com/alibaba/csp/sentinel/annotation/aspectj/AbstractSentinelAspectSupport.java",
"identifier": "AbstractSentinelAspectSupport",
"interfaces": "",
"methods": [
{
"class_method_signature": "AbstractSentinelAspectSupp... | {
"body": "protected String getResourceName(String resourceName, /*@NonNull*/ Method method) {\n // If resource name is present in annotation, use this value.\n if (StringUtil.isNotBlank(resourceName)) {\n return resourceName;\n }\n // Parse name of target method.\n retur... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_31 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/slots/block/flow/FlowRuleCheckerTest.java",
"identifier": "FlowRuleCheckerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testOtherOriginFlowSelectNode() {\n String originA = \"appA\";\n String originB = \"appB\";\n\n DefaultNode node = mock(DefaultNode.class);\n DefaultNode originNode = mock(DefaultNode.class);\n ClusterNode cn = mock(ClusterNode.class);\n when... | {
"fields": [],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/block/flow/FlowRuleChecker.java",
"identifier": "FlowRuleChecker",
"interfaces": "",
"methods": [
{
"class_method_signature": "FlowRuleChecker.checkFlow(Function<String, Collection<FlowRule>> ruleProvider, ResourceWr... | {
"body": "static Node selectNodeByRequesterAndStrategy(/*@NonNull*/ FlowRule rule, Context context, DefaultNode node) {\n // The limit app should not be empty.\n String limitApp = rule.getLimitApp();\n int strategy = rule.getStrategy();\n String origin = context.getOrigin();\n\n if... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_199 | {
"fields": [],
"file": "sentinel-adapter/sentinel-sofa-rpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/sofa/rpc/AbstractSofaRpcFilterTest.java",
"identifier": "AbstractSofaRpcFilterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testNeedToLoadConsumer() {\n SentinelSofaRpcConsumerFilter consumerFilter = new SentinelSofaRpcConsumerFilter();\n ConsumerConfig consumerConfig = new ConsumerConfig();\n consumerConfig.setInterfaceId(Serializer.class.getName());\n consumerConfig.setId(\"B... | {
"fields": [],
"file": "sentinel-adapter/sentinel-sofa-rpc-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/sofa/rpc/AbstractSofaRpcFilter.java",
"identifier": "AbstractSofaRpcFilter",
"interfaces": "",
"methods": [
{
"class_method_signature": "AbstractSofaRpcFilter.needToLoad(FilterInvoker i... | {
"body": "@Override\n public boolean needToLoad(FilterInvoker invoker) {\n AbstractInterfaceConfig<?, ?> config = invoker.getConfig();\n\n String enabled = config.getParameter(SentinelConstants.SOFA_RPC_SENTINEL_ENABLED);\n if (StringUtils.isNotBlank(enabled)) {\n return Boolean.pa... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_176 | {
"fields": [
{
"declarator": "consumerFilter = new SentinelDubboConsumerFilter()",
"modifier": "private final",
"original_string": "private final SentinelDubboConsumerFilter consumerFilter = new SentinelDubboConsumerFilter();",
"type": "SentinelDubboConsumerFilter",
"var_name": "con... | {
"body": "@Test\n public void testDegradeAsync() throws InterruptedException {\n\n Invocation invocation = DubboTestUtil.getDefaultMockInvocationOne();\n Invoker invoker = DubboTestUtil.getDefaultMockInvoker();\n\n when(invocation.getAttachment(ASYNC_KEY)).thenReturn(Boolean.TRUE.toString());... | {
"fields": [],
"file": "sentinel-adapter/sentinel-apache-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/SentinelDubboConsumerFilter.java",
"identifier": "SentinelDubboConsumerFilter",
"interfaces": "",
"methods": [
{
"class_method_signature": "SentinelDubboConsumerFilter.Sentine... | {
"body": "@Override\n String getInterfaceName(Invoker invoker, String prefix) {\n return DubboUtils.getInterfaceName(invoker, prefix);\n }",
"class_method_signature": "SentinelDubboConsumerFilter.getInterfaceName(Invoker invoker, String prefix)",
"constructor": false,
"full_signature": "@Override ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_208 | {
"fields": [],
"file": "sentinel-adapter/sentinel-zuul-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/gateway/zuul/filters/SentinelZuulPostFilterTest.java",
"identifier": "SentinelZuulPostFilterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testRun() throws Exception {\n SentinelZuulPostFilter sentinelZuulPostFilter = new SentinelZuulPostFilter();\n Object result = sentinelZuulPostFilter.run();\n Assert.assertNull(result);\n }",
"class_method_signature": "SentinelZuulPostFilterTest.testRun()",
... | {
"fields": [
{
"declarator": "order",
"modifier": "private final",
"original_string": "private final int order;",
"type": "int",
"var_name": "order"
}
],
"file": "sentinel-adapter/sentinel-zuul-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/gateway/zuul/filters/Senti... | {
"body": "@Override\n public Object run() throws ZuulException {\n // Exit the entries in order.\n // The entries can be retrieved from the request context.\n SentinelEntryUtils.tryExitFromCurrentContext();\n return null;\n }",
"class_method_signature": "SentinelZuulPostFilter.run... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_1 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
}
],
"file": "sentine... | {
"body": "@Test\n public void testIsBlank() {\n Assert.assertTrue(EagleEyeCoreUtils.isBlank(\"\"));\n Assert.assertTrue(EagleEyeCoreUtils.isBlank(\" \"));\n Assert.assertTrue(EagleEyeCoreUtils.isBlank(null));\n\n Assert.assertFalse(EagleEyeCoreUtils.isBlank(\"foo\"));\n }",
"class... | {
"fields": [
{
"declarator": "EMPTY_STRING = \"\"",
"modifier": "public static final",
"original_string": "public static final String EMPTY_STRING = \"\";",
"type": "String",
"var_name": "EMPTY_STRING"
},
{
"declarator": "NEWLINE = \"\\r\\n\"",
"modifier": "publi... | {
"body": "public static boolean isBlank(String str) {\n int strLen;\n if (str == null || (strLen = str.length()) == 0) {\n return true;\n }\n for (int i = 0; i < strLen; i++) {\n if ((!Character.isWhitespace(str.charAt(i)))) {\n return false;\n ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_89 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/SphUTest.java",
"identifier": "SphUTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testStringEntryType() throws BlockException {\n Entry e = SphU.entry(\"resourceName\", EntryType.IN);\n\n assertSame(e.resourceWrapper.getEntryType(), EntryType.IN);\n\n e.exit();\n }",
"class_method_signature": "SphUTest.testStringEntryType()",
"construct... | {
"fields": [
{
"declarator": "OBJECTS0 = new Object[0]",
"modifier": "private static final",
"original_string": "private static final Object[] OBJECTS0 = new Object[0];",
"type": "Object[]",
"var_name": "OBJECTS0"
}
],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sen... | {
"body": "public static Entry entry(String name) throws BlockException {\n return Env.sph.entry(name, EntryType.OUT, 1, OBJECTS0);\n }",
"class_method_signature": "SphU.entry(String name)",
"constructor": false,
"full_signature": "public static Entry entry(String name)",
"identifier": "entry",
"i... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_66 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/util/StringUtilTest.java",
"identifier": "StringUtilTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testTrimToEmpty() {\n Assert.assertEquals(\"\", StringUtil.trimToEmpty(\"\"));\n Assert.assertEquals(\"\", StringUtil.trimToEmpty(null));\n }",
"class_method_signature": "StringUtilTest.testTrimToEmpty()",
"constructor": false,
"full_signature": "@Test public void testTrim... | {
"fields": [
{
"declarator": "EMPTY = \"\"",
"modifier": "public static final",
"original_string": "public static final String EMPTY = \"\";",
"type": "String",
"var_name": "EMPTY"
}
],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/StringUtil.java",
"i... | {
"body": "public static String trimToEmpty(String str) {\n return str == null ? EMPTY : str.trim();\n }",
"class_method_signature": "StringUtil.trimToEmpty(String str)",
"constructor": false,
"full_signature": "public static String trimToEmpty(String str)",
"identifier": "trimToEmpty",
"invocatio... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_121 | {
"fields": [],
"file": "sentinel-cluster/sentinel-cluster-server-envoy-rls/src/test/java/com/alibaba/csp/sentinel/cluster/server/envoy/rls/rule/EnvoySentinelRuleConverterTest.java",
"identifier": "EnvoySentinelRuleConverterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testConvertToSentinelFlowRules() {\n String domain = \"testConvertToSentinelFlowRules\";\n EnvoyRlsRule rlsRule = new EnvoyRlsRule();\n rlsRule.setDomain(domain);\n List<ResourceDescriptor> descriptors = new ArrayList<>();\n ResourceDescriptor d1 = ... | {
"fields": [
{
"declarator": "SEPARATOR = \"|\"",
"modifier": "public static final",
"original_string": "public static final String SEPARATOR = \"|\";",
"type": "String",
"var_name": "SEPARATOR"
}
],
"file": "sentinel-cluster/sentinel-cluster-server-envoy-rls/src/main/java/c... | {
"body": "public static List<FlowRule> toSentinelFlowRules(EnvoyRlsRule rule) {\n if (!EnvoyRlsRuleManager.isValidRule(rule)) {\n throw new IllegalArgumentException(\"Not a valid RLS rule\");\n }\n return rule.getDescriptors().stream()\n .map(e -> toSentinelFlowRule(rule.ge... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_224 | {
"fields": [
{
"declarator": "routeIdPredicate = new Predicate<GatewayFlowRule>() {\n @Override\n public boolean test(GatewayFlowRule e) {\n return e.getResourceMode() == SentinelGatewayConstants.RESOURCE_MODE_ROUTE_ID;\n }\n }",
"modifier": "private final",
"... | {
"body": "@Test\n public void testParseParametersWithEmptyItemPattern() {\n RequestItemParser<Object> itemParser = mock(RequestItemParser.class);\n GatewayParamParser<Object> paramParser = new GatewayParamParser<>(itemParser);\n // Create a fake request.\n Object request = new Object()... | {
"fields": [
{
"declarator": "requestItemParser",
"modifier": "private final",
"original_string": "private final RequestItemParser<T> requestItemParser;",
"type": "RequestItemParser<T>",
"var_name": "requestItemParser"
}
],
"file": "sentinel-adapter/sentinel-api-gateway-adap... | {
"body": "public Object[] parseParameterFor(String resource, T request, Predicate<GatewayFlowRule> rulePredicate) {\n if (StringUtil.isEmpty(resource) || request == null || rulePredicate == null) {\n return new Object[0];\n }\n Set<GatewayFlowRule> gatewayRules = new HashSet<>();\n ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_225 | {
"fields": [
{
"declarator": "routeIdPredicate = new Predicate<GatewayFlowRule>() {\n @Override\n public boolean test(GatewayFlowRule e) {\n return e.getResourceMode() == SentinelGatewayConstants.RESOURCE_MODE_ROUTE_ID;\n }\n }",
"modifier": "private final",
"... | {
"body": "@Test\n public void testParseParametersWithItemPatternMatching() {\n RequestItemParser<Object> itemParser = mock(RequestItemParser.class);\n GatewayParamParser<Object> paramParser = new GatewayParamParser<>(itemParser);\n // Create a fake request.\n Object request = new Objec... | {
"fields": [
{
"declarator": "requestItemParser",
"modifier": "private final",
"original_string": "private final RequestItemParser<T> requestItemParser;",
"type": "RequestItemParser<T>",
"var_name": "requestItemParser"
}
],
"file": "sentinel-adapter/sentinel-api-gateway-adap... | {
"body": "public Object[] parseParameterFor(String resource, T request, Predicate<GatewayFlowRule> rulePredicate) {\n if (StringUtil.isEmpty(resource) || request == null || rulePredicate == null) {\n return new Object[0];\n }\n Set<GatewayFlowRule> gatewayRules = new HashSet<>();\n ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_120 | {
"fields": [],
"file": "sentinel-cluster/sentinel-cluster-client-default/src/test/java/com/alibaba/csp/sentinel/cluster/client/codec/data/PingResponseDataDecoderTest.java",
"identifier": "PingResponseDataDecoderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testDecodePingResponseData() {\n ByteBuf buf = Unpooled.buffer();\n PingResponseDataDecoder decoder = new PingResponseDataDecoder();\n\n int big = Integer.MAX_VALUE;\n buf.writeInt(big);\n assertThat(decoder.decode(buf)).isEqualTo(big);\n\n b... | {
"fields": [],
"file": "sentinel-cluster/sentinel-cluster-client-default/src/main/java/com/alibaba/csp/sentinel/cluster/client/codec/data/PingResponseDataDecoder.java",
"identifier": "PingResponseDataDecoder",
"interfaces": "implements EntityDecoder<ByteBuf, Integer>",
"methods": [
{
"class_method_... | {
"body": "@Override\n public Integer decode(ByteBuf source) {\n int size = source.readableBytes();\n if (size == 1) {\n // Compatible with old version (< 1.7.0).\n return (int) source.readByte();\n }\n if (size >= 4) {\n return source.readInt();\n ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_209 | {
"fields": [
{
"declarator": "SERVICE_ID = \"servicea\"",
"modifier": "private",
"original_string": "private String SERVICE_ID = \"servicea\";",
"type": "String",
"var_name": "SERVICE_ID"
},
{
"declarator": "URI = \"/servicea/test\"",
"modifier": "private",
... | {
"body": "@Test\n public void testFilterType() throws Exception {\n SentinelZuulPreFilter sentinelZuulPreFilter = new SentinelZuulPreFilter();\n Assert.assertEquals(sentinelZuulPreFilter.filterType(), PRE_TYPE);\n }",
"class_method_signature": "SentinelZuulPreFilterTest.testFilterType()",
"co... | {
"fields": [
{
"declarator": "order",
"modifier": "private final",
"original_string": "private final int order;",
"type": "int",
"var_name": "order"
},
{
"declarator": "paramParser = new GatewayParamParser<>(\n new RequestContextItemParser())",
"modifier":... | {
"body": "@Override\n public String filterType() {\n return ZuulConstant.PRE_TYPE;\n }",
"class_method_signature": "SentinelZuulPreFilter.filterType()",
"constructor": false,
"full_signature": "@Override public String filterType()",
"identifier": "filterType",
"invocations": [],
"modifiers":... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_0 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/eagleeye/TokenBucketTest.java",
"identifier": "TokenBucketTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testAccept() {\n TokenBucket tokenBucket = new TokenBucket(1, TimeUnit.SECONDS.toMillis(10));\n Assert.assertTrue(tokenBucket.accept(System.currentTimeMillis()));\n Assert.assertFalse(tokenBucket.accept(System.currentTimeMillis()));\n }",
"class_method_signa... | {
"fields": [
{
"declarator": "maxTokens",
"modifier": "private final",
"original_string": "private final long maxTokens;",
"type": "long",
"var_name": "maxTokens"
},
{
"declarator": "intervalMillis",
"modifier": "private final",
"original_string": "private ... | {
"body": "public boolean accept(long now) {\n long currTokens;\n if (now > nextUpdate) {\n currTokens = tokens.get();\n if (tokens.compareAndSet(currTokens, maxTokens)) {\n nextUpdate = System.currentTimeMillis() / 1000 * 1000 + intervalMillis;\n }\n ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_88 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/SphUTest.java",
"identifier": "SphUTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMethodEntryCount() throws BlockException, NoSuchMethodException, SecurityException {\n Method method = SphUTest.class.getMethod(\"testMethodEntryNormal\");\n Entry e = SphU.entry(method, 2);\n\n assertNotNull(e);\n assertTrue(StringUtil\n .e... | {
"fields": [
{
"declarator": "OBJECTS0 = new Object[0]",
"modifier": "private static final",
"original_string": "private static final Object[] OBJECTS0 = new Object[0];",
"type": "Object[]",
"var_name": "OBJECTS0"
}
],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sen... | {
"body": "public static Entry entry(String name) throws BlockException {\n return Env.sph.entry(name, EntryType.OUT, 1, OBJECTS0);\n }",
"class_method_signature": "SphU.entry(String name)",
"constructor": false,
"full_signature": "public static Entry entry(String name)",
"identifier": "entry",
"i... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_67 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/util/MethodUtilTest.java",
"identifier": "MethodUtilTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testResolveMethodName() {\n Method fooMethod = null;\n for (Method m : GoodClass.class.getMethods()) {\n if (m.getName().contains(\"foo\")) {\n fooMethod = m;\n break;\n }\n }\n assertNotNull(fooMethod);\... | {
"fields": [
{
"declarator": "methodNameMap = new ConcurrentHashMap<Method, String>()",
"modifier": "private static final",
"original_string": "private static final Map<Method, String> methodNameMap = new ConcurrentHashMap<Method, String>();",
"type": "Map<Method, String>",
"var_nam... | {
"body": "public static String resolveMethodName(Method method) {\n if (method == null) {\n throw new IllegalArgumentException(\"Null method\");\n }\n String methodName = methodNameMap.get(method);\n if (methodName == null) {\n synchronized (LOCK) {\n ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_198 | {
"fields": [],
"file": "sentinel-adapter/sentinel-sofa-rpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/sofa/rpc/AbstractSofaRpcFilterTest.java",
"identifier": "AbstractSofaRpcFilterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testNeedToLoadProvider() {\n SentinelSofaRpcProviderFilter providerFilter = new SentinelSofaRpcProviderFilter();\n ProviderConfig providerConfig = new ProviderConfig();\n providerConfig.setInterfaceId(Serializer.class.getName());\n providerConfig.setId(\"A... | {
"fields": [],
"file": "sentinel-adapter/sentinel-sofa-rpc-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/sofa/rpc/AbstractSofaRpcFilter.java",
"identifier": "AbstractSofaRpcFilter",
"interfaces": "",
"methods": [
{
"class_method_signature": "AbstractSofaRpcFilter.needToLoad(FilterInvoker i... | {
"body": "@Override\n public boolean needToLoad(FilterInvoker invoker) {\n AbstractInterfaceConfig<?, ?> config = invoker.getConfig();\n\n String enabled = config.getParameter(SentinelConstants.SOFA_RPC_SENTINEL_ENABLED);\n if (StringUtils.isNotBlank(enabled)) {\n return Boolean.pa... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_177 | {
"fields": [
{
"declarator": "consumerFilter = new SentinelDubboConsumerFilter()",
"modifier": "private final",
"original_string": "private final SentinelDubboConsumerFilter consumerFilter = new SentinelDubboConsumerFilter();",
"type": "SentinelDubboConsumerFilter",
"var_name": "con... | {
"body": "@Test\n public void testDegradeSync() throws InterruptedException {\n\n Invocation invocation = DubboTestUtil.getDefaultMockInvocationOne();\n Invoker invoker = DubboTestUtil.getDefaultMockInvoker();\n initDegradeRule(DubboUtils.getInterfaceName(invoker));\n\n Result result =... | {
"fields": [],
"file": "sentinel-adapter/sentinel-apache-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/SentinelDubboConsumerFilter.java",
"identifier": "SentinelDubboConsumerFilter",
"interfaces": "",
"methods": [
{
"class_method_signature": "SentinelDubboConsumerFilter.Sentine... | {
"body": "@Override\n String getInterfaceName(Invoker invoker, String prefix) {\n return DubboUtils.getInterfaceName(invoker, prefix);\n }",
"class_method_signature": "SentinelDubboConsumerFilter.getInterfaceName(Invoker invoker, String prefix)",
"constructor": false,
"full_signature": "@Override ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_30 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/slots/block/flow/FlowRuleCheckerTest.java",
"identifier": "FlowRuleCheckerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testCustomOriginFlowSelectNode() {\n String origin = \"appA\";\n String limitAppB = \"appB\";\n\n DefaultNode node = mock(DefaultNode.class);\n DefaultNode originNode = mock(DefaultNode.class);\n ClusterNode cn = mock(ClusterNode.class);\n wh... | {
"fields": [],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/block/flow/FlowRuleChecker.java",
"identifier": "FlowRuleChecker",
"interfaces": "",
"methods": [
{
"class_method_signature": "FlowRuleChecker.checkFlow(Function<String, Collection<FlowRule>> ruleProvider, ResourceWr... | {
"body": "static Node selectNodeByRequesterAndStrategy(/*@NonNull*/ FlowRule rule, Context context, DefaultNode node) {\n // The limit app should not be empty.\n String limitApp = rule.getLimitApp();\n int strategy = rule.getStrategy();\n String origin = context.getOrigin();\n\n if... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_161 | {
"fields": [
{
"declarator": "endPoints = \"http://127.0.0.1:2379\"",
"modifier": "private final",
"original_string": "private final String endPoints = \"http://127.0.0.1:2379\";",
"type": "String",
"var_name": "endPoints"
}
],
"file": "sentinel-extension/sentinel-datasource... | {
"body": "@Test\n public void testReadSource() throws Exception {\n EtcdDataSource dataSource = new EtcdDataSource(\"foo\", value -> value);\n KV kvClient = Client.builder()\n .endpoints(endPoints)\n .build().getKVClient();\n\n kvClient.put(ByteSequence.from(\"fo... | {
"fields": [
{
"declarator": "client",
"modifier": "private final",
"original_string": "private final Client client;",
"type": "Client",
"var_name": "client"
},
{
"declarator": "watcher",
"modifier": "private",
"original_string": "private Watch.Watcher watc... | {
"body": "@Override\n public String readSource() throws Exception {\n CompletableFuture<GetResponse> responseFuture = client.getKVClient().get(ByteSequence.from(key, charset));\n List<KeyValue> kvs = responseFuture.get().getKvs();\n return kvs.size() == 0 ? null : kvs.get(0).getValue().toStri... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_26 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/slots/block/authority/AuthorityRuleCheckerTest.java",
"identifier": "AuthorityRuleCheckerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testPassCheck() {\n String origin = \"appA\";\n ContextUtil.enter(\"entrance\", origin);\n try {\n String resourceName = \"testPassCheck\";\n AuthorityRule ruleA = new AuthorityRule()\n .setResource(resourceName)\n ... | {
"fields": [],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/block/authority/AuthorityRuleChecker.java",
"identifier": "AuthorityRuleChecker",
"interfaces": "",
"methods": [
{
"class_method_signature": "AuthorityRuleChecker.passCheck(AuthorityRule rule, Context context)",
... | {
"body": "static boolean passCheck(AuthorityRule rule, Context context) {\n String requester = context.getOrigin();\n\n // Empty origin or empty limitApp will pass.\n if (StringUtil.isEmpty(requester) || StringUtil.isEmpty(rule.getLimitApp())) {\n return true;\n }\n\n //... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_136 | {
"fields": [],
"file": "sentinel-extension/sentinel-parameter-flow-control/src/test/java/com/alibaba/csp/sentinel/slots/statistic/metric/HotParameterLeapArrayTest.java",
"identifier": "HotParameterLeapArrayTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetTopValues() {\n int intervalInSec = 2;\n int a1 = 3, a2 = 5;\n String paramPrefix = \"param-\";\n HotParameterLeapArray leapArray = mock(HotParameterLeapArray.class);\n when(leapArray.getIntervalInSecond()).thenReturn((double) intervalInSec);... | {
"fields": [],
"file": "sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/slots/statistic/metric/HotParameterLeapArray.java",
"identifier": "HotParameterLeapArray",
"interfaces": "",
"methods": [
{
"class_method_signature": "HotParameterLeapArray.HotParameter... | {
"body": "public Map<Object, Double> getTopValues(RollingParamEvent event, int number) {\n currentWindow();\n List<ParamMapBucket> buckets = this.values();\n\n Map<Object, Integer> result = new HashMap<Object, Integer>();\n\n for (ParamMapBucket b : buckets) {\n Set<Object> sub... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_71 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/util/ConfigUtilTest.java",
"identifier": "ConfigUtilTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testLoadProperties() throws IOException {\n\n File file = null;\n String logOutputType = \"utf-8\",\n dir = \"/data/logs/\",\n fileName = \"propertiesTest.properties\";\n try {\n String userDir = System.getProperty(\"user.... | {
"fields": [
{
"declarator": "CLASSPATH_FILE_FLAG = \"classpath:\"",
"modifier": "public static final",
"original_string": "public static final String CLASSPATH_FILE_FLAG = \"classpath:\";",
"type": "String",
"var_name": "CLASSPATH_FILE_FLAG"
}
],
"file": "sentinel-core/src/... | {
"body": "public static Properties loadProperties(String fileName) {\n if (StringUtil.isNotBlank(fileName)) {\n if (absolutePathStart(fileName)) {\n return loadPropertiesFromAbsoluteFile(fileName);\n } else if (fileName.startsWith(CLASSPATH_FILE_FLAG)) {\n r... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_141 | {
"fields": [],
"file": "sentinel-extension/sentinel-parameter-flow-control/src/test/java/com/alibaba/csp/sentinel/slots/block/flow/param/ParameterMetricStorageTest.java",
"identifier": "ParameterMetricStorageTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetNullParamMetric() {\n assertNull(ParameterMetricStorage.getParamMetric(null));\n }",
"class_method_signature": "ParameterMetricStorageTest.testGetNullParamMetric()",
"constructor": false,
"full_signature": "@Test public void testGetNullParamMetric()",
"identi... | {
"fields": [
{
"declarator": "metricsMap = new ConcurrentHashMap<>()",
"modifier": "private static final",
"original_string": "private static final Map<String, ParameterMetric> metricsMap = new ConcurrentHashMap<>();",
"type": "Map<String, ParameterMetric>",
"var_name": "metricsMap"... | {
"body": "public static ParameterMetric getParamMetric(ResourceWrapper resourceWrapper) {\n if (resourceWrapper == null || resourceWrapper.getName() == null) {\n return null;\n }\n return metricsMap.get(resourceWrapper.getName());\n }",
"class_method_signature": "ParameterMetricS... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_51 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/util/VersionUtilTest.java",
"identifier": "VersionUtilTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetDefaultVersion() {\n String defaultVersion = \"1.0\";\n String version = VersionUtil.getVersion(defaultVersion);\n // Manifest cannot be load before package.\n Assert.assertEquals(defaultVersion, version);\n }",
"class_method_signature": "Versi... | {
"fields": [],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/VersionUtil.java",
"identifier": "VersionUtil",
"interfaces": "",
"methods": [
{
"class_method_signature": "VersionUtil.getVersion(String defaultVersion)",
"constructor": false,
"full_signature": "public s... | {
"body": "public static String getVersion(String defaultVersion) {\n try {\n String version = VersionUtil.class.getPackage().getImplementationVersion();\n return StringUtil.isBlank(version) ? defaultVersion : version;\n } catch (Throwable e) {\n RecordLog.warn(\"Using d... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_116 | {
"fields": [],
"file": "sentinel-transport/sentinel-transport-simple-http/src/test/java/com/alibaba/csp/sentinel/transport/command/http/HttpEventTaskTest.java",
"identifier": "HttpEventTaskTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void processPostRequest() throws IOException {\n CommandRequest request;\n \n request = new CommandRequest();\n request.addParam(\"a\", \"1\");\n \n // illegal(empty) request\n try {\n HttpEventTask.processPostRequest(new ByteArr... | {
"fields": [
{
"declarator": "SERVER_ERROR_MESSAGE = \"Command server error\"",
"modifier": "public static final",
"original_string": "public static final String SERVER_ERROR_MESSAGE = \"Command server error\";",
"type": "String",
"var_name": "SERVER_ERROR_MESSAGE"
},
{
... | {
"body": "protected static void processPostRequest(InputStream in, CommandRequest request)\n throws RequestException, IOException {\n Map<String, String> headerMap = parsePostHeaders(in);\n\n if (headerMap == null) {\n // illegal request\n CommandCenterLog.warn(\"Illegal re... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_47 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/CtEntryTest.java",
"identifier": "CtEntryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testExitLastEntryWithDefaultContext() {\n final Context defaultContext = getFakeDefaultContext();\n ContextUtil.runOnContext(defaultContext, new Runnable() {\n @Override\n public void run() {\n CtEntry entry = new CtEntry(new StringR... | {
"fields": [
{
"declarator": "parent = null",
"modifier": "protected",
"original_string": "protected Entry parent = null;",
"type": "Entry",
"var_name": "parent"
},
{
"declarator": "child = null",
"modifier": "protected",
"original_string": "protected Entry... | {
"body": "@Override\n public void exit(int count, Object... args) throws ErrorEntryFreeException {\n trueExit(count, args);\n }",
"class_method_signature": "CtEntry.exit(int count, Object... args)",
"constructor": false,
"full_signature": "@Override public void exit(int count, Object... args)",
... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_100 | {
"fields": [
{
"declarator": "LOG_PREFIX = \"[StatisticNodeTest] \"",
"modifier": "private static final",
"original_string": "private static final String LOG_PREFIX = \"[StatisticNodeTest] \";",
"type": "String",
"var_name": "LOG_PREFIX"
},
{
"declarator": "SDF = new S... | {
"body": "@Test\n public void testStatisticLongAdder() throws InterruptedException {\n AtomicInteger atomicInteger = new AtomicInteger(0);\n StatisticNode statisticNode = new StatisticNode();\n ExecutorService bizEs1 = new ThreadPoolExecutor(THREAD_COUNT, THREAD_COUNT,\n 0L, Ti... | {
"fields": [
{
"declarator": "rollingCounterInSecond = new ArrayMetric(SampleCountProperty.SAMPLE_COUNT,\n IntervalProperty.INTERVAL)",
"modifier": "private transient volatile",
"original_string": "private transient volatile Metric rollingCounterInSecond = new ArrayMetric(SampleCountProp... | {
"body": "@Override\n public int curThreadNum() {\n return (int)curThreadNum.sum();\n }",
"class_method_signature": "StatisticNode.curThreadNum()",
"constructor": false,
"full_signature": "@Override public int curThreadNum()",
"identifier": "curThreadNum",
"invocations": [
"sum"
],
"mo... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_10 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
}
],
"file": "sentine... | {
"body": "@Test\n public void testIsNotEmpty() {\n Assert.assertFalse(EagleEyeCoreUtils.isNotEmpty(\"\"));\n Assert.assertFalse(EagleEyeCoreUtils.isNotEmpty(null));\n\n Assert.assertTrue(EagleEyeCoreUtils.isNotEmpty(\" \"));\n Assert.assertTrue(EagleEyeCoreUtils.isNotEmpty(\"foo\"));\n... | {
"fields": [
{
"declarator": "EMPTY_STRING = \"\"",
"modifier": "public static final",
"original_string": "public static final String EMPTY_STRING = \"\";",
"type": "String",
"var_name": "EMPTY_STRING"
},
{
"declarator": "NEWLINE = \"\\r\\n\"",
"modifier": "publi... | {
"body": "public static boolean isNotEmpty(String str) {\n return str != null && str.length() > 0;\n }",
"class_method_signature": "EagleEyeCoreUtils.isNotEmpty(String str)",
"constructor": false,
"full_signature": "public static boolean isNotEmpty(String str)",
"identifier": "isNotEmpty",
"invoc... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_157 | {
"fields": [],
"file": "sentinel-extension/sentinel-annotation-aspectj/src/test/java/com/alibaba/csp/sentinel/annotation/aspectj/ResourceMetadataRegistryTest.java",
"identifier": "ResourceMetadataRegistryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void testUpdateBlockHandlerBadArgument() {\n ResourceMetadataRegistry.updateBlockHandlerFor(null, \"sxs\", String.class.getMethods()[0]);\n }",
"class_method_signature": "ResourceMetadataRegistryTest.testUpdateBlockHandlerBadArgument(... | {
"fields": [
{
"declarator": "FALLBACK_MAP = new ConcurrentHashMap<>()",
"modifier": "private static final",
"original_string": "private static final Map<String, MethodWrapper> FALLBACK_MAP = new ConcurrentHashMap<>();",
"type": "Map<String, MethodWrapper>",
"var_name": "FALLBACK_MA... | {
"body": "static void updateBlockHandlerFor(Class<?> clazz, String name, Method method) {\n if (clazz == null || StringUtil.isBlank(name)) {\n throw new IllegalArgumentException(\"Bad argument\");\n }\n BLOCK_HANDLER_MAP.put(getKey(clazz, name), MethodWrapper.wrap(method));\n }",
... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_84 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/SphUTest.java",
"identifier": "SphUTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testStringEntryNormal() throws BlockException {\n Entry e = SphU.entry(\"resourceName\");\n\n assertNotNull(e);\n assertEquals(e.resourceWrapper.getName(), \"resourceName\");\n assertEquals(e.resourceWrapper.getEntryType(), EntryType.OUT);\n assertE... | {
"fields": [
{
"declarator": "OBJECTS0 = new Object[0]",
"modifier": "private static final",
"original_string": "private static final Object[] OBJECTS0 = new Object[0];",
"type": "Object[]",
"var_name": "OBJECTS0"
}
],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sen... | {
"body": "public static Entry entry(String name) throws BlockException {\n return Env.sph.entry(name, EntryType.OUT, 1, OBJECTS0);\n }",
"class_method_signature": "SphU.entry(String name)",
"constructor": false,
"full_signature": "public static Entry entry(String name)",
"identifier": "entry",
"i... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_205 | {
"fields": [],
"file": "sentinel-adapter/sentinel-zuul-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/gateway/zuul/filters/SentinelZuulErrorFilterTest.java",
"identifier": "SentinelZuulErrorFilterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testShouldFilter() {\n SentinelZuulErrorFilter sentinelZuulErrorFilter = new SentinelZuulErrorFilter();\n RequestContext ctx = RequestContext.getCurrentContext();\n ctx.setThrowable(new RuntimeException());\n Assert.assertTrue(sentinelZuulErrorFilter.shoul... | {
"fields": [
{
"declarator": "order",
"modifier": "private final",
"original_string": "private final int order;",
"type": "int",
"var_name": "order"
}
],
"file": "sentinel-adapter/sentinel-zuul-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/gateway/zuul/filters/Senti... | {
"body": "@Override\n public boolean shouldFilter() {\n RequestContext ctx = RequestContext.getCurrentContext();\n return ctx.getThrowable() != null;\n }",
"class_method_signature": "SentinelZuulErrorFilter.shouldFilter()",
"constructor": false,
"full_signature": "@Override public boolean s... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_194 | {
"fields": [],
"file": "sentinel-adapter/sentinel-sofa-rpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/sofa/rpc/SofaRpcUtilsTest.java",
"identifier": "SofaRpcUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetApplicationName() {\n SofaRequest request = new SofaRequest();\n String applicationName = SofaRpcUtils.getApplicationName(request);\n assertEquals(\"\", applicationName);\n\n request.addRequestProp(\"app\", \"test-app\");\n applicationName = ... | {
"fields": [],
"file": "sentinel-adapter/sentinel-sofa-rpc-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/sofa/rpc/SofaRpcUtils.java",
"identifier": "SofaRpcUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "SofaRpcUtils.getApplicationName(SofaRequest request)",
"cons... | {
"body": "public static String getApplicationName(SofaRequest request) {\n String appName = (String) request.getRequestProp(RemotingConstants.HEAD_APP_NAME);\n return appName == null ? \"\" : appName;\n }",
"class_method_signature": "SofaRpcUtils.getApplicationName(SofaRequest request)",
"constr... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_182 | {
"fields": [
{
"declarator": "filter = new DubboAppContextFilter()",
"modifier": "private",
"original_string": "private DubboAppContextFilter filter = new DubboAppContextFilter();",
"type": "DubboAppContextFilter",
"var_name": "filter"
}
],
"file": "sentinel-adapter/sentinel... | {
"body": "@Test\n public void testInvokeNullApplicationKey() {\n Invoker invoker = mock(Invoker.class);\n Invocation invocation = mock(Invocation.class);\n URL url = URL.valueOf(\"test://test:111/test?application=\");\n when(invoker.getUrl()).thenReturn(url);\n\n filter.invoke(i... | {
"fields": [],
"file": "sentinel-adapter/sentinel-apache-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/DubboAppContextFilter.java",
"identifier": "DubboAppContextFilter",
"interfaces": "implements Filter",
"methods": [
{
"class_method_signature": "DubboAppContextFilter.invoke(I... | {
"body": "@Override\n public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {\n String application = invoker.getUrl().getParameter(CommonConstants.APPLICATION_KEY);\n if (application != null) {\n RpcContext.getContext().setAttachment(DubboUtils.SENTINEL_DUBBO... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_92 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/SphUTest.java",
"identifier": "SphUTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMethodEntryCountType() throws BlockException, NoSuchMethodException, SecurityException {\n Method method = SphUTest.class.getMethod(\"testMethodEntryNormal\");\n Entry e = SphU.entry(method, EntryType.IN, 2);\n\n assertSame(e.resourceWrapper.getEntryType(), E... | {
"fields": [
{
"declarator": "OBJECTS0 = new Object[0]",
"modifier": "private static final",
"original_string": "private static final Object[] OBJECTS0 = new Object[0];",
"type": "Object[]",
"var_name": "OBJECTS0"
}
],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sen... | {
"body": "public static Entry entry(String name) throws BlockException {\n return Env.sph.entry(name, EntryType.OUT, 1, OBJECTS0);\n }",
"class_method_signature": "SphU.entry(String name)",
"constructor": false,
"full_signature": "public static Entry entry(String name)",
"identifier": "entry",
"i... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_142 | {
"fields": [
{
"declarator": "paramFlowSlot = new ParamFlowSlot()",
"modifier": "private final",
"original_string": "private final ParamFlowSlot paramFlowSlot = new ParamFlowSlot();",
"type": "ParamFlowSlot",
"var_name": "paramFlowSlot"
}
],
"file": "sentinel-extension/senti... | {
"body": "@Test\n public void testNegativeParamIdx() throws Throwable {\n String resourceName = \"testNegativeParamIdx\";\n ResourceWrapper resourceWrapper = new StringResourceWrapper(resourceName, EntryType.IN);\n ParamFlowRule rule = new ParamFlowRule(resourceName)\n .setCount(1)... | {
"fields": [],
"file": "sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/slots/block/flow/param/ParamFlowSlot.java",
"identifier": "ParamFlowSlot",
"interfaces": "",
"methods": [
{
"class_method_signature": "ParamFlowSlot.entry(Context context, ResourceWrapp... | {
"body": "@Override\n public void entry(Context context, ResourceWrapper resourceWrapper, DefaultNode node, int count,\n boolean prioritized, Object... args) throws Throwable {\n if (!ParamFlowRuleManager.hasRules(resourceWrapper.getName())) {\n fireEntry(context, resourceWr... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_52 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/util/VersionUtilTest.java",
"identifier": "VersionUtilTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testFromVersionString() {\n assertEquals(0x01020300, VersionUtil.fromVersionString(\"1.2.3\"));\n assertEquals(0x01020304, VersionUtil.fromVersionString(\"1.2.3.4\"));\n assertEquals(0x0102ff04, VersionUtil.fromVersionString(\"1.2.255.4\"));\n assertEquals... | {
"fields": [],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/VersionUtil.java",
"identifier": "VersionUtil",
"interfaces": "",
"methods": [
{
"class_method_signature": "VersionUtil.getVersion(String defaultVersion)",
"constructor": false,
"full_signature": "public s... | {
"body": "public static int fromVersionString(String verStr) {\n if (verStr == null || verStr.length() < 1) {\n return 0;\n }\n int[] versions = new int[] {0, 0, 0, 0};\n int index = 0;\n String segment;\n int cur = 0;\n int pos;\n do {\n ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_115 | {
"fields": [],
"file": "sentinel-transport/sentinel-transport-simple-http/src/test/java/com/alibaba/csp/sentinel/transport/command/http/HttpEventTaskTest.java",
"identifier": "HttpEventTaskTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void parsePostHeaders() throws IOException {\n Map<String, String> map;\n \n map = HttpEventTask.parsePostHeaders(new ByteArrayInputStream(\"\".getBytes()));\n assertTrue(map.size() == 0);\n \n map = HttpEventTask.parsePostHeaders(new ByteArrayInp... | {
"fields": [
{
"declarator": "SERVER_ERROR_MESSAGE = \"Command server error\"",
"modifier": "public static final",
"original_string": "public static final String SERVER_ERROR_MESSAGE = \"Command server error\";",
"type": "String",
"var_name": "SERVER_ERROR_MESSAGE"
},
{
... | {
"body": "protected static Map<String, String> parsePostHeaders(InputStream in) throws IOException {\n Map<String, String> headerMap = new HashMap<String, String>(4);\n String line;\n while (true) {\n line = readLine(in);\n if (line == null || line.length() == 0) {\n ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_44 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/slots/block/flow/controller/RateLimiterControllerTest.java",
"identifier": "RateLimiterControllerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testPaceController_zeroattack() throws InterruptedException {\n RateLimiterController paceController = new RateLimiterController(500, 0d);\n Node node = mock(Node.class);\n\n for (int i = 0; i < 2; i++) {\n assertFalse(paceController.canPass(node, 1));... | {
"fields": [
{
"declarator": "maxQueueingTimeMs",
"modifier": "private final",
"original_string": "private final int maxQueueingTimeMs;",
"type": "int",
"var_name": "maxQueueingTimeMs"
},
{
"declarator": "count",
"modifier": "private final",
"original_strin... | {
"body": "@Override\n public boolean canPass(Node node, int acquireCount) {\n return canPass(node, acquireCount, false);\n }",
"class_method_signature": "RateLimiterController.canPass(Node node, int acquireCount)",
"constructor": false,
"full_signature": "@Override public boolean canPass(Node node... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_103 | {
"fields": [
{
"declarator": "httpServer",
"modifier": "private static",
"original_string": "private static HttpServer httpServer;",
"type": "HttpServer",
"var_name": "httpServer"
}
],
"file": "sentinel-transport/sentinel-transport-netty-http/src/test/java/com/alibaba/csp/se... | {
"body": "@Test\n public void testRegisterCommand() {\n String commandName;\n CommandHandler handler;\n\n // If commandName is null, no handler added in handlerMap\n commandName = null;\n handler = new VersionCommandHandler();\n httpServer.registerCommand(commandName, han... | {
"fields": [
{
"declarator": "DEFAULT_PORT = 8719",
"modifier": "private static final",
"original_string": "private static final int DEFAULT_PORT = 8719;",
"type": "int",
"var_name": "DEFAULT_PORT"
},
{
"declarator": "channel",
"modifier": "private",
"origi... | {
"body": "public void registerCommand(String commandName, CommandHandler handler) {\n if (StringUtil.isEmpty(commandName) || handler == null) {\n return;\n }\n\n if (handlerMap.containsKey(commandName)) {\n CommandCenterLog.warn(\"[NettyHttpCommandCenter] Register failed (d... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_13 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
}
],
"file": "sentine... | {
"body": "@Test\n public void testAppendWithBlankCheck() {\n Assert.assertEquals(\"bar\", EagleEyeCoreUtils.appendWithBlankCheck(\n null, \"bar\", new StringBuilder()).toString());\n Assert.assertEquals(\"foo\", EagleEyeCoreUtils.appendWithBlankCheck(\n \"foo\", \"bar\"... | {
"fields": [
{
"declarator": "EMPTY_STRING = \"\"",
"modifier": "public static final",
"original_string": "public static final String EMPTY_STRING = \"\";",
"type": "String",
"var_name": "EMPTY_STRING"
},
{
"declarator": "NEWLINE = \"\\r\\n\"",
"modifier": "publi... | {
"body": "public static StringBuilder appendWithBlankCheck(String str, String defaultValue, StringBuilder appender) {\n if (isNotBlank(str)) {\n appender.append(str);\n } else {\n appender.append(defaultValue);\n }\n return appender;\n }",
"class_method_signatur... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_154 | {
"fields": [],
"file": "sentinel-extension/sentinel-datasource-zookeeper/src/test/java/com/alibaba/csp/sentinel/datasource/zookeeper/ZookeeperDataSourceTest.java",
"identifier": "ZookeeperDataSourceTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testZooKeeperDataSource() throws Exception {\n TestingServer server = new TestingServer(21812);\n server.start();\n\n final String remoteAddress = server.getConnectString();\n final String path = \"/sentinel-zk-ds-demo/flow-HK\";\n\n ReadableDataSou... | {
"fields": [
{
"declarator": "RETRY_TIMES = 3",
"modifier": "private static final",
"original_string": "private static final int RETRY_TIMES = 3;",
"type": "int",
"var_name": "RETRY_TIMES"
},
{
"declarator": "SLEEP_TIME = 1000",
"modifier": "private static final"... | {
"body": "public ZookeeperDataSource(final String serverAddr, final String path, Converter<String, T> parser) {\n super(parser);\n if (StringUtil.isBlank(serverAddr) || StringUtil.isBlank(path)) {\n throw new IllegalArgumentException(String.format(\"Bad argument: serverAddr=[%s], path=[%s]\"... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_68 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/util/MethodUtilTest.java",
"identifier": "MethodUtilTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void testResolveNullMethod() {\n MethodUtil.resolveMethodName(null);\n }",
"class_method_signature": "MethodUtilTest.testResolveNullMethod()",
"constructor": false,
"full_signature": "@Test(expected = IllegalArgumentException.clas... | {
"fields": [
{
"declarator": "methodNameMap = new ConcurrentHashMap<Method, String>()",
"modifier": "private static final",
"original_string": "private static final Map<Method, String> methodNameMap = new ConcurrentHashMap<Method, String>();",
"type": "Map<Method, String>",
"var_nam... | {
"body": "public static String resolveMethodName(Method method) {\n if (method == null) {\n throw new IllegalArgumentException(\"Null method\");\n }\n String methodName = methodNameMap.get(method);\n if (methodName == null) {\n synchronized (LOCK) {\n ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_206 | {
"fields": [],
"file": "sentinel-adapter/sentinel-zuul-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/gateway/zuul/filters/SentinelZuulErrorFilterTest.java",
"identifier": "SentinelZuulErrorFilterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testRun() throws Exception {\n SentinelZuulErrorFilter sentinelZuulErrorFilter = new SentinelZuulErrorFilter();\n Object result = sentinelZuulErrorFilter.run();\n Assert.assertNull(result);\n }",
"class_method_signature": "SentinelZuulErrorFilterTest.testRun... | {
"fields": [
{
"declarator": "order",
"modifier": "private final",
"original_string": "private final int order;",
"type": "int",
"var_name": "order"
}
],
"file": "sentinel-adapter/sentinel-zuul-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/gateway/zuul/filters/Senti... | {
"body": "@Override\n public Object run() throws ZuulException {\n RequestContext ctx = RequestContext.getCurrentContext();\n Throwable throwable = ctx.getThrowable();\n if (throwable != null) {\n if (!BlockException.isBlockException(throwable)) {\n // Trace exceptio... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_87 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/SphUTest.java",
"identifier": "SphUTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testStringEntryCount() throws BlockException {\n Entry e = SphU.entry(\"resourceName\", 2);\n\n assertNotNull(e);\n assertEquals(\"resourceName\", e.resourceWrapper.getName());\n assertEquals(e.resourceWrapper.getEntryType(), EntryType.OUT);\n asser... | {
"fields": [
{
"declarator": "OBJECTS0 = new Object[0]",
"modifier": "private static final",
"original_string": "private static final Object[] OBJECTS0 = new Object[0];",
"type": "Object[]",
"var_name": "OBJECTS0"
}
],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sen... | {
"body": "public static Entry entry(String name) throws BlockException {\n return Env.sph.entry(name, EntryType.OUT, 1, OBJECTS0);\n }",
"class_method_signature": "SphU.entry(String name)",
"constructor": false,
"full_signature": "public static Entry entry(String name)",
"identifier": "entry",
"i... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_178 | {
"fields": [
{
"declarator": "consumerFilter = new SentinelDubboConsumerFilter()",
"modifier": "private final",
"original_string": "private final SentinelDubboConsumerFilter consumerFilter = new SentinelDubboConsumerFilter();",
"type": "SentinelDubboConsumerFilter",
"var_name": "con... | {
"body": "@Test\n public void testMethodFlowControlAsync() {\n\n Invocation invocation = DubboTestUtil.getDefaultMockInvocationOne();\n Invoker invoker = DubboTestUtil.getDefaultMockInvoker();\n\n when(invocation.getAttachment(ASYNC_KEY)).thenReturn(Boolean.TRUE.toString());\n initFlow... | {
"fields": [],
"file": "sentinel-adapter/sentinel-apache-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/SentinelDubboConsumerFilter.java",
"identifier": "SentinelDubboConsumerFilter",
"interfaces": "",
"methods": [
{
"class_method_signature": "SentinelDubboConsumerFilter.Sentine... | {
"body": "@Override\n String getMethodName(Invoker invoker, Invocation invocation, String prefix) {\n return DubboUtils.getMethodResourceName(invoker, invocation, prefix);\n }",
"class_method_signature": "SentinelDubboConsumerFilter.getMethodName(Invoker invoker, Invocation invocation, String prefix)"... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_197 | {
"fields": [],
"file": "sentinel-adapter/sentinel-sofa-rpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/sofa/rpc/SofaRpcUtilsTest.java",
"identifier": "SofaRpcUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetMethodArguments() {\n SofaRequest request = new SofaRequest();\n request.setMethodArgs(new Object[]{\"Sentinel\", 2020});\n Object[] arguments = SofaRpcUtils.getMethodArguments(request);\n assertEquals(arguments.length, 2);\n assertEquals(\"S... | {
"fields": [],
"file": "sentinel-adapter/sentinel-sofa-rpc-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/sofa/rpc/SofaRpcUtils.java",
"identifier": "SofaRpcUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "SofaRpcUtils.getApplicationName(SofaRequest request)",
"cons... | {
"body": "public static Object[] getMethodArguments(SofaRequest request) {\n return request.getMethodArgs();\n }",
"class_method_signature": "SofaRpcUtils.getMethodArguments(SofaRequest request)",
"constructor": false,
"full_signature": "public static Object[] getMethodArguments(SofaRequest request)"... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_29 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/slots/block/flow/FlowRuleCheckerTest.java",
"identifier": "FlowRuleCheckerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testDefaultLimitAppFlowSelectNode() {\n DefaultNode node = mock(DefaultNode.class);\n ClusterNode cn = mock(ClusterNode.class);\n when(node.getClusterNode()).thenReturn(cn);\n Context context = mock(Context.class);\n\n // limitApp: default\n ... | {
"fields": [],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/block/flow/FlowRuleChecker.java",
"identifier": "FlowRuleChecker",
"interfaces": "",
"methods": [
{
"class_method_signature": "FlowRuleChecker.checkFlow(Function<String, Collection<FlowRule>> ruleProvider, ResourceWr... | {
"body": "static Node selectNodeByRequesterAndStrategy(/*@NonNull*/ FlowRule rule, Context context, DefaultNode node) {\n // The limit app should not be empty.\n String limitApp = rule.getLimitApp();\n int strategy = rule.getStrategy();\n String origin = context.getOrigin();\n\n if... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_181 | {
"fields": [
{
"declarator": "filter = new DubboAppContextFilter()",
"modifier": "private",
"original_string": "private DubboAppContextFilter filter = new DubboAppContextFilter();",
"type": "DubboAppContextFilter",
"var_name": "filter"
}
],
"file": "sentinel-adapter/sentinel... | {
"body": "@Test\n public void testInvokeApplicationKey() {\n Invoker invoker = mock(Invoker.class);\n Invocation invocation = mock(Invocation.class);\n URL url = URL.valueOf(\"test://test:111/test?application=serviceA\");\n when(invoker.getUrl()).thenReturn(url);\n\n filter.invo... | {
"fields": [],
"file": "sentinel-adapter/sentinel-apache-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/DubboAppContextFilter.java",
"identifier": "DubboAppContextFilter",
"interfaces": "implements Filter",
"methods": [
{
"class_method_signature": "DubboAppContextFilter.invoke(I... | {
"body": "@Override\n public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {\n String application = invoker.getUrl().getParameter(CommonConstants.APPLICATION_KEY);\n if (application != null) {\n RpcContext.getContext().setAttachment(DubboUtils.SENTINEL_DUBBO... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_91 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/SphUTest.java",
"identifier": "SphUTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testStringEntryCountType() throws BlockException {\n Entry e = SphU.entry(\"resourceName\", EntryType.IN, 2);\n\n assertSame(e.resourceWrapper.getEntryType(), EntryType.IN);\n\n e.exit(2);\n }",
"class_method_signature": "SphUTest.testStringEntryCountType()"... | {
"fields": [
{
"declarator": "OBJECTS0 = new Object[0]",
"modifier": "private static final",
"original_string": "private static final Object[] OBJECTS0 = new Object[0];",
"type": "Object[]",
"var_name": "OBJECTS0"
}
],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sen... | {
"body": "public static Entry entry(String name) throws BlockException {\n return Env.sph.entry(name, EntryType.OUT, 1, OBJECTS0);\n }",
"class_method_signature": "SphU.entry(String name)",
"constructor": false,
"full_signature": "public static Entry entry(String name)",
"identifier": "entry",
"i... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_210 | {
"fields": [],
"file": "sentinel-adapter/sentinel-reactor-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/reactor/ReactorSphUTest.java",
"identifier": "ReactorSphUTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testReactorEntryNormalWhenFlowControlTriggered() {\n String resourceName = createResourceName(\"testReactorEntryNormalWhenFlowControlTriggered\");\n FlowRuleManager.loadRules(Collections.singletonList(\n new FlowRule(resourceName).setCount(0)\n ));\n ... | {
"fields": [],
"file": "sentinel-adapter/sentinel-reactor-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/reactor/ReactorSphU.java",
"identifier": "ReactorSphU",
"interfaces": "",
"methods": [
{
"class_method_signature": "ReactorSphU.entryWith(String resourceName, Mono<R> actual)",
"co... | {
"body": "public static <R> Mono<R> entryWith(String resourceName, Mono<R> actual) {\n return entryWith(resourceName, EntryType.OUT, actual);\n }",
"class_method_signature": "ReactorSphU.entryWith(String resourceName, Mono<R> actual)",
"constructor": false,
"full_signature": "public static Mono<R> en... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_139 | {
"fields": [],
"file": "sentinel-extension/sentinel-parameter-flow-control/src/test/java/com/alibaba/csp/sentinel/slots/block/flow/param/ParamFlowRuleManagerTest.java",
"identifier": "ParamFlowRuleManagerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testLoadParamRulesClearingUnusedMetrics() {\n final String resA = \"resA\";\n ParamFlowRule ruleA = new ParamFlowRule(resA)\n .setCount(1)\n .setParamIdx(0);\n ParamFlowRuleManager.loadRules(Collections.singletonList(ruleA));\n Parame... | {
"fields": [
{
"declarator": "PARAM_FLOW_RULES = new ConcurrentHashMap<>()",
"modifier": "private static final",
"original_string": "private static final Map<String, List<ParamFlowRule>> PARAM_FLOW_RULES = new ConcurrentHashMap<>();",
"type": "Map<String, List<ParamFlowRule>>",
"var... | {
"body": "public static void loadRules(List<ParamFlowRule> rules) {\n try {\n currentProperty.updateValue(rules);\n } catch (Throwable e) {\n RecordLog.info(\"[ParamFlowRuleManager] Failed to load rules\", e);\n }\n }",
"class_method_signature": "ParamFlowRuleManager.l... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_119 | {
"fields": [],
"file": "sentinel-cluster/sentinel-cluster-client-default/src/test/java/com/alibaba/csp/sentinel/cluster/client/codec/data/ParamFlowRequestDataWriterTest.java",
"identifier": "ParamFlowRequestDataWriterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testResolveValidParams() {\n\n final int maxSize = 15;\n ParamFlowRequestDataWriter writer = new ParamFlowRequestDataWriter(maxSize);\n\n ArrayList<Object> params = new ArrayList<Object>() {{\n add(1);\n add(64);\n add(3);\n ... | {
"fields": [
{
"declarator": "maxParamByteSize",
"modifier": "private final",
"original_string": "private final int maxParamByteSize;",
"type": "int",
"var_name": "maxParamByteSize"
},
{
"declarator": "DEFAULT_PARAM_MAX_SIZE = 1024",
"modifier": "private static f... | {
"body": "public List<Object> resolveValidParams(Collection<Object> params) {\n List<Object> validParams = new ArrayList<>();\n int size = 0;\n for (Object param : params) {\n int s = calculateParamTransportSize(param);\n if (s <= 0) {\n RecordLog.warn(\"[Par... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_226 | {
"fields": [],
"file": "sentinel-adapter/sentinel-spring-cloud-gateway-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/gateway/sc/SentinelGatewayFilterTest.java",
"identifier": "SentinelGatewayFilterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testPickMatchingApiDefinitions() {\n // Mock a request.\n ServerWebExchange exchange = mock(ServerWebExchange.class);\n ServerHttpRequest request = mock(ServerHttpRequest.class);\n when(exchange.getRequest()).thenReturn(request);\n RequestPath reque... | {
"fields": [
{
"declarator": "order",
"modifier": "private final",
"original_string": "private final int order;",
"type": "int",
"var_name": "order"
},
{
"declarator": "paramParser = new GatewayParamParser<>(\n new ServerWebExchangeItemParser())",
"modifie... | {
"body": "Set<String> pickMatchingApiDefinitions(ServerWebExchange exchange) {\n return GatewayApiMatcherManager.getApiMatcherMap().values()\n .stream()\n .filter(m -> m.test(exchange))\n .map(WebExchangeApiMatcher::getApiName)\n .collect(Collectors.toSet());\n }... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_48 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/CtEntryTest.java",
"identifier": "CtEntryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testExitTwoLastEntriesWithCustomContext() {\n String contextName = \"context-rpc\";\n ContextUtil.enter(contextName);\n Context context = ContextUtil.getContext();\n try {\n CtEntry entry1 = new CtEntry(new StringResourceWrapper(\"resA\", EntryT... | {
"fields": [
{
"declarator": "parent = null",
"modifier": "protected",
"original_string": "protected Entry parent = null;",
"type": "Entry",
"var_name": "parent"
},
{
"declarator": "child = null",
"modifier": "protected",
"original_string": "protected Entry... | {
"body": "@Override\n public void exit(int count, Object... args) throws ErrorEntryFreeException {\n trueExit(count, args);\n }",
"class_method_signature": "CtEntry.exit(int count, Object... args)",
"constructor": false,
"full_signature": "@Override public void exit(int count, Object... args)",
... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_158 | {
"fields": [],
"file": "sentinel-extension/sentinel-annotation-aspectj/src/test/java/com/alibaba/csp/sentinel/annotation/aspectj/ResourceMetadataRegistryTest.java",
"identifier": "ResourceMetadataRegistryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void testUpdateFallbackBadArgument() {\n ResourceMetadataRegistry.updateBlockHandlerFor(String.class, \"\", String.class.getMethods()[0]);\n }",
"class_method_signature": "ResourceMetadataRegistryTest.testUpdateFallbackBadArgument()",... | {
"fields": [
{
"declarator": "FALLBACK_MAP = new ConcurrentHashMap<>()",
"modifier": "private static final",
"original_string": "private static final Map<String, MethodWrapper> FALLBACK_MAP = new ConcurrentHashMap<>();",
"type": "Map<String, MethodWrapper>",
"var_name": "FALLBACK_MA... | {
"body": "static void updateBlockHandlerFor(Class<?> clazz, String name, Method method) {\n if (clazz == null || StringUtil.isBlank(name)) {\n throw new IllegalArgumentException(\"Bad argument\");\n }\n BLOCK_HANDLER_MAP.put(getKey(clazz, name), MethodWrapper.wrap(method));\n }",
... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_123 | {
"fields": [],
"file": "sentinel-cluster/sentinel-cluster-server-default/src/test/java/com/alibaba/csp/sentinel/cluster/server/connection/ConnectionManagerTest.java",
"identifier": "ConnectionManagerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void testGetOrCreateGroupBadNamespace() {\n ConnectionManager.getOrCreateGroup(\"\");\n }",
"class_method_signature": "ConnectionManagerTest.testGetOrCreateGroupBadNamespace()",
"constructor": false,
"full_signature": "@Test(expec... | {
"fields": [
{
"declarator": "CONN_MAP = new ConcurrentHashMap<>()",
"modifier": "private static final",
"original_string": "private static final Map<String, ConnectionGroup> CONN_MAP = new ConcurrentHashMap<>();",
"type": "Map<String, ConnectionGroup>",
"var_name": "CONN_MAP"
}... | {
"body": "public static ConnectionGroup getOrCreateGroup(String namespace) {\n AssertUtil.assertNotBlank(namespace, \"namespace should not be empty\");\n ConnectionGroup group = CONN_MAP.get(namespace);\n if (group == null) {\n synchronized (CREATE_LOCK) {\n if ((group ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_64 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/util/StringUtilTest.java",
"identifier": "StringUtilTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testIsNotEmpty() {\n Assert.assertFalse(StringUtil.isNotEmpty(\"\"));\n Assert.assertTrue(StringUtil.isNotEmpty(\"foo\"));\n }",
"class_method_signature": "StringUtilTest.testIsNotEmpty()",
"constructor": false,
"full_signature": "@Test public void testIsNotEmpty()",
"id... | {
"fields": [
{
"declarator": "EMPTY = \"\"",
"modifier": "public static final",
"original_string": "public static final String EMPTY = \"\";",
"type": "String",
"var_name": "EMPTY"
}
],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/StringUtil.java",
"i... | {
"body": "public static boolean isNotEmpty(String str) {\n return !isEmpty(str);\n }",
"class_method_signature": "StringUtil.isNotEmpty(String str)",
"constructor": false,
"full_signature": "public static boolean isNotEmpty(String str)",
"identifier": "isNotEmpty",
"invocations": [
"isEmpty"
... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_3 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
}
],
"file": "sentine... | {
"body": "@Test\n public void testCheckNotNullEmptyInputEmptyStringThrowsException() {\n thrown.expect(IllegalArgumentException.class);\n EagleEyeCoreUtils.checkNotNullEmpty(\"\", \"bar\");\n // Method is not expected to return due to exception thrown\n }",
"class_method_signature": "Eag... | {
"fields": [
{
"declarator": "EMPTY_STRING = \"\"",
"modifier": "public static final",
"original_string": "public static final String EMPTY_STRING = \"\";",
"type": "String",
"var_name": "EMPTY_STRING"
},
{
"declarator": "NEWLINE = \"\\r\\n\"",
"modifier": "publi... | {
"body": "public static String checkNotNullEmpty(String value, String name) throws IllegalArgumentException {\n if (isBlank(value)) {\n throw new IllegalArgumentException(name + \" is null or empty\");\n }\n return value;\n }",
"class_method_signature": "EagleEyeCoreUtils.checkNo... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_174 | {
"fields": [],
"file": "sentinel-adapter/sentinel-apache-dubbo-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/dubbo/DubboUtilsTest.java",
"identifier": "DubboUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetInterfaceNameWithPrefix() throws NoSuchMethodException {\n URL url = URL.valueOf(\"dubbo://127.0.0.1:2181\")\n .addParameter(CommonConstants.VERSION_KEY, \"1.0.0\")\n .addParameter(CommonConstants.GROUP_KEY, \"grp1\")\n .addP... | {
"fields": [
{
"declarator": "SENTINEL_DUBBO_APPLICATION_KEY = \"dubboApplication\"",
"modifier": "public static final",
"original_string": "public static final String SENTINEL_DUBBO_APPLICATION_KEY = \"dubboApplication\";",
"type": "String",
"var_name": "SENTINEL_DUBBO_APPLICATION_... | {
"body": "public static String getInterfaceName(Invoker invoker) {\n return getInterfaceName(invoker, false);\n }",
"class_method_signature": "DubboUtils.getInterfaceName(Invoker invoker)",
"constructor": false,
"full_signature": "public static String getInterfaceName(Invoker invoker)",
"identifier... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_33 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/slots/block/flow/FlowRuleCheckerTest.java",
"identifier": "FlowRuleCheckerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testSelectNodeForRelateReference() {\n String refResource = \"testSelectNodeForRelateReference_refResource\";\n\n DefaultNode node = mock(DefaultNode.class);\n ClusterNode refCn = mock(ClusterNode.class);\n ClusterBuilderSlot.getClusterNodeMap().put(new St... | {
"fields": [],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/block/flow/FlowRuleChecker.java",
"identifier": "FlowRuleChecker",
"interfaces": "",
"methods": [
{
"class_method_signature": "FlowRuleChecker.checkFlow(Function<String, Collection<FlowRule>> ruleProvider, ResourceWr... | {
"body": "static Node selectReferenceNode(FlowRule rule, Context context, DefaultNode node) {\n String refResource = rule.getRefResource();\n int strategy = rule.getStrategy();\n\n if (StringUtil.isEmpty(refResource)) {\n return null;\n }\n\n if (strategy == RuleConstant... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_162 | {
"fields": [
{
"declarator": "SENTINEL_KEY = \"sentinel-rules\"",
"modifier": "private static final",
"original_string": "private static final String SENTINEL_KEY = \"sentinel-rules\";",
"type": "String",
"var_name": "SENTINEL_KEY"
},
{
"declarator": "port",
"mod... | {
"body": "@Test\n public void testEurekaDataSource() throws Exception {\n String url = \"http://localhost:\" + port + \"/eureka\";\n\n EurekaDataSource<List<FlowRule>> eurekaDataSource = new EurekaDataSource(appname, instanceId, Arrays.asList(url)\n , SENTINEL_KEY, new Converter<Strin... | {
"fields": [
{
"declarator": "DEFAULT_REFRESH_MS = 10000",
"modifier": "private static final",
"original_string": "private static final long DEFAULT_REFRESH_MS = 10000;",
"type": "long",
"var_name": "DEFAULT_REFRESH_MS"
},
{
"declarator": "DEFAULT_CONNECT_TIMEOUT_MS = ... | {
"body": "public EurekaDataSource(String appId, String instanceId, List<String> serviceUrls, String ruleKey,\n Converter<String, T> configParser) {\n this(appId, instanceId, serviceUrls, ruleKey, configParser, DEFAULT_REFRESH_MS, DEFAULT_CONNECT_TIMEOUT_MS,\n DEFAULT_READ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_25 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/slots/block/authority/AuthorityRuleManagerTest.java",
"identifier": "AuthorityRuleManagerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testIsValidRule() {\n AuthorityRule ruleA = new AuthorityRule();\n AuthorityRule ruleB = null;\n AuthorityRule ruleC = new AuthorityRule();\n ruleC.setResource(\"abc\");\n AuthorityRule ruleD = new AuthorityRule();\n ruleD.setResource(\"bcd\"... | {
"fields": [
{
"declarator": "authorityRules = new ConcurrentHashMap<>()",
"modifier": "private static",
"original_string": "private static Map<String, Set<AuthorityRule>> authorityRules = new ConcurrentHashMap<>();",
"type": "Map<String, Set<AuthorityRule>>",
"var_name": "authority... | {
"body": "public static boolean isValidRule(AuthorityRule rule) {\n return rule != null && !StringUtil.isBlank(rule.getResource())\n && rule.getStrategy() >= 0 && StringUtil.isNotBlank(rule.getLimitApp());\n }",
"class_method_signature": "AuthorityRuleManager.isValidRule(AuthorityRule rule)",
... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_135 | {
"fields": [],
"file": "sentinel-extension/sentinel-parameter-flow-control/src/test/java/com/alibaba/csp/sentinel/slots/statistic/metric/HotParameterLeapArrayTest.java",
"identifier": "HotParameterLeapArrayTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testAddValueToBucket() {\n HotParameterLeapArray leapArray = mock(HotParameterLeapArray.class);\n String paramA = \"paramA\";\n int initialCountA = 3;\n RollingParamEvent passEvent = RollingParamEvent.REQUEST_PASSED;\n final ParamMapBucket bucket = ... | {
"fields": [],
"file": "sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/slots/statistic/metric/HotParameterLeapArray.java",
"identifier": "HotParameterLeapArray",
"interfaces": "",
"methods": [
{
"class_method_signature": "HotParameterLeapArray.HotParameter... | {
"body": "public void addValue(RollingParamEvent event, int count, Object value) {\n currentWindow().value().add(event, count, value);\n }",
"class_method_signature": "HotParameterLeapArray.addValue(RollingParamEvent event, int count, Object value)",
"constructor": false,
"full_signature": "public vo... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_72 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/EntryTest.java",
"identifier": "EntryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testEntryExitCounts() {\n ResourceWrapper resourceWrapper = new StringResourceWrapper(\"resA\", EntryType.IN);\n TestEntry entry = new TestEntry(resourceWrapper);\n entry.exit();\n assertEquals(-1, entry.count);\n entry.exit(9);\n assertEqual... | {
"fields": [
{
"declarator": "OBJECTS0 = new Object[0]",
"modifier": "private static final",
"original_string": "private static final Object[] OBJECTS0 = new Object[0];",
"type": "Object[]",
"var_name": "OBJECTS0"
},
{
"declarator": "createTimestamp",
"modifier":... | {
"body": "public void exit() throws ErrorEntryFreeException {\n exit(1, OBJECTS0);\n }",
"class_method_signature": "Entry.exit()",
"constructor": false,
"full_signature": "public void exit()",
"identifier": "exit",
"invocations": [
"exit"
],
"modifiers": "public",
"parameters": "()",
... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_73 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/TracerTest.java",
"identifier": "TracerTest",
"interfaces": "",
"superclass": "extends Tracer"
} | {
"body": "@Test\n public void testTraceWhenContextSizeExceedsThreshold() {\n int i = 0;\n for (; i < Constants.MAX_CONTEXT_NAME_SIZE; i++) {\n ContextUtil.enter(\"test-context-\" + i);\n ContextUtil.exit();\n }\n\n try {\n ContextUtil.enter(\"test-conte... | {
"fields": [
{
"declarator": "traceClasses",
"modifier": "protected static",
"original_string": "protected static Class<? extends Throwable>[] traceClasses;",
"type": "Class<? extends Throwable>[]",
"var_name": "traceClasses"
},
{
"declarator": "ignoreClasses",
"... | {
"body": "public static void trace(Throwable e) {\n traceContext(e, ContextUtil.getContext());\n }",
"class_method_signature": "Tracer.trace(Throwable e)",
"constructor": false,
"full_signature": "public static void trace(Throwable e)",
"identifier": "trace",
"invocations": [
"traceContext",
... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_134 | {
"fields": [],
"file": "sentinel-cluster/sentinel-cluster-server-default/src/test/java/com/alibaba/csp/sentinel/cluster/flow/statistic/limit/RequestLimiterTest.java",
"identifier": "RequestLimiterTest",
"interfaces": "",
"superclass": "extends AbstractTimeBasedTest"
} | {
"body": "@Test\n public void testRequestLimiter() {\n setCurrentMillis(System.currentTimeMillis());\n RequestLimiter limiter = new RequestLimiter(10);\n limiter.add(3);\n limiter.add(3);\n limiter.add(3);\n assertTrue(limiter.canPass());\n assertEquals(9, limiter.... | {
"fields": [
{
"declarator": "qpsAllowed",
"modifier": "private",
"original_string": "private double qpsAllowed;",
"type": "double",
"var_name": "qpsAllowed"
},
{
"declarator": "data",
"modifier": "private final",
"original_string": "private final LeapArray... | {
"body": "public RequestLimiter(double qpsAllowed) {\n this(new UnaryLeapArray(10, 1000), qpsAllowed);\n }",
"class_method_signature": "RequestLimiter.RequestLimiter(double qpsAllowed)",
"constructor": true,
"full_signature": "public RequestLimiter(double qpsAllowed)",
"identifier": "RequestLimite... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_24 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/slots/block/authority/AuthorityRuleManagerTest.java",
"identifier": "AuthorityRuleManagerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testLoadRules() {\n String resourceName = \"testLoadRules\";\n\n AuthorityRule rule = new AuthorityRule();\n rule.setResource(resourceName);\n rule.setLimitApp(\"a,b\");\n rule.setStrategy(RuleConstant.AUTHORITY_WHITE);\n AuthorityRuleManager... | {
"fields": [
{
"declarator": "authorityRules = new ConcurrentHashMap<>()",
"modifier": "private static",
"original_string": "private static Map<String, Set<AuthorityRule>> authorityRules = new ConcurrentHashMap<>();",
"type": "Map<String, Set<AuthorityRule>>",
"var_name": "authority... | {
"body": "public static void loadRules(List<AuthorityRule> rules) {\n currentProperty.updateValue(rules);\n }",
"class_method_signature": "AuthorityRuleManager.loadRules(List<AuthorityRule> rules)",
"constructor": false,
"full_signature": "public static void loadRules(List<AuthorityRule> rules)",
"... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_32 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/slots/block/flow/FlowRuleCheckerTest.java",
"identifier": "FlowRuleCheckerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testSelectNodeForEmptyReference() {\n DefaultNode node = mock(DefaultNode.class);\n Context context = mock(Context.class);\n\n FlowRule rule = new FlowRule(\"testSelectNodeForEmptyReference\")\n .setCount(1)\n .setStrategy(RuleConstant.STRAT... | {
"fields": [],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/block/flow/FlowRuleChecker.java",
"identifier": "FlowRuleChecker",
"interfaces": "",
"methods": [
{
"class_method_signature": "FlowRuleChecker.checkFlow(Function<String, Collection<FlowRule>> ruleProvider, ResourceWr... | {
"body": "static Node selectReferenceNode(FlowRule rule, Context context, DefaultNode node) {\n String refResource = rule.getRefResource();\n int strategy = rule.getStrategy();\n\n if (StringUtil.isEmpty(refResource)) {\n return null;\n }\n\n if (strategy == RuleConstant... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_175 | {
"fields": [
{
"declarator": "consumerFilter = new SentinelDubboConsumerFilter()",
"modifier": "private final",
"original_string": "private final SentinelDubboConsumerFilter consumerFilter = new SentinelDubboConsumerFilter();",
"type": "SentinelDubboConsumerFilter",
"var_name": "con... | {
"body": "@Test\n public void testInterfaceLevelFollowControlAsync() throws InterruptedException {\n\n Invoker invoker = DubboTestUtil.getDefaultMockInvoker();\n Invocation invocation = DubboTestUtil.getDefaultMockInvocationOne();\n\n when(invocation.getAttachment(ASYNC_KEY)).thenReturn(Boole... | {
"fields": [],
"file": "sentinel-adapter/sentinel-apache-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/SentinelDubboConsumerFilter.java",
"identifier": "SentinelDubboConsumerFilter",
"interfaces": "",
"methods": [
{
"class_method_signature": "SentinelDubboConsumerFilter.Sentine... | {
"body": "@Override\n String getInterfaceName(Invoker invoker, String prefix) {\n return DubboUtils.getInterfaceName(invoker, prefix);\n }",
"class_method_signature": "SentinelDubboConsumerFilter.getInterfaceName(Invoker invoker, String prefix)",
"constructor": false,
"full_signature": "@Override ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_65 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/util/StringUtilTest.java",
"identifier": "StringUtilTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testTrim() {\n Assert.assertNull(StringUtil.trim(null));\n Assert.assertEquals(\"\", StringUtil.trim(\"\"));\n Assert.assertEquals(\"foo\", StringUtil.trim(\"foo \"));\n }",
"class_method_signature": "StringUtilTest.testTrim()",
"constructor": false,
"full_signature": ... | {
"fields": [
{
"declarator": "EMPTY = \"\"",
"modifier": "public static final",
"original_string": "public static final String EMPTY = \"\";",
"type": "String",
"var_name": "EMPTY"
}
],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/StringUtil.java",
"i... | {
"body": "public static String trim(String str) {\n return str == null ? null : str.trim();\n }",
"class_method_signature": "StringUtil.trim(String str)",
"constructor": false,
"full_signature": "public static String trim(String str)",
"identifier": "trim",
"invocations": [
"trim"
],
"mod... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_2 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public final",
"original_string": "@Rule\n public final ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
}
],
"file": "sentine... | {
"body": "@Test\n public void testCheckNotNullEmpty() {\n Assert.assertEquals(\"foo\",\n EagleEyeCoreUtils.checkNotNullEmpty(\"foo\", \"bar\"));\n }",
"class_method_signature": "EagleEyeCoreUtilsTest.testCheckNotNullEmpty()",
"constructor": false,
"full_signature": "@Test public voi... | {
"fields": [
{
"declarator": "EMPTY_STRING = \"\"",
"modifier": "public static final",
"original_string": "public static final String EMPTY_STRING = \"\";",
"type": "String",
"var_name": "EMPTY_STRING"
},
{
"declarator": "NEWLINE = \"\\r\\n\"",
"modifier": "publi... | {
"body": "public static String checkNotNullEmpty(String value, String name) throws IllegalArgumentException {\n if (isBlank(value)) {\n throw new IllegalArgumentException(name + \" is null or empty\");\n }\n return value;\n }",
"class_method_signature": "EagleEyeCoreUtils.checkNo... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_122 | {
"fields": [],
"file": "sentinel-cluster/sentinel-cluster-server-default/src/test/java/com/alibaba/csp/sentinel/cluster/server/codec/data/PingResponseDataWriterTest.java",
"identifier": "PingResponseDataWriterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testWritePingResponseAndParse() {\n ByteBuf buf = Unpooled.buffer();\n PingResponseDataWriter writer = new PingResponseDataWriter();\n\n int small = 120;\n writer.writeTo(small, buf);\n assertThat(buf.readableBytes()).isGreaterThanOrEqualTo(4);\n ... | {
"fields": [],
"file": "sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/codec/data/PingResponseDataWriter.java",
"identifier": "PingResponseDataWriter",
"interfaces": "implements EntityWriter<Integer, ByteBuf>",
"methods": [
{
"class_method_sig... | {
"body": "@Override\n public void writeTo(Integer entity, ByteBuf target) {\n if (entity == null || target == null) {\n return;\n }\n target.writeInt(entity);\n }",
"class_method_signature": "PingResponseDataWriter.writeTo(Integer entity, ByteBuf target)",
"constructor": fal... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_159 | {
"fields": [],
"file": "sentinel-extension/sentinel-annotation-aspectj/src/test/java/com/alibaba/csp/sentinel/annotation/aspectj/MethodWrapperTest.java",
"identifier": "MethodWrapperTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testNone() {\n MethodWrapper none = MethodWrapper.none();\n assertThat(none.isPresent()).isFalse();\n assertThat(none.getMethod()).isNull();\n }",
"class_method_signature": "MethodWrapperTest.testNone()",
"constructor": false,
"full_signature": "@Test pu... | {
"fields": [
{
"declarator": "method",
"modifier": "private final",
"original_string": "private final Method method;",
"type": "Method",
"var_name": "method"
},
{
"declarator": "present",
"modifier": "private final",
"original_string": "private final boolea... | {
"body": "static MethodWrapper none() {\n return new MethodWrapper(null, false);\n }",
"class_method_signature": "MethodWrapper.none()",
"constructor": false,
"full_signature": "static MethodWrapper none()",
"identifier": "none",
"invocations": [],
"modifiers": "static",
"parameters": "()",
... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_227 | {
"fields": [],
"file": "sentinel-dashboard/src/test/java/com/alibaba/csp/sentinel/dashboard/util/VersionUtilsTest.java",
"identifier": "VersionUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test() {\n Optional<SentinelVersion> version = VersionUtils.parseVersion(\"1.2.3\");\n assertTrue(version.isPresent());\n assertEquals(1, version.get().getMajorVersion());\n assertEquals(2, version.get().getMinorVersion());\n assertEquals(3, version... | {
"fields": [],
"file": "sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/VersionUtils.java",
"identifier": "VersionUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "VersionUtils.parseVersion(String verStr)",
"constructor": false,
"full_signature... | {
"body": "public static Optional<SentinelVersion> parseVersion(String verStr) {\n if (StringUtil.isBlank(verStr)) {\n return Optional.empty();\n }\n try {\n String versionFull = verStr;\n SentinelVersion version = new SentinelVersion();\n \n ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_49 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/CtEntryTest.java",
"identifier": "CtEntryTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testEntryAndExitWithNullContext() {\n Context context = new NullContext();\n CtEntry entry = new CtEntry(new StringResourceWrapper(\"testEntryAndExitWithNullContext\", EntryType.IN),\n null, context);\n assertNull(context.getCurEntry());\n entry... | {
"fields": [
{
"declarator": "parent = null",
"modifier": "protected",
"original_string": "protected Entry parent = null;",
"type": "Entry",
"var_name": "parent"
},
{
"declarator": "child = null",
"modifier": "protected",
"original_string": "protected Entry... | {
"body": "@Override\n public void exit(int count, Object... args) throws ErrorEntryFreeException {\n trueExit(count, args);\n }",
"class_method_signature": "CtEntry.exit(int count, Object... args)",
"constructor": false,
"full_signature": "@Override public void exit(int count, Object... args)",
... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_118 | {
"fields": [],
"file": "sentinel-cluster/sentinel-cluster-client-default/src/test/java/com/alibaba/csp/sentinel/cluster/client/codec/data/ParamFlowRequestDataWriterTest.java",
"identifier": "ParamFlowRequestDataWriterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testCalculateParamTransportSize() {\n ParamFlowRequestDataWriter writer = new ParamFlowRequestDataWriter();\n // POJO (non-primitive type) should not be regarded as a valid parameter.\n assertEquals(0, writer.calculateParamTransportSize(new SomePojo().setParam1(\... | {
"fields": [
{
"declarator": "maxParamByteSize",
"modifier": "private final",
"original_string": "private final int maxParamByteSize;",
"type": "int",
"var_name": "maxParamByteSize"
},
{
"declarator": "DEFAULT_PARAM_MAX_SIZE = 1024",
"modifier": "private static f... | {
"body": "int calculateParamTransportSize(Object value) {\n if (value == null) {\n return 0;\n }\n // Layout for primitives: |type flag(1)|value|\n // size = original size + type flag (1)\n if (value instanceof Integer || int.class.isInstance(value)) {\n retur... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_138 | {
"fields": [],
"file": "sentinel-extension/sentinel-parameter-flow-control/src/test/java/com/alibaba/csp/sentinel/slots/statistic/metric/HotParameterLeapArrayTest.java",
"identifier": "HotParameterLeapArrayTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetRollingAvg() {\n HotParameterLeapArray leapArray = mock(HotParameterLeapArray.class);\n when(leapArray.getRollingSum(any(RollingParamEvent.class), any(Object.class))).thenReturn(15L);\n when(leapArray.getIntervalInSecond()).thenReturn(1d)\n .the... | {
"fields": [],
"file": "sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/slots/statistic/metric/HotParameterLeapArray.java",
"identifier": "HotParameterLeapArray",
"interfaces": "",
"methods": [
{
"class_method_signature": "HotParameterLeapArray.HotParameter... | {
"body": "public double getRollingAvg(RollingParamEvent event, Object value) {\n return ((double) getRollingSum(event, value)) / getIntervalInSecond();\n }",
"class_method_signature": "HotParameterLeapArray.getRollingAvg(RollingParamEvent event, Object value)",
"constructor": false,
"full_signature":... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_90 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/SphUTest.java",
"identifier": "SphUTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMethodEntryType() throws BlockException, NoSuchMethodException, SecurityException {\n Method method = SphUTest.class.getMethod(\"testMethodEntryNormal\");\n Entry e = SphU.entry(method, EntryType.IN);\n\n assertSame(e.resourceWrapper.getEntryType(), EntryType... | {
"fields": [
{
"declarator": "OBJECTS0 = new Object[0]",
"modifier": "private static final",
"original_string": "private static final Object[] OBJECTS0 = new Object[0];",
"type": "Object[]",
"var_name": "OBJECTS0"
}
],
"file": "sentinel-core/src/main/java/com/alibaba/csp/sen... | {
"body": "public static Entry entry(String name) throws BlockException {\n return Env.sph.entry(name, EntryType.OUT, 1, OBJECTS0);\n }",
"class_method_signature": "SphU.entry(String name)",
"constructor": false,
"full_signature": "public static Entry entry(String name)",
"identifier": "entry",
"i... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_211 | {
"fields": [],
"file": "sentinel-adapter/sentinel-reactor-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/reactor/ReactorSphUTest.java",
"identifier": "ReactorSphUTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testReactorEntryWithCommon() {\n String resourceName = createResourceName(\"testReactorEntryWithCommon\");\n StepVerifier.create(ReactorSphU.entryWith(resourceName, Mono.just(60))\n .subscribeOn(Schedulers.elastic())\n .map(e -> e * 3))\n ... | {
"fields": [],
"file": "sentinel-adapter/sentinel-reactor-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/reactor/ReactorSphU.java",
"identifier": "ReactorSphU",
"interfaces": "",
"methods": [
{
"class_method_signature": "ReactorSphU.entryWith(String resourceName, Mono<R> actual)",
"co... | {
"body": "public static <R> Mono<R> entryWith(String resourceName, Mono<R> actual) {\n return entryWith(resourceName, EntryType.OUT, actual);\n }",
"class_method_signature": "ReactorSphU.entryWith(String resourceName, Mono<R> actual)",
"constructor": false,
"full_signature": "public static Mono<R> en... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_180 | {
"fields": [
{
"declarator": "consumerFilter = new SentinelDubboConsumerFilter()",
"modifier": "private final",
"original_string": "private final SentinelDubboConsumerFilter consumerFilter = new SentinelDubboConsumerFilter();",
"type": "SentinelDubboConsumerFilter",
"var_name": "con... | {
"body": "@Test\n public void testInvokeSync() {\n\n Invocation invocation = DubboTestUtil.getDefaultMockInvocationOne();\n Invoker invoker = DubboTestUtil.getDefaultMockInvoker();\n\n final Result result = mock(Result.class);\n when(result.hasException()).thenReturn(false);\n w... | {
"fields": [],
"file": "sentinel-adapter/sentinel-apache-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/SentinelDubboConsumerFilter.java",
"identifier": "SentinelDubboConsumerFilter",
"interfaces": "",
"methods": [
{
"class_method_signature": "SentinelDubboConsumerFilter.Sentine... | {
"body": "@Override\n public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {\n InvokeMode invokeMode = RpcUtils.getInvokeMode(invoker.getUrl(), invocation);\n if (InvokeMode.SYNC == invokeMode) {\n return syncInvoke(invoker, invocation);\n } else {\n ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_28 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/slots/block/flow/FlowSlotTest.java",
"identifier": "FlowSlotTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = FlowException.class)\n @SuppressWarnings(\"unchecked\")\n public void testCheckFlowBlock() throws Exception {\n FlowRuleChecker checker = mock(FlowRuleChecker.class);\n FlowSlot flowSlot = new FlowSlot(checker);\n Context context = mock(Context.class);\n D... | {
"fields": [
{
"declarator": "checker",
"modifier": "private final",
"original_string": "private final FlowRuleChecker checker;",
"type": "FlowRuleChecker",
"var_name": "checker"
},
{
"declarator": "ruleProvider = new Function<String, Collection<FlowRule>>() {\n ... | {
"body": "void checkFlow(ResourceWrapper resource, Context context, DefaultNode node, int count, boolean prioritized)\n throws BlockException {\n checker.checkFlow(ruleProvider, resource, context, node, count, prioritized);\n }",
"class_method_signature": "FlowSlot.checkFlow(ResourceWrapper resour... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_179 | {
"fields": [
{
"declarator": "consumerFilter = new SentinelDubboConsumerFilter()",
"modifier": "private final",
"original_string": "private final SentinelDubboConsumerFilter consumerFilter = new SentinelDubboConsumerFilter();",
"type": "SentinelDubboConsumerFilter",
"var_name": "con... | {
"body": "@Test\n public void testInvokeAsync() {\n\n Invocation invocation = DubboTestUtil.getDefaultMockInvocationOne();\n Invoker invoker = DubboTestUtil.getDefaultMockInvoker();\n\n when(invocation.getAttachment(ASYNC_KEY)).thenReturn(Boolean.TRUE.toString());\n final Result result... | {
"fields": [],
"file": "sentinel-adapter/sentinel-apache-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/SentinelDubboConsumerFilter.java",
"identifier": "SentinelDubboConsumerFilter",
"interfaces": "",
"methods": [
{
"class_method_signature": "SentinelDubboConsumerFilter.Sentine... | {
"body": "@Override\n public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {\n InvokeMode invokeMode = RpcUtils.getInvokeMode(invoker.getUrl(), invocation);\n if (InvokeMode.SYNC == invokeMode) {\n return syncInvoke(invoker, invocation);\n } else {\n ... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_196 | {
"fields": [],
"file": "sentinel-adapter/sentinel-sofa-rpc-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/sofa/rpc/SofaRpcUtilsTest.java",
"identifier": "SofaRpcUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetMethodResourceName() {\n SofaRequest request = new SofaRequest();\n request.setInterfaceName(\"com.alibaba.csp.sentinel.adapter.sofa.rpc.service.DemoService\");\n request.setMethodName(\"sayHello\");\n request.setMethodArgSigs(new String[]{\"java.la... | {
"fields": [],
"file": "sentinel-adapter/sentinel-sofa-rpc-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/sofa/rpc/SofaRpcUtils.java",
"identifier": "SofaRpcUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "SofaRpcUtils.getApplicationName(SofaRequest request)",
"cons... | {
"body": "public static String getMethodResourceName(SofaRequest request) {\n StringBuilder buf = new StringBuilder(64);\n buf.append(request.getInterfaceName())\n .append(\"#\")\n .append(request.getMethodName())\n .append(\"(\");\n\n boolean isFirst... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_69 | {
"fields": [],
"file": "sentinel-core/src/test/java/com/alibaba/csp/sentinel/util/function/Tuple2Test.java",
"identifier": "Tuple2Test",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testSwap() {\n Tuple2 tupleOld = new Tuple2(1, 2);\n Tuple2 tupleNew = tupleOld.swap();\n Assert.assertEquals(new Tuple2(2, 1), tupleNew);\n }",
"class_method_signature": "Tuple2Test.testSwap()",
"constructor": false,
"full_signature": "@Test public void... | {
"fields": [
{
"declarator": "r1",
"modifier": "public final",
"original_string": "public final R1 r1;",
"type": "R1",
"var_name": "r1"
},
{
"declarator": "r2",
"modifier": "public final",
"original_string": "public final R2 r2;",
"type": "R2",
... | {
"body": "public Tuple2<R2, R1> swap() {\n return new Tuple2<R2, R1>(this.r2, this.r1);\n }",
"class_method_signature": "Tuple2.swap()",
"constructor": false,
"full_signature": "public Tuple2<R2, R1> swap()",
"identifier": "swap",
"invocations": [],
"modifiers": "public",
"parameters": "()",
... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
128018428_207 | {
"fields": [],
"file": "sentinel-adapter/sentinel-zuul-adapter/src/test/java/com/alibaba/csp/sentinel/adapter/gateway/zuul/filters/SentinelZuulPostFilterTest.java",
"identifier": "SentinelZuulPostFilterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testFilterType() throws Exception {\n SentinelZuulPostFilter sentinelZuulPostFilter = new SentinelZuulPostFilter();\n Assert.assertEquals(sentinelZuulPostFilter.filterType(), POST_TYPE);\n }",
"class_method_signature": "SentinelZuulPostFilterTest.testFilterType()",... | {
"fields": [
{
"declarator": "order",
"modifier": "private final",
"original_string": "private final int order;",
"type": "int",
"var_name": "order"
}
],
"file": "sentinel-adapter/sentinel-zuul-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/gateway/zuul/filters/Senti... | {
"body": "@Override\n public String filterType() {\n return ZuulConstant.POST_TYPE;\n }",
"class_method_signature": "SentinelZuulPostFilter.filterType()",
"constructor": false,
"full_signature": "@Override public String filterType()",
"identifier": "filterType",
"invocations": [],
"modifiers... | {
"created": "4/4/2018 6:37:33 AM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 128018428,
"size": null,
"stargazer_count": null,
"stars": 10653,
"updates": "2020-01-27T13:24:35+00:00",
"url": "https://github.com/alibaba/Sentin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.