Search in sources :

Example 1 with FixedTimeFrameAlgorithmMigrationStep

use of com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.FixedTimeFrameAlgorithmMigrationStep in project mule-migration-assistant by mulesoft.

the class FixedTimeAlgorithmMigrationStepTestCase method rateLimitPomContributionTest.

@Test
public void rateLimitPomContributionTest() throws Exception {
    FixedTimeFrameAlgorithmMigrationStep step = new FixedTimeFrameAlgorithmMigrationStep();
    step.setApplicationModel(appModel);
    Element element = createPolicy(1, FIXED_TIME_FRAME_ALGORITHM_TAG_NAME, false);
    step.execute(element, reportMock);
    PomModel pm = appModel.getPomModel().get();
    assertThat(pm.getDependencies().size(), is(2));
    Dependency policyTransformExtensionDependency = pm.getDependencies().get(1);
    assertThat(policyTransformExtensionDependency.getGroupId(), is(COM_MULESOFT_ANYPOINT_GROUP_ID));
    assertThat(policyTransformExtensionDependency.getArtifactId(), is(MULE_THROTTLING_EXTENSION_ARTIFACT_ID));
    assertThat(policyTransformExtensionDependency.getVersion(), is(notNullValue()));
    assertThat(policyTransformExtensionDependency.getClassifier(), is(MULE_PLUGIN_CLASSIFIER));
}
Also used : Element(org.jdom2.Element) PomModel(com.mulesoft.tools.migration.project.model.pom.PomModel) FixedTimeFrameAlgorithmMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.FixedTimeFrameAlgorithmMigrationStep) Dependency(com.mulesoft.tools.migration.project.model.pom.Dependency) Test(org.junit.Test)

Example 2 with FixedTimeFrameAlgorithmMigrationStep

use of com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.FixedTimeFrameAlgorithmMigrationStep in project mule-migration-assistant by mulesoft.

the class ThrottlingMigrationTask method getSteps.

@Override
public List<MigrationStep> getSteps() {
    FixedTimeFrameAlgorithmMigrationStep fixedTimeFrameAlgorithmMigrationStep = new FixedTimeFrameAlgorithmMigrationStep();
    fixedTimeFrameAlgorithmMigrationStep.setApplicationModel(getApplicationModel());
    SlaBasedAlgorithmMigrationStep slaBasedAlgorithmMigrationStep = new SlaBasedAlgorithmMigrationStep();
    slaBasedAlgorithmMigrationStep.setApplicationModel(getApplicationModel());
    List<MigrationStep> steps = new ArrayList<>();
    steps.add(fixedTimeFrameAlgorithmMigrationStep);
    steps.add(slaBasedAlgorithmMigrationStep);
    steps.add(new RateLimitTagMigrationStep());
    steps.add(new DelayResponseTagMigrationStep());
    steps.add(new DiscardResponseTagMigrationStep());
    steps.add(new PolicyTagMigrationStep());
    steps.add(new ThrottleTagMigrationStep());
    return steps;
}
Also used : RateLimitTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.RateLimitTagMigrationStep) DiscardResponseTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.DiscardResponseTagMigrationStep) PolicyTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.PolicyTagMigrationStep) FixedTimeFrameAlgorithmMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.FixedTimeFrameAlgorithmMigrationStep) DelayResponseTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.DelayResponseTagMigrationStep) ThrottleTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.ThrottleTagMigrationStep) SlaBasedAlgorithmMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.SlaBasedAlgorithmMigrationStep) MigrationStep(com.mulesoft.tools.migration.step.MigrationStep) RateLimitTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.RateLimitTagMigrationStep) DiscardResponseTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.DiscardResponseTagMigrationStep) ArrayList(java.util.ArrayList) DelayResponseTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.DelayResponseTagMigrationStep) FixedTimeFrameAlgorithmMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.FixedTimeFrameAlgorithmMigrationStep) PolicyTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.PolicyTagMigrationStep) ThrottleTagMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.ThrottleTagMigrationStep) SlaBasedAlgorithmMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.SlaBasedAlgorithmMigrationStep)

