target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@SuppressWarnings("unchecked") @Test public void testRefreshKieConfig() { HttpClientRequest request = Mockito.mock(HttpClientRequest.class); Mockito.when(request.method()).thenReturn(HttpMethod.GET); Mockito.when(request.headers()).thenReturn(MultiMap.caseInsensitiveMultiMap()); Buffer rsp = Mockito.mock(Buffer.class);... | public void refreshKieConfig() { if (enableLongPolling) { EXECUTOR.execute(new ConfigRefresh(serviceUri)); } else { EXECUTOR.scheduleWithFixedDelay(new ConfigRefresh(serviceUri), firstRefreshInterval, refreshInterval, TimeUnit.MILLISECONDS); } } | KieClient { public void refreshKieConfig() { if (enableLongPolling) { EXECUTOR.execute(new ConfigRefresh(serviceUri)); } else { EXECUTOR.scheduleWithFixedDelay(new ConfigRefresh(serviceUri), firstRefreshInterval, refreshInterval, TimeUnit.MILLISECONDS); } } } | KieClient { public void refreshKieConfig() { if (enableLongPolling) { EXECUTOR.execute(new ConfigRefresh(serviceUri)); } else { EXECUTOR.scheduleWithFixedDelay(new ConfigRefresh(serviceUri), firstRefreshInterval, refreshInterval, TimeUnit.MILLISECONDS); } } KieClient(UpdateHandler updateHandler); } | KieClient { public void refreshKieConfig() { if (enableLongPolling) { EXECUTOR.execute(new ConfigRefresh(serviceUri)); } else { EXECUTOR.scheduleWithFixedDelay(new ConfigRefresh(serviceUri), firstRefreshInterval, refreshInterval, TimeUnit.MILLISECONDS); } } KieClient(UpdateHandler updateHandler); void refreshKieConfig(... | KieClient { public void refreshKieConfig() { if (enableLongPolling) { EXECUTOR.execute(new ConfigRefresh(serviceUri)); } else { EXECUTOR.scheduleWithFixedDelay(new ConfigRefresh(serviceUri), firstRefreshInterval, refreshInterval, TimeUnit.MILLISECONDS); } } KieClient(UpdateHandler updateHandler); void refreshKieConfig(... |
@Test public void destroy() { KieClient kieClient = new KieClient(null); ScheduledExecutorService executor = Deencapsulation.getField(kieClient, "EXECUTOR"); Assert.assertFalse(executor.isShutdown()); executor.shutdown(); Assert.assertTrue(executor.isShutdown()); } | public void destroy() { if (EXECUTOR != null) { EXECUTOR.shutdown(); EXECUTOR = null; } } | KieClient { public void destroy() { if (EXECUTOR != null) { EXECUTOR.shutdown(); EXECUTOR = null; } } } | KieClient { public void destroy() { if (EXECUTOR != null) { EXECUTOR.shutdown(); EXECUTOR = null; } } KieClient(UpdateHandler updateHandler); } | KieClient { public void destroy() { if (EXECUTOR != null) { EXECUTOR.shutdown(); EXECUTOR = null; } } KieClient(UpdateHandler updateHandler); void refreshKieConfig(); void destroy(); } | KieClient { public void destroy() { if (EXECUTOR != null) { EXECUTOR.shutdown(); EXECUTOR = null; } } KieClient(UpdateHandler updateHandler); void refreshKieConfig(); void destroy(); } |
@Test public void getServerUri() { String servers = KieConfig.INSTANCE.getServerUri(); Assert.assertEquals("https: } | public String getServerUri() { return finalConfig.getString(SERVER_URL_KEY); } | KieConfig { public String getServerUri() { return finalConfig.getString(SERVER_URL_KEY); } } | KieConfig { public String getServerUri() { return finalConfig.getString(SERVER_URL_KEY); } private KieConfig(); } | KieConfig { public String getServerUri() { return finalConfig.getString(SERVER_URL_KEY); } private KieConfig(); static ConcurrentCompositeConfiguration getFinalConfig(); static void setFinalConfig(ConcurrentCompositeConfiguration finalConfig); int getConnectionTimeOut(); int getEventLoopSize(); int getVerticalInstance... | KieConfig { public String getServerUri() { return finalConfig.getString(SERVER_URL_KEY); } private KieConfig(); static ConcurrentCompositeConfiguration getFinalConfig(); static void setFinalConfig(ConcurrentCompositeConfiguration finalConfig); int getConnectionTimeOut(); int getEventLoopSize(); int getVerticalInstance... |
@Test public void getEnvironment() { Assert.assertEquals("testing", KieConfig.INSTANCE.getEnvironment()); System.setProperty("SERVICECOMB_ENV", "development"); KieConfig.setFinalConfig(ConfigUtil.createLocalConfig()); Assert.assertEquals("development", KieConfig.INSTANCE.getEnvironment()); } | public String getEnvironment() { return BootStrapProperties.readServiceEnvironment(finalConfig); } | KieConfig { public String getEnvironment() { return BootStrapProperties.readServiceEnvironment(finalConfig); } } | KieConfig { public String getEnvironment() { return BootStrapProperties.readServiceEnvironment(finalConfig); } private KieConfig(); } | KieConfig { public String getEnvironment() { return BootStrapProperties.readServiceEnvironment(finalConfig); } private KieConfig(); static ConcurrentCompositeConfiguration getFinalConfig(); static void setFinalConfig(ConcurrentCompositeConfiguration finalConfig); int getConnectionTimeOut(); int getEventLoopSize(); int... | KieConfig { public String getEnvironment() { return BootStrapProperties.readServiceEnvironment(finalConfig); } private KieConfig(); static ConcurrentCompositeConfiguration getFinalConfig(); static void setFinalConfig(ConcurrentCompositeConfiguration finalConfig); int getConnectionTimeOut(); int getEventLoopSize(); int... |
@Test public void test_heartbeat_whenInstanceNotExist_shouldReturnFalse() { ServerUtil.microserviceInstanceMap = prepareServiceInstanceMap(false); boolean returnedResult = target.heartbeat(serviceId, instanceId1); Assert.assertFalse(returnedResult); } | public void heartbeat(ServerMicroserviceInstance receivedInstance) { String serviceId = receivedInstance.getServiceId(); String instanceId = receivedInstance.getInstanceId(); Map<String, ServerMicroserviceInstance> serverMicroserviceInstanceMap = ServerUtil.microserviceInstanceMap .get(serviceId); if (serverMicroservic... | ZeroConfigRegistryService { public void heartbeat(ServerMicroserviceInstance receivedInstance) { String serviceId = receivedInstance.getServiceId(); String instanceId = receivedInstance.getInstanceId(); Map<String, ServerMicroserviceInstance> serverMicroserviceInstanceMap = ServerUtil.microserviceInstanceMap .get(servi... | ZeroConfigRegistryService { public void heartbeat(ServerMicroserviceInstance receivedInstance) { String serviceId = receivedInstance.getServiceId(); String instanceId = receivedInstance.getInstanceId(); Map<String, ServerMicroserviceInstance> serverMicroserviceInstanceMap = ServerUtil.microserviceInstanceMap .get(servi... | ZeroConfigRegistryService { public void heartbeat(ServerMicroserviceInstance receivedInstance) { String serviceId = receivedInstance.getServiceId(); String instanceId = receivedInstance.getInstanceId(); Map<String, ServerMicroserviceInstance> serverMicroserviceInstanceMap = ServerUtil.microserviceInstanceMap .get(servi... | ZeroConfigRegistryService { public void heartbeat(ServerMicroserviceInstance receivedInstance) { String serviceId = receivedInstance.getServiceId(); String instanceId = receivedInstance.getInstanceId(); Map<String, ServerMicroserviceInstance> serverMicroserviceInstanceMap = ServerUtil.microserviceInstanceMap .get(servi... |
@Test public void testRefreshConfigItems() { boolean status = true; Map<String, Object> configMap = new HashMap<>(); configMap.put("key1", "application1"); configMap.put("key2", "application2"); configMap.put("key3", "application3"); configMap.put("key4", "application4"); Map<String, Object> result = null; try { result... | public void refreshConfigItems(Map<String, Object> remoteItems) { String md5Vaule = KieUtil.encrypt(remoteItems.toString()); if (CollectionUtils.isEmpty(remoteItems)) { updateHandler.handle("delete", lastTimeData); lastTimeData = remoteItems; return; } if (StringUtils.isEmpty(refreshRecord)) { refreshRecord = md5Vaule;... | KieWatcher { public void refreshConfigItems(Map<String, Object> remoteItems) { String md5Vaule = KieUtil.encrypt(remoteItems.toString()); if (CollectionUtils.isEmpty(remoteItems)) { updateHandler.handle("delete", lastTimeData); lastTimeData = remoteItems; return; } if (StringUtils.isEmpty(refreshRecord)) { refreshRecor... | KieWatcher { public void refreshConfigItems(Map<String, Object> remoteItems) { String md5Vaule = KieUtil.encrypt(remoteItems.toString()); if (CollectionUtils.isEmpty(remoteItems)) { updateHandler.handle("delete", lastTimeData); lastTimeData = remoteItems; return; } if (StringUtils.isEmpty(refreshRecord)) { refreshRecor... | KieWatcher { public void refreshConfigItems(Map<String, Object> remoteItems) { String md5Vaule = KieUtil.encrypt(remoteItems.toString()); if (CollectionUtils.isEmpty(remoteItems)) { updateHandler.handle("delete", lastTimeData); lastTimeData = remoteItems; return; } if (StringUtils.isEmpty(refreshRecord)) { refreshRecor... | KieWatcher { public void refreshConfigItems(Map<String, Object> remoteItems) { String md5Vaule = KieUtil.encrypt(remoteItems.toString()); if (CollectionUtils.isEmpty(remoteItems)) { updateHandler.handle("delete", lastTimeData); lastTimeData = remoteItems; return; } if (StringUtils.isEmpty(refreshRecord)) { refreshRecor... |
@Test public void test_getMicroservice_whenServiceExist_shouldReturnService() { ServerUtil.microserviceInstanceMap = prepareServiceInstanceMap(true); ServerMicroserviceInstance returnedResult = target.getMicroservice(serviceId); Assert.assertNotNull(returnedResult); Assert.assertEquals(serviceId, returnedResult.getServ... | public ServerMicroserviceInstance getMicroservice(String microserviceId) { Map<String, ServerMicroserviceInstance> instanceIdMap = ServerUtil.microserviceInstanceMap .get(microserviceId); if (instanceIdMap != null) { List<ServerMicroserviceInstance> serverMicroserviceInstanceList = new ArrayList<>( instanceIdMap.values... | ZeroConfigRegistryService { public ServerMicroserviceInstance getMicroservice(String microserviceId) { Map<String, ServerMicroserviceInstance> instanceIdMap = ServerUtil.microserviceInstanceMap .get(microserviceId); if (instanceIdMap != null) { List<ServerMicroserviceInstance> serverMicroserviceInstanceList = new Array... | ZeroConfigRegistryService { public ServerMicroserviceInstance getMicroservice(String microserviceId) { Map<String, ServerMicroserviceInstance> instanceIdMap = ServerUtil.microserviceInstanceMap .get(microserviceId); if (instanceIdMap != null) { List<ServerMicroserviceInstance> serverMicroserviceInstanceList = new Array... | ZeroConfigRegistryService { public ServerMicroserviceInstance getMicroservice(String microserviceId) { Map<String, ServerMicroserviceInstance> instanceIdMap = ServerUtil.microserviceInstanceMap .get(microserviceId); if (instanceIdMap != null) { List<ServerMicroserviceInstance> serverMicroserviceInstanceList = new Array... | ZeroConfigRegistryService { public ServerMicroserviceInstance getMicroservice(String microserviceId) { Map<String, ServerMicroserviceInstance> instanceIdMap = ServerUtil.microserviceInstanceMap .get(microserviceId); if (instanceIdMap != null) { List<ServerMicroserviceInstance> serverMicroserviceInstanceList = new Array... |
@Test public void test_getMicroservice_whenServiceNotExist_shouldReturnNull() { ServerUtil.microserviceInstanceMap = prepareServiceInstanceMap(true); ServerMicroserviceInstance returnedResult = target.getMicroservice(otherServiceId); Assert.assertNull(returnedResult); } | public ServerMicroserviceInstance getMicroservice(String microserviceId) { Map<String, ServerMicroserviceInstance> instanceIdMap = ServerUtil.microserviceInstanceMap .get(microserviceId); if (instanceIdMap != null) { List<ServerMicroserviceInstance> serverMicroserviceInstanceList = new ArrayList<>( instanceIdMap.values... | ZeroConfigRegistryService { public ServerMicroserviceInstance getMicroservice(String microserviceId) { Map<String, ServerMicroserviceInstance> instanceIdMap = ServerUtil.microserviceInstanceMap .get(microserviceId); if (instanceIdMap != null) { List<ServerMicroserviceInstance> serverMicroserviceInstanceList = new Array... | ZeroConfigRegistryService { public ServerMicroserviceInstance getMicroservice(String microserviceId) { Map<String, ServerMicroserviceInstance> instanceIdMap = ServerUtil.microserviceInstanceMap .get(microserviceId); if (instanceIdMap != null) { List<ServerMicroserviceInstance> serverMicroserviceInstanceList = new Array... | ZeroConfigRegistryService { public ServerMicroserviceInstance getMicroservice(String microserviceId) { Map<String, ServerMicroserviceInstance> instanceIdMap = ServerUtil.microserviceInstanceMap .get(microserviceId); if (instanceIdMap != null) { List<ServerMicroserviceInstance> serverMicroserviceInstanceList = new Array... | ZeroConfigRegistryService { public ServerMicroserviceInstance getMicroservice(String microserviceId) { Map<String, ServerMicroserviceInstance> instanceIdMap = ServerUtil.microserviceInstanceMap .get(microserviceId); if (instanceIdMap != null) { List<ServerMicroserviceInstance> serverMicroserviceInstanceList = new Array... |
@Test public void test_findServiceInstances_whenInstanceExist_shouldReturnInstanceList() { ServerUtil.microserviceInstanceMap = prepareServiceInstanceMap(true); List<ServerMicroserviceInstance> returnedResult = target .findServiceInstances(appId, serviceName); Assert.assertTrue(!returnedResult.isEmpty()); Assert.assert... | public List<ServerMicroserviceInstance> findServiceInstances(String appId, String serviceName) { List<ServerMicroserviceInstance> resultInstanceList = new ArrayList<>(); ServerUtil.microserviceInstanceMap.forEach((serviceId, instanceIdMap) -> { instanceIdMap.forEach((instanceId, instance) -> { if (appId.equals(instance... | ZeroConfigRegistryService { public List<ServerMicroserviceInstance> findServiceInstances(String appId, String serviceName) { List<ServerMicroserviceInstance> resultInstanceList = new ArrayList<>(); ServerUtil.microserviceInstanceMap.forEach((serviceId, instanceIdMap) -> { instanceIdMap.forEach((instanceId, instance) ->... | ZeroConfigRegistryService { public List<ServerMicroserviceInstance> findServiceInstances(String appId, String serviceName) { List<ServerMicroserviceInstance> resultInstanceList = new ArrayList<>(); ServerUtil.microserviceInstanceMap.forEach((serviceId, instanceIdMap) -> { instanceIdMap.forEach((instanceId, instance) ->... | ZeroConfigRegistryService { public List<ServerMicroserviceInstance> findServiceInstances(String appId, String serviceName) { List<ServerMicroserviceInstance> resultInstanceList = new ArrayList<>(); ServerUtil.microserviceInstanceMap.forEach((serviceId, instanceIdMap) -> { instanceIdMap.forEach((instanceId, instance) ->... | ZeroConfigRegistryService { public List<ServerMicroserviceInstance> findServiceInstances(String appId, String serviceName) { List<ServerMicroserviceInstance> resultInstanceList = new ArrayList<>(); ServerUtil.microserviceInstanceMap.forEach((serviceId, instanceIdMap) -> { instanceIdMap.forEach((instanceId, instance) ->... |
@Test public void test_findServiceInstances_whenNoInstanceExist_shouldReturnEmptyInstanceList() { ServerUtil.microserviceInstanceMap = prepareServiceInstanceMap(true); List<ServerMicroserviceInstance> returnedResult = target .findServiceInstances(appId, otherServiceName); Assert.assertTrue(returnedResult.isEmpty()); } | public List<ServerMicroserviceInstance> findServiceInstances(String appId, String serviceName) { List<ServerMicroserviceInstance> resultInstanceList = new ArrayList<>(); ServerUtil.microserviceInstanceMap.forEach((serviceId, instanceIdMap) -> { instanceIdMap.forEach((instanceId, instance) -> { if (appId.equals(instance... | ZeroConfigRegistryService { public List<ServerMicroserviceInstance> findServiceInstances(String appId, String serviceName) { List<ServerMicroserviceInstance> resultInstanceList = new ArrayList<>(); ServerUtil.microserviceInstanceMap.forEach((serviceId, instanceIdMap) -> { instanceIdMap.forEach((instanceId, instance) ->... | ZeroConfigRegistryService { public List<ServerMicroserviceInstance> findServiceInstances(String appId, String serviceName) { List<ServerMicroserviceInstance> resultInstanceList = new ArrayList<>(); ServerUtil.microserviceInstanceMap.forEach((serviceId, instanceIdMap) -> { instanceIdMap.forEach((instanceId, instance) ->... | ZeroConfigRegistryService { public List<ServerMicroserviceInstance> findServiceInstances(String appId, String serviceName) { List<ServerMicroserviceInstance> resultInstanceList = new ArrayList<>(); ServerUtil.microserviceInstanceMap.forEach((serviceId, instanceIdMap) -> { instanceIdMap.forEach((instanceId, instance) ->... | ZeroConfigRegistryService { public List<ServerMicroserviceInstance> findServiceInstances(String appId, String serviceName) { List<ServerMicroserviceInstance> resultInstanceList = new ArrayList<>(); ServerUtil.microserviceInstanceMap.forEach((serviceId, instanceIdMap) -> { instanceIdMap.forEach((instanceId, instance) ->... |
@Test public void enableButNotSlow() { new Expectations() { { operationConfig.isSlowInvocationEnabled(); result = true; operationConfig.getNanoSlowInvocation(); result = 2; stageTrace.calcTotalTime(); result = 1; } }; logger.onInvocationFinish(event); Assert.assertTrue(logCollector.getEvents().isEmpty()); } | @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationStageTrace().calcTotalTime... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... |
@Test public void testLoadbalanceExceptionUtils() { assertEquals("servicecomb.handler.lb.wrong.rule", LoadbalanceExceptionUtils.CSE_HANDLER_LB_WRONG_RULE); CseException cseException = LoadbalanceExceptionUtils.createLoadbalanceException("servicecomb.handler.lb.wrong.rule", new Throwable(), "ARGS"); Assert.assertNotNull... | public static CseException createLoadbalanceException(String code, Throwable cause, Object... args) { String msg = String.format(ERROR_DESC_MGR.ensureFindValue(code), args); CseException exception = new CseException(code, msg, cause); return exception; } | LoadbalanceExceptionUtils extends ExceptionUtils { public static CseException createLoadbalanceException(String code, Throwable cause, Object... args) { String msg = String.format(ERROR_DESC_MGR.ensureFindValue(code), args); CseException exception = new CseException(code, msg, cause); return exception; } } | LoadbalanceExceptionUtils extends ExceptionUtils { public static CseException createLoadbalanceException(String code, Throwable cause, Object... args) { String msg = String.format(ERROR_DESC_MGR.ensureFindValue(code), args); CseException exception = new CseException(code, msg, cause); return exception; } } | LoadbalanceExceptionUtils extends ExceptionUtils { public static CseException createLoadbalanceException(String code, Throwable cause, Object... args) { String msg = String.format(ERROR_DESC_MGR.ensureFindValue(code), args); CseException exception = new CseException(code, msg, cause); return exception; } static CseExc... | LoadbalanceExceptionUtils extends ExceptionUtils { public static CseException createLoadbalanceException(String code, Throwable cause, Object... args) { String msg = String.format(ERROR_DESC_MGR.ensureFindValue(code), args); CseException exception = new CseException(code, msg, cause); return exception; } static CseExc... |
@Test public void discovery_no_instance_reach_error_threshold() { DiscoveryTreeNode childNode = filter.discovery(discoveryContext, discoveryTreeNode); Map<String, MicroserviceInstance> childNodeData = childNode.data(); Assert.assertThat(childNodeData.keySet(), Matchers.containsInAnyOrder("i0", "i1", "i2")); Assert.asse... | @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(invocation.getMicroserviceName())) { return parent; } Ma... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... |
@Test public void discovery_isolate_error_instance() { ServiceCombServer server0 = ServiceCombLoadBalancerStats.INSTANCE.getServiceCombServer(data.get("i0")); for (int i = 0; i < 4; ++i) { ServiceCombLoadBalancerStats.INSTANCE.markFailure(server0); } DiscoveryTreeNode childNode = filter.discovery(discoveryContext, disc... | @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(invocation.getMicroserviceName())) { return parent; } Ma... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... |
@Test public void discovery_try_isolated_instance_after_singleTestTime() { ServiceCombServer server0 = ServiceCombLoadBalancerStats.INSTANCE.getServiceCombServer(data.get("i0")); ServiceCombServerStats serviceCombServerStats = ServiceCombLoadBalancerStats.INSTANCE .getServiceCombServerStats(server0); for (int i = 0; i ... | @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(invocation.getMicroserviceName())) { return parent; } Ma... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... |
@Test public void discovery_not_try_isolated_instance_concurrently() { ServiceCombServer server0 = ServiceCombLoadBalancerStats.INSTANCE.getServiceCombServer(data.get("i0")); ServiceCombServerStats serviceCombServerStats = ServiceCombLoadBalancerStats.INSTANCE .getServiceCombServerStats(server0); for (int i = 0; i < 5;... | @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(invocation.getMicroserviceName())) { return parent; } Ma... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... |
@Test public void discovery_keep_minIsolationTime() { ServiceCombServer server0 = ServiceCombLoadBalancerStats.INSTANCE.getServiceCombServer(data.get("i0")); ServiceCombLoadBalancerStats.INSTANCE.markIsolated(server0, true); ServiceCombLoadBalancerStats.INSTANCE.markSuccess(server0); DiscoveryTreeNode childNode = filte... | @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(invocation.getMicroserviceName())) { return parent; } Ma... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... |
@Test public void discovery_recover_instance() { ServiceCombServer server0 = ServiceCombLoadBalancerStats.INSTANCE.getServiceCombServer(data.get("i0")); ServiceCombLoadBalancerStats.INSTANCE.markSuccess(server0); ServiceCombServerStats serviceCombServerStats = ServiceCombLoadBalancerStats.INSTANCE .getServiceCombServer... | @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(invocation.getMicroserviceName())) { return parent; } Ma... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... | IsolationDiscoveryFilter implements DiscoveryFilter { @Override public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { Map<String, MicroserviceInstance> instances = parent.data(); Invocation invocation = context.getInputParameters(); if (!Configuration.INSTANCE.isIsolationFilterOpen(in... |
@Test public void testAllowVisit() { Map<String, String> filterOptions = new HashMap<>(); Assert.assertTrue(filter.allowVisit(instance, filterOptions)); filterOptions.put("tag0", "value0"); Assert.assertTrue(filter.allowVisit(instance, filterOptions)); filterOptions.put("tag2", "value2"); Assert.assertFalse(filter.allo... | protected boolean allowVisit(MicroserviceInstance instance, Map<String, String> filterOptions) { Map<String, String> propertiesMap = instance.getProperties(); for (Entry<String, String> entry : filterOptions.entrySet()) { if (!entry.getValue().equals(propertiesMap.get(entry.getKey()))) { return false; } } return true; ... | InstancePropertyDiscoveryFilter extends AbstractDiscoveryFilter { protected boolean allowVisit(MicroserviceInstance instance, Map<String, String> filterOptions) { Map<String, String> propertiesMap = instance.getProperties(); for (Entry<String, String> entry : filterOptions.entrySet()) { if (!entry.getValue().equals(pro... | InstancePropertyDiscoveryFilter extends AbstractDiscoveryFilter { protected boolean allowVisit(MicroserviceInstance instance, Map<String, String> filterOptions) { Map<String, String> propertiesMap = instance.getProperties(); for (Entry<String, String> entry : filterOptions.entrySet()) { if (!entry.getValue().equals(pro... | InstancePropertyDiscoveryFilter extends AbstractDiscoveryFilter { protected boolean allowVisit(MicroserviceInstance instance, Map<String, String> filterOptions) { Map<String, String> propertiesMap = instance.getProperties(); for (Entry<String, String> entry : filterOptions.entrySet()) { if (!entry.getValue().equals(pro... | InstancePropertyDiscoveryFilter extends AbstractDiscoveryFilter { protected boolean allowVisit(MicroserviceInstance instance, Map<String, String> filterOptions) { Map<String, String> propertiesMap = instance.getProperties(); for (Entry<String, String> entry : filterOptions.entrySet()) { if (!entry.getValue().equals(pro... |
@Test public void createEndpoint_TransportNotExist() { new Expectations(transportManager) { { transportManager.findTransport(anyString); result = null; } }; ServiceCombServer server = (ServiceCombServer) filter.createEndpoint(Const.RESTFUL, null, null); Assert.assertNull(server); } | @Override protected Object createEndpoint(String transportName, String endpoint, MicroserviceInstance instance) { Transport transport = SCBEngine.getInstance().getTransportManager().findTransport(transportName); if (transport == null) { LOGGER.info("not deployed transport {}, ignore {}.", transportName, endpoint); retu... | ServerDiscoveryFilter extends EndpointDiscoveryFilter { @Override protected Object createEndpoint(String transportName, String endpoint, MicroserviceInstance instance) { Transport transport = SCBEngine.getInstance().getTransportManager().findTransport(transportName); if (transport == null) { LOGGER.info("not deployed t... | ServerDiscoveryFilter extends EndpointDiscoveryFilter { @Override protected Object createEndpoint(String transportName, String endpoint, MicroserviceInstance instance) { Transport transport = SCBEngine.getInstance().getTransportManager().findTransport(transportName); if (transport == null) { LOGGER.info("not deployed t... | ServerDiscoveryFilter extends EndpointDiscoveryFilter { @Override protected Object createEndpoint(String transportName, String endpoint, MicroserviceInstance instance) { Transport transport = SCBEngine.getInstance().getTransportManager().findTransport(transportName); if (transport == null) { LOGGER.info("not deployed t... | ServerDiscoveryFilter extends EndpointDiscoveryFilter { @Override protected Object createEndpoint(String transportName, String endpoint, MicroserviceInstance instance) { Transport transport = SCBEngine.getInstance().getTransportManager().findTransport(transportName); if (transport == null) { LOGGER.info("not deployed t... |
@Test public void createEndpointNormal() { new Expectations(transportManager) { { transportManager.findTransport(anyString); result = trasport; } }; MicroserviceInstance instance = new MicroserviceInstance(); instance.setInstanceId("0000001"); ServiceCombServer server = (ServiceCombServer) filter .createEndpoint(Const.... | @Override protected Object createEndpoint(String transportName, String endpoint, MicroserviceInstance instance) { Transport transport = SCBEngine.getInstance().getTransportManager().findTransport(transportName); if (transport == null) { LOGGER.info("not deployed transport {}, ignore {}.", transportName, endpoint); retu... | ServerDiscoveryFilter extends EndpointDiscoveryFilter { @Override protected Object createEndpoint(String transportName, String endpoint, MicroserviceInstance instance) { Transport transport = SCBEngine.getInstance().getTransportManager().findTransport(transportName); if (transport == null) { LOGGER.info("not deployed t... | ServerDiscoveryFilter extends EndpointDiscoveryFilter { @Override protected Object createEndpoint(String transportName, String endpoint, MicroserviceInstance instance) { Transport transport = SCBEngine.getInstance().getTransportManager().findTransport(transportName); if (transport == null) { LOGGER.info("not deployed t... | ServerDiscoveryFilter extends EndpointDiscoveryFilter { @Override protected Object createEndpoint(String transportName, String endpoint, MicroserviceInstance instance) { Transport transport = SCBEngine.getInstance().getTransportManager().findTransport(transportName); if (transport == null) { LOGGER.info("not deployed t... | ServerDiscoveryFilter extends EndpointDiscoveryFilter { @Override protected Object createEndpoint(String transportName, String endpoint, MicroserviceInstance instance) { Transport transport = SCBEngine.getInstance().getTransportManager().findTransport(transportName); if (transport == null) { LOGGER.info("not deployed t... |
@Test public void consumerSlow(@Mocked Endpoint endpoint) { new Expectations() { { invocation.getEndpoint(); result = endpoint; endpoint.getEndpoint(); result = "rest: invocation.isConsumer(); result = true; invocation.getTraceIdLogger(); result = new TraceIdLogger(invocation); operationMeta.getExtData(RestConst.SWAGGE... | @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationStageTrace().calcTotalTime... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... |
@Test public void testConfigurationWithGetpropertyReturnsStringChar() { new MockUp<Configuration>() { @Mock private String getProperty(String defaultValue, String... keys) { return "tyt"; } }; Configuration.INSTANCE.getRetryNextServer("test"); assertNotNull(Configuration.INSTANCE.getRetryNextServer("test")); } | public int getRetryNextServer(String microservice) { return getRetryServer(microservice, RETRY_ON_NEXT); } | Configuration { public int getRetryNextServer(String microservice) { return getRetryServer(microservice, RETRY_ON_NEXT); } } | Configuration { public int getRetryNextServer(String microservice) { return getRetryServer(microservice, RETRY_ON_NEXT); } private Configuration(); } | Configuration { public int getRetryNextServer(String microservice) { return getRetryServer(microservice, RETRY_ON_NEXT); } private Configuration(); String getRuleStrategyName(String microservice); int getSessionTimeoutInSeconds(String microservice); int getSuccessiveFailedTimes(String microservice); String getRetryHan... | Configuration { public int getRetryNextServer(String microservice) { return getRetryServer(microservice, RETRY_ON_NEXT); } private Configuration(); String getRuleStrategyName(String microservice); int getSessionTimeoutInSeconds(String microservice); int getSuccessiveFailedTimes(String microservice); String getRetryHan... |
@Test public void testConfigurationWithGetpropertyReturnsStringNum() { new MockUp<Configuration>() { @Mock private String getProperty(String defaultValue, String... keys) { return "1234"; } }; Configuration.INSTANCE.getRetryNextServer("test"); assertNotNull(Configuration.INSTANCE.getRetryNextServer("test")); } | public int getRetryNextServer(String microservice) { return getRetryServer(microservice, RETRY_ON_NEXT); } | Configuration { public int getRetryNextServer(String microservice) { return getRetryServer(microservice, RETRY_ON_NEXT); } } | Configuration { public int getRetryNextServer(String microservice) { return getRetryServer(microservice, RETRY_ON_NEXT); } private Configuration(); } | Configuration { public int getRetryNextServer(String microservice) { return getRetryServer(microservice, RETRY_ON_NEXT); } private Configuration(); String getRuleStrategyName(String microservice); int getSessionTimeoutInSeconds(String microservice); int getSuccessiveFailedTimes(String microservice); String getRetryHan... | Configuration { public int getRetryNextServer(String microservice) { return getRetryServer(microservice, RETRY_ON_NEXT); } private Configuration(); String getRuleStrategyName(String microservice); int getSessionTimeoutInSeconds(String microservice); int getSuccessiveFailedTimes(String microservice); String getRetryHan... |
@Test public void testGetRetryOnSameWithGetpropertyReturnsStringChar() { new MockUp<Configuration>() { @Mock private String getProperty(String defaultValue, String... keys) { return "tyt"; } }; Configuration.INSTANCE.getRetrySameServer("test"); assertNotNull(Configuration.INSTANCE.getRetrySameServer("test")); } | public int getRetrySameServer(String microservice) { return getRetryServer(microservice, RETRY_ON_SAME); } | Configuration { public int getRetrySameServer(String microservice) { return getRetryServer(microservice, RETRY_ON_SAME); } } | Configuration { public int getRetrySameServer(String microservice) { return getRetryServer(microservice, RETRY_ON_SAME); } private Configuration(); } | Configuration { public int getRetrySameServer(String microservice) { return getRetryServer(microservice, RETRY_ON_SAME); } private Configuration(); String getRuleStrategyName(String microservice); int getSessionTimeoutInSeconds(String microservice); int getSuccessiveFailedTimes(String microservice); String getRetryHan... | Configuration { public int getRetrySameServer(String microservice) { return getRetryServer(microservice, RETRY_ON_SAME); } private Configuration(); String getRuleStrategyName(String microservice); int getSessionTimeoutInSeconds(String microservice); int getSuccessiveFailedTimes(String microservice); String getRetryHan... |
@Test public void testGetRetryOnSameWithGetpropertyReturnsStringNum() { new MockUp<Configuration>() { @Mock private String getProperty(String defaultValue, String... keys) { return "1234"; } }; Configuration.INSTANCE.getRetrySameServer("test"); assertNotNull(Configuration.INSTANCE.getRetrySameServer("test")); } | public int getRetrySameServer(String microservice) { return getRetryServer(microservice, RETRY_ON_SAME); } | Configuration { public int getRetrySameServer(String microservice) { return getRetryServer(microservice, RETRY_ON_SAME); } } | Configuration { public int getRetrySameServer(String microservice) { return getRetryServer(microservice, RETRY_ON_SAME); } private Configuration(); } | Configuration { public int getRetrySameServer(String microservice) { return getRetryServer(microservice, RETRY_ON_SAME); } private Configuration(); String getRuleStrategyName(String microservice); int getSessionTimeoutInSeconds(String microservice); int getSuccessiveFailedTimes(String microservice); String getRetryHan... | Configuration { public int getRetrySameServer(String microservice) { return getRetryServer(microservice, RETRY_ON_SAME); } private Configuration(); String getRuleStrategyName(String microservice); int getSessionTimeoutInSeconds(String microservice); int getSuccessiveFailedTimes(String microservice); String getRetryHan... |
@Test public void testIsRetryEnabledWithGetpropertyReturnsStringChar() { new MockUp<Configuration>() { @Mock private String getProperty(String defaultValue, String... keys) { return "tyt"; } }; Configuration.INSTANCE.isRetryEnabled("test"); assertNotNull(Configuration.INSTANCE.isRetryEnabled("test")); } | public boolean isRetryEnabled(String microservice) { String p = getStringProperty("false", ROOT + microservice + "." + RETRY_ENABLED, ROOT + RETRY_ENABLED); return Boolean.parseBoolean(p); } | Configuration { public boolean isRetryEnabled(String microservice) { String p = getStringProperty("false", ROOT + microservice + "." + RETRY_ENABLED, ROOT + RETRY_ENABLED); return Boolean.parseBoolean(p); } } | Configuration { public boolean isRetryEnabled(String microservice) { String p = getStringProperty("false", ROOT + microservice + "." + RETRY_ENABLED, ROOT + RETRY_ENABLED); return Boolean.parseBoolean(p); } private Configuration(); } | Configuration { public boolean isRetryEnabled(String microservice) { String p = getStringProperty("false", ROOT + microservice + "." + RETRY_ENABLED, ROOT + RETRY_ENABLED); return Boolean.parseBoolean(p); } private Configuration(); String getRuleStrategyName(String microservice); int getSessionTimeoutInSeconds(String ... | Configuration { public boolean isRetryEnabled(String microservice) { String p = getStringProperty("false", ROOT + microservice + "." + RETRY_ENABLED, ROOT + RETRY_ENABLED); return Boolean.parseBoolean(p); } private Configuration(); String getRuleStrategyName(String microservice); int getSessionTimeoutInSeconds(String ... |
@Test public void testIsRetryEnabledWithGetpropertyReturnsStringNum() { new MockUp<Configuration>() { @Mock private String getProperty(String defaultValue, String... keys) { return "1234"; } }; Configuration.INSTANCE.isRetryEnabled("test"); assertNotNull(Configuration.INSTANCE.isRetryEnabled("test")); } | public boolean isRetryEnabled(String microservice) { String p = getStringProperty("false", ROOT + microservice + "." + RETRY_ENABLED, ROOT + RETRY_ENABLED); return Boolean.parseBoolean(p); } | Configuration { public boolean isRetryEnabled(String microservice) { String p = getStringProperty("false", ROOT + microservice + "." + RETRY_ENABLED, ROOT + RETRY_ENABLED); return Boolean.parseBoolean(p); } } | Configuration { public boolean isRetryEnabled(String microservice) { String p = getStringProperty("false", ROOT + microservice + "." + RETRY_ENABLED, ROOT + RETRY_ENABLED); return Boolean.parseBoolean(p); } private Configuration(); } | Configuration { public boolean isRetryEnabled(String microservice) { String p = getStringProperty("false", ROOT + microservice + "." + RETRY_ENABLED, ROOT + RETRY_ENABLED); return Boolean.parseBoolean(p); } private Configuration(); String getRuleStrategyName(String microservice); int getSessionTimeoutInSeconds(String ... | Configuration { public boolean isRetryEnabled(String microservice) { String p = getStringProperty("false", ROOT + microservice + "." + RETRY_ENABLED, ROOT + RETRY_ENABLED); return Boolean.parseBoolean(p); } private Configuration(); String getRuleStrategyName(String microservice); int getSessionTimeoutInSeconds(String ... |
@Test public void testGetSuccessiveFailedTimes() { assertNotNull(Configuration.INSTANCE.getSuccessiveFailedTimes("test")); } | public int getSuccessiveFailedTimes(String microservice) { final int defaultValue = 5; String p = getStringProperty("5", ROOT + microservice + "." + SUCCESSIVE_FAILED_TIMES, ROOT + SUCCESSIVE_FAILED_TIMES); try { return Integer.parseInt(p); } catch (NumberFormatException e) { return defaultValue; } } | Configuration { public int getSuccessiveFailedTimes(String microservice) { final int defaultValue = 5; String p = getStringProperty("5", ROOT + microservice + "." + SUCCESSIVE_FAILED_TIMES, ROOT + SUCCESSIVE_FAILED_TIMES); try { return Integer.parseInt(p); } catch (NumberFormatException e) { return defaultValue; } } } | Configuration { public int getSuccessiveFailedTimes(String microservice) { final int defaultValue = 5; String p = getStringProperty("5", ROOT + microservice + "." + SUCCESSIVE_FAILED_TIMES, ROOT + SUCCESSIVE_FAILED_TIMES); try { return Integer.parseInt(p); } catch (NumberFormatException e) { return defaultValue; } } pr... | Configuration { public int getSuccessiveFailedTimes(String microservice) { final int defaultValue = 5; String p = getStringProperty("5", ROOT + microservice + "." + SUCCESSIVE_FAILED_TIMES, ROOT + SUCCESSIVE_FAILED_TIMES); try { return Integer.parseInt(p); } catch (NumberFormatException e) { return defaultValue; } } pr... | Configuration { public int getSuccessiveFailedTimes(String microservice) { final int defaultValue = 5; String p = getStringProperty("5", ROOT + microservice + "." + SUCCESSIVE_FAILED_TIMES, ROOT + SUCCESSIVE_FAILED_TIMES); try { return Integer.parseInt(p); } catch (NumberFormatException e) { return defaultValue; } } pr... |
@Test public void testGetSessionTimeoutInSeconds() { assertNotNull(Configuration.INSTANCE.getSessionTimeoutInSeconds("test")); } | public int getSessionTimeoutInSeconds(String microservice) { final int defaultValue = 30; String p = getStringProperty("30", ROOT + microservice + "." + SESSION_TIMEOUT_IN_SECONDS, ROOT + SESSION_TIMEOUT_IN_SECONDS); try { return Integer.parseInt(p); } catch (NumberFormatException e) { return defaultValue; } } | Configuration { public int getSessionTimeoutInSeconds(String microservice) { final int defaultValue = 30; String p = getStringProperty("30", ROOT + microservice + "." + SESSION_TIMEOUT_IN_SECONDS, ROOT + SESSION_TIMEOUT_IN_SECONDS); try { return Integer.parseInt(p); } catch (NumberFormatException e) { return defaultVal... | Configuration { public int getSessionTimeoutInSeconds(String microservice) { final int defaultValue = 30; String p = getStringProperty("30", ROOT + microservice + "." + SESSION_TIMEOUT_IN_SECONDS, ROOT + SESSION_TIMEOUT_IN_SECONDS); try { return Integer.parseInt(p); } catch (NumberFormatException e) { return defaultVal... | Configuration { public int getSessionTimeoutInSeconds(String microservice) { final int defaultValue = 30; String p = getStringProperty("30", ROOT + microservice + "." + SESSION_TIMEOUT_IN_SECONDS, ROOT + SESSION_TIMEOUT_IN_SECONDS); try { return Integer.parseInt(p); } catch (NumberFormatException e) { return defaultVal... | Configuration { public int getSessionTimeoutInSeconds(String microservice) { final int defaultValue = 30; String p = getStringProperty("30", ROOT + microservice + "." + SESSION_TIMEOUT_IN_SECONDS, ROOT + SESSION_TIMEOUT_IN_SECONDS); try { return Integer.parseInt(p); } catch (NumberFormatException e) { return defaultVal... |
@Test public void testGetMaxSingleTestWindow() { assertEquals(60000, Configuration.INSTANCE.getMaxSingleTestWindow()); ArchaiusUtils.setProperty("servicecomb.loadbalance.isolation.maxSingleTestWindow", 5000); assertEquals(5000, Configuration.INSTANCE.getMaxSingleTestWindow()); } | public int getMaxSingleTestWindow() { final int defaultValue = 60000; String p = getStringProperty(Integer.toString(defaultValue), ROOT + FILTER_ISOLATION + FILTER_MAX_SINGLE_TEST_WINDOW); try { int result = Integer.parseInt(p); if (result >= 0) { return result; } return defaultValue; } catch (NumberFormatException e) ... | Configuration { public int getMaxSingleTestWindow() { final int defaultValue = 60000; String p = getStringProperty(Integer.toString(defaultValue), ROOT + FILTER_ISOLATION + FILTER_MAX_SINGLE_TEST_WINDOW); try { int result = Integer.parseInt(p); if (result >= 0) { return result; } return defaultValue; } catch (NumberFor... | Configuration { public int getMaxSingleTestWindow() { final int defaultValue = 60000; String p = getStringProperty(Integer.toString(defaultValue), ROOT + FILTER_ISOLATION + FILTER_MAX_SINGLE_TEST_WINDOW); try { int result = Integer.parseInt(p); if (result >= 0) { return result; } return defaultValue; } catch (NumberFor... | Configuration { public int getMaxSingleTestWindow() { final int defaultValue = 60000; String p = getStringProperty(Integer.toString(defaultValue), ROOT + FILTER_ISOLATION + FILTER_MAX_SINGLE_TEST_WINDOW); try { int result = Integer.parseInt(p); if (result >= 0) { return result; } return defaultValue; } catch (NumberFor... | Configuration { public int getMaxSingleTestWindow() { final int defaultValue = 60000; String p = getStringProperty(Integer.toString(defaultValue), ROOT + FILTER_ISOLATION + FILTER_MAX_SINGLE_TEST_WINDOW); try { int result = Integer.parseInt(p); if (result >= 0) { return result; } return defaultValue; } catch (NumberFor... |
@Test public void sendWithRetry(@Injectable LoadBalancer loadBalancer) { Holder<String> result = new Holder<>(); Deencapsulation.invoke(handler, "sendWithRetry", invocation, (AsyncResponse) resp -> { result.value = resp.getResult(); }, loadBalancer); } | private void sendWithRetry(Invocation invocation, AsyncResponse asyncResp, LoadBalancer chosenLB) throws Exception { long time = System.currentTimeMillis(); int currentHandler = invocation.getHandlerIndex(); SyncResponseExecutor orginExecutor; Executor newExecutor; if (invocation.getResponseExecutor() instanceof SyncRe... | LoadbalanceHandler implements Handler { private void sendWithRetry(Invocation invocation, AsyncResponse asyncResp, LoadBalancer chosenLB) throws Exception { long time = System.currentTimeMillis(); int currentHandler = invocation.getHandlerIndex(); SyncResponseExecutor orginExecutor; Executor newExecutor; if (invocation... | LoadbalanceHandler implements Handler { private void sendWithRetry(Invocation invocation, AsyncResponse asyncResp, LoadBalancer chosenLB) throws Exception { long time = System.currentTimeMillis(); int currentHandler = invocation.getHandlerIndex(); SyncResponseExecutor orginExecutor; Executor newExecutor; if (invocation... | LoadbalanceHandler implements Handler { private void sendWithRetry(Invocation invocation, AsyncResponse asyncResp, LoadBalancer chosenLB) throws Exception { long time = System.currentTimeMillis(); int currentHandler = invocation.getHandlerIndex(); SyncResponseExecutor orginExecutor; Executor newExecutor; if (invocation... | LoadbalanceHandler implements Handler { private void sendWithRetry(Invocation invocation, AsyncResponse asyncResp, LoadBalancer chosenLB) throws Exception { long time = System.currentTimeMillis(); int currentHandler = invocation.getHandlerIndex(); SyncResponseExecutor orginExecutor; Executor newExecutor; if (invocation... |
@Test public void edgeSlow(@Mocked Endpoint endpoint) { new Expectations() { { invocation.getEndpoint(); result = endpoint; endpoint.getEndpoint(); result = "rest: invocation.isConsumer(); result = true; invocation.getTraceIdLogger(); result = new TraceIdLogger(invocation); invocation.isEdge(); result = true; operation... | @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationStageTrace().calcTotalTime... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... |
@Test public void testIsFailedResponse() { Assert.assertFalse(handler.isFailedResponse(Response.create(400, "", ""))); Assert.assertFalse(handler.isFailedResponse(Response.create(500, "", ""))); Assert.assertTrue(handler.isFailedResponse(Response.create(490, "", ""))); Assert.assertTrue(handler.isFailedResponse(Respons... | protected boolean isFailedResponse(Response resp) { if (resp.isFailed()) { if (InvocationException.class.isInstance(resp.getResult())) { InvocationException e = (InvocationException) resp.getResult(); return e.getStatusCode() == ExceptionFactory.CONSUMER_INNER_STATUS_CODE || e.getStatusCode() == 503; } else { return tr... | LoadbalanceHandler implements Handler { protected boolean isFailedResponse(Response resp) { if (resp.isFailed()) { if (InvocationException.class.isInstance(resp.getResult())) { InvocationException e = (InvocationException) resp.getResult(); return e.getStatusCode() == ExceptionFactory.CONSUMER_INNER_STATUS_CODE || e.ge... | LoadbalanceHandler implements Handler { protected boolean isFailedResponse(Response resp) { if (resp.isFailed()) { if (InvocationException.class.isInstance(resp.getResult())) { InvocationException e = (InvocationException) resp.getResult(); return e.getStatusCode() == ExceptionFactory.CONSUMER_INNER_STATUS_CODE || e.ge... | LoadbalanceHandler implements Handler { protected boolean isFailedResponse(Response resp) { if (resp.isFailed()) { if (InvocationException.class.isInstance(resp.getResult())) { InvocationException e = (InvocationException) resp.getResult(); return e.getStatusCode() == ExceptionFactory.CONSUMER_INNER_STATUS_CODE || e.ge... | LoadbalanceHandler implements Handler { protected boolean isFailedResponse(Response resp) { if (resp.isFailed()) { if (InvocationException.class.isInstance(resp.getResult())) { InvocationException e = (InvocationException) resp.getResult(); return e.getStatusCode() == ExceptionFactory.CONSUMER_INNER_STATUS_CODE || e.ge... |
@Test public void testRuleName() { System.setProperty("servicecomb.loadbalance.mytest1.strategy.name", "RoundRobin"); System.setProperty("servicecomb.loadbalance.mytest2.strategy.name", "Random"); System.setProperty("servicecomb.loadbalance.mytest3.strategy.name", "WeightedResponse"); System.setProperty("servicecomb.lo... | public static RuleExt createLoadBalancerRule(String microservice) { RuleExt rule = null; for (ExtensionsFactory factory : extentionFactories) { if (factory.isSupport(Configuration.RULE_STRATEGY_NAME, Configuration.INSTANCE.getRuleStrategyName(microservice))) { rule = factory.createLoadBalancerRule( Configuration.INSTAN... | ExtensionsManager { public static RuleExt createLoadBalancerRule(String microservice) { RuleExt rule = null; for (ExtensionsFactory factory : extentionFactories) { if (factory.isSupport(Configuration.RULE_STRATEGY_NAME, Configuration.INSTANCE.getRuleStrategyName(microservice))) { rule = factory.createLoadBalancerRule( ... | ExtensionsManager { public static RuleExt createLoadBalancerRule(String microservice) { RuleExt rule = null; for (ExtensionsFactory factory : extentionFactories) { if (factory.isSupport(Configuration.RULE_STRATEGY_NAME, Configuration.INSTANCE.getRuleStrategyName(microservice))) { rule = factory.createLoadBalancerRule( ... | ExtensionsManager { public static RuleExt createLoadBalancerRule(String microservice) { RuleExt rule = null; for (ExtensionsFactory factory : extentionFactories) { if (factory.isSupport(Configuration.RULE_STRATEGY_NAME, Configuration.INSTANCE.getRuleStrategyName(microservice))) { rule = factory.createLoadBalancerRule( ... | ExtensionsManager { public static RuleExt createLoadBalancerRule(String microservice) { RuleExt rule = null; for (ExtensionsFactory factory : extentionFactories) { if (factory.isSupport(Configuration.RULE_STRATEGY_NAME, Configuration.INSTANCE.getRuleStrategyName(microservice))) { rule = factory.createLoadBalancerRule( ... |
@Test public void testRuleClassName() { BeansHolder holder = new BeansHolder(); List<ExtensionsFactory> extensionsFactories = new ArrayList<>(); extensionsFactories.add(new RuleNameExtentionsFactory()); extensionsFactories.add(new DefaultRetryExtensionsFactory()); Deencapsulation.setField(holder, "extentionsFactories",... | public static RetryHandler createRetryHandler(String microservice) { RetryHandler handler = null; for (ExtensionsFactory factory : extentionFactories) { if (factory.isSupport(Configuration.RETRY_HANDLER, Configuration.INSTANCE.getRetryHandler(microservice))) { handler = factory.createRetryHandler(Configuration.INSTANCE... | ExtensionsManager { public static RetryHandler createRetryHandler(String microservice) { RetryHandler handler = null; for (ExtensionsFactory factory : extentionFactories) { if (factory.isSupport(Configuration.RETRY_HANDLER, Configuration.INSTANCE.getRetryHandler(microservice))) { handler = factory.createRetryHandler(Co... | ExtensionsManager { public static RetryHandler createRetryHandler(String microservice) { RetryHandler handler = null; for (ExtensionsFactory factory : extentionFactories) { if (factory.isSupport(Configuration.RETRY_HANDLER, Configuration.INSTANCE.getRetryHandler(microservice))) { handler = factory.createRetryHandler(Co... | ExtensionsManager { public static RetryHandler createRetryHandler(String microservice) { RetryHandler handler = null; for (ExtensionsFactory factory : extentionFactories) { if (factory.isSupport(Configuration.RETRY_HANDLER, Configuration.INSTANCE.getRetryHandler(microservice))) { handler = factory.createRetryHandler(Co... | ExtensionsManager { public static RetryHandler createRetryHandler(String microservice) { RetryHandler handler = null; for (ExtensionsFactory factory : extentionFactories) { if (factory.isSupport(Configuration.RETRY_HANDLER, Configuration.INSTANCE.getRetryHandler(microservice))) { handler = factory.createRetryHandler(Co... |
@Test public void testRoundRobin() { RoundRobinRuleExt rule = new RoundRobinRuleExt(); LoadBalancer loadBalancer = new LoadBalancer(rule, "testService"); List<ServiceCombServer> servers = new ArrayList<>(); Invocation invocation = Mockito.mock(Invocation.class); for (int i = 0; i < 2; i++) { ServiceCombServer server = ... | @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { if (servers.isEmpty()) { return null; } int index = Math.abs(counter.getAndIncrement()) % servers.size(); return servers.get(index); } | RoundRobinRuleExt implements RuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { if (servers.isEmpty()) { return null; } int index = Math.abs(counter.getAndIncrement()) % servers.size(); return servers.get(index); } } | RoundRobinRuleExt implements RuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { if (servers.isEmpty()) { return null; } int index = Math.abs(counter.getAndIncrement()) % servers.size(); return servers.get(index); } } | RoundRobinRuleExt implements RuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { if (servers.isEmpty()) { return null; } int index = Math.abs(counter.getAndIncrement()) % servers.size(); return servers.get(index); } @Override ServiceCombServer choose(List<Servi... | RoundRobinRuleExt implements RuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { if (servers.isEmpty()) { return null; } int index = Math.abs(counter.getAndIncrement()) % servers.size(); return servers.get(index); } @Override ServiceCombServer choose(List<Servi... |
@Test public void testBenchmarkRobin() { RoundRobinRuleExt rule = new RoundRobinRuleExt(); LoadBalancer loadBalancer = new LoadBalancer(rule, "testService"); List<ServiceCombServer> servers = new ArrayList<>(); Invocation invocation = Mockito.mock(Invocation.class); for (int i = 0; i < 100; i++) { ServiceCombServer ser... | @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { if (servers.isEmpty()) { return null; } int index = Math.abs(counter.getAndIncrement()) % servers.size(); return servers.get(index); } | RoundRobinRuleExt implements RuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { if (servers.isEmpty()) { return null; } int index = Math.abs(counter.getAndIncrement()) % servers.size(); return servers.get(index); } } | RoundRobinRuleExt implements RuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { if (servers.isEmpty()) { return null; } int index = Math.abs(counter.getAndIncrement()) % servers.size(); return servers.get(index); } } | RoundRobinRuleExt implements RuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { if (servers.isEmpty()) { return null; } int index = Math.abs(counter.getAndIncrement()) % servers.size(); return servers.get(index); } @Override ServiceCombServer choose(List<Servi... | RoundRobinRuleExt implements RuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { if (servers.isEmpty()) { return null; } int index = Math.abs(counter.getAndIncrement()) % servers.size(); return servers.get(index); } @Override ServiceCombServer choose(List<Servi... |
@Test public void testRoundRobin() { WeightedResponseTimeRuleExt rule = new WeightedResponseTimeRuleExt(); LoadBalancer loadBalancer = new LoadBalancer(rule, "testService"); List<ServiceCombServer> servers = new ArrayList<>(); Invocation invocation = Mockito.mock(Invocation.class); for (int i = 0; i < 2; i++) { Service... | @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>(servers.size()); for (int i = 0; i < stats.size() - 1; ... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... |
@Test public void testWeighed() { WeightedResponseTimeRuleExt rule = new WeightedResponseTimeRuleExt(); LoadBalancer loadBalancer = new LoadBalancer(rule, "testService"); List<ServiceCombServer> servers = new ArrayList<>(); Invocation invocation = Mockito.mock(Invocation.class); for (int i = 0; i < 2; i++) { ServiceCom... | @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>(servers.size()); for (int i = 0; i < stats.size() - 1; ... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... |
@Test public void testBenchmark() { WeightedResponseTimeRuleExt rule = new WeightedResponseTimeRuleExt(); LoadBalancer loadBalancer = new LoadBalancer(rule, "testService"); List<ServiceCombServer> servers = new ArrayList<>(); Invocation invocation = Mockito.mock(Invocation.class); for (int i = 0; i < 100; i++) { Servic... | @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>(servers.size()); for (int i = 0; i < stats.size() - 1; ... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... |
@Test public void testBenchmarkRobin() { WeightedResponseTimeRuleExt rule = new WeightedResponseTimeRuleExt(); LoadBalancer loadBalancer = new LoadBalancer(rule, "testService"); List<ServiceCombServer> servers = new ArrayList<>(); Invocation invocation = Mockito.mock(Invocation.class); for (int i = 0; i < 100; i++) { S... | @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>(servers.size()); for (int i = 0; i < stats.size() - 1; ... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... | WeightedResponseTimeRuleExt extends RoundRobinRuleExt { @Override public ServiceCombServer choose(List<ServiceCombServer> servers, Invocation invocation) { List<Double> stats = calculateTotalWeights(servers); if (stats.size() > 0) { double finalTotal = stats.get(stats.size() - 1); List<Double> weights = new ArrayList<>... |
@Test public void testGlobalAllowIsolatedServerTryingFlag_apply_with_null_precondition() { Invocation invocation = new Invocation(); Assert.assertTrue(ServiceCombServerStats.applyForTryingChance(invocation)); Assert.assertSame(invocation, ServiceCombServerStats.globalAllowIsolatedServerTryingFlag.get().getInvocation())... | public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOutdated()) { return globalA... | ServiceCombServerStats { public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOut... | ServiceCombServerStats { public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOut... | ServiceCombServerStats { public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOut... | ServiceCombServerStats { public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOut... |
@Test public void producerSlow(@Mocked HttpServletRequestEx requestEx) { new Expectations() { { invocation.getRequestEx(); result = requestEx; invocation.getTraceIdLogger(); result = new TraceIdLogger(invocation); requestEx.getRemoteAddr(); result = "1.1.1.1"; requestEx.getRemotePort(); result = 1234; invocation.isCons... | @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationStageTrace().calcTotalTime... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... | SlowInvocationLogger { @Subscribe @AllowConcurrentEvents public void onInvocationFinish(InvocationFinishEvent event) { Invocation invocation = event.getInvocation(); OperationConfig operationConfig = invocation.getOperationMeta().getConfig(); if (!operationConfig.isSlowInvocationEnabled() || invocation.getInvocationSta... |
@Test public void testGlobalAllowIsolatedServerTryingFlag_apply_with_chance_occupied() { Invocation invocation = new Invocation(); Assert.assertTrue(ServiceCombServerStats.applyForTryingChance(invocation)); Assert.assertSame(invocation, ServiceCombServerStats.globalAllowIsolatedServerTryingFlag.get().getInvocation()); ... | public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOutdated()) { return globalA... | ServiceCombServerStats { public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOut... | ServiceCombServerStats { public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOut... | ServiceCombServerStats { public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOut... | ServiceCombServerStats { public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOut... |
@Test public void testGlobalAllowIsolatedServerTryingFlag_apply_with_flag_outdated() { Invocation invocation = new Invocation(); Assert.assertTrue(ServiceCombServerStats.applyForTryingChance(invocation)); Assert.assertSame(invocation, ServiceCombServerStats.globalAllowIsolatedServerTryingFlag.get().getInvocation()); Se... | public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOutdated()) { return globalA... | ServiceCombServerStats { public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOut... | ServiceCombServerStats { public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOut... | ServiceCombServerStats { public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOut... | ServiceCombServerStats { public static boolean applyForTryingChance(Invocation invocation) { TryingIsolatedServerMarker marker = globalAllowIsolatedServerTryingFlag.get(); if (marker == null) { return globalAllowIsolatedServerTryingFlag.compareAndSet(null, new TryingIsolatedServerMarker(invocation)); } if (marker.isOut... |
@Test public void testGetEndpoint() { cs.getEndpoint(); assertNotNull(cs.getEndpoint()); } | public Endpoint getEndpoint() { return endpoint; } | ServiceCombServer extends Server { public Endpoint getEndpoint() { return endpoint; } } | ServiceCombServer extends Server { public Endpoint getEndpoint() { return endpoint; } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); ServiceCombServer(Transport transport, CacheEndpoint cacheEndpoint); } | ServiceCombServer extends Server { public Endpoint getEndpoint() { return endpoint; } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); ServiceCombServer(Transport transport, CacheEndpoint cacheEndpoint); Endpoint getEndpoint(); MicroserviceInstance getInstance(); String toString... | ServiceCombServer extends Server { public Endpoint getEndpoint() { return endpoint; } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); ServiceCombServer(Transport transport, CacheEndpoint cacheEndpoint); Endpoint getEndpoint(); MicroserviceInstance getInstance(); String toString... |
@Test public void testEqualsMethod() { Assert.assertFalse(cs.equals((Object) "abcd")); MicroserviceInstance instance1 = new MicroserviceInstance(); instance1.setInstanceId("1234"); ServiceCombServer other = new ServiceCombServer(transport, new CacheEndpoint("1234", instance1)); Assert.assertFalse(cs.equals(other)); Mic... | public boolean equals(Object o) { if (o instanceof ServiceCombServer) { return this.instance.getInstanceId().equals(((ServiceCombServer) o).instance.getInstanceId()); } else { return false; } } | ServiceCombServer extends Server { public boolean equals(Object o) { if (o instanceof ServiceCombServer) { return this.instance.getInstanceId().equals(((ServiceCombServer) o).instance.getInstanceId()); } else { return false; } } } | ServiceCombServer extends Server { public boolean equals(Object o) { if (o instanceof ServiceCombServer) { return this.instance.getInstanceId().equals(((ServiceCombServer) o).instance.getInstanceId()); } else { return false; } } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); S... | ServiceCombServer extends Server { public boolean equals(Object o) { if (o instanceof ServiceCombServer) { return this.instance.getInstanceId().equals(((ServiceCombServer) o).instance.getInstanceId()); } else { return false; } } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); S... | ServiceCombServer extends Server { public boolean equals(Object o) { if (o instanceof ServiceCombServer) { return this.instance.getInstanceId().equals(((ServiceCombServer) o).instance.getInstanceId()); } else { return false; } } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); S... |
@Test public void testToStringMethod() { cs.toString(); assertNotNull(cs.toString()); } | public String toString() { return endpoint.getEndpoint(); } | ServiceCombServer extends Server { public String toString() { return endpoint.getEndpoint(); } } | ServiceCombServer extends Server { public String toString() { return endpoint.getEndpoint(); } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); ServiceCombServer(Transport transport, CacheEndpoint cacheEndpoint); } | ServiceCombServer extends Server { public String toString() { return endpoint.getEndpoint(); } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); ServiceCombServer(Transport transport, CacheEndpoint cacheEndpoint); Endpoint getEndpoint(); MicroserviceInstance getInstance(); String... | ServiceCombServer extends Server { public String toString() { return endpoint.getEndpoint(); } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); ServiceCombServer(Transport transport, CacheEndpoint cacheEndpoint); Endpoint getEndpoint(); MicroserviceInstance getInstance(); String... |
@Test public void testGetHost() { cs.getHost(); assertNotNull(cs.getHost()); } | public String getHost() { return endpoint.getEndpoint(); } | ServiceCombServer extends Server { public String getHost() { return endpoint.getEndpoint(); } } | ServiceCombServer extends Server { public String getHost() { return endpoint.getEndpoint(); } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); ServiceCombServer(Transport transport, CacheEndpoint cacheEndpoint); } | ServiceCombServer extends Server { public String getHost() { return endpoint.getEndpoint(); } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); ServiceCombServer(Transport transport, CacheEndpoint cacheEndpoint); Endpoint getEndpoint(); MicroserviceInstance getInstance(); String ... | ServiceCombServer extends Server { public String getHost() { return endpoint.getEndpoint(); } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); ServiceCombServer(Transport transport, CacheEndpoint cacheEndpoint); Endpoint getEndpoint(); MicroserviceInstance getInstance(); String ... |
@Test public void testHashCodeMethod() { cs.hashCode(); assertNotNull(cs.hashCode()); } | public int hashCode() { return this.instance.getInstanceId().hashCode(); } | ServiceCombServer extends Server { public int hashCode() { return this.instance.getInstanceId().hashCode(); } } | ServiceCombServer extends Server { public int hashCode() { return this.instance.getInstanceId().hashCode(); } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); ServiceCombServer(Transport transport, CacheEndpoint cacheEndpoint); } | ServiceCombServer extends Server { public int hashCode() { return this.instance.getInstanceId().hashCode(); } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); ServiceCombServer(Transport transport, CacheEndpoint cacheEndpoint); Endpoint getEndpoint(); MicroserviceInstance getIns... | ServiceCombServer extends Server { public int hashCode() { return this.instance.getInstanceId().hashCode(); } @VisibleForTesting ServiceCombServer(Endpoint endpoint, MicroserviceInstance instance); ServiceCombServer(Transport transport, CacheEndpoint cacheEndpoint); Endpoint getEndpoint(); MicroserviceInstance getIns... |
@Test public void testGlobalQpsControl(final @Injectable Invocation invocation, final @Injectable AsyncResponse asyncResp) throws Exception { new Expectations() { { invocation.getHandlerIndex(); result = 0; invocation.getContext(Const.SRC_MICROSERVICE); result = "test"; invocation.getOperationMeta(); result = QpsContro... | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getContext(Const.SRC_MICROSERVICE); QpsStrategy qpsStra... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... |
@Test public void testQpsController() { AbstractQpsStrategy qpsStrategy = new FixedWindowStrategy(); qpsStrategy.setKey("abc"); qpsStrategy.setQpsLimit(100L); assertFalse(qpsStrategy.isLimitNewRequest()); qpsStrategy.setQpsLimit(1L); assertTrue(qpsStrategy.isLimitNewRequest()); } | private boolean isLimitNewRequest(QpsStrategy qpsStrategy, AsyncResponse asyncResp) { if (qpsStrategy.isLimitNewRequest()) { CommonExceptionData errorData = new CommonExceptionData("rejected by qps flowcontrol"); asyncResp.producerFail(new InvocationException(QpsConst.TOO_MANY_REQUESTS_STATUS, errorData)); return true;... | ProviderQpsFlowControlHandler implements Handler { private boolean isLimitNewRequest(QpsStrategy qpsStrategy, AsyncResponse asyncResp) { if (qpsStrategy.isLimitNewRequest()) { CommonExceptionData errorData = new CommonExceptionData("rejected by qps flowcontrol"); asyncResp.producerFail(new InvocationException(QpsConst.... | ProviderQpsFlowControlHandler implements Handler { private boolean isLimitNewRequest(QpsStrategy qpsStrategy, AsyncResponse asyncResp) { if (qpsStrategy.isLimitNewRequest()) { CommonExceptionData errorData = new CommonExceptionData("rejected by qps flowcontrol"); asyncResp.producerFail(new InvocationException(QpsConst.... | ProviderQpsFlowControlHandler implements Handler { private boolean isLimitNewRequest(QpsStrategy qpsStrategy, AsyncResponse asyncResp) { if (qpsStrategy.isLimitNewRequest()) { CommonExceptionData errorData = new CommonExceptionData("rejected by qps flowcontrol"); asyncResp.producerFail(new InvocationException(QpsConst.... | ProviderQpsFlowControlHandler implements Handler { private boolean isLimitNewRequest(QpsStrategy qpsStrategy, AsyncResponse asyncResp) { if (qpsStrategy.isLimitNewRequest()) { CommonExceptionData errorData = new CommonExceptionData("rejected by qps flowcontrol"); asyncResp.producerFail(new InvocationException(QpsConst.... |
@Test public void testHandleOnSourceMicroserviceNameIsNull() throws Exception { Mockito.when(invocation.getContext(Const.SRC_MICROSERVICE)).thenReturn(null); Mockito.when(invocation.getHandlerIndex()).thenReturn(0); ArchaiusUtils.setProperty("servicecomb.flowcontrol.Provider.qps.global.limit", 1); ProviderQpsFlowContro... | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getContext(Const.SRC_MICROSERVICE); QpsStrategy qpsStra... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... |
@Test public void addOperationPerf() { OperationPerf opPerf = Utils.createOperationPerf(op); group.addOperationPerf(opPerf); group.addOperationPerf(opPerf); Assert.assertThat(group.getOperationPerfs(), Matchers.contains(opPerf, opPerf)); OperationPerf summary = group.getSummary(); PerfInfo perfInfo = summary.findStage(... | public void addOperationPerf(OperationPerf operationPerf) { operationPerfs.add(operationPerf); if (summary == null) { summary = new OperationPerf(); summary.setOperation(""); } summary.add(operationPerf); } | OperationPerfGroup { public void addOperationPerf(OperationPerf operationPerf) { operationPerfs.add(operationPerf); if (summary == null) { summary = new OperationPerf(); summary.setOperation(""); } summary.add(operationPerf); } } | OperationPerfGroup { public void addOperationPerf(OperationPerf operationPerf) { operationPerfs.add(operationPerf); if (summary == null) { summary = new OperationPerf(); summary.setOperation(""); } summary.add(operationPerf); } OperationPerfGroup(String transport, String status); } | OperationPerfGroup { public void addOperationPerf(OperationPerf operationPerf) { operationPerfs.add(operationPerf); if (summary == null) { summary = new OperationPerf(); summary.setOperation(""); } summary.add(operationPerf); } OperationPerfGroup(String transport, String status); String getTransport(); String getStatus... | OperationPerfGroup { public void addOperationPerf(OperationPerf operationPerf) { operationPerfs.add(operationPerf); if (summary == null) { summary = new OperationPerf(); summary.setOperation(""); } summary.add(operationPerf); } OperationPerfGroup(String transport, String status); String getTransport(); String getStatus... |
@Test public void testHandleOnSourceOnHandlerIndexIsGreaterThan0() throws Exception { Mockito.when(invocation.getContext(Const.SRC_MICROSERVICE)).thenReturn(null); Mockito.when(invocation.getHandlerIndex()).thenReturn(1); handler.handle(invocation, asyncResp); handler.handle(invocation, asyncResp); Mockito.verify(invoc... | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getContext(Const.SRC_MICROSERVICE); QpsStrategy qpsStra... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... |
@Test public void testHandle() throws Exception { Mockito.when(invocation.getContext(Const.SRC_MICROSERVICE)).thenReturn("test"); OperationMeta mockOperationMeta = QpsControllerManagerTest.getMockOperationMeta("pojo", "server", "opr"); Mockito.when(invocation.getOperationMeta()).thenReturn(mockOperationMeta); Mockito.w... | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getContext(Const.SRC_MICROSERVICE); QpsStrategy qpsStra... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... |
@Test public void testHandleIsLimitNewRequestAsFalse() throws Exception { Mockito.when(invocation.getContext(Const.SRC_MICROSERVICE)).thenReturn("test"); OperationMeta mockOperationMeta = QpsControllerManagerTest .getMockOperationMeta("pojo", "server", "opr"); Mockito.when(invocation.getOperationMeta()).thenReturn(mock... | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getContext(Const.SRC_MICROSERVICE); QpsStrategy qpsStra... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... | ProviderQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (invocation.getHandlerIndex() > 0) { invocation.next(asyncResp); return; } if (!Config.INSTANCE.isProviderEnabled()) { return; } String microserviceName = invocation.getC... |
@Test public void testGetOrCreate(@Mocked Invocation invocation, @Mocked OperationMeta operationMeta) { new Expectations() { { invocation.getOperationMeta(); result = operationMeta; invocation.getSchemaId(); result = "server"; operationMeta.getSchemaQualifiedName(); result = "server.test"; } }; QpsControllerManager tes... | public QpsStrategy getOrCreate(String microserviceName, Invocation invocation) { return qualifiedNameControllerMap .computeIfAbsent( microserviceName + SEPARATOR + invocation.getOperationMeta().getSchemaQualifiedName(), key -> create(key, microserviceName, invocation)); } | QpsControllerManager { public QpsStrategy getOrCreate(String microserviceName, Invocation invocation) { return qualifiedNameControllerMap .computeIfAbsent( microserviceName + SEPARATOR + invocation.getOperationMeta().getSchemaQualifiedName(), key -> create(key, microserviceName, invocation)); } } | QpsControllerManager { public QpsStrategy getOrCreate(String microserviceName, Invocation invocation) { return qualifiedNameControllerMap .computeIfAbsent( microserviceName + SEPARATOR + invocation.getOperationMeta().getSchemaQualifiedName(), key -> create(key, microserviceName, invocation)); } } | QpsControllerManager { public QpsStrategy getOrCreate(String microserviceName, Invocation invocation) { return qualifiedNameControllerMap .computeIfAbsent( microserviceName + SEPARATOR + invocation.getOperationMeta().getSchemaQualifiedName(), key -> create(key, microserviceName, invocation)); } QpsStrategy getOrCreate... | QpsControllerManager { public QpsStrategy getOrCreate(String microserviceName, Invocation invocation) { return qualifiedNameControllerMap .computeIfAbsent( microserviceName + SEPARATOR + invocation.getOperationMeta().getSchemaQualifiedName(), key -> create(key, microserviceName, invocation)); } QpsStrategy getOrCreate... |
@Test public void testQualifiedNameKey(@Mocked Invocation invocation, @Mocked OperationMeta operationMeta) { new Expectations() { { invocation.getOperationMeta(); result = operationMeta; invocation.getSchemaId(); result = "schema"; operationMeta.getSchemaQualifiedName(); result = "schema.opr"; } }; QpsControllerManager... | public QpsStrategy getOrCreate(String microserviceName, Invocation invocation) { return qualifiedNameControllerMap .computeIfAbsent( microserviceName + SEPARATOR + invocation.getOperationMeta().getSchemaQualifiedName(), key -> create(key, microserviceName, invocation)); } | QpsControllerManager { public QpsStrategy getOrCreate(String microserviceName, Invocation invocation) { return qualifiedNameControllerMap .computeIfAbsent( microserviceName + SEPARATOR + invocation.getOperationMeta().getSchemaQualifiedName(), key -> create(key, microserviceName, invocation)); } } | QpsControllerManager { public QpsStrategy getOrCreate(String microserviceName, Invocation invocation) { return qualifiedNameControllerMap .computeIfAbsent( microserviceName + SEPARATOR + invocation.getOperationMeta().getSchemaQualifiedName(), key -> create(key, microserviceName, invocation)); } } | QpsControllerManager { public QpsStrategy getOrCreate(String microserviceName, Invocation invocation) { return qualifiedNameControllerMap .computeIfAbsent( microserviceName + SEPARATOR + invocation.getOperationMeta().getSchemaQualifiedName(), key -> create(key, microserviceName, invocation)); } QpsStrategy getOrCreate... | QpsControllerManager { public QpsStrategy getOrCreate(String microserviceName, Invocation invocation) { return qualifiedNameControllerMap .computeIfAbsent( microserviceName + SEPARATOR + invocation.getOperationMeta().getSchemaQualifiedName(), key -> create(key, microserviceName, invocation)); } QpsStrategy getOrCreate... |
@Test public void testHandle() throws Exception { String key = "svc.schema.opr"; AbstractQpsStrategy qpsStrategy = new FixedWindowStrategy(); qpsStrategy.setKey("key"); qpsStrategy.setQpsLimit(12L); Mockito.when(invocation.getOperationMeta()).thenReturn(operationMeta); Mockito.when(operationMeta.getSchemaQualifiedName(... | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (!Config.INSTANCE.isConsumerEnabled()) { invocation.next(asyncResp); return; } QpsStrategy qpsStrategy = qpsControllerMgr.getOrCreate(invocation.getMicroserviceName(), invocation); if (qpsStrategy.isLimitNewRequest()) { C... | ConsumerQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (!Config.INSTANCE.isConsumerEnabled()) { invocation.next(asyncResp); return; } QpsStrategy qpsStrategy = qpsControllerMgr.getOrCreate(invocation.getMicroserviceName(), in... | ConsumerQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (!Config.INSTANCE.isConsumerEnabled()) { invocation.next(asyncResp); return; } QpsStrategy qpsStrategy = qpsControllerMgr.getOrCreate(invocation.getMicroserviceName(), in... | ConsumerQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (!Config.INSTANCE.isConsumerEnabled()) { invocation.next(asyncResp); return; } QpsStrategy qpsStrategy = qpsControllerMgr.getOrCreate(invocation.getMicroserviceName(), in... | ConsumerQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (!Config.INSTANCE.isConsumerEnabled()) { invocation.next(asyncResp); return; } QpsStrategy qpsStrategy = qpsControllerMgr.getOrCreate(invocation.getMicroserviceName(), in... |
@Test public void testHandleIsLimitNewRequestAsFalse() throws Exception { String key = "service.schema.id"; AbstractQpsStrategy qpsStrategy = new FixedWindowStrategy(); qpsStrategy.setKey("service"); qpsStrategy.setQpsLimit(12L); Mockito.when(invocation.getMicroserviceName()).thenReturn("service"); Mockito.when(invocat... | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (!Config.INSTANCE.isConsumerEnabled()) { invocation.next(asyncResp); return; } QpsStrategy qpsStrategy = qpsControllerMgr.getOrCreate(invocation.getMicroserviceName(), invocation); if (qpsStrategy.isLimitNewRequest()) { C... | ConsumerQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (!Config.INSTANCE.isConsumerEnabled()) { invocation.next(asyncResp); return; } QpsStrategy qpsStrategy = qpsControllerMgr.getOrCreate(invocation.getMicroserviceName(), in... | ConsumerQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (!Config.INSTANCE.isConsumerEnabled()) { invocation.next(asyncResp); return; } QpsStrategy qpsStrategy = qpsControllerMgr.getOrCreate(invocation.getMicroserviceName(), in... | ConsumerQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (!Config.INSTANCE.isConsumerEnabled()) { invocation.next(asyncResp); return; } QpsStrategy qpsStrategy = qpsControllerMgr.getOrCreate(invocation.getMicroserviceName(), in... | ConsumerQpsFlowControlHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception { if (!Config.INSTANCE.isConsumerEnabled()) { invocation.next(asyncResp); return; } QpsStrategy qpsStrategy = qpsControllerMgr.getOrCreate(invocation.getMicroserviceName(), in... |
@Test public void injectFaultVertxDelay() throws InterruptedException { ArchaiusUtils .setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.delay.fixedDelay", "10"); ArchaiusUtils .setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.delay.percent", "100"); assert... | @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fault inject handler"); long delay = ... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... |
@Test public void injectFaultSystemDelay() throws InterruptedException { ArchaiusUtils .setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.delay.fixedDelay", "10"); ArchaiusUtils .setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.delay.percent", "100"); asser... | @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fault inject handler"); long delay = ... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... |
@Test public void injectFaultNotDelay() throws InterruptedException { ArchaiusUtils .setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.delay.fixedDelay", "10"); ArchaiusUtils.setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.delay.percent", "0"); assertEqual... | @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fault inject handler"); long delay = ... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... |
@Test public void testToString() { PerfInfo perf = new PerfInfo(); perf.setTps(10); perf.setMsTotalTime(10); perf.setMsMaxLatency(100); Assert.assertEquals("PerfInfo [tps=10.0, msTotalTime=10.0, msLatency=1.0, msMaxLatency=100.0]", perf.toString()); } | @Override public String toString() { return "PerfInfo [tps=" + tps + ", msTotalTime=" + msTotalTime + ", msLatency=" + calcMsLatency() + ", msMaxLatency=" + msMaxLatency + "]"; } | PerfInfo { @Override public String toString() { return "PerfInfo [tps=" + tps + ", msTotalTime=" + msTotalTime + ", msLatency=" + calcMsLatency() + ", msMaxLatency=" + msMaxLatency + "]"; } } | PerfInfo { @Override public String toString() { return "PerfInfo [tps=" + tps + ", msTotalTime=" + msTotalTime + ", msLatency=" + calcMsLatency() + ", msMaxLatency=" + msMaxLatency + "]"; } } | PerfInfo { @Override public String toString() { return "PerfInfo [tps=" + tps + ", msTotalTime=" + msTotalTime + ", msLatency=" + calcMsLatency() + ", msMaxLatency=" + msMaxLatency + "]"; } double getTps(); void setTps(double tps); double getMsTotalTime(); void setMsTotalTime(double msTotalTime); double getMsMaxLatenc... | PerfInfo { @Override public String toString() { return "PerfInfo [tps=" + tps + ", msTotalTime=" + msTotalTime + ", msLatency=" + calcMsLatency() + ", msMaxLatency=" + msMaxLatency + "]"; } double getTps(); void setTps(double tps); double getMsTotalTime(); void setMsTotalTime(double msTotalTime); double getMsMaxLatenc... |
@Test public void injectFaultNoPercentageConfig() { ArchaiusUtils .setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.delay.percent", null); assertNull(DynamicProperty .getInstance("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.delay.percent") .getString()); DelayFaul... | @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fault inject handler"); long delay = ... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... |
@Test public void injectFaultNoDelayMsConfig() { ArchaiusUtils .setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.delay.percent", "10"); assertEquals("10", DynamicProperty .getInstance("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.delay.percent") .getString()); Dela... | @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fault inject handler"); long delay = ... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... | DelayFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asynResponse) { if (!shouldDelay(invocation, faultParam, asynResponse)) { asynResponse.success(SUCCESS_RESPONSE); return; } LOGGER.debug("Fault injection: delay is added for the request by fa... |
@Test public void injectFaultError() { ArchaiusUtils .setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.abort.httpStatus", "421"); ArchaiusUtils .setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.abort.percent", "100"); assertEquals("421", DynamicProperty .g... | @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.httpStatus"); if (errorCode == Fault... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... |
@Test public void injectFaultNoError() { ArchaiusUtils .setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.abort.httpStatus", "421"); ArchaiusUtils.setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.abort.percent", "0"); assertEquals("421", DynamicProperty .ge... | @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.httpStatus"); if (errorCode == Fault... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... |
@Test public void injectFaultNoPercentageConfig() { ArchaiusUtils .setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.abort.percent", null); assertNull(DynamicProperty .getInstance("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.abort.percent") .getString()); AbortFaul... | @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.httpStatus"); if (errorCode == Fault... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... |
@Test public void injectFaultNoErrorCodeConfig() { ArchaiusUtils .setProperty("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.abort.percent", "10"); assertEquals("10", DynamicProperty .getInstance("servicecomb.governance.Consumer._global.policy.fault.protocols.rest.abort.percent") .getString()); Ab... | @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.httpStatus"); if (errorCode == Fault... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... | AbortFault extends AbstractFault { @Override public void injectFault(Invocation invocation, FaultParam faultParam, AsyncResponse asyncResponse) { if (!shouldAbort(invocation, faultParam)) { asyncResponse.success(SUCCESS_RESPONSE); return; } int errorCode = FaultInjectionUtil.getFaultInjectionConfig(invocation, "abort.h... |
@Test public void testResumeWithFallbackProvider() { Invocation invocation = Mockito.mock(Invocation.class); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()).thenReturn("test1"); HystrixCommandProperties... | @Override protected Observable<Response> resumeWithFallback() { Throwable cause = getFailedExecutionException(); Observable<Response> observable = Observable.create(f -> { try { f.onNext(FallbackPolicyManager.getFallbackResponse(type, cause, invocation)); f.onCompleted(); } catch (Exception e) { LOG.warn("fallback fail... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> resumeWithFallback() { Throwable cause = getFailedExecutionException(); Observable<Response> observable = Observable.create(f -> { try { f.onNext(FallbackPolicyManager.getFallbackResponse(type, cause, invocation)); f.... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> resumeWithFallback() { Throwable cause = getFailedExecutionException(); Observable<Response> observable = Observable.create(f -> { try { f.onNext(FallbackPolicyManager.getFallbackResponse(type, cause, invocation)); f.... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> resumeWithFallback() { Throwable cause = getFailedExecutionException(); Observable<Response> observable = Observable.create(f -> { try { f.onNext(FallbackPolicyManager.getFallbackResponse(type, cause, invocation)); f.... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> resumeWithFallback() { Throwable cause = getFailedExecutionException(); Observable<Response> observable = Observable.create(f -> { try { f.onNext(FallbackPolicyManager.getFallbackResponse(type, cause, invocation)); f.... |
@Test public void testConstructProvider() { Invocation invocation = Mockito.mock(Invocation.class); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()).thenReturn("test1"); HystrixCommandProperties.Setter s... | @Override protected Observable<Response> construct() { Observable<Response> observable = Observable.create(f -> { try { invocation.next(resp -> { if (isFailedResponse(resp)) { LOG.warn("bizkeeper command {} failed due to {}", invocation.getInvocationQualifiedName(), resp.getResult()); f.onError(resp.getResult()); Fallb... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> construct() { Observable<Response> observable = Observable.create(f -> { try { invocation.next(resp -> { if (isFailedResponse(resp)) { LOG.warn("bizkeeper command {} failed due to {}", invocation.getInvocationQualifie... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> construct() { Observable<Response> observable = Observable.create(f -> { try { invocation.next(resp -> { if (isFailedResponse(resp)) { LOG.warn("bizkeeper command {} failed due to {}", invocation.getInvocationQualifie... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> construct() { Observable<Response> observable = Observable.create(f -> { try { invocation.next(resp -> { if (isFailedResponse(resp)) { LOG.warn("bizkeeper command {} failed due to {}", invocation.getInvocationQualifie... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> construct() { Observable<Response> observable = Observable.create(f -> { try { invocation.next(resp -> { if (isFailedResponse(resp)) { LOG.warn("bizkeeper command {} failed due to {}", invocation.getInvocationQualifie... |
@Test public void testGetCacheKeyWithContextInitializedProvider() { Invocation invocation = Mockito.mock(Invocation.class); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()).thenReturn("test1"); HystrixCo... | @Override protected String getCacheKey() { if (HystrixRequestContext.isCurrentThreadInitialized()) { StringBuilder sb = new StringBuilder(); sb.append(this.getCommandGroup().name()); sb.append("-"); sb.append(this.getCommandKey().name()); return sb.toString(); } else { return super.getCacheKey(); } } | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected String getCacheKey() { if (HystrixRequestContext.isCurrentThreadInitialized()) { StringBuilder sb = new StringBuilder(); sb.append(this.getCommandGroup().name()); sb.append("-"); sb.append(this.getCommandKey().name()); return sb.toString(... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected String getCacheKey() { if (HystrixRequestContext.isCurrentThreadInitialized()) { StringBuilder sb = new StringBuilder(); sb.append(this.getCommandGroup().name()); sb.append("-"); sb.append(this.getCommandKey().name()); return sb.toString(... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected String getCacheKey() { if (HystrixRequestContext.isCurrentThreadInitialized()) { StringBuilder sb = new StringBuilder(); sb.append(this.getCommandGroup().name()); sb.append("-"); sb.append(this.getCommandKey().name()); return sb.toString(... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected String getCacheKey() { if (HystrixRequestContext.isCurrentThreadInitialized()) { StringBuilder sb = new StringBuilder(); sb.append(this.getCommandGroup().name()); sb.append("-"); sb.append(this.getCommandKey().name()); return sb.toString(... |
@Test public void testResumeWithFallbackConsumer() { Invocation invocation = Mockito.mock(Invocation.class); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()).thenReturn("test1"); HystrixCommandProperties... | @Override protected Observable<Response> resumeWithFallback() { Throwable cause = getFailedExecutionException(); Observable<Response> observable = Observable.create(f -> { try { f.onNext(FallbackPolicyManager.getFallbackResponse(type, cause, invocation)); f.onCompleted(); } catch (Exception e) { LOG.warn("fallback fail... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> resumeWithFallback() { Throwable cause = getFailedExecutionException(); Observable<Response> observable = Observable.create(f -> { try { f.onNext(FallbackPolicyManager.getFallbackResponse(type, cause, invocation)); f.... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> resumeWithFallback() { Throwable cause = getFailedExecutionException(); Observable<Response> observable = Observable.create(f -> { try { f.onNext(FallbackPolicyManager.getFallbackResponse(type, cause, invocation)); f.... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> resumeWithFallback() { Throwable cause = getFailedExecutionException(); Observable<Response> observable = Observable.create(f -> { try { f.onNext(FallbackPolicyManager.getFallbackResponse(type, cause, invocation)); f.... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> resumeWithFallback() { Throwable cause = getFailedExecutionException(); Observable<Response> observable = Observable.create(f -> { try { f.onNext(FallbackPolicyManager.getFallbackResponse(type, cause, invocation)); f.... |
@Test public void add() { Assert.assertTrue(opPerf.getStages().isEmpty()); OperationPerf otherOpPerf = Utils.createOperationPerf(op); opPerf.add(otherOpPerf); Assert.assertEquals(op, otherOpPerf.getOperation()); PerfInfo perfInfo = opPerf.findStage(MeterInvocationConst.STAGE_TOTAL); Assert.assertEquals(10, perfInfo.get... | public void add(OperationPerf operationPerf) { operationPerf.stages.forEach((key, value) -> { PerfInfo perfInfo = stages.computeIfAbsent(key, n -> new PerfInfo()); perfInfo.add(value); }); if (operationPerf.getLatencyDistribution() == null) { return; } if (latencyDistribution == null) { latencyDistribution = new Intege... | OperationPerf { public void add(OperationPerf operationPerf) { operationPerf.stages.forEach((key, value) -> { PerfInfo perfInfo = stages.computeIfAbsent(key, n -> new PerfInfo()); perfInfo.add(value); }); if (operationPerf.getLatencyDistribution() == null) { return; } if (latencyDistribution == null) { latencyDistribut... | OperationPerf { public void add(OperationPerf operationPerf) { operationPerf.stages.forEach((key, value) -> { PerfInfo perfInfo = stages.computeIfAbsent(key, n -> new PerfInfo()); perfInfo.add(value); }); if (operationPerf.getLatencyDistribution() == null) { return; } if (latencyDistribution == null) { latencyDistribut... | OperationPerf { public void add(OperationPerf operationPerf) { operationPerf.stages.forEach((key, value) -> { PerfInfo perfInfo = stages.computeIfAbsent(key, n -> new PerfInfo()); perfInfo.add(value); }); if (operationPerf.getLatencyDistribution() == null) { return; } if (latencyDistribution == null) { latencyDistribut... | OperationPerf { public void add(OperationPerf operationPerf) { operationPerf.stages.forEach((key, value) -> { PerfInfo perfInfo = stages.computeIfAbsent(key, n -> new PerfInfo()); perfInfo.add(value); }); if (operationPerf.getLatencyDistribution() == null) { return; } if (latencyDistribution == null) { latencyDistribut... |
@Test public void testConstructConsumer() { Invocation invocation = Mockito.mock(Invocation.class); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()).thenReturn("test1"); HystrixCommandProperties.Setter s... | @Override protected Observable<Response> construct() { Observable<Response> observable = Observable.create(f -> { try { invocation.next(resp -> { if (isFailedResponse(resp)) { LOG.warn("bizkeeper command {} failed due to {}", invocation.getInvocationQualifiedName(), resp.getResult()); f.onError(resp.getResult()); Fallb... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> construct() { Observable<Response> observable = Observable.create(f -> { try { invocation.next(resp -> { if (isFailedResponse(resp)) { LOG.warn("bizkeeper command {} failed due to {}", invocation.getInvocationQualifie... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> construct() { Observable<Response> observable = Observable.create(f -> { try { invocation.next(resp -> { if (isFailedResponse(resp)) { LOG.warn("bizkeeper command {} failed due to {}", invocation.getInvocationQualifie... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> construct() { Observable<Response> observable = Observable.create(f -> { try { invocation.next(resp -> { if (isFailedResponse(resp)) { LOG.warn("bizkeeper command {} failed due to {}", invocation.getInvocationQualifie... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected Observable<Response> construct() { Observable<Response> observable = Observable.create(f -> { try { invocation.next(resp -> { if (isFailedResponse(resp)) { LOG.warn("bizkeeper command {} failed due to {}", invocation.getInvocationQualifie... |
@Test public void testGetCacheKeyWithContextInitializedConsumer() { Invocation invocation = Mockito.mock(Invocation.class); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()).thenReturn("test1"); HystrixCo... | @Override protected String getCacheKey() { if (HystrixRequestContext.isCurrentThreadInitialized()) { StringBuilder sb = new StringBuilder(); sb.append(this.getCommandGroup().name()); sb.append("-"); sb.append(this.getCommandKey().name()); return sb.toString(); } else { return super.getCacheKey(); } } | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected String getCacheKey() { if (HystrixRequestContext.isCurrentThreadInitialized()) { StringBuilder sb = new StringBuilder(); sb.append(this.getCommandGroup().name()); sb.append("-"); sb.append(this.getCommandKey().name()); return sb.toString(... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected String getCacheKey() { if (HystrixRequestContext.isCurrentThreadInitialized()) { StringBuilder sb = new StringBuilder(); sb.append(this.getCommandGroup().name()); sb.append("-"); sb.append(this.getCommandKey().name()); return sb.toString(... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected String getCacheKey() { if (HystrixRequestContext.isCurrentThreadInitialized()) { StringBuilder sb = new StringBuilder(); sb.append(this.getCommandGroup().name()); sb.append("-"); sb.append(this.getCommandKey().name()); return sb.toString(... | BizkeeperCommand extends HystrixObservableCommand<Response> { @Override protected String getCacheKey() { if (HystrixRequestContext.isCurrentThreadInitialized()) { StringBuilder sb = new StringBuilder(); sb.append(this.getCommandGroup().name()); sb.append("-"); sb.append(this.getCommandKey().name()); return sb.toString(... |
@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("test1"); Assert.assertNotNull(invoc... | public static HystrixCommandGroupKey toHystrixCommandGroupKey(String type, Invocation invocation) { return CustomizeCommandGroupKey.asKey(type + "." + invocation.getOperationMeta().getMicroserviceQualifiedName(), invocation); } | CommandKey { public static HystrixCommandGroupKey toHystrixCommandGroupKey(String type, Invocation invocation) { return CustomizeCommandGroupKey.asKey(type + "." + invocation.getOperationMeta().getMicroserviceQualifiedName(), invocation); } } | CommandKey { public static HystrixCommandGroupKey toHystrixCommandGroupKey(String type, Invocation invocation) { return CustomizeCommandGroupKey.asKey(type + "." + invocation.getOperationMeta().getMicroserviceQualifiedName(), invocation); } private CommandKey(); } | CommandKey { public static HystrixCommandGroupKey toHystrixCommandGroupKey(String type, Invocation invocation) { return CustomizeCommandGroupKey.asKey(type + "." + invocation.getOperationMeta().getMicroserviceQualifiedName(), invocation); } private CommandKey(); static HystrixCommandGroupKey toHystrixCommandGroupKey(S... | CommandKey { public static HystrixCommandGroupKey toHystrixCommandGroupKey(String type, Invocation invocation) { return CustomizeCommandGroupKey.asKey(type + "." + invocation.getOperationMeta().getMicroserviceQualifiedName(), invocation); } private CommandKey(); static HystrixCommandGroupKey toHystrixCommandGroupKey(S... |
@Test public void testToHystrixCommandKey() { Invocation invocation = Mockito.mock(Invocation.class); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()).thenReturn("test1"); Assert.assertNotNull(invocation... | public static HystrixCommandKey toHystrixCommandKey(String type, Invocation invocation) { return HystrixCommandKey.Factory .asKey(type + "." + invocation.getOperationMeta().getMicroserviceQualifiedName()); } | CommandKey { public static HystrixCommandKey toHystrixCommandKey(String type, Invocation invocation) { return HystrixCommandKey.Factory .asKey(type + "." + invocation.getOperationMeta().getMicroserviceQualifiedName()); } } | CommandKey { public static HystrixCommandKey toHystrixCommandKey(String type, Invocation invocation) { return HystrixCommandKey.Factory .asKey(type + "." + invocation.getOperationMeta().getMicroserviceQualifiedName()); } private CommandKey(); } | CommandKey { public static HystrixCommandKey toHystrixCommandKey(String type, Invocation invocation) { return HystrixCommandKey.Factory .asKey(type + "." + invocation.getOperationMeta().getMicroserviceQualifiedName()); } private CommandKey(); static HystrixCommandGroupKey toHystrixCommandGroupKey(String type, Invocati... | CommandKey { public static HystrixCommandKey toHystrixCommandKey(String type, Invocation invocation) { return HystrixCommandKey.Factory .asKey(type + "." + invocation.getOperationMeta().getMicroserviceQualifiedName()); } private CommandKey(); static HystrixCommandGroupKey toHystrixCommandGroupKey(String type, Invocati... |
@Test public void testCreateBizkeeperCommand() { HystrixPlugins.reset(); ConsumerBizkeeperHandler consumerBizkeeperHandler = new ConsumerBizkeeperHandler(); Invocation invocation = Mockito.mock(Invocation.class); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(inv... | @Override protected BizkeeperCommand createBizkeeperCommand(Invocation invocation) { HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() .withRequestCacheEnabled(true) .withRequestLogEnabled(false); setCommonProperties(invocation, setter); BizkeeperCommand command = new ConsumerBizkeeperCommand(g... | ConsumerBizkeeperHandler extends BizkeeperHandler { @Override protected BizkeeperCommand createBizkeeperCommand(Invocation invocation) { HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() .withRequestCacheEnabled(true) .withRequestLogEnabled(false); setCommonProperties(invocation, setter); Bizke... | ConsumerBizkeeperHandler extends BizkeeperHandler { @Override protected BizkeeperCommand createBizkeeperCommand(Invocation invocation) { HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() .withRequestCacheEnabled(true) .withRequestLogEnabled(false); setCommonProperties(invocation, setter); Bizke... | ConsumerBizkeeperHandler extends BizkeeperHandler { @Override protected BizkeeperCommand createBizkeeperCommand(Invocation invocation) { HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() .withRequestCacheEnabled(true) .withRequestLogEnabled(false); setCommonProperties(invocation, setter); Bizke... | ConsumerBizkeeperHandler extends BizkeeperHandler { @Override protected BizkeeperCommand createBizkeeperCommand(Invocation invocation) { HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() .withRequestCacheEnabled(true) .withRequestLogEnabled(false); setCommonProperties(invocation, setter); Bizke... |
@Test public void testInitializeContext() { BizkeeperRequestContext bizkeeperRequestContext = BizkeeperRequestContext.initializeContext(); Assert.assertNotNull(bizkeeperRequestContext); } | public static BizkeeperRequestContext initializeContext() { return new BizkeeperRequestContext(HystrixRequestContext.initializeContext()); } | BizkeeperRequestContext { public static BizkeeperRequestContext initializeContext() { return new BizkeeperRequestContext(HystrixRequestContext.initializeContext()); } } | BizkeeperRequestContext { public static BizkeeperRequestContext initializeContext() { return new BizkeeperRequestContext(HystrixRequestContext.initializeContext()); } private BizkeeperRequestContext(HystrixRequestContext context); } | BizkeeperRequestContext { public static BizkeeperRequestContext initializeContext() { return new BizkeeperRequestContext(HystrixRequestContext.initializeContext()); } private BizkeeperRequestContext(HystrixRequestContext context); static BizkeeperRequestContext initializeContext(); void shutdown(); } | BizkeeperRequestContext { public static BizkeeperRequestContext initializeContext() { return new BizkeeperRequestContext(HystrixRequestContext.initializeContext()); } private BizkeeperRequestContext(HystrixRequestContext context); static BizkeeperRequestContext initializeContext(); void shutdown(); } |
@Test public void testShutdown() { BizkeeperRequestContext bizkeeperRequestContext = BizkeeperRequestContext.initializeContext(); boolean validAssert; try { bizkeeperRequestContext.shutdown(); validAssert = true; } catch (Exception e) { validAssert = false; } Assert.assertTrue(validAssert); } | public void shutdown() { this.context.shutdown(); } | BizkeeperRequestContext { public void shutdown() { this.context.shutdown(); } } | BizkeeperRequestContext { public void shutdown() { this.context.shutdown(); } private BizkeeperRequestContext(HystrixRequestContext context); } | BizkeeperRequestContext { public void shutdown() { this.context.shutdown(); } private BizkeeperRequestContext(HystrixRequestContext context); static BizkeeperRequestContext initializeContext(); void shutdown(); } | BizkeeperRequestContext { public void shutdown() { this.context.shutdown(); } private BizkeeperRequestContext(HystrixRequestContext context); static BizkeeperRequestContext initializeContext(); void shutdown(); } |
@Test public void testHandleWithException() { boolean validAssert; HystrixPlugins.reset(); try { validAssert = true; bizkeeperHandler.handle(invocation, asyncResp); } catch (Exception e) { validAssert = false; } Assert.assertFalse(validAssert); } | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn("catch error in bizkeeper:" + error.ge... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... |
@Test public void testHandle() { boolean validAssert; try { Assert.assertNotNull(bizkeeperHandler); Mockito.when(invocation.getMicroserviceName()).thenReturn("test1"); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQua... | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn("catch error in bizkeeper:" + error.ge... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... |
@Test public void testSetCommonProperties() { boolean validAssert; try { validAssert = true; HystrixPlugins.reset(); HystrixCommandProperties.Setter setter = Mockito.mock(HystrixCommandProperties.Setter.class); bizkeeperHandler.setCommonProperties(invocation, setter); } catch (Exception e) { validAssert = false; } Asse... | protected void setCommonProperties(Invocation invocation, HystrixCommandProperties.Setter setter) { } | BizkeeperHandler implements Handler { protected void setCommonProperties(Invocation invocation, HystrixCommandProperties.Setter setter) { } } | BizkeeperHandler implements Handler { protected void setCommonProperties(Invocation invocation, HystrixCommandProperties.Setter setter) { } BizkeeperHandler(String groupname); } | BizkeeperHandler implements Handler { protected void setCommonProperties(Invocation invocation, HystrixCommandProperties.Setter setter) { } BizkeeperHandler(String groupname); @Override void handle(Invocation invocation, AsyncResponse asyncResp); } | BizkeeperHandler implements Handler { protected void setCommonProperties(Invocation invocation, HystrixCommandProperties.Setter setter) { } BizkeeperHandler(String groupname); @Override void handle(Invocation invocation, AsyncResponse asyncResp); } |
@Test public void init_enabled_default() { Holder<Boolean> registered = new Holder<>(false); new MockUp<EventBus>(eventBus) { @Mock void register(Object object) { registered.value = true; } }; publisher.init(globalRegistry, eventBus, new MetricsBootstrapConfig()); Assert.assertFalse(registered.value); } | @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { if (!DynamicPropertyFactory.getInstance() .getBooleanProperty(ENABLED, false) .get()) { return; } initLatencyDistribution(); eventBus.register(this); } | DefaultLogPublisher implements MetricsInitializer { @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { if (!DynamicPropertyFactory.getInstance() .getBooleanProperty(ENABLED, false) .get()) { return; } initLatencyDistribution(); eventBus.register(this); } } | DefaultLogPublisher implements MetricsInitializer { @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { if (!DynamicPropertyFactory.getInstance() .getBooleanProperty(ENABLED, false) .get()) { return; } initLatencyDistribution(); eventBus.register(this); } } | DefaultLogPublisher implements MetricsInitializer { @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { if (!DynamicPropertyFactory.getInstance() .getBooleanProperty(ENABLED, false) .get()) { return; } initLatencyDistribution(); eventBus.register(this); } @Over... | DefaultLogPublisher implements MetricsInitializer { @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { if (!DynamicPropertyFactory.getInstance() .getBooleanProperty(ENABLED, false) .get()) { return; } initLatencyDistribution(); eventBus.register(this); } @Over... |
@Test public void testBadPublishAddress_BadPort() { thrown.expect(ServiceCombException.class); ArchaiusUtils.setProperty(PrometheusPublisher.METRICS_PROMETHEUS_ADDRESS, "localhost:xxxx"); publisher.init(globalRegistry, null, null); } | @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { this.globalRegistry = globalRegistry; String address = DynamicPropertyFactory.getInstance().getStringProperty(METRICS_PROMETHEUS_ADDRESS, "0.0.0.0:9696").get(); try { InetSocketAddress socketAddress = getSocket... | PrometheusPublisher extends Collector implements Collector.Describable, MetricsInitializer { @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { this.globalRegistry = globalRegistry; String address = DynamicPropertyFactory.getInstance().getStringProperty(METRICS... | PrometheusPublisher extends Collector implements Collector.Describable, MetricsInitializer { @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { this.globalRegistry = globalRegistry; String address = DynamicPropertyFactory.getInstance().getStringProperty(METRICS... | PrometheusPublisher extends Collector implements Collector.Describable, MetricsInitializer { @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { this.globalRegistry = globalRegistry; String address = DynamicPropertyFactory.getInstance().getStringProperty(METRICS... | PrometheusPublisher extends Collector implements Collector.Describable, MetricsInitializer { @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { this.globalRegistry = globalRegistry; String address = DynamicPropertyFactory.getInstance().getStringProperty(METRICS... |
@Test public void testHandleForceThrowException() throws Exception { Mockito.when(invocation.getMicroserviceName()).thenReturn("testHandleForceThrowException"); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedN... | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn("catch error in bizkeeper:" + error.ge... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... |
@Test public void testHandleForceReturnnull() throws Exception { Mockito.when(invocation.getMicroserviceName()).thenReturn("testHandleForceReturnnull"); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()) .... | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn("catch error in bizkeeper:" + error.ge... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... |
@Test public void testHandleInError() throws Exception { Mockito.when(invocation.getMicroserviceName()).thenReturn("testHandleInError"); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()) .thenReturn("test... | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn("catch error in bizkeeper:" + error.ge... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... |
@Test public void testHandlNextException() throws Exception { Mockito.when(invocation.getMicroserviceName()).thenReturn("testHandlNextException"); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()) .thenRe... | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn("catch error in bizkeeper:" + error.ge... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... |
@Test public void testHandleSuccess() throws Exception { Mockito.when(invocation.getMicroserviceName()).thenReturn("testHandleSuccess"); Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class)); Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName()) .thenReturn("test... | @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn("catch error in bizkeeper:" + error.ge... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... | BizkeeperHandler implements Handler { @Override public void handle(Invocation invocation, AsyncResponse asyncResp) { HystrixObservable<Response> command = delegate.createBizkeeperCommand(invocation); Observable<Response> observable = command.toObservable(); observable.subscribe(asyncResp::complete, error -> { LOG.warn(... |
@Test public void testConfiguration() { assertNotNull(Configuration.INSTANCE); assertEquals("returnnull", Configuration.FALLBACKPOLICY_POLICY_RETURN); assertEquals("throwexception", Configuration.FALLBACKPOLICY_POLICY_THROW); Configuration c = Configuration.INSTANCE; Invocation invocation = Mockito.mock(Invocation.clas... | private Configuration() { } | Configuration { private Configuration() { } } | Configuration { private Configuration() { } private Configuration(); } | Configuration { private Configuration() { } private Configuration(); int getIsolationTimeoutInMilliseconds(String type, String microserviceName,
String qualifiedOperationName); boolean getIsolationTimeoutEnabled(String type, String microserviceName,
String qualifiedOperationName); int getIsolationMaxConcur... | Configuration { private Configuration() { } private Configuration(); int getIsolationTimeoutInMilliseconds(String type, String microserviceName,
String qualifiedOperationName); boolean getIsolationTimeoutEnabled(String type, String microserviceName,
String qualifiedOperationName); int getIsolationMaxConcur... |
@Test public void testCreateBizkeeperException() { Assert.assertEquals("servicecomb.bizkeeper.fallback", BizkeeperExceptionUtils.SERVICECOMB_BIZKEEPER_FALLBACK); CseException cseException = BizkeeperExceptionUtils.createBizkeeperException("servicecomb.bizkeeper.fallback", new Throwable(), "ARGS"); Assert.assertNotNull(... | public static CseException createBizkeeperException(String code, Throwable cause, Object... args) { String msg = String.format(ERROR_DESC_MGR.ensureFindValue(code), args); return new CseException(code, msg, cause); } | BizkeeperExceptionUtils extends ExceptionUtils { public static CseException createBizkeeperException(String code, Throwable cause, Object... args) { String msg = String.format(ERROR_DESC_MGR.ensureFindValue(code), args); return new CseException(code, msg, cause); } } | BizkeeperExceptionUtils extends ExceptionUtils { public static CseException createBizkeeperException(String code, Throwable cause, Object... args) { String msg = String.format(ERROR_DESC_MGR.ensureFindValue(code), args); return new CseException(code, msg, cause); } private BizkeeperExceptionUtils(); } | BizkeeperExceptionUtils extends ExceptionUtils { public static CseException createBizkeeperException(String code, Throwable cause, Object... args) { String msg = String.format(ERROR_DESC_MGR.ensureFindValue(code), args); return new CseException(code, msg, cause); } private BizkeeperExceptionUtils(); static CseExceptio... | BizkeeperExceptionUtils extends ExceptionUtils { public static CseException createBizkeeperException(String code, Throwable cause, Object... args) { String msg = String.format(ERROR_DESC_MGR.ensureFindValue(code), args); return new CseException(code, msg, cause); } private BizkeeperExceptionUtils(); static CseExceptio... |
@Test public void testGetCommandPropertiesCacheKey() { assertNotNull(HystrixPropertiesStrategyExt.getInstance()); HystrixPropertiesStrategyExt hps = HystrixPropertiesStrategyExt.getInstance(); HystrixCommandKey commandKey = Mockito.mock(HystrixCommandKey.class); Invocation invocation = Mockito.mock(Invocation.class); M... | public static HystrixPropertiesStrategyExt getInstance() { return INSTANCE; } | HystrixPropertiesStrategyExt extends HystrixPropertiesStrategy { public static HystrixPropertiesStrategyExt getInstance() { return INSTANCE; } } | HystrixPropertiesStrategyExt extends HystrixPropertiesStrategy { public static HystrixPropertiesStrategyExt getInstance() { return INSTANCE; } private HystrixPropertiesStrategyExt(); } | HystrixPropertiesStrategyExt extends HystrixPropertiesStrategy { public static HystrixPropertiesStrategyExt getInstance() { return INSTANCE; } private HystrixPropertiesStrategyExt(); static HystrixPropertiesStrategyExt getInstance(); @Override HystrixCommandProperties getCommandProperties(HystrixCommandKey commandKey,... | HystrixPropertiesStrategyExt extends HystrixPropertiesStrategy { public static HystrixPropertiesStrategyExt getInstance() { return INSTANCE; } private HystrixPropertiesStrategyExt(); static HystrixPropertiesStrategyExt getInstance(); @Override HystrixCommandProperties getCommandProperties(HystrixCommandKey commandKey,... |
@Test public void testgetCommandProperties() { HystrixCommandKey commandKey = Mockito.mock(HystrixCommandKey.class); Mockito.when(commandKey.name()) .thenReturn("provider.HystrixPropertiesStrategyExtTest.testgetCommandProperties"); HystrixCommandProperties commandPro = HystrixPropertiesStrategyExt.getInstance() .getCom... | @Override public HystrixCommandProperties getCommandProperties(HystrixCommandKey commandKey, Setter builder) { HystrixCommandProperties commandProperties = commandPropertiesMap.get(commandKey.name()); if (commandProperties == null) { commandProperties = new HystrixCommandPropertiesExt(commandKey, builder); commandPrope... | HystrixPropertiesStrategyExt extends HystrixPropertiesStrategy { @Override public HystrixCommandProperties getCommandProperties(HystrixCommandKey commandKey, Setter builder) { HystrixCommandProperties commandProperties = commandPropertiesMap.get(commandKey.name()); if (commandProperties == null) { commandProperties = n... | HystrixPropertiesStrategyExt extends HystrixPropertiesStrategy { @Override public HystrixCommandProperties getCommandProperties(HystrixCommandKey commandKey, Setter builder) { HystrixCommandProperties commandProperties = commandPropertiesMap.get(commandKey.name()); if (commandProperties == null) { commandProperties = n... | HystrixPropertiesStrategyExt extends HystrixPropertiesStrategy { @Override public HystrixCommandProperties getCommandProperties(HystrixCommandKey commandKey, Setter builder) { HystrixCommandProperties commandProperties = commandPropertiesMap.get(commandKey.name()); if (commandProperties == null) { commandProperties = n... | HystrixPropertiesStrategyExt extends HystrixPropertiesStrategy { @Override public HystrixCommandProperties getCommandProperties(HystrixCommandKey commandKey, Setter builder) { HystrixCommandProperties commandProperties = commandPropertiesMap.get(commandKey.name()); if (commandProperties == null) { commandProperties = n... |
@Test public void testMarkEvent() { Mockito.when(commandKey.name()).thenReturn("Consumer.springmvc.springmvcHello.sayHi"); new Expectations(HystrixCommandMetrics.class) { { HystrixCommandMetrics.getInstance(commandKey); result = null; } }; circutBreakerEventNotifier.markEvent(HystrixEventType.SHORT_CIRCUITED, commandKe... | @Override public void markEvent(HystrixEventType eventType, HystrixCommandKey key) { String keyName = key.name(); AtomicBoolean flag = circuitFlag.computeIfAbsent(keyName, k -> new AtomicBoolean()); switch (eventType) { case SHORT_CIRCUITED: if (flag.compareAndSet(false, true)) { eventBus.post(new CircutBreakerEvent(ke... | CircutBreakerEventNotifier extends HystrixEventNotifier { @Override public void markEvent(HystrixEventType eventType, HystrixCommandKey key) { String keyName = key.name(); AtomicBoolean flag = circuitFlag.computeIfAbsent(keyName, k -> new AtomicBoolean()); switch (eventType) { case SHORT_CIRCUITED: if (flag.compareAndS... | CircutBreakerEventNotifier extends HystrixEventNotifier { @Override public void markEvent(HystrixEventType eventType, HystrixCommandKey key) { String keyName = key.name(); AtomicBoolean flag = circuitFlag.computeIfAbsent(keyName, k -> new AtomicBoolean()); switch (eventType) { case SHORT_CIRCUITED: if (flag.compareAndS... | CircutBreakerEventNotifier extends HystrixEventNotifier { @Override public void markEvent(HystrixEventType eventType, HystrixCommandKey key) { String keyName = key.name(); AtomicBoolean flag = circuitFlag.computeIfAbsent(keyName, k -> new AtomicBoolean()); switch (eventType) { case SHORT_CIRCUITED: if (flag.compareAndS... | CircutBreakerEventNotifier extends HystrixEventNotifier { @Override public void markEvent(HystrixEventType eventType, HystrixCommandKey key) { String keyName = key.name(); AtomicBoolean flag = circuitFlag.computeIfAbsent(keyName, k -> new AtomicBoolean()); switch (eventType) { case SHORT_CIRCUITED: if (flag.compareAndS... |
@Test public void init_enabled_true() { Holder<Boolean> registered = new Holder<>(); new MockUp<EventBus>(eventBus) { @Mock void register(Object object) { registered.value = true; } }; ArchaiusUtils.setProperty(DefaultLogPublisher.ENABLED, true); publisher.init(globalRegistry, eventBus, new MetricsBootstrapConfig()); A... | @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { if (!DynamicPropertyFactory.getInstance() .getBooleanProperty(ENABLED, false) .get()) { return; } initLatencyDistribution(); eventBus.register(this); } | DefaultLogPublisher implements MetricsInitializer { @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { if (!DynamicPropertyFactory.getInstance() .getBooleanProperty(ENABLED, false) .get()) { return; } initLatencyDistribution(); eventBus.register(this); } } | DefaultLogPublisher implements MetricsInitializer { @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { if (!DynamicPropertyFactory.getInstance() .getBooleanProperty(ENABLED, false) .get()) { return; } initLatencyDistribution(); eventBus.register(this); } } | DefaultLogPublisher implements MetricsInitializer { @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { if (!DynamicPropertyFactory.getInstance() .getBooleanProperty(ENABLED, false) .get()) { return; } initLatencyDistribution(); eventBus.register(this); } @Over... | DefaultLogPublisher implements MetricsInitializer { @Override public void init(GlobalRegistry globalRegistry, EventBus eventBus, MetricsBootstrapConfig config) { if (!DynamicPropertyFactory.getInstance() .getBooleanProperty(ENABLED, false) .get()) { return; } initLatencyDistribution(); eventBus.register(this); } @Over... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.