use of org.apache.servicecomb.governance.marker.Matcher in project java-chassis by ServiceComb.
the class OperatorTest method test_compare_header_not_match.
@Test
public void test_compare_header_not_match() {
GovernanceRequest request = new GovernanceRequest();
Map<String, String> reqHeaders = new HashMap<>();
reqHeaders.put("header1", "100");
request.setHeaders(reqHeaders);
Matcher matcher = new Matcher();
Map<String, RawOperator> headers = new HashMap<>();
RawOperator header1 = new RawOperator();
header1.put("compare", ">1000");
headers.put("header1", header1);
matcher.setHeaders(headers);
Assert.assertFalse(requestProcessor.match(request, matcher));
header1 = new RawOperator();
header1.put("compare", ">=1000");
headers.put("header1", header1);
matcher.setHeaders(headers);
Assert.assertFalse(requestProcessor.match(request, matcher));
header1 = new RawOperator();
header1.put("compare", "<10");
headers.put("header1", header1);
matcher.setHeaders(headers);
Assert.assertFalse(requestProcessor.match(request, matcher));
header1 = new RawOperator();
header1.put("compare", "<=10");
headers.put("header1", header1);
matcher.setHeaders(headers);
Assert.assertFalse(requestProcessor.match(request, matcher));
header1 = new RawOperator();
header1.put("compare", "=200");
headers.put("header1", header1);
matcher.setHeaders(headers);
Assert.assertFalse(requestProcessor.match(request, matcher));
}
use of org.apache.servicecomb.governance.marker.Matcher in project java-chassis by ServiceComb.
the class OperatorTest method test_suffix_api_path_match.
@Test
public void test_suffix_api_path_match() {
GovernanceRequest request = new GovernanceRequest();
request.setUri("/api/bulkhead");
Matcher matcher = new Matcher();
RawOperator apiPath = new RawOperator();
apiPath.put("suffix", "/bulkhead");
matcher.setApiPath(apiPath);
Assert.assertTrue(requestProcessor.match(request, matcher));
}
use of org.apache.servicecomb.governance.marker.Matcher in project java-chassis by ServiceComb.
the class OperatorTest method test_header_low_case.
@Test
public void test_header_low_case() {
GovernanceRequest request = new GovernanceRequest();
Map<String, String> reqHeaders = new HashMap<>();
reqHeaders.put("hEadeR", "100");
request.setHeaders(reqHeaders);
Matcher matcher = new Matcher();
Map<String, RawOperator> headers = new HashMap<>();
RawOperator header1 = new RawOperator();
header1.put("compare", ">10");
headers.put("HeAder", header1);
matcher.setHeaders(headers);
Assert.assertTrue(requestProcessor.match(request, matcher));
}
use of org.apache.servicecomb.governance.marker.Matcher in project java-chassis by ServiceComb.
the class OperatorTest method test_suffix_api_path_not_match_null.
@Test
public void test_suffix_api_path_not_match_null() {
GovernanceRequest request = new GovernanceRequest();
request.setUri("/api/bulkhead");
Matcher matcher = new Matcher();
RawOperator apiPath = new RawOperator();
apiPath.put("suffix", null);
matcher.setApiPath(apiPath);
Assert.assertFalse(requestProcessor.match(request, matcher));
}
use of org.apache.servicecomb.governance.marker.Matcher in project java-chassis by ServiceComb.
the class OperatorTest method test_prefix_api_path_match.
@Test
public void test_prefix_api_path_match() {
GovernanceRequest request = new GovernanceRequest();
request.setUri("/bulkhead/hello");
Matcher matcher = new Matcher();
RawOperator apiPath = new RawOperator();
apiPath.put("prefix", "/bulkhead");
matcher.setApiPath(apiPath);
Assert.assertTrue(requestProcessor.match(request, matcher));
}
Aggregations