use of org.wso2.carbon.apimgt.api.dto.ConditionDTO in project carbon-apimgt by wso2.
the class APIUtilTest method testGetConditionDtoListWithHavingMultipleConditionTypes.
@Test
public void testGetConditionDtoListWithHavingMultipleConditionTypes() throws ParseException {
String base64EncodedString = "W3siaXBzcGVjaWZpYyI6eyJzcGVjaWZpY0lwIjoxNzQzMjcxODksImludmVydCI6ZmFsc2V9LCJoZW" + "FkZXIiOnsiaW52ZXJ0IjpmYWxzZSwidmFsdWVzIjp7ImFiYyI6ImRlZiJ9fSwiand0Y2xhaW1zIjp7ImludmVydCI6ZmFsc2UsI" + "nZhbHVlcyI6eyJhYmMiOiJkZWYifX19XQo=";
List<ConditionDto> conditionDtoList = APIUtil.extractConditionDto(base64EncodedString);
Assert.assertEquals(conditionDtoList.size(), 1);
ConditionDto conditionDto = conditionDtoList.get(0);
Assert.assertNotNull(conditionDto.getIpCondition());
Assert.assertNotNull(conditionDto.getHeaderConditions());
Assert.assertNotNull(conditionDto.getJwtClaimConditions());
Assert.assertEquals(conditionDto.getHeaderConditions().getValues().size(), 1);
Assert.assertEquals(conditionDto.getJwtClaimConditions().getValues().size(), 1);
}
use of org.wso2.carbon.apimgt.api.dto.ConditionDTO in project carbon-apimgt by wso2.
the class APIUtilTest method testGetConditionDtoListWithHavingHeaderConditionOnly.
@Test
public void testGetConditionDtoListWithHavingHeaderConditionOnly() throws ParseException {
String base64EncodedString = "W3siaGVhZGVyIjp7ImludmVydCI6ZmFsc2UsInZhbHVlcyI6eyJhYmMiOiJkZWYifX19XQo=";
List<ConditionDto> conditionDtoList = APIUtil.extractConditionDto(base64EncodedString);
Assert.assertEquals(conditionDtoList.size(), 1);
ConditionDto conditionDto = conditionDtoList.get(0);
Assert.assertNotNull(conditionDto.getHeaderConditions());
Assert.assertEquals(conditionDto.getHeaderConditions().getValues().size(), 1);
}
use of org.wso2.carbon.apimgt.api.dto.ConditionDTO in project carbon-apimgt by wso2.
the class APIUtilTest method testGetConditionDtoListWithHavingIPRangeConditionOnly.
@Test
public void testGetConditionDtoListWithHavingIPRangeConditionOnly() throws ParseException {
String base64EncodedString = "W3siaXByYW5nZSI6eyJzdGFydGluZ0lwIjoxNjg0MzAwOTAsImVuZGluZ0lwIjoxNjg0MzAwOTEsImludmVydCI6dHJ1ZX19XQ==";
List<ConditionDto> conditionDtoList = APIUtil.extractConditionDto(base64EncodedString);
Assert.assertEquals(conditionDtoList.size(), 1);
ConditionDto conditionDto = conditionDtoList.get(0);
Assert.assertNotNull(conditionDto.getIpRangeCondition());
Assert.assertTrue(conditionDto.getIpRangeCondition().isInvert());
}
use of org.wso2.carbon.apimgt.api.dto.ConditionDTO in project carbon-apimgt by wso2.
the class APIUtilTest method testGetConditionDtoListWithHavingJWTClaimConditionOnly.
@Test
public void testGetConditionDtoListWithHavingJWTClaimConditionOnly() throws ParseException {
String base64EncodedString = "W3siand0Y2xhaW1zIjp7ImludmVydCI6ZmFsc2UsInZhbHVlcyI6eyJhYmMiOiJkZWYifX19XQo=";
List<ConditionDto> conditionDtoList = APIUtil.extractConditionDto(base64EncodedString);
Assert.assertEquals(conditionDtoList.size(), 1);
ConditionDto conditionDto = conditionDtoList.get(0);
Assert.assertNotNull(conditionDto.getJwtClaimConditions());
Assert.assertEquals(conditionDto.getJwtClaimConditions().getValues().size(), 1);
}
use of org.wso2.carbon.apimgt.api.dto.ConditionDTO in project carbon-apimgt by wso2.
the class APIUtilTest method testGetConditionDtoListWithHavingIPSpecificConditionOnly.
@Test
public void testGetConditionDtoListWithHavingIPSpecificConditionOnly() throws ParseException {
String base64EncodedString = "W3siaXBzcGVjaWZpYyI6eyJzcGVjaWZpY0lwIjoxNjg0MzAwOTAsImludmVydCI6ZmFsc2V9fV0=";
List<ConditionDto> conditionDtoList = APIUtil.extractConditionDto(base64EncodedString);
Assert.assertEquals(conditionDtoList.size(), 1);
ConditionDto conditionDto = conditionDtoList.get(0);
Assert.assertNotNull(conditionDto.getIpCondition());
}
Aggregations