Example 3 with FixedTimeFrameAlgorithmMigrationStep

use of com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.FixedTimeFrameAlgorithmMigrationStep in project mule-migration-assistant by mulesoft.

the class FixedTimeAlgorithmMigrationStepTestCase method multipleRateLimitElements.

@Test
public void multipleRateLimitElements() {
    FixedTimeFrameAlgorithmMigrationStep step = new FixedTimeFrameAlgorithmMigrationStep();
    step.setApplicationModel(appModel);
    Element element = createPolicy(2, FIXED_TIME_FRAME_ALGORITHM_TAG_NAME, true);
    step.execute(element, reportMock);
    assertConfigElement(element, 2, true);
    assertOperationElements(element, 2, true);
    assertNamespaces(element);
    assertPolicyName(element);
}
Also used : Element(org.jdom2.Element) FixedTimeFrameAlgorithmMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.FixedTimeFrameAlgorithmMigrationStep) Test(org.junit.Test)

Example 4 with FixedTimeFrameAlgorithmMigrationStep

use of com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.FixedTimeFrameAlgorithmMigrationStep in project mule-migration-assistant by mulesoft.

the class FixedTimeAlgorithmMigrationStepTestCase method oneRateLimitElement.

@Test
public void oneRateLimitElement() {
    FixedTimeFrameAlgorithmMigrationStep step = new FixedTimeFrameAlgorithmMigrationStep();
    step.setApplicationModel(appModel);
    Element element = createPolicy(1, FIXED_TIME_FRAME_ALGORITHM_TAG_NAME, true);
    step.execute(element, reportMock);
    assertConfigElement(element, 1, true);
    assertOperationElements(element, 1, true);
    assertNamespaces(element);
    assertPolicyName(element);
}
Also used : Element(org.jdom2.Element) FixedTimeFrameAlgorithmMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.FixedTimeFrameAlgorithmMigrationStep) Test(org.junit.Test)

Example 5 with FixedTimeFrameAlgorithmMigrationStep

use of com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.FixedTimeFrameAlgorithmMigrationStep in project mule-migration-assistant by mulesoft.

the class FixedTimeAlgorithmMigrationStepTestCase method oneRateLimitElementSpikeControl.

@Test
public void oneRateLimitElementSpikeControl() {
    FixedTimeFrameAlgorithmMigrationStep step = new FixedTimeFrameAlgorithmMigrationStep();
    step.setApplicationModel(appModel);
    Element element = createPolicy(1, FIXED_TIME_FRAME_ALGORITHM_TAG_NAME, false);
    step.execute(element, reportMock);
    assertConfigElement(element, 1, false);
    assertOperationElements(element, 1, false);
    assertNamespaces(element);
    assertPolicyName(element);
}
Also used : Element(org.jdom2.Element) FixedTimeFrameAlgorithmMigrationStep(com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.FixedTimeFrameAlgorithmMigrationStep) Test(org.junit.Test)

Aggregations

FixedTimeFrameAlgorithmMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.FixedTimeFrameAlgorithmMigrationStep)6 Element (org.jdom2.Element)5 Test (org.junit.Test)5 DelayResponseTagMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.DelayResponseTagMigrationStep)1 DiscardResponseTagMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.DiscardResponseTagMigrationStep)1 PolicyTagMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.PolicyTagMigrationStep)1 RateLimitTagMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.RateLimitTagMigrationStep)1 SlaBasedAlgorithmMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.SlaBasedAlgorithmMigrationStep)1 ThrottleTagMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.throttling.ThrottleTagMigrationStep)1 Dependency (com.mulesoft.tools.migration.project.model.pom.Dependency)1 PomModel (com.mulesoft.tools.migration.project.model.pom.PomModel)1 MigrationStep (com.mulesoft.tools.migration.step.MigrationStep)1 ArrayList (java.util.ArrayList)1