use of org.wso2.siddhi.core.util.transport.TemplateBuilder in project carbon-apimgt by wso2.
the class ThrottleTemplateBuilderTestCase method testSiddiQueryForApp.
@Test
public void testSiddiQueryForApp() throws APITemplateException {
ApplicationPolicy policy = SampleTestObjectCreator.createDefaultApplicationPolicy();
ApplicationThrottlePolicyTemplateBuilder templateBuilder = new ApplicationThrottlePolicyTemplateBuilder(policy);
String siddhiQuery = templateBuilder.getThrottlePolicyForAppLevel();
String sampleQuery = SampleTestObjectCreator.createDefaultSiddhiAppforAppPolicy();
Assert.assertEquals(siddhiQuery, sampleQuery);
}
use of org.wso2.siddhi.core.util.transport.TemplateBuilder in project carbon-apimgt by wso2.
the class ThrottleTemplateBuilderTestCase method testSiddhiQueryForAPIPolicy.
@Test
public void testSiddhiQueryForAPIPolicy() throws APITemplateException {
APIPolicy apiPolicy = SampleTestObjectCreator.createDefaultAPIPolicy();
APIThrottlePolicyTemplateBuilder templateBuilder = new APIThrottlePolicyTemplateBuilder(apiPolicy);
Map<String, String> siddhiQueryMap = templateBuilder.getThrottlePolicyTemplateForPipelines();
String actualQuery = siddhiQueryMap.get("resource_SampleAPIPolicy_condition_0");
String expectedQuery = SampleTestObjectCreator.createDefaultSiddhiAppForAPIThrottlePolicy();
Assert.assertEquals(actualQuery, expectedQuery);
}
use of org.wso2.siddhi.core.util.transport.TemplateBuilder in project carbon-apimgt by wso2.
the class ThrottleTemplateBuilderTestCase method testSiddhiQueryForSubscriptionPolicy.
@Test
public void testSiddhiQueryForSubscriptionPolicy() throws APITemplateException {
SubscriptionPolicy policy = SampleTestObjectCreator.createDefaultSubscriptionPolicy();
SubscriptionThrottlePolicyTemplateBuilder templateBuilder = new SubscriptionThrottlePolicyTemplateBuilder(policy);
String siddhiQuery = templateBuilder.getThrottlePolicyForSubscriptionLevel();
String sampleQuery = SampleTestObjectCreator.createDefaultSiddhiAppforSubscriptionPolicy();
Assert.assertEquals(siddhiQuery, sampleQuery);
}
use of org.wso2.siddhi.core.util.transport.TemplateBuilder in project carbon-apimgt by wso2.
the class ThrottleTemplateBuilderTestCase method testSiddhiQueryForCustomPolicy.
@Test
public void testSiddhiQueryForCustomPolicy() throws APITemplateException {
CustomPolicy policy = SampleTestObjectCreator.createDefaultCustomPolicy();
CustomThrottlePolicyTemplateBuilder templateBuilder = new CustomThrottlePolicyTemplateBuilder(policy);
String siddhiQuery = templateBuilder.getThrottlePolicyTemplateForCustomPolicy();
String sampleQuery = SampleTestObjectCreator.createDefaultCustomPolicySiddhiApp();
Assert.assertEquals(siddhiQuery, sampleQuery);
}
use of org.wso2.siddhi.core.util.transport.TemplateBuilder in project carbon-apimgt by wso2.
the class ThrottleTemplateBuilderTestCase method testSiddhiQueryForAPILevelDefaultConditions.
@Test
public void testSiddhiQueryForAPILevelDefaultConditions() throws APITemplateException {
APIPolicy apiPolicy = SampleTestObjectCreator.createDefaultAPIPolicy();
APIThrottlePolicyTemplateBuilder templateBuilder = new APIThrottlePolicyTemplateBuilder(apiPolicy);
String actualQuery = templateBuilder.getThrottlePolicyTemplateForAPILevelDefaultCondition();
String expectedQuery = SampleTestObjectCreator.createDefaultSiddhiAppForAPILevelDefaultThrottlePolicy();
Assert.assertEquals(actualQuery, expectedQuery);
}
Aggregations