Skip to content

Commit

Permalink
Remove subscription burst control throttle test
Browse files Browse the repository at this point in the history
  • Loading branch information
nisan-abeywickrama committed Oct 13, 2024
1 parent 558cd0e commit 0f11d8b
Showing 1 changed file with 0 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -472,37 +472,6 @@ public void testMsgThrottleOutWhenCustomThrottlingLimitExceeded() {
throttleDataHolder.removeKeyTemplate("$user");
}

@Test
public void testMsgThrottleOutWhenHittingSubscriptionLevelSpike() {
ThrottleDataHolder throttleDataHolder = ThrottleDataHolder.getInstance();

ThrottleHandler throttleHandler = new ThrottlingHandlerWrapper(timer, throttleDataHolder, throttleEvaluator,
accessInformation);
throttleHandler.setSandboxMaxCount("100");
SynapseEnvironment synapseEnvironment = Mockito.mock(SynapseEnvironment.class);
throttleHandler.init(synapseEnvironment);

MessageContext messageContext = TestUtils.getMessageContextWithAuthContext(apiContext, apiVersion);
messageContext.setProperty(VERB_INFO_DTO, verbInfoDTO);
((Axis2MessageContext) messageContext).getAxis2MessageContext().getProperty(org.apache.axis2.context
.MessageContext.TRANSPORT_HEADERS);
AuthenticationContext authenticationContext = (AuthenticationContext) messageContext.getProperty
(API_AUTH_CONTEXT);
authenticationContext.setApiTier(throttlingTier);
authenticationContext.setKeyType("SANDBOX");
authenticationContext.setSpikeArrestLimit(100);
authenticationContext.setStopOnQuotaReach(true);

messageContext.setProperty(API_AUTH_CONTEXT, authenticationContext);

verbInfo.setConditionGroups(conditionGroupDTOs);
ArrayList<ConditionGroupDTO> matchingConditions = new ArrayList<>();
matchingConditions.add(conditionGroupDTO);
throttleDataHolder.addKeyTemplate("$user", "$user");
Mockito.when(accessInformation.isAccessAllowed()).thenReturn(false);
Assert.assertFalse(throttleHandler.handleRequest(messageContext));
}

@Test
public void testHandleResponse() {
ThrottleDataHolder throttleDataHolder = ThrottleDataHolder.getInstance();
Expand Down

0 comments on commit 0f11d8b

Please sign in to comment.