Search in sources :

Example 6 with JWTClaimsCondition

use of org.wso2.carbon.apimgt.core.models.policy.JWTClaimsCondition in project carbon-apimgt by wso2.

the class CommonThrottleMappingUtilTestCase method fromJWTConditionDtoToJWTConditionModelTest.

@Test(description = "Convert JWT Condition DTO to JWTCondition Model object")
public void fromJWTConditionDtoToJWTConditionModelTest() throws Exception {
    ThrottleConditionDTO throttleConditionDTO = new ThrottleConditionDTO();
    throttleConditionDTO.setType(PolicyConstants.JWT_CLAIMS_CONDITION_TYPE);
    JWTClaimsConditionDTO jwtClaimsConditionDTO = new JWTClaimsConditionDTO();
    jwtClaimsConditionDTO.setAttribute("testAttribute");
    jwtClaimsConditionDTO.setClaimUrl("http://wso2.org/claims");
    throttleConditionDTO.setJwtClaimsCondition(jwtClaimsConditionDTO);
    JWTClaimsCondition condition = (JWTClaimsCondition) CommonThrottleMappingUtil.fromDTOToCondition(throttleConditionDTO);
    Assert.assertNotNull(condition);
    assertEquals(condition.getAttribute(), "testAttribute");
    assertEquals(condition.getClaimUrl(), "http://wso2.org/claims");
}
Also used : JWTClaimsCondition(org.wso2.carbon.apimgt.core.models.policy.JWTClaimsCondition) Test(org.testng.annotations.Test)

Aggregations

JWTClaimsCondition (org.wso2.carbon.apimgt.core.models.policy.JWTClaimsCondition)5 ArrayList (java.util.ArrayList)2 BandwidthLimit (org.wso2.carbon.apimgt.core.models.policy.BandwidthLimit)2 Condition (org.wso2.carbon.apimgt.core.models.policy.Condition)2 HeaderCondition (org.wso2.carbon.apimgt.core.models.policy.HeaderCondition)2 IPCondition (org.wso2.carbon.apimgt.core.models.policy.IPCondition)2 Pipeline (org.wso2.carbon.apimgt.core.models.policy.Pipeline)2 QueryParameterCondition (org.wso2.carbon.apimgt.core.models.policy.QueryParameterCondition)2 QuotaPolicy (org.wso2.carbon.apimgt.core.models.policy.QuotaPolicy)2 RequestCountLimit (org.wso2.carbon.apimgt.core.models.policy.RequestCountLimit)2 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 Test (org.testng.annotations.Test)1 JWTClaimsConditionDTO (org.wso2.carbon.apimgt.rest.api.admin.dto.JWTClaimsConditionDTO)1 ThrottleConditionDTO (org.wso2.carbon.apimgt.rest.api.admin.dto.ThrottleConditionDTO)1