[jira] [Commented] (SCB-324) Chassis must support network failure simulation, so that I can developers can enhance the robustness of the app

2018-02-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-324:


liubao68 commented on a change in pull request #543: [SCB-324] Fault-Injection 
handler implementation
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/543#discussion_r165897787
 
 

 ##
 File path: 
handlers/handler-fault-injection/src/main/java/org/apache/servicecomb/faultinjection/FaultInjectionConst.java
 ##
 @@ -0,0 +1,52 @@
+/*
+ * 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.faultinjection;
+
+/**
+ * Handles the all constant values for fault injection.
+ */
+public class FaultInjectionConst {
+  public static final int FAULT_INJECTION_DELAY_DEFAULT = 5;
+
+  public static final int FAULT_INJECTION_DELAY_PERCENTAGE_DEFAULT = 100;
+
+  public static final int FAULT_INJECTION_ABORT_PERCENTAGE_DEFAULT = 100;
+
+  public static final int FAULT_INJECTION_ABORT_ERROR_MSG_DEFAULT = 421;
+
+  public static final int FAULT_INJECTION_CFG_NULL = -1;
+
+  public static final String CONSUMER_FAULTINJECTION = 
"cse.governance.Consumer.";
+
+  public static final String CONSUMER_FAULTINJECTION_OPERATION = 
"cse.governance.Consumer.operations.";
+
+  public static final String CONSUMER_FAULTINJECTION_SCHEMAS = 
"cse.governance.Consumer.schemas.";
+
+  public static final String CONSUMER_FAULTINJECTION_GLOBAL = 
"cse.governance.Consumer._global.";
 
 Review comment:
   This is different from the docs:
   global:
   cse.governance.Consumer.global.policy.fault.protocols.rest.
   Service:
   cse.governance.Consumer.MyTestServiceName.policy.fault.protocols.rest.
   Schema:
   
cse.governance.Consumer.MyTestServiceName.schemas.MySchemaName.policy.fault.protocols.rest.
   Operations:
   
cse.governance.Consumer.MyTestServiceName.schemas.MySchemaName.operations.MyOperation.policy.fault.protocols.rest.
   Please confirm. Your layers may have conflicts because each service may have 
same operation
   


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


> Chassis must support network failure simulation, so that I can developers can 
> enhance the robustness of the app
> ---
>
> Key: SCB-324
> URL: https://issues.apache.org/jira/browse/SCB-324
> Project: Apache ServiceComb
>  Issue Type: Task
>  Components: Java-Chassis
>Reporter: sukesh
>Assignee: sukesh
>Priority: Minor
> Fix For: java-chassis-1.0.0-m1
>
>
> Add new handler for fault injection.
> 1) If handler 'fault-injection' is added in application property 
> file(microservice.yaml) then fault-injection handler should include in 
> handler chain.
> 2) When handler is called read the configuration and listen the configuration 
> event related to fault inject. The sample configuration file is in next slide.
> 3) The configuration mainly consist
>     -delay
>     -abort
>  *delay:*can set the delay for requests based on percentage configured. The 
> unit is ms. The delay percentage default value is 100%
>  *abort*: Abort the requests based on percentage configured. For rest 
> transport protocol error code can be configurable(500, 421) and highway 
> protocol does not support for error return. The abort percentage default 
> value is 100%
> 4) This features currently supports at consumer side.



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


[jira] [Commented] (SCB-324) Chassis must support network failure simulation, so that I can developers can enhance the robustness of the app

2018-02-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-324:


liubao68 commented on a change in pull request #543: [SCB-324] Fault-Injection 
handler implementation
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/543#discussion_r165899465
 
 

 ##
 File path: 
handlers/handler-fault-injection/src/test/java/org/apache/servicecomb/faultinjection/TestFaultInjectHandler.java
 ##
 @@ -0,0 +1,421 @@
