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

ASF GitHub Bot commented on SCB-506:
------------------------------------

liubao68 commented on a change in pull request #678: [SCB-506]服务治理相关的需要事件上报
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/678#discussion_r194986012
 
 

 ##########
 File path: 
handlers/handler-bizkeeper/src/test/java/org/apache/servicecomb/bizkeeper/TestCustomCommandGroupKey.java
 ##########
 @@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.bizkeeper;
+
+import org.apache.servicecomb.core.Invocation;
+import org.apache.servicecomb.core.definition.OperationMeta;
+import org.apache.servicecomb.swagger.invocation.InvocationType;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class TestCustomCommandGroupKey {
+  @Test
+  public void testToHystrixCommandGroupKey() {
+
+    Invocation invocation = Mockito.mock(Invocation.class);
+    
Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class));
+    
Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()).thenReturn("test2");
+    
Mockito.when(invocation.getMicroserviceName()).thenReturn("microserviceName");
+    
Mockito.when(invocation.getInvocationType()).thenReturn(InvocationType.CONSUMER);
+    Mockito.when(invocation.getSchemaId()).thenReturn("schemaId");
+    Mockito.when(invocation.getOperationName()).thenReturn("operationName");
+    CustomizeCommandGroupKey customizeCommandGroupKey =
+        (CustomizeCommandGroupKey) CustomizeCommandGroupKey.asKey("type", 
invocation);
+    Assert.assertEquals("CONSUMER", 
customizeCommandGroupKey.getInvocationType());
+    Assert.assertEquals("microserviceName", 
customizeCommandGroupKey.getMicroserviceName());
+    Assert.assertEquals("schemaId", customizeCommandGroupKey.getSchema());
+    Assert.assertEquals("operationName", 
customizeCommandGroupKey.getOperation());
 
 Review comment:
   As mentioned above about OOM, we can add a test case to ensure for same 
operation, CustomizeCommandGroupKey is the same. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> 服务治理相关的需要事件上报
> -------------
>
>                 Key: SCB-506
>                 URL: https://issues.apache.org/jira/browse/SCB-506
>             Project: Apache ServiceComb
>          Issue Type: Task
>          Components: Java-Chassis
>            Reporter: xuyiyun
>            Assignee: xuyiyun
>            Priority: Major
>             Fix For: Java-chassis-1.0.0
>
>
> 如果发生服务降级 实例隔离 熔断等操作,业务监控系统需要能获取到对应的通知,方便集成



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to