use of org.apache.servicecomb.governance.marker.TrafficMarker in project java-chassis by ServiceComb.
the class GovernancePropertiesTest method test_match_properties_delete.
@Test
public void test_match_properties_delete() {
Map<String, TrafficMarker> markers = matchProperties.getParsedEntity();
Assert.assertEquals(4, markers.size());
dynamicValues.put("servicecomb.matchGroup.test", "matches:\n" + " - apiPath:\n" + " exact: \"/hello2\"\n" + " name: match0");
GovernanceEventManager.post(new GovernanceConfigurationChangedEvent(new HashSet<>(dynamicValues.keySet())));
markers = matchProperties.getParsedEntity();
Assert.assertEquals(5, markers.size());
tearDown();
markers = matchProperties.getParsedEntity();
Assert.assertEquals(4, markers.size());
}
use of org.apache.servicecomb.governance.marker.TrafficMarker in project incubator-servicecomb-java-chassis by apache.
the class GovernancePropertiesTest method test_match_properties_successfully_loaded.
@Test
public void test_match_properties_successfully_loaded() {
Map<String, TrafficMarker> markers = matchProperties.getParsedEntity();
Assert.assertEquals(4, markers.size());
TrafficMarker demoRateLimiting = markers.get("demo-rateLimiting");
List<Matcher> matchers = demoRateLimiting.getMatches();
Assert.assertEquals(1, matchers.size());
Matcher matcher = matchers.get(0);
Assert.assertEquals("/hello", matcher.getApiPath().get("exact"));
TrafficMarker demoBulkhead = markers.get("demo-bulkhead");
matchers = demoBulkhead.getMatches();
Assert.assertEquals(2, matchers.size());
matcher = matchers.get(0);
Assert.assertEquals("/bulkhead", matcher.getApiPath().get("exact"));
Assert.assertEquals("matchPath", matcher.getName());
}
use of org.apache.servicecomb.governance.marker.TrafficMarker in project incubator-servicecomb-java-chassis by apache.
the class GovernancePropertiesTest method test_match_properties_delete.
@Test
public void test_match_properties_delete() {
Map<String, TrafficMarker> markers = matchProperties.getParsedEntity();
Assert.assertEquals(4, markers.size());
dynamicValues.put("servicecomb.matchGroup.test", "matches:\n" + " - apiPath:\n" + " exact: \"/hello2\"\n" + " name: match0");
GovernanceEventManager.post(new GovernanceConfigurationChangedEvent(new HashSet<>(dynamicValues.keySet())));
markers = matchProperties.getParsedEntity();
Assert.assertEquals(5, markers.size());
tearDown();
markers = matchProperties.getParsedEntity();
Assert.assertEquals(4, markers.size());
}
use of org.apache.servicecomb.governance.marker.TrafficMarker in project java-chassis by ServiceComb.
the class MatchersServiceImpl method checkMatch.
@Override
public boolean checkMatch(GovernanceRequest governanceRequest, String key) {
Map<String, TrafficMarker> parsedEntity = matchProperties.getParsedEntity();
TrafficMarker trafficMarker = parsedEntity.get(key);
if (trafficMarker == null) {
return false;
}
return trafficMarker.checkMatch(governanceRequest, requestProcessor);
}
use of org.apache.servicecomb.governance.marker.TrafficMarker in project java-chassis by ServiceComb.
the class GovernancePropertiesTest method test_match_properties_successfully_loaded.
@Test
public void test_match_properties_successfully_loaded() {
Map<String, TrafficMarker> markers = matchProperties.getParsedEntity();
Assert.assertEquals(4, markers.size());
TrafficMarker demoRateLimiting = markers.get("demo-rateLimiting");
List<Matcher> matchers = demoRateLimiting.getMatches();
Assert.assertEquals(1, matchers.size());
Matcher matcher = matchers.get(0);
Assert.assertEquals("/hello", matcher.getApiPath().get("exact"));
TrafficMarker demoBulkhead = markers.get("demo-bulkhead");
matchers = demoBulkhead.getMatches();
Assert.assertEquals(2, matchers.size());
matcher = matchers.get(0);
Assert.assertEquals("/bulkhead", matcher.getApiPath().get("exact"));
Assert.assertEquals("matchPath", matcher.getName());
}
Aggregations