diff --git a/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVOrderFormModel.java b/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVOrderFormModel.java index e209f632..69aed9d8 100644 --- a/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVOrderFormModel.java +++ b/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVOrderFormModel.java @@ -3,7 +3,7 @@ public class RHVOrderFormModel { // RHVOrderForm - private Double year1RhvOrderSku; + private String year1RhvOrderSku; private Double year1RhvOrder; private Double year1RhvOrderConsult; private Double year1RhvOrderTAndE; @@ -21,13 +21,13 @@ public class RHVOrderFormModel private Double year1RhvOrderTAndETotalValue; private Double year1RhvOrderLearningSubsTotalValue; private Double year1RhvOrderGrandTotal; - private Double year2RhvOrderSku; + private String year2RhvOrderSku; private Double year2RhvOrder; private Double year2RhvOrderListValue; private Double year2RhvOrderDiscountValue; private Double year2RhvOrderTotalValue; private Double year2RhvOrderGrandTotal; - private Double year3RhvOrderSku; + private String year3RhvOrderSku; private Double year3RhvOrder; private Double year3RhvOrderListValue; private Double year3RhvOrderDiscountValue; @@ -36,11 +36,11 @@ public class RHVOrderFormModel public RHVOrderFormModel() {} - public Double getYear1RhvOrderSku() { + public String getYear1RhvOrderSku() { return year1RhvOrderSku; } - public void setYear1RhvOrderSku(Double year1RhvOrderSku) { + public void setYear1RhvOrderSku(String year1RhvOrderSku) { this.year1RhvOrderSku = year1RhvOrderSku; } @@ -180,11 +180,11 @@ public void setYear1RhvOrderGrandTotal(Double year1RhvOrderGrandTotal) { this.year1RhvOrderGrandTotal = year1RhvOrderGrandTotal; } - public Double getYear2RhvOrderSku() { + public String getYear2RhvOrderSku() { return year2RhvOrderSku; } - public void setYear2RhvOrderSku(Double year2RhvOrderSku) { + public void setYear2RhvOrderSku(String year2RhvOrderSku) { this.year2RhvOrderSku = year2RhvOrderSku; } @@ -228,11 +228,11 @@ public void setYear2RhvOrderGrandTotal(Double year2RhvOrderGrandTotal) { this.year2RhvOrderGrandTotal = year2RhvOrderGrandTotal; } - public Double getYear3RhvOrderSku() { + public String getYear3RhvOrderSku() { return year3RhvOrderSku; } - public void setYear3RhvOrderSku(Double year3RhvOrderSku) { + public void setYear3RhvOrderSku(String year3RhvOrderSku) { this.year3RhvOrderSku = year3RhvOrderSku; } diff --git a/src/main/resources/org/jboss/xavier/analytics/rules/initialcostsaving/RHVOrderForm.drl b/src/main/resources/org/jboss/xavier/analytics/rules/initialcostsaving/RHVOrderForm.drl new file mode 100644 index 00000000..f58a5661 --- /dev/null +++ b/src/main/resources/org/jboss/xavier/analytics/rules/initialcostsaving/RHVOrderForm.drl @@ -0,0 +1,148 @@ +package org.jboss.xavier.analytics.rules.initialcostsaving; + + +import org.jboss.xavier.analytics.pojo.support.initialcostsaving.PricingDataModel; +import org.jboss.xavier.analytics.pojo.output.RHVOrderFormModel +import org.jboss.xavier.analytics.pojo.output.EnvironmentModel +import org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel +import org.jboss.xavier.analytics.pojo.output.RHVYearByYearCostsModel +import org.jboss.xavier.analytics.pojo.output.RHVRampUpCostsModel + + + +import function org.jboss.xavier.analytics.functions.HelperFunctions.round; + + +dialect "java" +agenda-group "RHVOrderForm" +lock-on-active true + +rule "RHVOrderFormRules" + when + pricing : PricingDataModel( + rhvListValue != null, + rhvValue != null, + rhVirtListValue != null, + rhVirtValue != null, + rhvConsultValue != null, + rhvTAndEValue != null, + rhLearningSubsValue != null) + report : InitialSavingsEstimationReportModel( + environmentModel != null, + environmentModel.sourceProductIndicator != null, + rhvRampUpCostsModel != null, + rhvRampUpCostsModel.year1RhvPaidSubs != null, + rhvRampUpCostsModel.year1RhvPaidSubsGrowth != null, + rhvRampUpCostsModel.year2RhvPaidSubs != null, + rhvRampUpCostsModel.year2RhvPaidSubsGrowth != null, + rhvRampUpCostsModel.year3RhvPaidSubs != null, + rhvRampUpCostsModel.year3RhvPaidSubsGrowth != null) + then + RHVOrderFormModel rhvOrderFormModel = new RHVOrderFormModel(); + RHVRampUpCostsModel rhvRampUpCostsModel = report.getRhvRampUpCostsModel(); + boolean isVSphere = report.getEnvironmentModel().getSourceProductIndicator()==1; + //Year1 + boolean year1SubsNotPaid = rhvRampUpCostsModel.getYear1RhvPaidSubs()==0; + boolean noYear1PaidSubsGrowth = rhvRampUpCostsModel.getYear1RhvPaidSubsGrowth()==0; + if(year1SubsNotPaid && noYear1PaidSubsGrowth) + { + rhvOrderFormModel.setYear1RhvOrderSku(""); + rhvOrderFormModel.setYear1RhvOrder(0d); + rhvOrderFormModel.setYear1RhvOrderListValue(0d); + rhvOrderFormModel.setYear1RhvOrderDiscountValue(0d); + rhvOrderFormModel.setYear1RhvOrderTotalValue(0d); + } + else if( isVSphere) + { + rhvOrderFormModel.setYear1RhvOrderSku("RV0213787"); + rhvOrderFormModel.setYear1RhvOrder((double)round(rhvRampUpCostsModel.getYear1RhvPaidSubs() + rhvRampUpCostsModel.getYear1RhvPaidSubsGrowth())); + rhvOrderFormModel.setYear1RhvOrderListValue(pricing.getRhvListValue()); + rhvOrderFormModel.setYear1RhvOrderDiscountValue((1-pricing.getRhvValue())*pricing.getRhvListValue()); + rhvOrderFormModel.setYear1RhvOrderTotalValue(rhvOrderFormModel.getYear1RhvOrder()*rhvOrderFormModel.getYear1RhvOrderDiscountValue()); + } + else + { + rhvOrderFormModel.setYear1RhvOrderSku("RV00012"); + rhvOrderFormModel.setYear1RhvOrder((double)round(rhvRampUpCostsModel.getYear1RhvPaidSubs() + rhvRampUpCostsModel.getYear1RhvPaidSubsGrowth())); + rhvOrderFormModel.setYear1RhvOrderListValue(pricing.getRhVirtListValue()); + rhvOrderFormModel.setYear1RhvOrderDiscountValue((1-pricing.getRhVirtValue())*pricing.getRhVirtListValue()); + rhvOrderFormModel.setYear1RhvOrderTotalValue(rhvOrderFormModel.getYear1RhvOrder()*rhvOrderFormModel.getYear1RhvOrderDiscountValue()); + } + rhvOrderFormModel.setYear1RhvOrderConsult(pricing.getRhvConsultValue()/100); + rhvOrderFormModel.setYear1RhvOrderConsultListValue(100.0); + rhvOrderFormModel.setYear1RhvOrderConsultDiscountValue(100.0); + rhvOrderFormModel.setYear1RhvOrderConsultTotalValue(rhvOrderFormModel.getYear1RhvOrderConsult()*rhvOrderFormModel.getYear1RhvOrderConsultDiscountValue()); + rhvOrderFormModel.setYear1RhvOrderTAndE(1d); + rhvOrderFormModel.setYear1RhvOrderTAndEValue(pricing.getRhvTAndEValue()); + rhvOrderFormModel.setYear1RhvOrderTAndEDiscountValue(pricing.getRhvTAndEValue()); + rhvOrderFormModel.setYear1RhvOrderTAndETotalValue(rhvOrderFormModel.getYear1RhvOrderTAndE()*rhvOrderFormModel.getYear1RhvOrderTAndEDiscountValue()); + rhvOrderFormModel.setYear1RhvOrderLearningSubsListValue(7000d); + rhvOrderFormModel.setYear1RhvOrderLearningSubs(pricing.getRhLearningSubsValue()/rhvOrderFormModel.getYear1RhvOrderLearningSubsListValue()); + rhvOrderFormModel.setYear1RhvOrderLearningSubsDiscountValue(7000d); + rhvOrderFormModel.setYear1RhvOrderLearningSubsTotalValue(rhvOrderFormModel.getYear1RhvOrderLearningSubs()*rhvOrderFormModel.getYear1RhvOrderLearningSubsListValue()); + rhvOrderFormModel.setYear1RhvOrderGrandTotal(rhvOrderFormModel.getYear1RhvOrderTotalValue() + + rhvOrderFormModel.getYear1RhvOrderConsultTotalValue() + + rhvOrderFormModel.getYear1RhvOrderTAndETotalValue() + + rhvOrderFormModel.getYear1RhvOrderLearningSubsTotalValue()); + //Year2 + boolean year2SubsNotPaid = rhvRampUpCostsModel.getYear2RhvPaidSubs()==0; + boolean noYear2PaidSubsGrowth = rhvRampUpCostsModel.getYear2RhvPaidSubsGrowth()==0; + if(year2SubsNotPaid && noYear2PaidSubsGrowth) + { + rhvOrderFormModel.setYear2RhvOrderSku(""); + rhvOrderFormModel.setYear2RhvOrder(0d); + rhvOrderFormModel.setYear2RhvOrderListValue(0d); + rhvOrderFormModel.setYear2RhvOrderDiscountValue(0d); + rhvOrderFormModel.setYear2RhvOrderTotalValue(0d); + } + else if( isVSphere) + { + rhvOrderFormModel.setYear2RhvOrderSku("RV0213787"); + rhvOrderFormModel.setYear2RhvOrder((double)round(rhvRampUpCostsModel.getYear2RhvPaidSubs() + rhvRampUpCostsModel.getYear2RhvPaidSubsGrowth())); + rhvOrderFormModel.setYear2RhvOrderListValue(pricing.getRhvListValue()); + rhvOrderFormModel.setYear2RhvOrderDiscountValue((1-pricing.getRhvValue())*pricing.getRhvListValue()); + rhvOrderFormModel.setYear2RhvOrderTotalValue(rhvOrderFormModel.getYear2RhvOrder()*rhvOrderFormModel.getYear2RhvOrderDiscountValue()); + } + else + { + rhvOrderFormModel.setYear2RhvOrderSku("RV00012"); + rhvOrderFormModel.setYear2RhvOrder((double)round(rhvRampUpCostsModel.getYear2RhvPaidSubs() + rhvRampUpCostsModel.getYear2RhvPaidSubsGrowth())); + rhvOrderFormModel.setYear2RhvOrderListValue(pricing.getRhVirtListValue()); + rhvOrderFormModel.setYear2RhvOrderDiscountValue((1-pricing.getRhVirtValue())*pricing.getRhVirtListValue()); + rhvOrderFormModel.setYear2RhvOrderTotalValue(rhvOrderFormModel.getYear2RhvOrder()*rhvOrderFormModel.getYear2RhvOrderDiscountValue()); + } + rhvOrderFormModel.setYear2RhvOrderGrandTotal(rhvOrderFormModel.getYear2RhvOrderTotalValue()); + //Year3 + boolean year3SubsNotPaid = rhvRampUpCostsModel.getYear3RhvPaidSubs()==0; + boolean noYear3PaidSubsGrowth = rhvRampUpCostsModel.getYear3RhvPaidSubsGrowth()==0; + if(year3SubsNotPaid && noYear3PaidSubsGrowth) + { + rhvOrderFormModel.setYear3RhvOrderSku(""); + rhvOrderFormModel.setYear3RhvOrder(0d); + rhvOrderFormModel.setYear3RhvOrderListValue(0d); + rhvOrderFormModel.setYear3RhvOrderDiscountValue(0d); + rhvOrderFormModel.setYear3RhvOrderTotalValue(0d); + } + else if( isVSphere) + { + rhvOrderFormModel.setYear3RhvOrderSku("RV0213787"); + rhvOrderFormModel.setYear3RhvOrder((double)round(rhvRampUpCostsModel.getYear3RhvPaidSubs() + rhvRampUpCostsModel.getYear3RhvPaidSubsGrowth())); + rhvOrderFormModel.setYear3RhvOrderListValue(pricing.getRhvListValue()); + rhvOrderFormModel.setYear3RhvOrderDiscountValue((1-pricing.getRhvValue())*pricing.getRhvListValue()); + rhvOrderFormModel.setYear3RhvOrderTotalValue(rhvOrderFormModel.getYear3RhvOrder()*rhvOrderFormModel.getYear3RhvOrderDiscountValue()); + } + else + { + rhvOrderFormModel.setYear3RhvOrderSku("RV00012"); + rhvOrderFormModel.setYear3RhvOrder((double)round(rhvRampUpCostsModel.getYear3RhvPaidSubs() + rhvRampUpCostsModel.getYear3RhvPaidSubsGrowth())); + rhvOrderFormModel.setYear3RhvOrderListValue(pricing.getRhVirtListValue()); + rhvOrderFormModel.setYear3RhvOrderDiscountValue((1-pricing.getRhVirtValue())*pricing.getRhVirtListValue()); + rhvOrderFormModel.setYear3RhvOrderTotalValue(rhvOrderFormModel.getYear3RhvOrder()*rhvOrderFormModel.getYear3RhvOrderDiscountValue()); + } + rhvOrderFormModel.setYear3RhvOrderGrandTotal(rhvOrderFormModel.getYear3RhvOrderTotalValue()); + + modify(report) + { + setRhvOrderFormModel(rhvOrderFormModel) + } +end diff --git a/src/test/java/org/jboss/xavier/analytics/rules/initialcostsaving/InitialSavingsEstimationReportTest.java b/src/test/java/org/jboss/xavier/analytics/rules/initialcostsaving/InitialSavingsEstimationReportTest.java index 247f12b8..0d4b3f1d 100644 --- a/src/test/java/org/jboss/xavier/analytics/rules/initialcostsaving/InitialSavingsEstimationReportTest.java +++ b/src/test/java/org/jboss/xavier/analytics/rules/initialcostsaving/InitialSavingsEstimationReportTest.java @@ -1,14 +1,7 @@ package org.jboss.xavier.analytics.rules.initialcostsaving; import org.jboss.xavier.analytics.pojo.input.UploadFormInputDataModel; -import org.jboss.xavier.analytics.pojo.output.EnvironmentModel; -import org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel; -import org.jboss.xavier.analytics.pojo.output.RHVAdditionalContainerCapacityModel; -import org.jboss.xavier.analytics.pojo.output.RHVRampUpCostsModel; -import org.jboss.xavier.analytics.pojo.output.RHVSavingsModel; -import org.jboss.xavier.analytics.pojo.output.RHVYearByYearCostsModel; -import org.jboss.xavier.analytics.pojo.output.SourceCostsModel; -import org.jboss.xavier.analytics.pojo.output.SourceRampDownCostsModel; +import org.jboss.xavier.analytics.pojo.output.*; import org.jboss.xavier.analytics.pojo.support.initialcostsaving.PricingDataModel; import org.jboss.xavier.analytics.rules.BaseIntegrationTest; import org.jboss.xavier.analytics.test.Utils; @@ -39,7 +32,7 @@ public InitialSavingsEstimationReportTest() public void test_SourceNewELAIndicator_0() { // check that the numbers of rule from the DRL file is the number of rules loaded - Utils.checkLoadedRulesNumber(kieSession, "org.jboss.xavier.analytics.rules.initialcostsaving", 26); + Utils.checkLoadedRulesNumber(kieSession, "org.jboss.xavier.analytics.rules.initialcostsaving", 27); // create a Map with the facts (i.e. Objects) you want to put in the working memory Map facts = new HashMap<>(); @@ -71,7 +64,7 @@ public void test_SourceNewELAIndicator_0() Map results = Utils.executeCommandsAndGetResults(kieSession, commands); // check that the number of rules fired is what you expect - Assert.assertEquals(21, results.get(NUMBER_OF_FIRED_RULE_KEY)); + Assert.assertEquals(22, results.get(NUMBER_OF_FIRED_RULE_KEY)); // check the names of the rules fired are what you expect Utils.verifyRulesFiredNames(this.agendaEventListener, // Environment @@ -89,8 +82,9 @@ public void test_SourceNewELAIndicator_0() // RHVSavings "RHVSavingsRules", // RHVAdditionalContainerCapacity - "RHVAdditionalContainerCapacity" + "RHVAdditionalContainerCapacity", // RHVOrderForm + "RHVOrderFormRules" ); // retrieve the QueryResults that was available in the working memory from the results @@ -281,6 +275,43 @@ public void test_SourceNewELAIndicator_0() Assert.assertEquals(345210, model.getRhvContainerLikely(), 0); Assert.assertEquals(243960, model.getRhvContainerLow(), 0); // RHVOrderForm + RHVOrderFormModel rhvOrderFormModel = report.getRhvOrderFormModel(); + Assert.assertEquals("", rhvOrderFormModel.getYear1RhvOrderSku()); + Assert.assertEquals(0, rhvOrderFormModel.getYear1RhvOrder().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear1RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear1RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear1RhvOrderTotalValue().doubleValue(),0.1); + + + Assert.assertEquals(1000, rhvOrderFormModel.getYear1RhvOrderConsult().doubleValue(),0.1); + Assert.assertEquals(100, rhvOrderFormModel.getYear1RhvOrderConsultListValue().doubleValue(),0.1); + Assert.assertEquals(100, rhvOrderFormModel.getYear1RhvOrderConsultDiscountValue().doubleValue(),0.1); + Assert.assertEquals(100000, rhvOrderFormModel.getYear1RhvOrderConsultTotalValue().doubleValue(),0.1); + Assert.assertEquals(1, rhvOrderFormModel.getYear1RhvOrderTAndE().doubleValue(),0.1); + Assert.assertEquals(30000, rhvOrderFormModel.getYear1RhvOrderTAndEValue().doubleValue(),0.1); + Assert.assertEquals(30000, rhvOrderFormModel.getYear1RhvOrderTAndEDiscountValue().doubleValue(),0.1); + Assert.assertEquals(30000, rhvOrderFormModel.getYear1RhvOrderTAndETotalValue().doubleValue(),0.1); + Assert.assertEquals(7000, rhvOrderFormModel.getYear1RhvOrderLearningSubsListValue().doubleValue(),0.1); + Assert.assertEquals(4.28, rhvOrderFormModel.getYear1RhvOrderLearningSubs().doubleValue(),0.1); + Assert.assertEquals(7000, rhvOrderFormModel.getYear1RhvOrderLearningSubsDiscountValue().doubleValue(),0.1); + Assert.assertEquals(30000, rhvOrderFormModel.getYear1RhvOrderLearningSubsTotalValue().doubleValue(),0.1); + Assert.assertEquals(160000, rhvOrderFormModel.getYear1RhvOrderGrandTotal().doubleValue(),0.1); + + + Assert.assertEquals("RV0213787", rhvOrderFormModel.getYear2RhvOrderSku()); + Assert.assertEquals(620, rhvOrderFormModel.getYear2RhvOrder().doubleValue(),0.1); + Assert.assertEquals(1500, rhvOrderFormModel.getYear2RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(375, rhvOrderFormModel.getYear2RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(232500, rhvOrderFormModel.getYear2RhvOrderTotalValue().doubleValue(),0.1); + Assert.assertEquals(232500, rhvOrderFormModel.getYear2RhvOrderGrandTotal().doubleValue(),0.1); + + + Assert.assertEquals("RV0213787", rhvOrderFormModel.getYear3RhvOrderSku()); + Assert.assertEquals(864, rhvOrderFormModel.getYear3RhvOrder().doubleValue(),0.1); + Assert.assertEquals(1500, rhvOrderFormModel.getYear3RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(375, rhvOrderFormModel.getYear3RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(324000, rhvOrderFormModel.getYear3RhvOrderTotalValue().doubleValue(),0.1); + Assert.assertEquals(324000, rhvOrderFormModel.getYear3RhvOrderGrandTotal().doubleValue(),0.1); } @Test @Ignore diff --git a/src/test/java/org/jboss/xavier/analytics/rules/initialcostsaving/RHVOrderFormTest.java b/src/test/java/org/jboss/xavier/analytics/rules/initialcostsaving/RHVOrderFormTest.java new file mode 100644 index 00000000..6ea0de52 --- /dev/null +++ b/src/test/java/org/jboss/xavier/analytics/rules/initialcostsaving/RHVOrderFormTest.java @@ -0,0 +1,466 @@ +package org.jboss.xavier.analytics.rules.initialcostsaving; + +import org.jboss.xavier.analytics.pojo.output.EnvironmentModel; +import org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel; +import org.jboss.xavier.analytics.pojo.output.RHVOrderFormModel; +import org.jboss.xavier.analytics.pojo.output.RHVRampUpCostsModel; +import org.jboss.xavier.analytics.pojo.support.initialcostsaving.PricingDataModel; +import org.jboss.xavier.analytics.rules.BaseTest; +import org.jboss.xavier.analytics.test.Utils; +import org.junit.Assert; +import org.junit.Test; +import org.kie.api.command.Command; +import org.kie.api.io.ResourceType; +import org.kie.internal.command.CommandFactory; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class RHVOrderFormTest extends BaseTest +{ + public RHVOrderFormTest() + { + // provide the name of the DRL file you want to test + super("/org/jboss/xavier/analytics/rules/initialcostsaving/RHVOrderForm.drl", ResourceType.DRL); + } + + @Test + public void testVSphereNoSubsOrGrowth() + { + // check that the numbers of rule from the DRL file is the number of rules loaded + Utils.checkLoadedRulesNumber(kieSession, "org.jboss.xavier.analytics.rules.initialcostsaving", 1); + + // create a Map with the facts (i.e. Objects) you want to put in the working memory + Map facts = new HashMap<>(); + // always add a String fact with the name of the agenda group defined in the DRL file (e.g. "SourceCosts") + facts.put("agendaGroup", "RHVOrderForm"); + + // define the objects needed to define the "When" side of the test + PricingDataModel pricingDataModel = new PricingDataModel(); + pricingDataModel.setRhvConsultValue(288600.0); + pricingDataModel.setRhLearningSubsValue(28000.0); + pricingDataModel.setRhvTAndEValue(55000.0); + pricingDataModel.setRhvValue(0.73); + pricingDataModel.setRhvListValue(1498.0); + pricingDataModel.setRhVirtValue(0.40); + pricingDataModel.setRhVirtListValue(2798.0); + // and add each object to the Map + facts.put("pricingDataModel", pricingDataModel); + + EnvironmentModel environmentModel = new EnvironmentModel(); + environmentModel.setSourceProductIndicator(1); + + RHVRampUpCostsModel rhvRampUpCostsModel = new RHVRampUpCostsModel(); + rhvRampUpCostsModel.setYear1RhvPaidSubs(0); + rhvRampUpCostsModel.setYear1RhvPaidSubsGrowth(0); + rhvRampUpCostsModel.setYear2RhvPaidSubs(0); + rhvRampUpCostsModel.setYear2RhvPaidSubsGrowth(0); + rhvRampUpCostsModel.setYear3RhvPaidSubs(0); + rhvRampUpCostsModel.setYear3RhvPaidSubsGrowth(0); + + + InitialSavingsEstimationReportModel reportModel = new InitialSavingsEstimationReportModel(); + reportModel.setEnvironmentModel(environmentModel); + reportModel.setRhvRampUpCostsModel(rhvRampUpCostsModel); + // added to the facts Map + facts.put("reportModel", reportModel); + + // define the list of commands you want to be executed by Drools + List commands = new ArrayList<>(); + // first generate and add all of the facts created above + commands.addAll(Utils.newInsertCommands(facts)); + // then generate the 'fireAllRules' command + commands.add(CommandFactory.newFireAllRules(NUMBER_OF_FIRED_RULE_KEY)); + // last create the command to retrieve the objects available in + // the working memory at the end of the rules' execution + commands.add(CommandFactory.newGetObjects(GET_OBJECTS_KEY)); + + // execute the commands in the KIE session and get the results + Map results = Utils.executeCommandsAndGetResults(kieSession, commands); + + // check that the number of rules fired is what you expect + Assert.assertEquals(2, results.get(NUMBER_OF_FIRED_RULE_KEY)); + + // retrieve the List of Objects that were available in the working memory from the results + List objects = (List) results.get((GET_OBJECTS_KEY)); + // filter the type of object you're interested in checking (e.g. InitialSavingsEstimationReportModel) + List reports = objects.stream() + .filter(object -> object instanceof InitialSavingsEstimationReportModel) + .map(object -> (InitialSavingsEstimationReportModel) object) + .collect(Collectors.toList()); + + // Check that the number of object is the right one (in this case, there must be just one report) + Assert.assertEquals(1, reports.size()); + + // Check that the object has exactly the fields that the rule tested should add/change + InitialSavingsEstimationReportModel report = reports.get(0); + RHVOrderFormModel rhvOrderFormModel = report.getRhvOrderFormModel(); + Assert.assertEquals("", rhvOrderFormModel.getYear1RhvOrderSku()); + Assert.assertEquals(0, rhvOrderFormModel.getYear1RhvOrder().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear1RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear1RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear1RhvOrderTotalValue().doubleValue(),0.1); + + + Assert.assertEquals(2886, rhvOrderFormModel.getYear1RhvOrderConsult().doubleValue(),0.1); + Assert.assertEquals(100, rhvOrderFormModel.getYear1RhvOrderConsultListValue().doubleValue(),0.1); + Assert.assertEquals(100, rhvOrderFormModel.getYear1RhvOrderConsultDiscountValue().doubleValue(),0.1); + Assert.assertEquals(288600, rhvOrderFormModel.getYear1RhvOrderConsultTotalValue().doubleValue(),0.1); + Assert.assertEquals(1, rhvOrderFormModel.getYear1RhvOrderTAndE().doubleValue(),0.1); + Assert.assertEquals(55000, rhvOrderFormModel.getYear1RhvOrderTAndEValue().doubleValue(),0.1); + Assert.assertEquals(55000, rhvOrderFormModel.getYear1RhvOrderTAndEDiscountValue().doubleValue(),0.1); + Assert.assertEquals(55000, rhvOrderFormModel.getYear1RhvOrderTAndETotalValue().doubleValue(),0.1); + Assert.assertEquals(7000, rhvOrderFormModel.getYear1RhvOrderLearningSubsListValue().doubleValue(),0.1); + Assert.assertEquals(4, rhvOrderFormModel.getYear1RhvOrderLearningSubs().doubleValue(),0.1); + Assert.assertEquals(7000, rhvOrderFormModel.getYear1RhvOrderLearningSubsDiscountValue().doubleValue(),0.1); + Assert.assertEquals(28000, rhvOrderFormModel.getYear1RhvOrderLearningSubsTotalValue().doubleValue(),0.1); + Assert.assertEquals(371600, rhvOrderFormModel.getYear1RhvOrderGrandTotal().doubleValue(),0.1); + + + Assert.assertEquals("", rhvOrderFormModel.getYear2RhvOrderSku()); + Assert.assertEquals(0, rhvOrderFormModel.getYear2RhvOrder().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear2RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear2RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear2RhvOrderTotalValue().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear2RhvOrderGrandTotal().doubleValue(),0.1); + + + Assert.assertEquals("", rhvOrderFormModel.getYear3RhvOrderSku()); + Assert.assertEquals(0, rhvOrderFormModel.getYear3RhvOrder().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear3RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear3RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear3RhvOrderTotalValue().doubleValue(),0.1); + Assert.assertEquals(0, rhvOrderFormModel.getYear3RhvOrderGrandTotal().doubleValue(),0.1); + + } + + @Test + public void testVSpherePaidSubs() + { +// check that the numbers of rule from the DRL file is the number of rules loaded + Utils.checkLoadedRulesNumber(kieSession, "org.jboss.xavier.analytics.rules.initialcostsaving", 1); + + // create a Map with the facts (i.e. Objects) you want to put in the working memory + Map facts = new HashMap<>(); + // always add a String fact with the name of the agenda group defined in the DRL file (e.g. "SourceCosts") + facts.put("agendaGroup", "RHVOrderForm"); + + // define the objects needed to define the "When" side of the test + PricingDataModel pricingDataModel = new PricingDataModel(); + pricingDataModel.setRhvConsultValue(288600.0); + pricingDataModel.setRhLearningSubsValue(28000.0); + pricingDataModel.setRhvTAndEValue(55000.0); + pricingDataModel.setRhvValue(0.73); + pricingDataModel.setRhvListValue(1498.0); + pricingDataModel.setRhVirtValue(0.40); + pricingDataModel.setRhVirtListValue(2798.0); + // and add each object to the Map + facts.put("pricingDataModel", pricingDataModel); + + EnvironmentModel environmentModel = new EnvironmentModel(); + environmentModel.setSourceProductIndicator(1); + + RHVRampUpCostsModel rhvRampUpCostsModel = new RHVRampUpCostsModel(); + rhvRampUpCostsModel.setYear1RhvPaidSubs(250); + rhvRampUpCostsModel.setYear1RhvPaidSubsGrowth(25); + rhvRampUpCostsModel.setYear2RhvPaidSubs(400); + rhvRampUpCostsModel.setYear2RhvPaidSubsGrowth(51); + rhvRampUpCostsModel.setYear3RhvPaidSubs(500); + rhvRampUpCostsModel.setYear3RhvPaidSubsGrowth(79); + + + InitialSavingsEstimationReportModel reportModel = new InitialSavingsEstimationReportModel(); + reportModel.setEnvironmentModel(environmentModel); + reportModel.setRhvRampUpCostsModel(rhvRampUpCostsModel); + // added to the facts Map + facts.put("reportModel", reportModel); + + // define the list of commands you want to be executed by Drools + List commands = new ArrayList<>(); + // first generate and add all of the facts created above + commands.addAll(Utils.newInsertCommands(facts)); + // then generate the 'fireAllRules' command + commands.add(CommandFactory.newFireAllRules(NUMBER_OF_FIRED_RULE_KEY)); + // last create the command to retrieve the objects available in + // the working memory at the end of the rules' execution + commands.add(CommandFactory.newGetObjects(GET_OBJECTS_KEY)); + + // execute the commands in the KIE session and get the results + Map results = Utils.executeCommandsAndGetResults(kieSession, commands); + + // check that the number of rules fired is what you expect + Assert.assertEquals(2, results.get(NUMBER_OF_FIRED_RULE_KEY)); + + // retrieve the List of Objects that were available in the working memory from the results + List objects = (List) results.get((GET_OBJECTS_KEY)); + // filter the type of object you're interested in checking (e.g. InitialSavingsEstimationReportModel) + List reports = objects.stream() + .filter(object -> object instanceof InitialSavingsEstimationReportModel) + .map(object -> (InitialSavingsEstimationReportModel) object) + .collect(Collectors.toList()); + + // Check that the number of object is the right one (in this case, there must be just one report) + Assert.assertEquals(1, reports.size()); + + // Check that the object has exactly the fields that the rule tested should add/change + InitialSavingsEstimationReportModel report = reports.get(0); + RHVOrderFormModel rhvOrderFormModel = report.getRhvOrderFormModel(); + Assert.assertEquals("RV0213787", rhvOrderFormModel.getYear1RhvOrderSku()); + Assert.assertEquals(275, rhvOrderFormModel.getYear1RhvOrder().doubleValue(),0.1); + Assert.assertEquals(1498, rhvOrderFormModel.getYear1RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(404.46, rhvOrderFormModel.getYear1RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(111226.5, rhvOrderFormModel.getYear1RhvOrderTotalValue().doubleValue(),0.1); + + + Assert.assertEquals(2886, rhvOrderFormModel.getYear1RhvOrderConsult().doubleValue(),0.1); + Assert.assertEquals(100, rhvOrderFormModel.getYear1RhvOrderConsultListValue().doubleValue(),0.1); + Assert.assertEquals(100, rhvOrderFormModel.getYear1RhvOrderConsultDiscountValue().doubleValue(),0.1); + Assert.assertEquals(288600, rhvOrderFormModel.getYear1RhvOrderConsultTotalValue().doubleValue(),0.1); + Assert.assertEquals(1, rhvOrderFormModel.getYear1RhvOrderTAndE().doubleValue(),0.1); + Assert.assertEquals(55000, rhvOrderFormModel.getYear1RhvOrderTAndEValue().doubleValue(),0.1); + Assert.assertEquals(55000, rhvOrderFormModel.getYear1RhvOrderTAndEDiscountValue().doubleValue(),0.1); + Assert.assertEquals(55000, rhvOrderFormModel.getYear1RhvOrderTAndETotalValue().doubleValue(),0.1); + Assert.assertEquals(7000, rhvOrderFormModel.getYear1RhvOrderLearningSubsListValue().doubleValue(),0.1); + Assert.assertEquals(4, rhvOrderFormModel.getYear1RhvOrderLearningSubs().doubleValue(),0.1); + Assert.assertEquals(7000, rhvOrderFormModel.getYear1RhvOrderLearningSubsDiscountValue().doubleValue(),0.1); + Assert.assertEquals(28000, rhvOrderFormModel.getYear1RhvOrderLearningSubsTotalValue().doubleValue(),0.1); + Assert.assertEquals(482826.5, rhvOrderFormModel.getYear1RhvOrderGrandTotal().doubleValue(),0.1); + + + Assert.assertEquals("RV0213787", rhvOrderFormModel.getYear2RhvOrderSku()); + Assert.assertEquals(451, rhvOrderFormModel.getYear2RhvOrder().doubleValue(),0.1); + Assert.assertEquals(1498, rhvOrderFormModel.getYear2RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(404.46, rhvOrderFormModel.getYear2RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(182411.46, rhvOrderFormModel.getYear2RhvOrderTotalValue().doubleValue(),0.1); + Assert.assertEquals(182411.46, rhvOrderFormModel.getYear2RhvOrderGrandTotal().doubleValue(),0.1); + + + Assert.assertEquals("RV0213787", rhvOrderFormModel.getYear3RhvOrderSku()); + Assert.assertEquals(579, rhvOrderFormModel.getYear3RhvOrder().doubleValue(),0.1); + Assert.assertEquals(1498, rhvOrderFormModel.getYear3RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(404.46, rhvOrderFormModel.getYear3RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(234182.34, rhvOrderFormModel.getYear3RhvOrderTotalValue().doubleValue(),0.1); + Assert.assertEquals(234182.34, rhvOrderFormModel.getYear3RhvOrderGrandTotal().doubleValue(),0.1); + } + + @Test + public void testVSphereNoPaidSubsButGrowth() + { +// check that the numbers of rule from the DRL file is the number of rules loaded + Utils.checkLoadedRulesNumber(kieSession, "org.jboss.xavier.analytics.rules.initialcostsaving", 1); + + // create a Map with the facts (i.e. Objects) you want to put in the working memory + Map facts = new HashMap<>(); + // always add a String fact with the name of the agenda group defined in the DRL file (e.g. "SourceCosts") + facts.put("agendaGroup", "RHVOrderForm"); + + // define the objects needed to define the "When" side of the test + PricingDataModel pricingDataModel = new PricingDataModel(); + pricingDataModel.setRhvConsultValue(288600.0); + pricingDataModel.setRhLearningSubsValue(28000.0); + pricingDataModel.setRhvTAndEValue(55000.0); + pricingDataModel.setRhvValue(0.73); + pricingDataModel.setRhvListValue(1498.0); + pricingDataModel.setRhVirtValue(0.40); + pricingDataModel.setRhVirtListValue(2798.0); + // and add each object to the Map + facts.put("pricingDataModel", pricingDataModel); + + EnvironmentModel environmentModel = new EnvironmentModel(); + environmentModel.setSourceProductIndicator(1); + + RHVRampUpCostsModel rhvRampUpCostsModel = new RHVRampUpCostsModel(); + rhvRampUpCostsModel.setYear1RhvPaidSubs(0); + rhvRampUpCostsModel.setYear1RhvPaidSubsGrowth(25); + rhvRampUpCostsModel.setYear2RhvPaidSubs(0); + rhvRampUpCostsModel.setYear2RhvPaidSubsGrowth(51); + rhvRampUpCostsModel.setYear3RhvPaidSubs(0); + rhvRampUpCostsModel.setYear3RhvPaidSubsGrowth(79); + + + InitialSavingsEstimationReportModel reportModel = new InitialSavingsEstimationReportModel(); + reportModel.setEnvironmentModel(environmentModel); + reportModel.setRhvRampUpCostsModel(rhvRampUpCostsModel); + // added to the facts Map + facts.put("reportModel", reportModel); + + // define the list of commands you want to be executed by Drools + List commands = new ArrayList<>(); + // first generate and add all of the facts created above + commands.addAll(Utils.newInsertCommands(facts)); + // then generate the 'fireAllRules' command + commands.add(CommandFactory.newFireAllRules(NUMBER_OF_FIRED_RULE_KEY)); + // last create the command to retrieve the objects available in + // the working memory at the end of the rules' execution + commands.add(CommandFactory.newGetObjects(GET_OBJECTS_KEY)); + + // execute the commands in the KIE session and get the results + Map results = Utils.executeCommandsAndGetResults(kieSession, commands); + + // check that the number of rules fired is what you expect + Assert.assertEquals(2, results.get(NUMBER_OF_FIRED_RULE_KEY)); + + // retrieve the List of Objects that were available in the working memory from the results + List objects = (List) results.get((GET_OBJECTS_KEY)); + // filter the type of object you're interested in checking (e.g. InitialSavingsEstimationReportModel) + List reports = objects.stream() + .filter(object -> object instanceof InitialSavingsEstimationReportModel) + .map(object -> (InitialSavingsEstimationReportModel) object) + .collect(Collectors.toList()); + + // Check that the number of object is the right one (in this case, there must be just one report) + Assert.assertEquals(1, reports.size()); + + // Check that the object has exactly the fields that the rule tested should add/change + InitialSavingsEstimationReportModel report = reports.get(0); + RHVOrderFormModel rhvOrderFormModel = report.getRhvOrderFormModel(); + Assert.assertEquals("RV0213787", rhvOrderFormModel.getYear1RhvOrderSku()); + Assert.assertEquals(25, rhvOrderFormModel.getYear1RhvOrder().doubleValue(),0.1); + Assert.assertEquals(1498, rhvOrderFormModel.getYear1RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(404.46, rhvOrderFormModel.getYear1RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(10111.5, rhvOrderFormModel.getYear1RhvOrderTotalValue().doubleValue(),0.1); + + + Assert.assertEquals(2886, rhvOrderFormModel.getYear1RhvOrderConsult().doubleValue(),0.1); + Assert.assertEquals(100, rhvOrderFormModel.getYear1RhvOrderConsultListValue().doubleValue(),0.1); + Assert.assertEquals(100, rhvOrderFormModel.getYear1RhvOrderConsultDiscountValue().doubleValue(),0.1); + Assert.assertEquals(288600, rhvOrderFormModel.getYear1RhvOrderConsultTotalValue().doubleValue(),0.1); + Assert.assertEquals(1, rhvOrderFormModel.getYear1RhvOrderTAndE().doubleValue(),0.1); + Assert.assertEquals(55000, rhvOrderFormModel.getYear1RhvOrderTAndEValue().doubleValue(),0.1); + Assert.assertEquals(55000, rhvOrderFormModel.getYear1RhvOrderTAndEDiscountValue().doubleValue(),0.1); + Assert.assertEquals(55000, rhvOrderFormModel.getYear1RhvOrderTAndETotalValue().doubleValue(),0.1); + Assert.assertEquals(7000, rhvOrderFormModel.getYear1RhvOrderLearningSubsListValue().doubleValue(),0.1); + Assert.assertEquals(4, rhvOrderFormModel.getYear1RhvOrderLearningSubs().doubleValue(),0.1); + Assert.assertEquals(7000, rhvOrderFormModel.getYear1RhvOrderLearningSubsDiscountValue().doubleValue(),0.1); + Assert.assertEquals(28000, rhvOrderFormModel.getYear1RhvOrderLearningSubsTotalValue().doubleValue(),0.1); + Assert.assertEquals(381711.5, rhvOrderFormModel.getYear1RhvOrderGrandTotal().doubleValue(),0.1); + + + Assert.assertEquals("RV0213787", rhvOrderFormModel.getYear2RhvOrderSku()); + Assert.assertEquals(51, rhvOrderFormModel.getYear2RhvOrder().doubleValue(),0.1); + Assert.assertEquals(1498, rhvOrderFormModel.getYear2RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(404.46, rhvOrderFormModel.getYear2RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(20627.46, rhvOrderFormModel.getYear2RhvOrderTotalValue().doubleValue(),0.1); + Assert.assertEquals(20627.46, rhvOrderFormModel.getYear2RhvOrderGrandTotal().doubleValue(),0.1); + + + Assert.assertEquals("RV0213787", rhvOrderFormModel.getYear3RhvOrderSku()); + Assert.assertEquals(79, rhvOrderFormModel.getYear3RhvOrder().doubleValue(),0.1); + Assert.assertEquals(1498, rhvOrderFormModel.getYear3RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(404.46, rhvOrderFormModel.getYear3RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(31952.34, rhvOrderFormModel.getYear3RhvOrderTotalValue().doubleValue(),0.1); + Assert.assertEquals(31952.34, rhvOrderFormModel.getYear3RhvOrderGrandTotal().doubleValue(),0.1); + } + + @Test + public void testNotVSpherePaidSubs() + { +// check that the numbers of rule from the DRL file is the number of rules loaded + Utils.checkLoadedRulesNumber(kieSession, "org.jboss.xavier.analytics.rules.initialcostsaving", 1); + + // create a Map with the facts (i.e. Objects) you want to put in the working memory + Map facts = new HashMap<>(); + // always add a String fact with the name of the agenda group defined in the DRL file (e.g. "SourceCosts") + facts.put("agendaGroup", "RHVOrderForm"); + + // define the objects needed to define the "When" side of the test + PricingDataModel pricingDataModel = new PricingDataModel(); + pricingDataModel.setRhvConsultValue(288600.0); + pricingDataModel.setRhLearningSubsValue(28000.0); + pricingDataModel.setRhvTAndEValue(55000.0); + pricingDataModel.setRhvValue(0.73); + pricingDataModel.setRhvListValue(1498.0); + pricingDataModel.setRhVirtValue(0.40); + pricingDataModel.setRhVirtListValue(2798.0); + // and add each object to the Map + facts.put("pricingDataModel", pricingDataModel); + + EnvironmentModel environmentModel = new EnvironmentModel(); + environmentModel.setSourceProductIndicator(2); + + RHVRampUpCostsModel rhvRampUpCostsModel = new RHVRampUpCostsModel(); + rhvRampUpCostsModel.setYear1RhvPaidSubs(250); + rhvRampUpCostsModel.setYear1RhvPaidSubsGrowth(25); + rhvRampUpCostsModel.setYear2RhvPaidSubs(400); + rhvRampUpCostsModel.setYear2RhvPaidSubsGrowth(51); + rhvRampUpCostsModel.setYear3RhvPaidSubs(500); + rhvRampUpCostsModel.setYear3RhvPaidSubsGrowth(79); + + InitialSavingsEstimationReportModel reportModel = new InitialSavingsEstimationReportModel(); + reportModel.setEnvironmentModel(environmentModel); + reportModel.setRhvRampUpCostsModel(rhvRampUpCostsModel); + // added to the facts Map + facts.put("reportModel", reportModel); + + // define the list of commands you want to be executed by Drools + List commands = new ArrayList<>(); + // first generate and add all of the facts created above + commands.addAll(Utils.newInsertCommands(facts)); + // then generate the 'fireAllRules' command + commands.add(CommandFactory.newFireAllRules(NUMBER_OF_FIRED_RULE_KEY)); + // last create the command to retrieve the objects available in + // the working memory at the end of the rules' execution + commands.add(CommandFactory.newGetObjects(GET_OBJECTS_KEY)); + + // execute the commands in the KIE session and get the results + Map results = Utils.executeCommandsAndGetResults(kieSession, commands); + + // check that the number of rules fired is what you expect + Assert.assertEquals(2, results.get(NUMBER_OF_FIRED_RULE_KEY)); + + // retrieve the List of Objects that were available in the working memory from the results + List objects = (List) results.get((GET_OBJECTS_KEY)); + // filter the type of object you're interested in checking (e.g. InitialSavingsEstimationReportModel) + List reports = objects.stream() + .filter(object -> object instanceof InitialSavingsEstimationReportModel) + .map(object -> (InitialSavingsEstimationReportModel) object) + .collect(Collectors.toList()); + + // Check that the number of object is the right one (in this case, there must be just one report) + Assert.assertEquals(1, reports.size()); + + // Check that the object has exactly the fields that the rule tested should add/change + InitialSavingsEstimationReportModel report = reports.get(0); + RHVOrderFormModel rhvOrderFormModel = report.getRhvOrderFormModel(); + Assert.assertEquals("RV00012", rhvOrderFormModel.getYear1RhvOrderSku()); + Assert.assertEquals(275, rhvOrderFormModel.getYear1RhvOrder().doubleValue(),0.1); + Assert.assertEquals(2798, rhvOrderFormModel.getYear1RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(1678.8, rhvOrderFormModel.getYear1RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(461670, rhvOrderFormModel.getYear1RhvOrderTotalValue().doubleValue(),0.1); + + + Assert.assertEquals(2886, rhvOrderFormModel.getYear1RhvOrderConsult().doubleValue(),0.1); + Assert.assertEquals(100, rhvOrderFormModel.getYear1RhvOrderConsultListValue().doubleValue(),0.1); + Assert.assertEquals(100, rhvOrderFormModel.getYear1RhvOrderConsultDiscountValue().doubleValue(),0.1); + Assert.assertEquals(288600, rhvOrderFormModel.getYear1RhvOrderConsultTotalValue().doubleValue(),0.1); + Assert.assertEquals(1, rhvOrderFormModel.getYear1RhvOrderTAndE().doubleValue(),0.1); + Assert.assertEquals(55000, rhvOrderFormModel.getYear1RhvOrderTAndEValue().doubleValue(),0.1); + Assert.assertEquals(55000, rhvOrderFormModel.getYear1RhvOrderTAndEDiscountValue().doubleValue(),0.1); + Assert.assertEquals(55000, rhvOrderFormModel.getYear1RhvOrderTAndETotalValue().doubleValue(),0.1); + Assert.assertEquals(7000, rhvOrderFormModel.getYear1RhvOrderLearningSubsListValue().doubleValue(),0.1); + Assert.assertEquals(4, rhvOrderFormModel.getYear1RhvOrderLearningSubs().doubleValue(),0.1); + Assert.assertEquals(7000, rhvOrderFormModel.getYear1RhvOrderLearningSubsDiscountValue().doubleValue(),0.1); + Assert.assertEquals(28000, rhvOrderFormModel.getYear1RhvOrderLearningSubsTotalValue().doubleValue(),0.1); + Assert.assertEquals(833270, rhvOrderFormModel.getYear1RhvOrderGrandTotal().doubleValue(),0.1); + + + Assert.assertEquals("RV00012", rhvOrderFormModel.getYear2RhvOrderSku()); + Assert.assertEquals(451, rhvOrderFormModel.getYear2RhvOrder().doubleValue(),0.1); + Assert.assertEquals(2798, rhvOrderFormModel.getYear2RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(1678.8, rhvOrderFormModel.getYear2RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(757138.8, rhvOrderFormModel.getYear2RhvOrderTotalValue().doubleValue(),0.1); + Assert.assertEquals(757138.8, rhvOrderFormModel.getYear2RhvOrderGrandTotal().doubleValue(),0.1); + + + Assert.assertEquals("RV00012", rhvOrderFormModel.getYear3RhvOrderSku()); + Assert.assertEquals(579, rhvOrderFormModel.getYear3RhvOrder().doubleValue(),0.1); + Assert.assertEquals(2798, rhvOrderFormModel.getYear3RhvOrderListValue().doubleValue(),0.1); + Assert.assertEquals(1678.8, rhvOrderFormModel.getYear3RhvOrderDiscountValue().doubleValue(),0.1); + Assert.assertEquals(972025.2, rhvOrderFormModel.getYear3RhvOrderTotalValue().doubleValue(),0.1); + Assert.assertEquals(972025.2, rhvOrderFormModel.getYear3RhvOrderGrandTotal().doubleValue(),0.1); + } + +}