use of org.apache.servicecomb.governance.marker.operator.RawOperator in project java-chassis by ServiceComb.
the class OperatorTest method test_exact_api_path_match_header_not_match.
@Test
public void test_exact_api_path_match_header_not_match() {
GovernanceRequest request = new GovernanceRequest();
request.setUri("/bulkhead");
request.setMethod("GET");
Map<String, String> reqHeaders = new HashMap<>();
reqHeaders.put("header1", "value2");
request.setHeaders(reqHeaders);
Matcher matcher = new Matcher();
RawOperator apiPath = new RawOperator();
apiPath.put("exact", "/bulkhead");
matcher.setApiPath(apiPath);
matcher.setMethod(Arrays.asList("GET"));
Map<String, RawOperator> headers = new HashMap<>();
RawOperator header1 = new RawOperator();
header1.put("exact", "value1");
headers.put("header1", header1);
matcher.setHeaders(headers);
Assert.assertFalse(requestProcessor.match(request, matcher));
reqHeaders.clear();
request.setHeaders(reqHeaders);
Assert.assertFalse(requestProcessor.match(request, matcher));
}
use of org.apache.servicecomb.governance.marker.operator.RawOperator in project java-chassis by ServiceComb.
the class OperatorTest method test_exact_api_path_match.
@Test
public void test_exact_api_path_match() {
GovernanceRequest request = new GovernanceRequest();
request.setUri("/bulkhead");
Matcher matcher = new Matcher();
RawOperator apiPath = new RawOperator();
apiPath.put("exact", "/bulkhead");
matcher.setApiPath(apiPath);
Assert.assertTrue(requestProcessor.match(request, matcher));
}
use of org.apache.servicecomb.governance.marker.operator.RawOperator in project java-chassis by ServiceComb.
the class OperatorTest method test_unknown_operator.
@Test
public void test_unknown_operator() {
GovernanceRequest request = new GovernanceRequest();
request.setUri("/test");
Matcher matcher = new Matcher();
RawOperator apiPath = new RawOperator();
apiPath.put("unknown", "/test");
matcher.setApiPath(apiPath);
Assert.assertFalse(requestProcessor.match(request, matcher));
}
use of org.apache.servicecomb.governance.marker.operator.RawOperator in project incubator-servicecomb-java-chassis by apache.
the class OperatorTest method test_exact_api_path_match_header_match.
@Test
public void test_exact_api_path_match_header_match() {
GovernanceRequest request = new GovernanceRequest();
request.setUri("/bulkhead");
request.setMethod("GET");
Map<String, String> reqHeaders = new HashMap<>();
reqHeaders.put("header1", "value1");
request.setHeaders(reqHeaders);
Matcher matcher = new Matcher();
RawOperator apiPath = new RawOperator();
apiPath.put("exact", "/bulkhead");
matcher.setApiPath(apiPath);
matcher.setMethod(Arrays.asList("GET"));
Map<String, RawOperator> headers = new HashMap<>();
RawOperator header1 = new RawOperator();
header1.put("exact", "value1");
headers.put("header1", header1);
matcher.setHeaders(headers);
Assert.assertTrue(requestProcessor.match(request, matcher));
}
use of org.apache.servicecomb.governance.marker.operator.RawOperator in project incubator-servicecomb-java-chassis by apache.
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