Search in sources :

Example 1 with MULE_3_POLICY_NAMESPACE

use of com.mulesoft.tools.migration.library.gateway.steps.GatewayNamespaces.MULE_3_POLICY_NAMESPACE in project mule-migration-assistant by mulesoft.

the class AbstractThrottlingTestCase method createPolicy.

protected Element createPolicy(int rateLimitElements, String algorithmTagName, boolean isRateLimit) {
    Element policy = new Element(POLICY_TAG_NAME, MULE_3_POLICY_NAMESPACE);
    Element throttlingPolicy = new Element(POLICY_TAG_NAME, THROTTLING_GW_MULE_3_NAMESPACE);
    throttlingPolicy.addContent(isRateLimit ? getNewElement(DISCARD_RESPONSE_TAG_NAME) : getDelayResponseElement());
    Element algorithmElement = getNewElement(algorithmTagName);
    IntStream.range(0, rateLimitElements).mapToObj(i -> getRateLimitElement(String.valueOf(i))).forEach(algorithmElement::addContent);
    throttlingPolicy.addContent(algorithmElement);
    new Document().setRootElement(policy.addContent(throttlingPolicy));
    return algorithmElement;
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) IntStream(java.util.stream.IntStream) POLICY_TAG_NAME(com.mulesoft.tools.migration.library.gateway.TestConstants.POLICY_TAG_NAME) SOURCE_TAG_NAME(com.mulesoft.tools.migration.library.gateway.TestConstants.SOURCE_TAG_NAME) XSI_NAMESPACE(com.mulesoft.tools.migration.library.gateway.steps.GatewayNamespaces.XSI_NAMESPACE) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) Text(org.jdom2.Text) CONFIG(com.mulesoft.tools.migration.library.gateway.TestConstants.CONFIG) CoreMatchers.notNullValue(org.hamcrest.CoreMatchers.notNullValue) TRY_TAG_NAME(com.mulesoft.tools.migration.library.gateway.TestConstants.TRY_TAG_NAME) Document(org.jdom2.Document) STATUS_CODE(com.mulesoft.tools.migration.library.gateway.TestConstants.STATUS_CODE) Namespace(org.jdom2.Namespace) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) SET_RESPONSE_TAG_NAME(com.mulesoft.tools.migration.library.gateway.TestConstants.SET_RESPONSE_TAG_NAME) Path(java.nio.file.Path) PROXY_TAG_NAME(com.mulesoft.tools.migration.library.gateway.TestConstants.PROXY_TAG_NAME) Before(org.junit.Before) ProjectType(com.mulesoft.tools.migration.project.ProjectType) MigrationReport(com.mulesoft.tools.migration.step.category.MigrationReport) THROTTLING_GW_MULE_3_NAMESPACE(com.mulesoft.tools.migration.library.gateway.steps.GatewayNamespaces.THROTTLING_GW_MULE_3_NAMESPACE) FALSE(com.mulesoft.tools.migration.library.gateway.TestConstants.FALSE) MULE_3_POLICY_NAMESPACE(com.mulesoft.tools.migration.library.gateway.steps.GatewayNamespaces.MULE_3_POLICY_NAMESPACE) Mockito.verify(org.mockito.Mockito.verify) THROTTLING_MULE_4_NAMESPACE(com.mulesoft.tools.migration.library.gateway.steps.GatewayNamespaces.THROTTLING_MULE_4_NAMESPACE) Paths(java.nio.file.Paths) MULE_4_CORE_NAMESPACE_NO_PREFIX(com.mulesoft.tools.migration.library.gateway.steps.GatewayNamespaces.MULE_4_CORE_NAMESPACE_NO_PREFIX) HTTP_TRANSFORM_NAMESPACE(com.mulesoft.tools.migration.library.gateway.steps.GatewayNamespaces.HTTP_TRANSFORM_NAMESPACE) SCHEMA_LOCATION(com.mulesoft.tools.migration.library.gateway.TestConstants.SCHEMA_LOCATION) Mockito.mock(org.mockito.Mockito.mock) Element(org.jdom2.Element) Element(org.jdom2.Element) Document(org.jdom2.Document)

Aggregations

CONFIG (com.mulesoft.tools.migration.library.gateway.TestConstants.CONFIG)1 FALSE (com.mulesoft.tools.migration.library.gateway.TestConstants.FALSE)1 POLICY_TAG_NAME (com.mulesoft.tools.migration.library.gateway.TestConstants.POLICY_TAG_NAME)1 PROXY_TAG_NAME (com.mulesoft.tools.migration.library.gateway.TestConstants.PROXY_TAG_NAME)1 SCHEMA_LOCATION (com.mulesoft.tools.migration.library.gateway.TestConstants.SCHEMA_LOCATION)1 SET_RESPONSE_TAG_NAME (com.mulesoft.tools.migration.library.gateway.TestConstants.SET_RESPONSE_TAG_NAME)1 SOURCE_TAG_NAME (com.mulesoft.tools.migration.library.gateway.TestConstants.SOURCE_TAG_NAME)1 STATUS_CODE (com.mulesoft.tools.migration.library.gateway.TestConstants.STATUS_CODE)1 TRY_TAG_NAME (com.mulesoft.tools.migration.library.gateway.TestConstants.TRY_TAG_NAME)1 HTTP_TRANSFORM_NAMESPACE (com.mulesoft.tools.migration.library.gateway.steps.GatewayNamespaces.HTTP_TRANSFORM_NAMESPACE)1 MULE_3_POLICY_NAMESPACE (com.mulesoft.tools.migration.library.gateway.steps.GatewayNamespaces.MULE_3_POLICY_NAMESPACE)1 MULE_4_CORE_NAMESPACE_NO_PREFIX (com.mulesoft.tools.migration.library.gateway.steps.GatewayNamespaces.MULE_4_CORE_NAMESPACE_NO_PREFIX)1 THROTTLING_GW_MULE_3_NAMESPACE (com.mulesoft.tools.migration.library.gateway.steps.GatewayNamespaces.THROTTLING_GW_MULE_3_NAMESPACE)1 THROTTLING_MULE_4_NAMESPACE (com.mulesoft.tools.migration.library.gateway.steps.GatewayNamespaces.THROTTLING_MULE_4_NAMESPACE)1 XSI_NAMESPACE (com.mulesoft.tools.migration.library.gateway.steps.GatewayNamespaces.XSI_NAMESPACE)1 ProjectType (com.mulesoft.tools.migration.project.ProjectType)1 ApplicationModel (com.mulesoft.tools.migration.project.model.ApplicationModel)1 MigrationReport (com.mulesoft.tools.migration.step.category.MigrationReport)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1