+/*
+ * 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.faultinjection;
+
+import static org.junit.Assert.assertEquals;
+import java.util.concurrent.atomic.AtomicLong;
+import org.apache.servicecomb.core.Invocation;
+import org.apache.servicecomb.core.Transport;
+import org.apache.servicecomb.core.definition.OperationMeta;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.apache.servicecomb.swagger.invocation.AsyncResponse;
+
+/**
+ * Tests the fault injection handler functionality.
+ */
+public class TestFaultInjectHandler {
+  FaultInjectionHandler handler;
+
+  Invocation invocation;
+
+  AsyncResponse asyncResp;
+
+  OperationMeta operationMeta;
+
+  private Transport transport;
+
+  @Before
+  public void setUp() throws Exception {
+handler = new FaultInjectionHandler();
+
+invocation = Mockito.mock(Invocation.class);
+
+asyncResp = Mockito.mock(AsyncResponse.class);
+
+operationMeta = Mockito.mock(OperationMeta.class);
+
+transport = Mockito.mock(Transport.class);
+  }
+
+  @After
+  public void tearDown() throws Exception {
+handler = null;
+
+invocation = null;
+
+asyncResp = null;
+
+operationMeta = null;
+
+transport = null;
+  }
+
+  /**
+   * Tests the fault injection handler functionality with default values for
+   * highway transport.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void testFaultInjectHandlerHighwayWithDefaultCfg() throws Exception {
+
+
Mockito.when(invocation.getMicroserviceQualifiedName()).thenReturn("MicroserviceQualifiedName1");
+Mockito.when(invocation.getTransport()).thenReturn(transport);
+Mockito.when(transport.getName()).thenReturn("highway");
+Mockito.when(invocation.getOperationName()).thenReturn("sayHello");
+Mockito.when(invocation.getSchemaId()).thenReturn("sayHelloSchema");
+Mockito.when(invocation.getMicroserviceName()).thenReturn("hello");
+
+handler.handle(invocation, asyncResp);
+
+AtomicLong count = 
FaultInjectionUtil.getOperMetTotalReq("highwayMicroserviceQualifiedName1");
+assertEquals(2, count.get());
+  }
+
+  /**
+   * Tests the fault injection handler functionality with default values for 
rest
+   * transport.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void testFaultInjectHandlerRestWithDefaultCfg() throws Exception {
+
+
Mockito.when(invocation.getMicroserviceQualifiedName()).thenReturn("MicroserviceQualifiedName2");
+Mockito.when(invocation.getTransport()).thenReturn(transport);
+Mockito.when(transport.getName()).thenReturn("rest");
+Mockito.when(invocation.getOperationName()).thenReturn("sayHello");
+Mockito.when(invocation.getSchemaId()).thenReturn("sayHelloSchema");
+Mockito.when(invocation.getMicroserviceName()).thenReturn("hello");
+
+handler.handle(invocation, asyncResp);
+
+AtomicLong count = 
FaultInjectionUtil.getOperMetTotalReq("restMicroserviceQualifiedName2");
+assertEquals(2, count.get());
+  }
+
+  /**
+   * Tests the fault injection handler functionality with global configuration
+   * with delay/abort condition.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void testFaultInjectHandlerConfigChangeGlobal() throws Exception {
+
+
System.setProperty("cse.governance.Consumer._global.policy.fault.protocols.rest.delay.fixedDelay",
 "5");
+
System.setProperty("cse.governance.Consumer._global.policy.fault.protocols.rest.delay.percent",
 "10");
+

[jira] [Commented] (SCB-324) Chassis must support network failure simulation, so that I can developers can enhance the robustness of the app

2018-02-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-324:


liubao68 commented on a change in pull request #543: [SCB-324] Fault-Injection 
handler implementation
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/543#discussion_r165898966
 
 

 ##
 File path: 
handlers/handler-fault-injection/src/main/java/org/apache/servicecomb/faultinjection/FaultInjectionHandler.java
 ##
 @@ -0,0 +1,216 @@
+/*
+ * 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.faultinjection;
+
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.servicecomb.core.Handler;
+import org.apache.servicecomb.core.Invocation;
+import org.apache.servicecomb.swagger.invocation.AsyncResponse;
+import org.apache.servicecomb.swagger.invocation.context.HttpStatus;
+import org.apache.servicecomb.swagger.invocation.exception.CommonExceptionData;
+import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
+import static org.apache.servicecomb.faultinjection.FaultInjectionConst.*;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Fault injection handler which injects the delay/abort for requests based on
+ * the percentage configured in service file.
+ *
+ */
+public class FaultInjectionHandler implements Handler {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(FaultInjectionHandler.class);
+
+  @Override
+  public void handle(Invocation invocation, AsyncResponse asyncResp) throws 
Exception {
+// prepare the key and lookup for request count.
+String key = invocation.getTransport().getName() + 
invocation.getMicroserviceQualifiedName();
+
+AtomicLong reqCount = FaultInjectionUtil.getOperMetTotalReq(key);
+long reqCountCurrent = reqCount.get();
+// increment the request count here after checking the delay/abort 
condition.
+reqCount.incrementAndGet();
+
+// get the config values related to delay percentage.
+int delayPercent = getFaultInjectionConfig(invocation,
+"delay.percent",
+FAULT_INJECTION_DELAY_PERCENTAGE_DEFAULT);
+
+// check fault delay condition.
+boolean isDelay = checkFaultInjectionDelayAndAbort(reqCountCurrent, 
delayPercent);
+if (isDelay) {
+  LOGGER.info("delay is added for the request by fault inject handler");
+  long delay = getFaultInjectionConfig(invocation,
+  "delay.fixedDelay",
+  FAULT_INJECTION_DELAY_DEFAULT);
+
+  Thread.sleep(delay);
+}
+
+// get the config values related to delay.
+int abortPercent = getFaultInjectionConfig(invocation,
+"abort.percent",
+FAULT_INJECTION_ABORT_PERCENTAGE_DEFAULT);
+
+// check fault delay condition.
+boolean isAbort = checkFaultInjectionDelayAndAbort(reqCountCurrent, 
abortPercent);
+if (isAbort) {
+  // get the config values related to delay percentage.
+  int errorCode = getFaultInjectionConfig(invocation,
+  "abort.httpStatus",
+  FAULT_INJECTION_ABORT_ERROR_MSG_DEFAULT);
+  // if request need to be abort then return failure with given error code
+  CommonExceptionData errorData = new CommonExceptionData("aborted by 
fault inject");
+  asyncResp.consumerFail(
+  new InvocationException(new HttpStatus(errorCode, "aborted by fault 
inject"), errorData));
+  return;
+}
+
+// if no delay and no abort then continue to next handler.
+invocation.next(asyncResp);
+  }
+
+  /**
+   * It will check the delay/abort condition based on request count and 
percentage
+   * received.
+   * 
+   * @param reqCount
+   * @param percentage
+   * @param key
+   * @return true/false
+   */
+  private boolean checkFaultInjectionDelayAndAbort(long reqCount, int 
percentage) {
+/*
+ * Example: delay/abort percentage configured is 10% and Get the 
count(suppose
+ * if it is 10th request) from map and calculate resultNew(10th request) 
and
+ * requestOld(9th request). Like this for 

[jira] [Commented] (SCB-324) Chassis must support network failure simulation, so that I can developers can enhance the robustness of the app

2018-02-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-324:


liubao68 commented on a change in pull request #543: [SCB-324] Fault-Injection 
handler implementation
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/543#discussion_r165897787
 
 

 ##
 File path: 
handlers/handler-fault-injection/src/main/java/org/apache/servicecomb/faultinjection/FaultInjectionConst.java
 ##
 @@ -0,0 +1,52 @@
+/*
+ * 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.faultinjection;
+
+/**
+ * Handles the all constant values for fault injection.
+ */
+public class FaultInjectionConst {
+  public static final int FAULT_INJECTION_DELAY_DEFAULT = 5;
+
+  public static final int FAULT_INJECTION_DELAY_PERCENTAGE_DEFAULT = 100;
+
+  public static final int FAULT_INJECTION_ABORT_PERCENTAGE_DEFAULT = 100;
+
+  public static final int FAULT_INJECTION_ABORT_ERROR_MSG_DEFAULT = 421;
+
+  public static final int FAULT_INJECTION_CFG_NULL = -1;
+
+  public static final String CONSUMER_FAULTINJECTION = 
"cse.governance.Consumer.";
+
+  public static final String CONSUMER_FAULTINJECTION_OPERATION = 
"cse.governance.Consumer.operations.";
+
+  public static final String CONSUMER_FAULTINJECTION_SCHEMAS = 
"cse.governance.Consumer.schemas.";
+
+  public static final String CONSUMER_FAULTINJECTION_GLOBAL = 
"cse.governance.Consumer._global.";
 
 Review comment:
   This is different from the docs:
   global:
   cse.governance.Consumer.global.policy.fault.protocols.rest.
   Service:
   cse.governance.Consumer.MyTestServiceName.policy.fault.protocols.rest.
   Schema:
   
cse.governance.Consumer.MyTestServiceName.schemas.MySchemaName.policy.fault.protocols.rest.
   Operations:
   
cse.governance.Consumer.MyTestServiceName.schemas.MySchemaName.operations.MyOperation.policy.fault.protocols.rest.
   Please confirm. Your layers may have conflicts because each service may have 
some operation
   


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


> Chassis must support network failure simulation, so that I can developers can 
> enhance the robustness of the app
> ---
>
> Key: SCB-324
> URL: https://issues.apache.org/jira/browse/SCB-324
> Project: Apache ServiceComb
>  Issue Type: Task
>  Components: Java-Chassis
>Reporter: sukesh
>Assignee: sukesh
>Priority: Minor
> Fix For: java-chassis-1.0.0-m1
>
>
> Add new handler for fault injection.
> 1) If handler 'fault-injection' is added in application property 
> file(microservice.yaml) then fault-injection handler should include in 
> handler chain.
> 2) When handler is called read the configuration and listen the configuration 
> event related to fault inject. The sample configuration file is in next slide.
> 3) The configuration mainly consist
>     -delay
>     -abort
>  *delay:*can set the delay for requests based on percentage configured. The 
> unit is ms. The delay percentage default value is 100%
>  *abort*: Abort the requests based on percentage configured. For rest 
> transport protocol error code can be configurable(500, 421) and highway 
> protocol does not support for error return. The abort percentage default 
> value is 100%
> 4) This features currently supports at consumer side.



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


[jira] [Commented] (SCB-324) Chassis must support network failure simulation, so that I can developers can enhance the robustness of the app

2018-02-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-324:


liubao68 commented on a change in pull request #543: [SCB-324] Fault-Injection 
handler implementation
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/543#discussion_r165896361
 
 

 ##
 File path: 
handlers/handler-fault-injection/src/main/java/org/apache/servicecomb/faultinjection/FaultInjectionHandler.java
 ##
 @@ -0,0 +1,216 @@
+/*
+ * 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.faultinjection;
+
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.servicecomb.core.Handler;
+import org.apache.servicecomb.core.Invocation;
+import org.apache.servicecomb.swagger.invocation.AsyncResponse;
+import org.apache.servicecomb.swagger.invocation.context.HttpStatus;
+import org.apache.servicecomb.swagger.invocation.exception.CommonExceptionData;
+import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
+import static org.apache.servicecomb.faultinjection.FaultInjectionConst.*;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Fault injection handler which injects the delay/abort for requests based on
+ * the percentage configured in service file.
+ *
+ */
+public class FaultInjectionHandler implements Handler {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(FaultInjectionHandler.class);
+
+  @Override
+  public void handle(Invocation invocation, AsyncResponse asyncResp) throws 
Exception {
+// prepare the key and lookup for request count.
+String key = invocation.getTransport().getName() + 
invocation.getMicroserviceQualifiedName();
 
 Review comment:
   transport may be empty


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


> Chassis must support network failure simulation, so that I can developers can 
> enhance the robustness of the app
> ---
>
> Key: SCB-324
> URL: https://issues.apache.org/jira/browse/SCB-324
> Project: Apache ServiceComb
>  Issue Type: Task
>  Components: Java-Chassis
>Reporter: sukesh
>Assignee: sukesh
>Priority: Minor
> Fix For: java-chassis-1.0.0-m1
>
>
> Add new handler for fault injection.
> 1) If handler 'fault-injection' is added in application property 
> file(microservice.yaml) then fault-injection handler should include in 
> handler chain.
> 2) When handler is called read the configuration and listen the configuration 
> event related to fault inject. The sample configuration file is in next slide.
> 3) The configuration mainly consist
>     -delay
>     -abort
>  *delay:*can set the delay for requests based on percentage configured. The 
> unit is ms. The delay percentage default value is 100%
>  *abort*: Abort the requests based on percentage configured. For rest 
> transport protocol error code can be configurable(500, 421) and highway 
> protocol does not support for error return. The abort percentage default 
> value is 100%
> 4) This features currently supports at consumer side.



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


[jira] [Commented] (SCB-324) Chassis must support network failure simulation, so that I can developers can enhance the robustness of the app

2018-02-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-324:


liubao68 commented on a change in pull request #543: [SCB-324] Fault-Injection 
handler implementation
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/543#discussion_r165895737
 
 

 ##
 File path: 
handlers/handler-fault-injection/src/main/java/org/apache/servicecomb/faultinjection/FaultInjectionConfig.java
 ##
 @@ -0,0 +1,58 @@
+/*
+ * 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.faultinjection;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.netflix.config.DynamicIntProperty;
+import com.netflix.config.DynamicPropertyFactory;
+
+/**
+ * Handles the fault injection configuration read from micro service 
file/config
+ * center.
+ */
+public final class FaultInjectionConfig {
+
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(FaultInjectionConfig.class);
+
+  // key is configuration parameter.
+  public static List cfgCallback = new LinkedList<>();
+
+  public int getConfigVal(String config, int defaultValue) {
+DynamicIntProperty dynamicIntProperty = 
DynamicPropertyFactory.getInstance().getIntProperty(config,
+defaultValue);
+if (!cfgCallback.contains(config)) {
+  cfgCallback.add(config);
+  dynamicIntProperty.addCallback(() -> {
+int newValue = dynamicIntProperty.get();
+String cfgName = dynamicIntProperty.getName();
+
+//store the value in config center map and check for next requests.
+FaultInjectionUtil.setConfigCenterValue(cfgName, new 
AtomicInteger(newValue));
+LOGGER.info("{} changed from {} to {}", cfgName, dynamicIntProperty, 
newValue);
 
 Review comment:
   dynamicIntProperty is not an integer


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


> Chassis must support network failure simulation, so that I can developers can 
> enhance the robustness of the app
> ---
>
> Key: SCB-324
> URL: https://issues.apache.org/jira/browse/SCB-324
> Project: Apache ServiceComb
>  Issue Type: Task
>  Components: Java-Chassis
>Reporter: sukesh
>Assignee: sukesh
>Priority: Minor
> Fix For: java-chassis-1.0.0-m1
>
>
> Add new handler for fault injection.
> 1) If handler 'fault-injection' is added in application property 
> file(microservice.yaml) then fault-injection handler should include in 
> handler chain.
> 2) When handler is called read the configuration and listen the configuration 
> event related to fault inject. The sample configuration file is in next slide.
> 3) The configuration mainly consist
>     -delay
>     -abort
>  *delay:*can set the delay for requests based on percentage configured. The 
> unit is ms. The delay percentage default value is 100%
>  *abort*: Abort the requests based on percentage configured. For rest 
> transport protocol error code can be configurable(500, 421) and highway 
> protocol does not support for error return. The abort percentage default 
> value is 100%
> 4) This features currently supports at consumer side.



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


[jira] [Commented] (SCB-317) Prepare the release for Service-Center-1.0.0-m1

2018-02-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-317:


little-cui closed pull request #273: SCB-317 Update the cors license
URL: https://github.com/apache/incubator-servicecomb-service-center/pull/273
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/NOTICE b/NOTICE
index 7fe2cb6d..5111231c 100644
--- a/NOTICE
+++ b/NOTICE
@@ -36,6 +36,7 @@ The following components are provided under the  MIT License  
(http://www.openso
 github.com/beorn7/perks/quantile
 github.com/boltdb/bolt
 github.com/satori/go.uuid
+github.com/rs/cors
 AngularJS v1.6.6 (http://angularjs.org)
 Bootstrap v3.3.7 (http://getbootstrap.com)
 Chart.js (https://github.com/chartjs/Chart.js)
@@ -192,3 +193,16 @@ Copyright 2014-2015 The Prometheus Authors
 
 This product includes software developed at
 SoundCloud Ltd. (http://soundcloud.com/).
+
+
+
+Notice for rs/cors
+
+rs/cors provides functions to allow CORS for http request, some part
+of the code was used and modified as per the use case.
+
+Credit to :
+
+Copyright (c) 2014 Olivier Poitrey 
+
+Licensed under MIT
diff --git a/server/interceptor/cors/cors.go b/server/interceptor/cors/cors.go
index 5dd39c5c..e0c60eda 100644
--- a/server/interceptor/cors/cors.go
+++ b/server/interceptor/cors/cors.go
@@ -1,19 +1,26 @@
 /*
- * 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.
- */
+ Copyright (c) 2014 Olivier Poitrey 
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+The original code was modified to fit the Service-Center use case.
+  */
 package cors
 
 import (


 


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


> Prepare the release for Service-Center-1.0.0-m1
> ---
>
> Key: SCB-317
> URL: https://issues.apache.org/jira/browse/SCB-317
> Project: Apache ServiceComb
>  Issue Type: Wish
>  Components: Service-Center
>Affects Versions: service-center-1.0.0-m1
>Reporter: Mohammad Asif Siddiqui
>Assignee: Mohammad Asif Siddiqui
>Priority: Major
> Fix For: service-center-1.0.0-m1
>
>




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