diff --git a/README.md b/README.md index 5e4568e7..93008c26 100644 --- a/README.md +++ b/README.md @@ -1 +1,23 @@ -# xavier-analytics \ No newline at end of file +# xavier-analytics + +## How to create a new rule set for an agenda group with test +The procedure describes how to create a rule set for the agenda group `FooAgendaGroup` +1. create a copy of [SourceCosts.drl](src/main/resources/org/jboss/xavier/analytics/rules/SourceCosts.drl) with name `FooAgendaGroup.drl` within the `org.jboss.xavier.analytics.rules` package +1. in the `FooAgendaGroup.drl` file: + 1. change the `agenda-group` value to become `FooAgendaGroup` + 1. change the `rule` ID value to something like `FooAgendaGroupRules` (i.e. `rule "FooAgendaGroupRules"`) +1. create a copy of [SourceCostsTest.java](src/test/java/org/jboss/xavier/analytics/test/SourceCostsTest.java) with name `FooAgendaGroupTest.java` within the `org.jboss.xavier.analytics.test` package + 1. change the constructor to reference the `FooAgendaGroup.drl` file instead of `SourceCosts.drl` (i.e. `super("/org/jboss/xavier/analytics/rules/FooAgendaGroup.drl", ResourceType.DRL);`) + 1. change the `agendaGroup` to reference the `FooAgendaGroup` agenda group (i.e. `facts.put("agendaGroup", "FooAgendaGroup");`) +1. run the `mvn -gs ./configuration/settings.xml test -Dtest=FooAgendaGroupTest` to check that everything works fine + +Now you have a working rule set with a test and you can start developing the rules keeping updated the test. + +## How to interact locally with OKD +1. Follow the "[Installation](https://github.com/project-xavier/xavier-integration#installation)" procedure from [xavier-integration](https://github.com/project-xavier/xavier-integration) project with one difference, use your own fork URL (e.g. `https://github.com/mrizzi/xavier-analytics.git`) instead of using `https://github.com/project-xavier/xavier-analytics.git` in the [Decision Manager](https://github.com/project-xavier/xavier-integration#decision-manager) section +1. go to `Settings` page in Business Central project +1. copy the `ssh` URL (e.g. `ssh://analytics-rhdmcentr-2-9ws6w:8001/MySpace/xavier-analytics`) +1. from your local terminal, login to the local OKD instance as `developer` and switch to use the migration analytics project +1. `oc port-forward ` `oc get pod | grep "^analytics-rhdmcentr" | awk '{print $1}'`` 8001:8001` +1. from your `xavier-analytics` project root folder, execute `git remote add remote-dm ssh://adminUser@localhost:8001/MySpace/xavier-analytics` replacing the remote host's name (e.g. `analytics-rhdmcentr-2-9ws6w`) with `localhost` +1. retrieve the code from Decision Manager Business Central using `git pull remote-dm MIGENG-45` diff --git a/configuration/settings.xml b/configuration/settings.xml new file mode 100644 index 00000000..073722c3 --- /dev/null +++ b/configuration/settings.xml @@ -0,0 +1,123 @@ + + + + + + + fuse.repos + + + + + maven.central + Maven Central + https://repo1.maven.org/maven2 + + false + + + true + never + + + + + + redhat.ga + Red Hat General Availability Repository + https://maven.repository.redhat.com/ga + + false + + + true + never + + + + + + redhat.ea + Red Hat Early Access Repository + https://maven.repository.redhat.com/earlyaccess/all + + false + + + true + never + + + + + + + + + maven.central + Maven Central + https://repo1.maven.org/maven2 + + false + + + true + never + + + + + + redhat.ga + Red Hat General Availability Repository + https://maven.repository.redhat.com/ga + + false + + + true + never + + + + + + redhat.ea + Red Hat Early Access Repository + https://maven.repository.redhat.com/earlyaccess/all + + false + + + true + never + + + + + + + + + fuse.repos + + + diff --git a/pom.xml b/pom.xml index c3c51c34..92edd883 100644 --- a/pom.xml +++ b/pom.xml @@ -1,95 +1,135 @@ - 4.0.0 - com.myspace - sample-analytics - 1.0.0-SNAPSHOT - kjar - sample-analytics - - - - com.thoughtworks.xstream - xstream - 1.4.10 - test - - - org.kie - kie-internal - 7.18.0.Final-redhat-00002 - provided - - - org.optaplanner - optaplanner-core - 7.18.0.Final-redhat-00002 - provided - - - junit - junit - 4.12 - test - - - org.optaplanner - optaplanner-persistence-jaxb - 7.18.0.Final-redhat-00002 - provided - - - org.kie - kie-api - 7.18.0.Final-redhat-00002 - provided - - - org.drools - drools-wb-scenario-simulation-editor-api - 7.18.0.Final-redhat-00002 - test - - - org.drools - drools-wb-scenario-simulation-editor-backend - 7.18.0.Final-redhat-00002 - test - - - org.drools - drools-compiler - 7.18.0.Final-redhat-00002 - test - - - org.kie - kie-dmn-feel - 7.18.0.Final-redhat-00002 - test - - - org.kie - kie-dmn-api - 7.18.0.Final-redhat-00002 - test - - - org.kie - kie-dmn-core - 7.18.0.Final-redhat-00002 - test - - - - - - org.kie - kie-maven-plugin - 7.18.0.Final-redhat-00002 - true - - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + 4.0.0 + org.jboss.xavier + xavier-analytics + 0.0.1-SNAPSHOT + kjar + Xavier Analytics + + + 1.8 + 1.8 + 7.18.0.Final-redhat-00002 + + + + com.thoughtworks.xstream + xstream + 1.4.10 + test + + + org.kie + kie-internal + ${rhdm.version} + provided + + + org.optaplanner + optaplanner-core + ${rhdm.version} + provided + + + junit + junit + 4.12 + test + + + org.optaplanner + optaplanner-persistence-jaxb + ${rhdm.version} + provided + + + org.kie + kie-api + ${rhdm.version} + provided + + + javax.persistence + javax.persistence-api + 2.2 + provided + + + org.drools + drools-wb-scenario-simulation-editor-api + ${rhdm.version} + test + + + org.drools + drools-wb-scenario-simulation-editor-backend + ${rhdm.version} + test + + + org.drools + drools-compiler + ${rhdm.version} + test + + + org.kie + kie-dmn-feel + ${rhdm.version} + test + + + org.kie + kie-dmn-api + ${rhdm.version} + test + + + org.kie + kie-dmn-core + ${rhdm.version} + test + + + org.drools + drools-core + ${rhdm.version} + test + + + org.drools + drools-canonical-model + ${rhdm.version} + test + + + org.drools + drools-model-compiler + ${rhdm.version} + test + + + org.drools + drools-decisiontables + ${rhdm.version} + test + + + + + + + org.kie + kie-maven-plugin + ${rhdm.version} + true + + + diff --git a/project.repositories b/project.repositories index c8da00ec..d5e93ea5 100644 --- a/project.repositories +++ b/project.repositories @@ -3,17 +3,17 @@ true - central - https://repo1.maven.org/maven2 - SETTINGS + local + /home/jboss/.m2/repository + LOCAL true - local - /home/jboss/.m2/repository - LOCAL + central + https://repo1.maven.org/maven2 + SETTINGS diff --git a/src/main/java/org/jboss/xavier/analytics/functions/HelperFunctions.java b/src/main/java/org/jboss/xavier/analytics/functions/HelperFunctions.java new file mode 100644 index 00000000..0db3f9a2 --- /dev/null +++ b/src/main/java/org/jboss/xavier/analytics/functions/HelperFunctions.java @@ -0,0 +1,9 @@ +package org.jboss.xavier.analytics.functions; + +public class HelperFunctions +{ + public static int round(double value) + { + return (int) Math.round(value); + } +} diff --git a/src/main/java/org/jboss/xavier/analytics/pojo/input/UploadFormInputDataModel.java b/src/main/java/org/jboss/xavier/analytics/pojo/input/UploadFormInputDataModel.java new file mode 100644 index 00000000..b44241ab --- /dev/null +++ b/src/main/java/org/jboss/xavier/analytics/pojo/input/UploadFormInputDataModel.java @@ -0,0 +1,134 @@ +package org.jboss.xavier.analytics.pojo.input; + +/** + * This class was automatically generated by the data modeler tool. + */ + +import org.kie.api.definition.type.Label; + +public class UploadFormInputDataModel implements java.io.Serializable { + + @Label("Customer ID") + private String customerId; + + @Label("Source payload file name") + private String fileName; + + @Label("Number of ESXi hypervisors found") + private Integer hypervisor; + + @Label("Total disk space used found ") + private Long totalDiskSpace; + + private Integer sourceProductIndicator; + + private Double year1HypervisorPercentage; + + private Double year2HypervisorPercentage; + + private Double year3HypervisorPercentage; + + private Double growthRatePercentage; + + private int dealIndicator = 1; + + private int openStackIndicator = 1; + + public UploadFormInputDataModel() { + } + + public String getCustomerId() { + return this.customerId; + } + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + public String getFileName() { + return this.fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public Integer getHypervisor() { + return this.hypervisor; + } + + public void setHypervisor(Integer hypervisor) { + this.hypervisor = hypervisor; + } + + public Long getTotalDiskSpace() { + return this.totalDiskSpace; + } + + public void setTotalDiskSpace(Long totalDiskSpace) { + this.totalDiskSpace = totalDiskSpace; + } + + public Integer getSourceProductIndicator() { + return this.sourceProductIndicator; + } + + public void setSourceProductIndicator(Integer sourceProductIndicator) { + this.sourceProductIndicator = sourceProductIndicator; + } + + public Double getYear1HypervisorPercentage() { + return this.year1HypervisorPercentage; + } + + public void setYear1HypervisorPercentage( + Double year1HypervisorPercentage) { + this.year1HypervisorPercentage = year1HypervisorPercentage; + } + + public Double getYear2HypervisorPercentage() { + return this.year2HypervisorPercentage; + } + + public void setYear2HypervisorPercentage( + Double year2HypervisorPercentage) { + this.year2HypervisorPercentage = year2HypervisorPercentage; + } + + public Double getYear3HypervisorPercentage() { + return this.year3HypervisorPercentage; + } + + public void setYear3HypervisorPercentage( + Double year3HypervisorPercentage) { + this.year3HypervisorPercentage = year3HypervisorPercentage; + } + + public Double getGrowthRatePercentage() { + return this.growthRatePercentage; + } + + public void setGrowthRatePercentage( + Double growthRatePercentage) { + this.growthRatePercentage = growthRatePercentage; + } + + public UploadFormInputDataModel(String customerId, + String fileName, Integer hypervisor, + Long totalDiskSpace, Integer sourceProductIndicator, + Double year1HypervisorPercentage, + Double year2HypervisorPercentage, + Double year3HypervisorPercentage, + Double growthRatePercentage) { + this.customerId = customerId; + this.fileName = fileName; + this.hypervisor = hypervisor; + this.totalDiskSpace = totalDiskSpace; + this.sourceProductIndicator = sourceProductIndicator; + this.year1HypervisorPercentage = year1HypervisorPercentage; + this.year2HypervisorPercentage = year2HypervisorPercentage; + this.year3HypervisorPercentage = year3HypervisorPercentage; + this.growthRatePercentage = growthRatePercentage; + } + +} diff --git a/src/main/java/org/jboss/xavier/analytics/pojo/output/EnvironmentModel.java b/src/main/java/org/jboss/xavier/analytics/pojo/output/EnvironmentModel.java new file mode 100644 index 00000000..21676e85 --- /dev/null +++ b/src/main/java/org/jboss/xavier/analytics/pojo/output/EnvironmentModel.java @@ -0,0 +1,65 @@ +package org.jboss.xavier.analytics.pojo.output; + +import org.kie.api.definition.type.Label; + +public class EnvironmentModel +{ + // Environment + private Integer sourceProductIndicator; + @Label("Number of hypervisors found") + private Integer hypervisors; + private Integer year1Hypervisor; + private Integer year2Hypervisor; + private Integer year3Hypervisor; + private Double growthRatePercentage; + + public EnvironmentModel() {} + + public Integer getSourceProductIndicator() { + return sourceProductIndicator; + } + + public void setSourceProductIndicator(Integer sourceProductIndicator) { + this.sourceProductIndicator = sourceProductIndicator; + } + + public Integer getHypervisors() { + return hypervisors; + } + + public void setHypervisors(Integer hypervisors) { + this.hypervisors = hypervisors; + } + + public Integer getYear1Hypervisor() { + return year1Hypervisor; + } + + public void setYear1Hypervisor(Integer year1Hypervisor) { + this.year1Hypervisor = year1Hypervisor; + } + + public Integer getYear2Hypervisor() { + return year2Hypervisor; + } + + public void setYear2Hypervisor(Integer year2Hypervisor) { + this.year2Hypervisor = year2Hypervisor; + } + + public Integer getYear3Hypervisor() { + return year3Hypervisor; + } + + public void setYear3Hypervisor(Integer year3Hypervisor) { + this.year3Hypervisor = year3Hypervisor; + } + + public Double getGrowthRatePercentage() { + return growthRatePercentage; + } + + public void setGrowthRatePercentage(Double growthRatePercentage) { + this.growthRatePercentage = growthRatePercentage; + } +} diff --git a/src/main/java/org/jboss/xavier/analytics/pojo/output/InitialSavingsEstimationReportModel.java b/src/main/java/org/jboss/xavier/analytics/pojo/output/InitialSavingsEstimationReportModel.java new file mode 100644 index 00000000..0caf0f65 --- /dev/null +++ b/src/main/java/org/jboss/xavier/analytics/pojo/output/InitialSavingsEstimationReportModel.java @@ -0,0 +1,141 @@ +package org.jboss.xavier.analytics.pojo.output; + +import java.util.Date; +import org.kie.api.definition.type.Label; + +/** + * This class was automatically generated by the data modeler tool. + */ + +@javax.persistence.Entity +public class InitialSavingsEstimationReportModel + implements + java.io.Serializable { + + static final long serialVersionUID = 1L; + + @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO, generator = "INITIALSAVINGSESTIMATIONREPORTMODEL_ID_GENERATOR") + @javax.persistence.Id + @javax.persistence.SequenceGenerator(sequenceName = "INITIALSAVINGSESTIMATIONREPORTMODEL_ID_SEQ", name = "INITIALSAVINGSESTIMATIONREPORTMODEL_ID_GENERATOR") + private Long id; + + @Label("Customer ID") + private String customerId; + + @Label("Source payload file name") + private String fileName; + + @Label(value = "Date of creation") + private Date creationDate; + + private EnvironmentModel environmentModel; + private SourceCostsModel sourceCostsModel; + private SourceRampDownCostsModel sourceRampDownCostsModel; + private RHVRampUpCostsModel rhvRampUpCostsModel; + private RHVYearByYearCostsModel rhvYearByYearCostsModel; + private RHVSavingsModel rhvSavingsModel; + private RHVAdditionalContainerCapacityModel rhvAdditionalContainerCapacityModel; + private RHVOrderFormModel rhvOrderFormModel; + + public InitialSavingsEstimationReportModel() {} + + public static long getSerialVersionUID() { + return serialVersionUID; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCustomerId() { + return customerId; + } + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public Date getCreationDate() { + return creationDate; + } + + public void setCreationDate(Date creationDate) { + this.creationDate = creationDate; + } + + public EnvironmentModel getEnvironmentModel() { + return environmentModel; + } + + public void setEnvironmentModel(EnvironmentModel environmentModel) { + this.environmentModel = environmentModel; + } + + public SourceCostsModel getSourceCostsModel() { + return sourceCostsModel; + } + + public void setSourceCostsModel(SourceCostsModel sourceCostsModel) { + this.sourceCostsModel = sourceCostsModel; + } + + public SourceRampDownCostsModel getSourceRampDownCostsModel() { + return sourceRampDownCostsModel; + } + + public void setSourceRampDownCostsModel(SourceRampDownCostsModel sourceRampDownCostsModel) { + this.sourceRampDownCostsModel = sourceRampDownCostsModel; + } + + public RHVRampUpCostsModel getRhvRampUpCostsModel() { + return rhvRampUpCostsModel; + } + + public void setRhvRampUpCostsModel(RHVRampUpCostsModel rhvRampUpCostsModel) { + this.rhvRampUpCostsModel = rhvRampUpCostsModel; + } + + public RHVYearByYearCostsModel getRhvYearByYearCostsModel() { + return rhvYearByYearCostsModel; + } + + public void setRhvYearByYearCostsModel(RHVYearByYearCostsModel rhvYearByYearCostsModel) { + this.rhvYearByYearCostsModel = rhvYearByYearCostsModel; + } + + public RHVSavingsModel getRhvSavingsModel() { + return rhvSavingsModel; + } + + public void setRhvSavingsModel(RHVSavingsModel rhvSavingsModel) { + this.rhvSavingsModel = rhvSavingsModel; + } + + public RHVAdditionalContainerCapacityModel getRhvAdditionalContainerCapacityModel() { + return rhvAdditionalContainerCapacityModel; + } + + public void setRhvAdditionalContainerCapacityModel(RHVAdditionalContainerCapacityModel rhvAdditionalContainerCapacityModel) { + this.rhvAdditionalContainerCapacityModel = rhvAdditionalContainerCapacityModel; + } + + public RHVOrderFormModel getRhvOrderFormModel() { + return rhvOrderFormModel; + } + + public void setRhvOrderFormModel(RHVOrderFormModel rhvOrderFormModel) { + this.rhvOrderFormModel = rhvOrderFormModel; + } +} diff --git a/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVAdditionalContainerCapacityModel.java b/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVAdditionalContainerCapacityModel.java new file mode 100644 index 00000000..6d2a1a2d --- /dev/null +++ b/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVAdditionalContainerCapacityModel.java @@ -0,0 +1,53 @@ +package org.jboss.xavier.analytics.pojo.output; + +public class RHVAdditionalContainerCapacityModel +{ + // RHVAdditionalContainerCapacity + private Double rhvContainerHigh; + private Double rhvContainerLikely; + private Double rhvContainerLow; + private Double rhvContainerFrom; + private Double rhvContainerTo; + + public RHVAdditionalContainerCapacityModel() {} + + public Double getRhvContainerHigh() { + return rhvContainerHigh; + } + + public void setRhvContainerHigh(Double rhvContainerHigh) { + this.rhvContainerHigh = rhvContainerHigh; + } + + public Double getRhvContainerLikely() { + return rhvContainerLikely; + } + + public void setRhvContainerLikely(Double rhvContainerLikely) { + this.rhvContainerLikely = rhvContainerLikely; + } + + public Double getRhvContainerLow() { + return rhvContainerLow; + } + + public void setRhvContainerLow(Double rhvContainerLow) { + this.rhvContainerLow = rhvContainerLow; + } + + public Double getRhvContainerFrom() { + return rhvContainerFrom; + } + + public void setRhvContainerFrom(Double rhvContainerFrom) { + this.rhvContainerFrom = rhvContainerFrom; + } + + public Double getRhvContainerTo() { + return rhvContainerTo; + } + + public void setRhvContainerTo(Double rhvContainerTo) { + this.rhvContainerTo = rhvContainerTo; + } +} 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 new file mode 100644 index 00000000..e209f632 --- /dev/null +++ b/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVOrderFormModel.java @@ -0,0 +1,278 @@ +package org.jboss.xavier.analytics.pojo.output; + +public class RHVOrderFormModel +{ + // RHVOrderForm + private Double year1RhvOrderSku; + private Double year1RhvOrder; + private Double year1RhvOrderConsult; + private Double year1RhvOrderTAndE; + private Double year1RhvOrderLearningSubs; + private Double year1RhvOrderListValue; + private Double year1RhvOrderConsultListValue; + private Double year1RhvOrderTAndEValue; + private Double year1RhvOrderLearningSubsListValue; + private Double year1RhvOrderDiscountValue; + private Double year1RhvOrderConsultDiscountValue; + private Double year1RhvOrderTAndEDiscountValue; + private Double year1RhvOrderLearningSubsDiscountValue; + private Double year1RhvOrderTotalValue; + private Double year1RhvOrderConsultTotalValue; + private Double year1RhvOrderTAndETotalValue; + private Double year1RhvOrderLearningSubsTotalValue; + private Double year1RhvOrderGrandTotal; + private Double year2RhvOrderSku; + private Double year2RhvOrder; + private Double year2RhvOrderListValue; + private Double year2RhvOrderDiscountValue; + private Double year2RhvOrderTotalValue; + private Double year2RhvOrderGrandTotal; + private Double year3RhvOrderSku; + private Double year3RhvOrder; + private Double year3RhvOrderListValue; + private Double year3RhvOrderDiscountValue; + private Double year3RhvOrderTotalValue; + private Double year3RhvOrderGrandTotal; + + public RHVOrderFormModel() {} + + public Double getYear1RhvOrderSku() { + return year1RhvOrderSku; + } + + public void setYear1RhvOrderSku(Double year1RhvOrderSku) { + this.year1RhvOrderSku = year1RhvOrderSku; + } + + public Double getYear1RhvOrder() { + return year1RhvOrder; + } + + public void setYear1RhvOrder(Double year1RhvOrder) { + this.year1RhvOrder = year1RhvOrder; + } + + public Double getYear1RhvOrderConsult() { + return year1RhvOrderConsult; + } + + public void setYear1RhvOrderConsult(Double year1RhvOrderConsult) { + this.year1RhvOrderConsult = year1RhvOrderConsult; + } + + public Double getYear1RhvOrderTAndE() { + return year1RhvOrderTAndE; + } + + public void setYear1RhvOrderTAndE(Double year1RhvOrderTAndE) { + this.year1RhvOrderTAndE = year1RhvOrderTAndE; + } + + public Double getYear1RhvOrderLearningSubs() { + return year1RhvOrderLearningSubs; + } + + public void setYear1RhvOrderLearningSubs(Double year1RhvOrderLearningSubs) { + this.year1RhvOrderLearningSubs = year1RhvOrderLearningSubs; + } + + public Double getYear1RhvOrderListValue() { + return year1RhvOrderListValue; + } + + public void setYear1RhvOrderListValue(Double year1RhvOrderListValue) { + this.year1RhvOrderListValue = year1RhvOrderListValue; + } + + public Double getYear1RhvOrderConsultListValue() { + return year1RhvOrderConsultListValue; + } + + public void setYear1RhvOrderConsultListValue(Double year1RhvOrderConsultListValue) { + this.year1RhvOrderConsultListValue = year1RhvOrderConsultListValue; + } + + public Double getYear1RhvOrderTAndEValue() { + return year1RhvOrderTAndEValue; + } + + public void setYear1RhvOrderTAndEValue(Double year1RhvOrderTAndEValue) { + this.year1RhvOrderTAndEValue = year1RhvOrderTAndEValue; + } + + public Double getYear1RhvOrderLearningSubsListValue() { + return year1RhvOrderLearningSubsListValue; + } + + public void setYear1RhvOrderLearningSubsListValue(Double year1RhvOrderLearningSubsListValue) { + this.year1RhvOrderLearningSubsListValue = year1RhvOrderLearningSubsListValue; + } + + public Double getYear1RhvOrderDiscountValue() { + return year1RhvOrderDiscountValue; + } + + public void setYear1RhvOrderDiscountValue(Double year1RhvOrderDiscountValue) { + this.year1RhvOrderDiscountValue = year1RhvOrderDiscountValue; + } + + public Double getYear1RhvOrderConsultDiscountValue() { + return year1RhvOrderConsultDiscountValue; + } + + public void setYear1RhvOrderConsultDiscountValue(Double year1RhvOrderConsultDiscountValue) { + this.year1RhvOrderConsultDiscountValue = year1RhvOrderConsultDiscountValue; + } + + public Double getYear1RhvOrderTAndEDiscountValue() { + return year1RhvOrderTAndEDiscountValue; + } + + public void setYear1RhvOrderTAndEDiscountValue(Double year1RhvOrderTAndEDiscountValue) { + this.year1RhvOrderTAndEDiscountValue = year1RhvOrderTAndEDiscountValue; + } + + public Double getYear1RhvOrderLearningSubsDiscountValue() { + return year1RhvOrderLearningSubsDiscountValue; + } + + public void setYear1RhvOrderLearningSubsDiscountValue(Double year1RhvOrderLearningSubsDiscountValue) { + this.year1RhvOrderLearningSubsDiscountValue = year1RhvOrderLearningSubsDiscountValue; + } + + public Double getYear1RhvOrderTotalValue() { + return year1RhvOrderTotalValue; + } + + public void setYear1RhvOrderTotalValue(Double year1RhvOrderTotalValue) { + this.year1RhvOrderTotalValue = year1RhvOrderTotalValue; + } + + public Double getYear1RhvOrderConsultTotalValue() { + return year1RhvOrderConsultTotalValue; + } + + public void setYear1RhvOrderConsultTotalValue(Double year1RhvOrderConsultTotalValue) { + this.year1RhvOrderConsultTotalValue = year1RhvOrderConsultTotalValue; + } + + public Double getYear1RhvOrderTAndETotalValue() { + return year1RhvOrderTAndETotalValue; + } + + public void setYear1RhvOrderTAndETotalValue(Double year1RhvOrderTAndETotalValue) { + this.year1RhvOrderTAndETotalValue = year1RhvOrderTAndETotalValue; + } + + public Double getYear1RhvOrderLearningSubsTotalValue() { + return year1RhvOrderLearningSubsTotalValue; + } + + public void setYear1RhvOrderLearningSubsTotalValue(Double year1RhvOrderLearningSubsTotalValue) { + this.year1RhvOrderLearningSubsTotalValue = year1RhvOrderLearningSubsTotalValue; + } + + public Double getYear1RhvOrderGrandTotal() { + return year1RhvOrderGrandTotal; + } + + public void setYear1RhvOrderGrandTotal(Double year1RhvOrderGrandTotal) { + this.year1RhvOrderGrandTotal = year1RhvOrderGrandTotal; + } + + public Double getYear2RhvOrderSku() { + return year2RhvOrderSku; + } + + public void setYear2RhvOrderSku(Double year2RhvOrderSku) { + this.year2RhvOrderSku = year2RhvOrderSku; + } + + public Double getYear2RhvOrder() { + return year2RhvOrder; + } + + public void setYear2RhvOrder(Double year2RhvOrder) { + this.year2RhvOrder = year2RhvOrder; + } + + public Double getYear2RhvOrderListValue() { + return year2RhvOrderListValue; + } + + public void setYear2RhvOrderListValue(Double year2RhvOrderListValue) { + this.year2RhvOrderListValue = year2RhvOrderListValue; + } + + public Double getYear2RhvOrderDiscountValue() { + return year2RhvOrderDiscountValue; + } + + public void setYear2RhvOrderDiscountValue(Double year2RhvOrderDiscountValue) { + this.year2RhvOrderDiscountValue = year2RhvOrderDiscountValue; + } + + public Double getYear2RhvOrderTotalValue() { + return year2RhvOrderTotalValue; + } + + public void setYear2RhvOrderTotalValue(Double year2RhvOrderTotalValue) { + this.year2RhvOrderTotalValue = year2RhvOrderTotalValue; + } + + public Double getYear2RhvOrderGrandTotal() { + return year2RhvOrderGrandTotal; + } + + public void setYear2RhvOrderGrandTotal(Double year2RhvOrderGrandTotal) { + this.year2RhvOrderGrandTotal = year2RhvOrderGrandTotal; + } + + public Double getYear3RhvOrderSku() { + return year3RhvOrderSku; + } + + public void setYear3RhvOrderSku(Double year3RhvOrderSku) { + this.year3RhvOrderSku = year3RhvOrderSku; + } + + public Double getYear3RhvOrder() { + return year3RhvOrder; + } + + public void setYear3RhvOrder(Double year3RhvOrder) { + this.year3RhvOrder = year3RhvOrder; + } + + public Double getYear3RhvOrderListValue() { + return year3RhvOrderListValue; + } + + public void setYear3RhvOrderListValue(Double year3RhvOrderListValue) { + this.year3RhvOrderListValue = year3RhvOrderListValue; + } + + public Double getYear3RhvOrderDiscountValue() { + return year3RhvOrderDiscountValue; + } + + public void setYear3RhvOrderDiscountValue(Double year3RhvOrderDiscountValue) { + this.year3RhvOrderDiscountValue = year3RhvOrderDiscountValue; + } + + public Double getYear3RhvOrderTotalValue() { + return year3RhvOrderTotalValue; + } + + public void setYear3RhvOrderTotalValue(Double year3RhvOrderTotalValue) { + this.year3RhvOrderTotalValue = year3RhvOrderTotalValue; + } + + public Double getYear3RhvOrderGrandTotal() { + return year3RhvOrderGrandTotal; + } + + public void setYear3RhvOrderGrandTotal(Double year3RhvOrderGrandTotal) { + this.year3RhvOrderGrandTotal = year3RhvOrderGrandTotal; + } +} diff --git a/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVRampUpCostsModel.java b/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVRampUpCostsModel.java new file mode 100644 index 00000000..81cc743a --- /dev/null +++ b/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVRampUpCostsModel.java @@ -0,0 +1,332 @@ +package org.jboss.xavier.analytics.pojo.output; + +public class RHVRampUpCostsModel +{ + // RHVRampUpCosts + private Double year1RhvServers; + private Double year1RhvCompSubs; + private Double year1RhvPaidSubs; + private Double year1RhvPerServerValue; + private Double year1RhvTotalValue; + private Double year1RhvServersGrowth; + private Double year1RhvCompSubsGrowth; + private Double year1RhvPaidSubsGrowth; + private Double year1RhvPerServerGrowthValue; + private Double year1RhvTotalGrowthValue; + private Double year1RhvGrandTotalGrowthValue; + private Double rhvSwitchLearningSubsValue; + private Double rhvSwitchConsultValue; + private Double rhvSwitchTAndEValue; + private Double year2RhvServers; + private Double year2RhvCompSubs; + private Double year2RhvPaidSubs; + private Double year2RhvPerServerValue; + private Double year2RhvTotalValue; + private Double year2RhvServersGrowth; + private Double year2RhvCompSubsGrowth; + private Double year2RhvPaidSubsGrowth; + private Double year2RhvPerServerGrowthValue; + private Double year2RhvTotalGrowthValue; + private Double year2RhvGrandTotalGrowthValue; + private Double year3RhvServers; + private Double year3RhvCompSubs; + private Double year3RhvPaidSubs; + private Double year3RhvPerServerValue; + private Double year3RhvTotalValue; + private Double year3RhvServersGrowth; + private Double year3RhvCompSubsGrowth; + private Double year3RhvPaidSubsGrowth; + private Double year3RhvPerServerGrowthValue; + private Double year3RhvTotalGrowthValue; + private Double year3RhvGrandTotalGrowthValue; + + public RHVRampUpCostsModel() {} + + public Double getYear1RhvServers() { + return year1RhvServers; + } + + public void setYear1RhvServers(Double year1RhvServers) { + this.year1RhvServers = year1RhvServers; + } + + public Double getYear1RhvCompSubs() { + return year1RhvCompSubs; + } + + public void setYear1RhvCompSubs(Double year1RhvCompSubs) { + this.year1RhvCompSubs = year1RhvCompSubs; + } + + public Double getYear1RhvPaidSubs() { + return year1RhvPaidSubs; + } + + public void setYear1RhvPaidSubs(Double year1RhvPaidSubs) { + this.year1RhvPaidSubs = year1RhvPaidSubs; + } + + public Double getYear1RhvPerServerValue() { + return year1RhvPerServerValue; + } + + public void setYear1RhvPerServerValue(Double year1RhvPerServerValue) { + this.year1RhvPerServerValue = year1RhvPerServerValue; + } + + public Double getYear1RhvTotalValue() { + return year1RhvTotalValue; + } + + public void setYear1RhvTotalValue(Double year1RhvTotalValue) { + this.year1RhvTotalValue = year1RhvTotalValue; + } + + public Double getYear1RhvServersGrowth() { + return year1RhvServersGrowth; + } + + public void setYear1RhvServersGrowth(Double year1RhvServersGrowth) { + this.year1RhvServersGrowth = year1RhvServersGrowth; + } + + public Double getYear1RhvCompSubsGrowth() { + return year1RhvCompSubsGrowth; + } + + public void setYear1RhvCompSubsGrowth(Double year1RhvCompSubsGrowth) { + this.year1RhvCompSubsGrowth = year1RhvCompSubsGrowth; + } + + public Double getYear1RhvPaidSubsGrowth() { + return year1RhvPaidSubsGrowth; + } + + public void setYear1RhvPaidSubsGrowth(Double year1RhvPaidSubsGrowth) { + this.year1RhvPaidSubsGrowth = year1RhvPaidSubsGrowth; + } + + public Double getYear1RhvPerServerGrowthValue() { + return year1RhvPerServerGrowthValue; + } + + public void setYear1RhvPerServerGrowthValue(Double year1RhvPerServerGrowthValue) { + this.year1RhvPerServerGrowthValue = year1RhvPerServerGrowthValue; + } + + public Double getYear1RhvTotalGrowthValue() { + return year1RhvTotalGrowthValue; + } + + public void setYear1RhvTotalGrowthValue(Double year1RhvTotalGrowthValue) { + this.year1RhvTotalGrowthValue = year1RhvTotalGrowthValue; + } + + public Double getYear1RhvGrandTotalGrowthValue() { + return year1RhvGrandTotalGrowthValue; + } + + public void setYear1RhvGrandTotalGrowthValue(Double year1RhvGrandTotalGrowthValue) { + this.year1RhvGrandTotalGrowthValue = year1RhvGrandTotalGrowthValue; + } + + public Double getRhvSwitchLearningSubsValue() { + return rhvSwitchLearningSubsValue; + } + + public void setRhvSwitchLearningSubsValue(Double rhvSwitchLearningSubsValue) { + this.rhvSwitchLearningSubsValue = rhvSwitchLearningSubsValue; + } + + public Double getRhvSwitchConsultValue() { + return rhvSwitchConsultValue; + } + + public void setRhvSwitchConsultValue(Double rhvSwitchConsultValue) { + this.rhvSwitchConsultValue = rhvSwitchConsultValue; + } + + public Double getRhvSwitchTAndEValue() { + return rhvSwitchTAndEValue; + } + + public void setRhvSwitchTAndEValue(Double rhvSwitchTAndEValue) { + this.rhvSwitchTAndEValue = rhvSwitchTAndEValue; + } + + public Double getYear2RhvServers() { + return year2RhvServers; + } + + public void setYear2RhvServers(Double year2RhvServers) { + this.year2RhvServers = year2RhvServers; + } + + public Double getYear2RhvCompSubs() { + return year2RhvCompSubs; + } + + public void setYear2RhvCompSubs(Double year2RhvCompSubs) { + this.year2RhvCompSubs = year2RhvCompSubs; + } + + public Double getYear2RhvPaidSubs() { + return year2RhvPaidSubs; + } + + public void setYear2RhvPaidSubs(Double year2RhvPaidSubs) { + this.year2RhvPaidSubs = year2RhvPaidSubs; + } + + public Double getYear2RhvPerServerValue() { + return year2RhvPerServerValue; + } + + public void setYear2RhvPerServerValue(Double year2RhvPerServerValue) { + this.year2RhvPerServerValue = year2RhvPerServerValue; + } + + public Double getYear2RhvTotalValue() { + return year2RhvTotalValue; + } + + public void setYear2RhvTotalValue(Double year2RhvTotalValue) { + this.year2RhvTotalValue = year2RhvTotalValue; + } + + public Double getYear2RhvServersGrowth() { + return year2RhvServersGrowth; + } + + public void setYear2RhvServersGrowth(Double year2RhvServersGrowth) { + this.year2RhvServersGrowth = year2RhvServersGrowth; + } + + public Double getYear2RhvCompSubsGrowth() { + return year2RhvCompSubsGrowth; + } + + public void setYear2RhvCompSubsGrowth(Double year2RhvCompSubsGrowth) { + this.year2RhvCompSubsGrowth = year2RhvCompSubsGrowth; + } + + public Double getYear2RhvPaidSubsGrowth() { + return year2RhvPaidSubsGrowth; + } + + public void setYear2RhvPaidSubsGrowth(Double year2RhvPaidSubsGrowth) { + this.year2RhvPaidSubsGrowth = year2RhvPaidSubsGrowth; + } + + public Double getYear2RhvPerServerGrowthValue() { + return year2RhvPerServerGrowthValue; + } + + public void setYear2RhvPerServerGrowthValue(Double year2RhvPerServerGrowthValue) { + this.year2RhvPerServerGrowthValue = year2RhvPerServerGrowthValue; + } + + public Double getYear2RhvTotalGrowthValue() { + return year2RhvTotalGrowthValue; + } + + public void setYear2RhvTotalGrowthValue(Double year2RhvTotalGrowthValue) { + this.year2RhvTotalGrowthValue = year2RhvTotalGrowthValue; + } + + public Double getYear2RhvGrandTotalGrowthValue() { + return year2RhvGrandTotalGrowthValue; + } + + public void setYear2RhvGrandTotalGrowthValue(Double year2RhvGrandTotalGrowthValue) { + this.year2RhvGrandTotalGrowthValue = year2RhvGrandTotalGrowthValue; + } + + public Double getYear3RhvServers() { + return year3RhvServers; + } + + public void setYear3RhvServers(Double year3RhvServers) { + this.year3RhvServers = year3RhvServers; + } + + public Double getYear3RhvCompSubs() { + return year3RhvCompSubs; + } + + public void setYear3RhvCompSubs(Double year3RhvCompSubs) { + this.year3RhvCompSubs = year3RhvCompSubs; + } + + public Double getYear3RhvPaidSubs() { + return year3RhvPaidSubs; + } + + public void setYear3RhvPaidSubs(Double year3RhvPaidSubs) { + this.year3RhvPaidSubs = year3RhvPaidSubs; + } + + public Double getYear3RhvPerServerValue() { + return year3RhvPerServerValue; + } + + public void setYear3RhvPerServerValue(Double year3RhvPerServerValue) { + this.year3RhvPerServerValue = year3RhvPerServerValue; + } + + public Double getYear3RhvTotalValue() { + return year3RhvTotalValue; + } + + public void setYear3RhvTotalValue(Double year3RhvTotalValue) { + this.year3RhvTotalValue = year3RhvTotalValue; + } + + public Double getYear3RhvServersGrowth() { + return year3RhvServersGrowth; + } + + public void setYear3RhvServersGrowth(Double year3RhvServersGrowth) { + this.year3RhvServersGrowth = year3RhvServersGrowth; + } + + public Double getYear3RhvCompSubsGrowth() { + return year3RhvCompSubsGrowth; + } + + public void setYear3RhvCompSubsGrowth(Double year3RhvCompSubsGrowth) { + this.year3RhvCompSubsGrowth = year3RhvCompSubsGrowth; + } + + public Double getYear3RhvPaidSubsGrowth() { + return year3RhvPaidSubsGrowth; + } + + public void setYear3RhvPaidSubsGrowth(Double year3RhvPaidSubsGrowth) { + this.year3RhvPaidSubsGrowth = year3RhvPaidSubsGrowth; + } + + public Double getYear3RhvPerServerGrowthValue() { + return year3RhvPerServerGrowthValue; + } + + public void setYear3RhvPerServerGrowthValue(Double year3RhvPerServerGrowthValue) { + this.year3RhvPerServerGrowthValue = year3RhvPerServerGrowthValue; + } + + public Double getYear3RhvTotalGrowthValue() { + return year3RhvTotalGrowthValue; + } + + public void setYear3RhvTotalGrowthValue(Double year3RhvTotalGrowthValue) { + this.year3RhvTotalGrowthValue = year3RhvTotalGrowthValue; + } + + public Double getYear3RhvGrandTotalGrowthValue() { + return year3RhvGrandTotalGrowthValue; + } + + public void setYear3RhvGrandTotalGrowthValue(Double year3RhvGrandTotalGrowthValue) { + this.year3RhvGrandTotalGrowthValue = year3RhvGrandTotalGrowthValue; + } +} diff --git a/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVSavingsModel.java b/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVSavingsModel.java new file mode 100644 index 00000000..2c794a58 --- /dev/null +++ b/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVSavingsModel.java @@ -0,0 +1,53 @@ +package org.jboss.xavier.analytics.pojo.output; + +public class RHVSavingsModel +{ + // RHVSavings + private Double rhvSaveHighValue; + private Double rhvSaveLikelyValue; + private Double rhvSaveLowValue; + private Double rhvSaveFromValue; + private Double rhvSaveToValue; + + public RHVSavingsModel() {} + + public Double getRhvSaveHighValue() { + return rhvSaveHighValue; + } + + public void setRhvSaveHighValue(Double rhvSaveHighValue) { + this.rhvSaveHighValue = rhvSaveHighValue; + } + + public Double getRhvSaveLikelyValue() { + return rhvSaveLikelyValue; + } + + public void setRhvSaveLikelyValue(Double rhvSaveLikelyValue) { + this.rhvSaveLikelyValue = rhvSaveLikelyValue; + } + + public Double getRhvSaveLowValue() { + return rhvSaveLowValue; + } + + public void setRhvSaveLowValue(Double rhvSaveLowValue) { + this.rhvSaveLowValue = rhvSaveLowValue; + } + + public Double getRhvSaveFromValue() { + return rhvSaveFromValue; + } + + public void setRhvSaveFromValue(Double rhvSaveFromValue) { + this.rhvSaveFromValue = rhvSaveFromValue; + } + + public Double getRhvSaveToValue() { + return rhvSaveToValue; + } + + public void setRhvSaveToValue(Double rhvSaveToValue) { + this.rhvSaveToValue = rhvSaveToValue; + } +} diff --git a/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVYearByYearCostsModel.java b/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVYearByYearCostsModel.java new file mode 100644 index 00000000..a291b571 --- /dev/null +++ b/src/main/java/org/jboss/xavier/analytics/pojo/output/RHVYearByYearCostsModel.java @@ -0,0 +1,116 @@ +package org.jboss.xavier.analytics.pojo.output; + +public class RHVYearByYearCostsModel +{ + // RHVYearByYearCosts + private Double year1RhvGrandTotalValue; + private Double year2RhvGrandTotalValue; + private Double year3RhvGrandTotalValue; + private Double year1RhvBudgetFreedHighValue; + private Double year1RhvBudgetFreedLikelyValue; + private Double year1RhvBudgetFreedLowValue; + private Double year2RhvBudgetFreedHighValue; + private Double year2RhvBudgetFreedLikelyValue; + private Double year2RhvBudgetFreedLowValue; + private Double year3RhvBudgetFreedHighValue; + private Double year3RhvBudgetFreedLikelyValue; + private Double year3RhvBudgetFreedLowValue; + + public RHVYearByYearCostsModel() {} + + public Double getYear1RhvGrandTotalValue() { + return year1RhvGrandTotalValue; + } + + public void setYear1RhvGrandTotalValue(Double year1RhvGrandTotalValue) { + this.year1RhvGrandTotalValue = year1RhvGrandTotalValue; + } + + public Double getYear2RhvGrandTotalValue() { + return year2RhvGrandTotalValue; + } + + public void setYear2RhvGrandTotalValue(Double year2RhvGrandTotalValue) { + this.year2RhvGrandTotalValue = year2RhvGrandTotalValue; + } + + public Double getYear3RhvGrandTotalValue() { + return year3RhvGrandTotalValue; + } + + public void setYear3RhvGrandTotalValue(Double year3RhvGrandTotalValue) { + this.year3RhvGrandTotalValue = year3RhvGrandTotalValue; + } + + public Double getYear1RhvBudgetFreedHighValue() { + return year1RhvBudgetFreedHighValue; + } + + public void setYear1RhvBudgetFreedHighValue(Double year1RhvBudgetFreedHighValue) { + this.year1RhvBudgetFreedHighValue = year1RhvBudgetFreedHighValue; + } + + public Double getYear1RhvBudgetFreedLikelyValue() { + return year1RhvBudgetFreedLikelyValue; + } + + public void setYear1RhvBudgetFreedLikelyValue(Double year1RhvBudgetFreedLikelyValue) { + this.year1RhvBudgetFreedLikelyValue = year1RhvBudgetFreedLikelyValue; + } + + public Double getYear1RhvBudgetFreedLowValue() { + return year1RhvBudgetFreedLowValue; + } + + public void setYear1RhvBudgetFreedLowValue(Double year1RhvBudgetFreedLowValue) { + this.year1RhvBudgetFreedLowValue = year1RhvBudgetFreedLowValue; + } + + public Double getYear2RhvBudgetFreedHighValue() { + return year2RhvBudgetFreedHighValue; + } + + public void setYear2RhvBudgetFreedHighValue(Double year2RhvBudgetFreedHighValue) { + this.year2RhvBudgetFreedHighValue = year2RhvBudgetFreedHighValue; + } + + public Double getYear2RhvBudgetFreedLikelyValue() { + return year2RhvBudgetFreedLikelyValue; + } + + public void setYear2RhvBudgetFreedLikelyValue(Double year2RhvBudgetFreedLikelyValue) { + this.year2RhvBudgetFreedLikelyValue = year2RhvBudgetFreedLikelyValue; + } + + public Double getYear2RhvBudgetFreedLowValue() { + return year2RhvBudgetFreedLowValue; + } + + public void setYear2RhvBudgetFreedLowValue(Double year2RhvBudgetFreedLowValue) { + this.year2RhvBudgetFreedLowValue = year2RhvBudgetFreedLowValue; + } + + public Double getYear3RhvBudgetFreedHighValue() { + return year3RhvBudgetFreedHighValue; + } + + public void setYear3RhvBudgetFreedHighValue(Double year3RhvBudgetFreedHighValue) { + this.year3RhvBudgetFreedHighValue = year3RhvBudgetFreedHighValue; + } + + public Double getYear3RhvBudgetFreedLikelyValue() { + return year3RhvBudgetFreedLikelyValue; + } + + public void setYear3RhvBudgetFreedLikelyValue(Double year3RhvBudgetFreedLikelyValue) { + this.year3RhvBudgetFreedLikelyValue = year3RhvBudgetFreedLikelyValue; + } + + public Double getYear3RhvBudgetFreedLowValue() { + return year3RhvBudgetFreedLowValue; + } + + public void setYear3RhvBudgetFreedLowValue(Double year3RhvBudgetFreedLowValue) { + this.year3RhvBudgetFreedLowValue = year3RhvBudgetFreedLowValue; + } +} diff --git a/src/main/java/org/jboss/xavier/analytics/pojo/output/SourceCostsModel.java b/src/main/java/org/jboss/xavier/analytics/pojo/output/SourceCostsModel.java new file mode 100644 index 00000000..e44513bc --- /dev/null +++ b/src/main/java/org/jboss/xavier/analytics/pojo/output/SourceCostsModel.java @@ -0,0 +1,197 @@ +package org.jboss.xavier.analytics.pojo.output; + +public class SourceCostsModel +{ + // SourceCosts + private Double sourceLicenseValue; + private Double sourceMaintenanceValue; + private Integer year1Server; + private Double year1SourceValue; + private Double year1SourceMaintenanceValue; + private Integer year2Server; + private Double year2SourceValue; + private Double year2SourceMaintenanceValue; + private Integer year3Server; + private Double year3SourceValue; + private Double year3SourceMaintenanceValue; + private Double totSourceValue; + private Double totSourceMaintenanceValue; + private Double totalSourceValue; + private Double sourceNewELAIndicator; + private Double sourceNewHighValue; + private Double sourceNewLikelyValue; + private Double sourceNewLowValue; + private Double sourceRenewHighValue; + private Double sourceRenewLikelyValue; + private Double sourceRenewLowValue; + + public SourceCostsModel() {} + + public Double getSourceLicenseValue() { + return sourceLicenseValue; + } + + public void setSourceLicenseValue(Double sourceLicenseValue) { + this.sourceLicenseValue = sourceLicenseValue; + } + + public Double getSourceMaintenanceValue() { + return sourceMaintenanceValue; + } + + public void setSourceMaintenanceValue(Double sourceMaintenanceValue) { + this.sourceMaintenanceValue = sourceMaintenanceValue; + } + + public Integer getYear1Server() { + return year1Server; + } + + public void setYear1Server(Integer year1Server) { + this.year1Server = year1Server; + } + + public Double getYear1SourceValue() { + return year1SourceValue; + } + + public void setYear1SourceValue(Double year1SourceValue) { + this.year1SourceValue = year1SourceValue; + } + + public Double getYear1SourceMaintenanceValue() { + return year1SourceMaintenanceValue; + } + + public void setYear1SourceMaintenanceValue(Double year1SourceMaintenanceValue) { + this.year1SourceMaintenanceValue = year1SourceMaintenanceValue; + } + + public Integer getYear2Server() { + return year2Server; + } + + public void setYear2Server(Integer year2Server) { + this.year2Server = year2Server; + } + + public Double getYear2SourceValue() { + return year2SourceValue; + } + + public void setYear2SourceValue(Double year2SourceValue) { + this.year2SourceValue = year2SourceValue; + } + + public Double getYear2SourceMaintenanceValue() { + return year2SourceMaintenanceValue; + } + + public void setYear2SourceMaintenanceValue(Double year2SourceMaintenanceValue) { + this.year2SourceMaintenanceValue = year2SourceMaintenanceValue; + } + + public Integer getYear3Server() { + return year3Server; + } + + public void setYear3Server(Integer year3Server) { + this.year3Server = year3Server; + } + + public Double getYear3SourceValue() { + return year3SourceValue; + } + + public void setYear3SourceValue(Double year3SourceValue) { + this.year3SourceValue = year3SourceValue; + } + + public Double getYear3SourceMaintenanceValue() { + return year3SourceMaintenanceValue; + } + + public void setYear3SourceMaintenanceValue(Double year3SourceMaintenanceValue) { + this.year3SourceMaintenanceValue = year3SourceMaintenanceValue; + } + + public Double getTotSourceValue() { + return totSourceValue; + } + + public void setTotSourceValue(Double totSourceValue) { + this.totSourceValue = totSourceValue; + } + + public Double getTotSourceMaintenanceValue() { + return totSourceMaintenanceValue; + } + + public void setTotSourceMaintenanceValue(Double totSourceMaintenanceValue) { + this.totSourceMaintenanceValue = totSourceMaintenanceValue; + } + + public Double getTotalSourceValue() { + return totalSourceValue; + } + + public void setTotalSourceValue(Double totalSourceValue) { + this.totalSourceValue = totalSourceValue; + } + + public Double getSourceNewELAIndicator() { + return sourceNewELAIndicator; + } + + public void setSourceNewELAIndicator(Double sourceNewELAIndicator) { + this.sourceNewELAIndicator = sourceNewELAIndicator; + } + + public Double getSourceNewHighValue() { + return sourceNewHighValue; + } + + public void setSourceNewHighValue(Double sourceNewHighValue) { + this.sourceNewHighValue = sourceNewHighValue; + } + + public Double getSourceNewLikelyValue() { + return sourceNewLikelyValue; + } + + public void setSourceNewLikelyValue(Double sourceNewLikelyValue) { + this.sourceNewLikelyValue = sourceNewLikelyValue; + } + + public Double getSourceNewLowValue() { + return sourceNewLowValue; + } + + public void setSourceNewLowValue(Double sourceNewLowValue) { + this.sourceNewLowValue = sourceNewLowValue; + } + + public Double getSourceRenewHighValue() { + return sourceRenewHighValue; + } + + public void setSourceRenewHighValue(Double sourceRenewHighValue) { + this.sourceRenewHighValue = sourceRenewHighValue; + } + + public Double getSourceRenewLikelyValue() { + return sourceRenewLikelyValue; + } + + public void setSourceRenewLikelyValue(Double sourceRenewLikelyValue) { + this.sourceRenewLikelyValue = sourceRenewLikelyValue; + } + + public Double getSourceRenewLowValue() { + return sourceRenewLowValue; + } + + public void setSourceRenewLowValue(Double sourceRenewLowValue) { + this.sourceRenewLowValue = sourceRenewLowValue; + } +} diff --git a/src/main/java/org/jboss/xavier/analytics/pojo/output/SourceRampDownCostsModel.java b/src/main/java/org/jboss/xavier/analytics/pojo/output/SourceRampDownCostsModel.java new file mode 100644 index 00000000..74ffaa1d --- /dev/null +++ b/src/main/java/org/jboss/xavier/analytics/pojo/output/SourceRampDownCostsModel.java @@ -0,0 +1,143 @@ +package org.jboss.xavier.analytics.pojo.output; + +public class SourceRampDownCostsModel +{ + // SourceRampDownCosts + private Double year1ServersOffSource; + private Double year1SourceActiveLicense; + private Double year1SourcePaidMaintenance; + private Double year1SourceMaintenancePerServerValue; + private Double year1SourceMaintenanceTotalValue; + private Double year2ServersOffSource; + private Double year2SourceActiveLicense; + private Double year2SourcePaidMaintenance; + private Double year2SourceMaintenancePerServerValue; + private Double year2SourceMaintenanceTotalValue; + private Double year3ServersOffSource; + private Double year3SourceActiveLicense; + private Double year3SourcePaidMaintenance; + private Double year3SourceMaintenancePerServerValue; + private Double year3SourceMaintenanceTotalValue; + + public SourceRampDownCostsModel() {} + + public Double getYear1ServersOffSource() { + return year1ServersOffSource; + } + + public void setYear1ServersOffSource(Double year1ServersOffSource) { + this.year1ServersOffSource = year1ServersOffSource; + } + + public Double getYear1SourceActiveLicense() { + return year1SourceActiveLicense; + } + + public void setYear1SourceActiveLicense(Double year1SourceActiveLicense) { + this.year1SourceActiveLicense = year1SourceActiveLicense; + } + + public Double getYear1SourcePaidMaintenance() { + return year1SourcePaidMaintenance; + } + + public void setYear1SourcePaidMaintenance(Double year1SourcePaidMaintenance) { + this.year1SourcePaidMaintenance = year1SourcePaidMaintenance; + } + + public Double getYear1SourceMaintenancePerServerValue() { + return year1SourceMaintenancePerServerValue; + } + + public void setYear1SourceMaintenancePerServerValue(Double year1SourceMaintenancePerServerValue) { + this.year1SourceMaintenancePerServerValue = year1SourceMaintenancePerServerValue; + } + + public Double getYear1SourceMaintenanceTotalValue() { + return year1SourceMaintenanceTotalValue; + } + + public void setYear1SourceMaintenanceTotalValue(Double year1SourceMaintenanceTotalValue) { + this.year1SourceMaintenanceTotalValue = year1SourceMaintenanceTotalValue; + } + + public Double getYear2ServersOffSource() { + return year2ServersOffSource; + } + + public void setYear2ServersOffSource(Double year2ServersOffSource) { + this.year2ServersOffSource = year2ServersOffSource; + } + + public Double getYear2SourceActiveLicense() { + return year2SourceActiveLicense; + } + + public void setYear2SourceActiveLicense(Double year2SourceActiveLicense) { + this.year2SourceActiveLicense = year2SourceActiveLicense; + } + + public Double getYear2SourcePaidMaintenance() { + return year2SourcePaidMaintenance; + } + + public void setYear2SourcePaidMaintenance(Double year2SourcePaidMaintenance) { + this.year2SourcePaidMaintenance = year2SourcePaidMaintenance; + } + + public Double getYear2SourceMaintenancePerServerValue() { + return year2SourceMaintenancePerServerValue; + } + + public void setYear2SourceMaintenancePerServerValue(Double year2SourceMaintenancePerServerValue) { + this.year2SourceMaintenancePerServerValue = year2SourceMaintenancePerServerValue; + } + + public Double getYear2SourceMaintenanceTotalValue() { + return year2SourceMaintenanceTotalValue; + } + + public void setYear2SourceMaintenanceTotalValue(Double year2SourceMaintenanceTotalValue) { + this.year2SourceMaintenanceTotalValue = year2SourceMaintenanceTotalValue; + } + + public Double getYear3ServersOffSource() { + return year3ServersOffSource; + } + + public void setYear3ServersOffSource(Double year3ServersOffSource) { + this.year3ServersOffSource = year3ServersOffSource; + } + + public Double getYear3SourceActiveLicense() { + return year3SourceActiveLicense; + } + + public void setYear3SourceActiveLicense(Double year3SourceActiveLicense) { + this.year3SourceActiveLicense = year3SourceActiveLicense; + } + + public Double getYear3SourcePaidMaintenance() { + return year3SourcePaidMaintenance; + } + + public void setYear3SourcePaidMaintenance(Double year3SourcePaidMaintenance) { + this.year3SourcePaidMaintenance = year3SourcePaidMaintenance; + } + + public Double getYear3SourceMaintenancePerServerValue() { + return year3SourceMaintenancePerServerValue; + } + + public void setYear3SourceMaintenancePerServerValue(Double year3SourceMaintenancePerServerValue) { + this.year3SourceMaintenancePerServerValue = year3SourceMaintenancePerServerValue; + } + + public Double getYear3SourceMaintenanceTotalValue() { + return year3SourceMaintenanceTotalValue; + } + + public void setYear3SourceMaintenanceTotalValue(Double year3SourceMaintenanceTotalValue) { + this.year3SourceMaintenanceTotalValue = year3SourceMaintenanceTotalValue; + } +} diff --git a/src/main/java/org/jboss/xavier/analytics/pojo/support/PricingDataModel.java b/src/main/java/org/jboss/xavier/analytics/pojo/support/PricingDataModel.java new file mode 100644 index 00000000..a9d6b0fd --- /dev/null +++ b/src/main/java/org/jboss/xavier/analytics/pojo/support/PricingDataModel.java @@ -0,0 +1,238 @@ +package org.jboss.xavier.analytics.pojo.support; + +/* +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +*/ +import org.kie.api.definition.type.Label; + +/*@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor*/ +public class PricingDataModel implements java.io.Serializable { + + @Label("Source product list price value") + private Double sourceListValue; + + @Label("Source product discount percentage (0-1)") + private Double sourceDiscountPercentage; + + @Label("Source product maintenance price percentage (0-1)") + private Double sourceMaintenancePercentage; + + @Label("Source product renewal goal high") + private Double sourceRenewHighFactor; + + @Label("Source product renewal goal likely") + private Double sourceRenewLikelyFactor; + + @Label("Source product renewal goal low") + private Double sourceRenewLowFactor; + + @Label("Year-over-Year growth in maintenance cost due to breaking ELA") + private Double sourceMaintenanceGrowthPercentage; + + @Label("RHV or RHV Suite Consulting") + private Double rhvConsultValue; + + @Label("RHV or RHV Suite T&E for consulting") + private Double rhvTAndEValue; + + @Label("Red Hat Learning subscriptions") + private Double rhLearningSubsValue; + + @Label("Red Hat Virtualization, Premium") + private Double rhvListValue; + + @Label("Red Hat Virtualization, Premium Discount") + private Double rhvDiscountperc; + + @Label("Red Hat CloudForms, Premium") + private Double rhCFListValue; + + @Label("Red Hat CloudForms, Premium Discount") + private Double rhCFDiscountPercentage; + + @Label("Red Hat OpenShift, Premium") + private Double rhOSListValue; + + @Label("Red Hat OpenShift, Premium Discount") + private Double rhOSDiscountPercentage; + + @Label("Red Hat Virtualization Suite, Premium") + private Double rhVirtListValue; + + @Label("Red Hat Virtualization Suite, Premium Discount") + private Double rhVirtDiscountPercentage; + + @Label("Red Hat Generosity") + private Double freeSubsYear1Indicator; + + @Label("Red Hat Generosity") + private Double freeSubsYear2And3Indicator; + + public PricingDataModel() {} + + public Double getSourceListValue() { + return sourceListValue; + } + + public void setSourceListValue(Double sourceListValue) { + this.sourceListValue = sourceListValue; + } + + public Double getSourceDiscountPercentage() { + return sourceDiscountPercentage; + } + + public void setSourceDiscountPercentage(Double sourceDiscountPercentage) { + this.sourceDiscountPercentage = sourceDiscountPercentage; + } + + public Double getSourceMaintenancePercentage() { + return sourceMaintenancePercentage; + } + + public void setSourceMaintenancePercentage(Double sourceMaintenancePercentage) { + this.sourceMaintenancePercentage = sourceMaintenancePercentage; + } + + public Double getSourceRenewHighFactor() { + return sourceRenewHighFactor; + } + + public void setSourceRenewHighFactor(Double sourceRenewHighFactor) { + this.sourceRenewHighFactor = sourceRenewHighFactor; + } + + public Double getSourceRenewLikelyFactor() { + return sourceRenewLikelyFactor; + } + + public void setSourceRenewLikelyFactor(Double sourceRenewLikelyFactor) { + this.sourceRenewLikelyFactor = sourceRenewLikelyFactor; + } + + public Double getSourceRenewLowFactor() { + return sourceRenewLowFactor; + } + + public void setSourceRenewLowFactor(Double sourceRenewLowFactor) { + this.sourceRenewLowFactor = sourceRenewLowFactor; + } + + public Double getSourceMaintenanceGrowthPercentage() { + return sourceMaintenanceGrowthPercentage; + } + + public void setSourceMaintenanceGrowthPercentage(Double sourceMaintenanceGrowthPercentage) { + this.sourceMaintenanceGrowthPercentage = sourceMaintenanceGrowthPercentage; + } + + public Double getRhvConsultValue() { + return rhvConsultValue; + } + + public void setRhvConsultValue(Double rhvConsultValue) { + this.rhvConsultValue = rhvConsultValue; + } + + public Double getRhvTAndEValue() { + return rhvTAndEValue; + } + + public void setRhvTAndEValue(Double rhvTAndEValue) { + this.rhvTAndEValue = rhvTAndEValue; + } + + public Double getRhLearningSubsValue() { + return rhLearningSubsValue; + } + + public void setRhLearningSubsValue(Double rhLearningSubsValue) { + this.rhLearningSubsValue = rhLearningSubsValue; + } + + public Double getRhvListValue() { + return rhvListValue; + } + + public void setRhvListValue(Double rhvListValue) { + this.rhvListValue = rhvListValue; + } + + public Double getRhvDiscountperc() { + return rhvDiscountperc; + } + + public void setRhvDiscountperc(Double rhvDiscountperc) { + this.rhvDiscountperc = rhvDiscountperc; + } + + public Double getRhCFListValue() { + return rhCFListValue; + } + + public void setRhCFListValue(Double rhCFListValue) { + this.rhCFListValue = rhCFListValue; + } + + public Double getRhCFDiscountPercentage() { + return rhCFDiscountPercentage; + } + + public void setRhCFDiscountPercentage(Double rhCFDiscountPercentage) { + this.rhCFDiscountPercentage = rhCFDiscountPercentage; + } + + public Double getRhOSListValue() { + return rhOSListValue; + } + + public void setRhOSListValue(Double rhOSListValue) { + this.rhOSListValue = rhOSListValue; + } + + public Double getRhOSDiscountPercentage() { + return rhOSDiscountPercentage; + } + + public void setRhOSDiscountPercentage(Double rhOSDiscountPercentage) { + this.rhOSDiscountPercentage = rhOSDiscountPercentage; + } + + public Double getRhVirtListValue() { + return rhVirtListValue; + } + + public void setRhVirtListValue(Double rhVirtListValue) { + this.rhVirtListValue = rhVirtListValue; + } + + public Double getRhVirtDiscountPercentage() { + return rhVirtDiscountPercentage; + } + + public void setRhVirtDiscountPercentage(Double rhVirtDiscountPercentage) { + this.rhVirtDiscountPercentage = rhVirtDiscountPercentage; + } + + public Double getFreeSubsYear1Indicator() { + return freeSubsYear1Indicator; + } + + public void setFreeSubsYear1Indicator(Double freeSubsYear1Indicator) { + this.freeSubsYear1Indicator = freeSubsYear1Indicator; + } + + public Double getFreeSubsYear2And3Indicator() { + return freeSubsYear2And3Indicator; + } + + public void setFreeSubsYear2And3Indicator(Double freeSubsYear2And3Indicator) { + this.freeSubsYear2And3Indicator = freeSubsYear2And3Indicator; + } +} diff --git a/src/test/java/com/myspace/sample_analytics/.gitkeep b/src/main/java/org/jboss/xavier/analytics/test/.gitkeep similarity index 100% rename from src/test/java/com/myspace/sample_analytics/.gitkeep rename to src/main/java/org/jboss/xavier/analytics/test/.gitkeep diff --git a/src/test/java/com/myspace/sample_analytics/decisiontable/.gitkeep b/src/main/java/org/jboss/xavier/analytics/test/scenario/.gitkeep similarity index 100% rename from src/test/java/com/myspace/sample_analytics/decisiontable/.gitkeep rename to src/main/java/org/jboss/xavier/analytics/test/scenario/.gitkeep diff --git a/src/main/resources/META-INF/kmodule.xml b/src/main/resources/META-INF/kmodule.xml index 509b3cc1..c674f3b2 100644 --- a/src/main/resources/META-INF/kmodule.xml +++ b/src/main/resources/META-INF/kmodule.xml @@ -2,4 +2,7 @@ + + + \ No newline at end of file diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml index fda3021d..0157ea41 100644 --- a/src/main/resources/META-INF/persistence.xml +++ b/src/main/resources/META-INF/persistence.xml @@ -5,6 +5,7 @@ java:jboss/datasources/ExampleDS com.myspace.sample_analytics.pojo.input.InputDataModel com.myspace.sample_analytics.pojo.output.ReportDataModel + org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel true diff --git a/src/main/resources/org/jboss/xavier/analytics/rules/Environment.drl b/src/main/resources/org/jboss/xavier/analytics/rules/Environment.drl new file mode 100644 index 00000000..bc1b7b2b --- /dev/null +++ b/src/main/resources/org/jboss/xavier/analytics/rules/Environment.drl @@ -0,0 +1,40 @@ +package org.jboss.xavier.analytics.rules; + +import org.jboss.xavier.analytics.pojo.input.UploadFormInputDataModel; +import org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel; +import org.jboss.xavier.analytics.pojo.output.EnvironmentModel; +import java.util.Date + +import function org.jboss.xavier.analytics.functions.HelperFunctions.round; + +dialect "java" +agenda-group "Environment" +auto-focus true + +rule "Copy input fields and agenda controller" + salience 65001 + when + uploadedPayload : UploadFormInputDataModel(customerId != null) + then + InitialSavingsEstimationReportModel initialSavingsEstimationReport = new InitialSavingsEstimationReportModel(); + initialSavingsEstimationReport.setCustomerId(uploadedPayload.getCustomerId()); + initialSavingsEstimationReport.setFileName(uploadedPayload.getFileName()); + initialSavingsEstimationReport.setCreationDate(new Date()); + EnvironmentModel environmentModel = new EnvironmentModel(); + environmentModel.setHypervisors(uploadedPayload.getHypervisor()); + environmentModel.setSourceProductIndicator(1); + environmentModel.setYear1Hypervisor(round(uploadedPayload.getYear1HypervisorPercentage() * uploadedPayload.getHypervisor())); + environmentModel.setYear2Hypervisor(round(uploadedPayload.getYear2HypervisorPercentage() * uploadedPayload.getHypervisor())); + environmentModel.setYear3Hypervisor(round(uploadedPayload.getYear3HypervisorPercentage() * uploadedPayload.getHypervisor())); + environmentModel.setGrowthRatePercentage(uploadedPayload.getGrowthRatePercentage()); + initialSavingsEstimationReport.setEnvironmentModel(environmentModel); + insert(initialSavingsEstimationReport); + kcontext.getKieRuntime().getAgenda().getAgendaGroup("Pricing").setFocus(); + kcontext.getKieRuntime().getAgenda().getAgendaGroup("SourceCosts").setFocus(); + kcontext.getKieRuntime().getAgenda().getAgendaGroup("SourceRampDownCosts").setFocus(); + kcontext.getKieRuntime().getAgenda().getAgendaGroup("RHVRampUpCosts").setFocus(); + kcontext.getKieRuntime().getAgenda().getAgendaGroup("RHVYearByYearCosts").setFocus(); + kcontext.getKieRuntime().getAgenda().getAgendaGroup("RHVSavings").setFocus(); + kcontext.getKieRuntime().getAgenda().getAgendaGroup("RHVAdditionalContainerCapacity").setFocus(); + kcontext.getKieRuntime().getAgenda().getAgendaGroup("RHVOrderForm").setFocus(); +end diff --git a/src/main/resources/org/jboss/xavier/analytics/rules/GetInitialSavingsEstimationReports.drl b/src/main/resources/org/jboss/xavier/analytics/rules/GetInitialSavingsEstimationReports.drl new file mode 100644 index 00000000..39864bd9 --- /dev/null +++ b/src/main/resources/org/jboss/xavier/analytics/rules/GetInitialSavingsEstimationReports.drl @@ -0,0 +1,5 @@ +package org.jboss.xavier.analytics.rules; + +query "get InitialSavingsEstimationReports"() + report : org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel() +end diff --git a/src/main/resources/org/jboss/xavier/analytics/rules/PricingRule.xlsx b/src/main/resources/org/jboss/xavier/analytics/rules/PricingRule.xlsx new file mode 100644 index 00000000..9c6b8491 Binary files /dev/null and b/src/main/resources/org/jboss/xavier/analytics/rules/PricingRule.xlsx differ diff --git a/src/main/resources/org/jboss/xavier/analytics/rules/SourceCosts.drl b/src/main/resources/org/jboss/xavier/analytics/rules/SourceCosts.drl new file mode 100644 index 00000000..b0ff2179 --- /dev/null +++ b/src/main/resources/org/jboss/xavier/analytics/rules/SourceCosts.drl @@ -0,0 +1,25 @@ +package org.jboss.xavier.analytics.rules; + +import java.lang.Number; +import org.jboss.xavier.analytics.pojo.support.PricingDataModel; +import org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel +import org.jboss.xavier.analytics.pojo.output.EnvironmentModel +import org.jboss.xavier.analytics.pojo.output.SourceCostsModel; + +dialect "java" +agenda-group "SourceCosts" +lock-on-active true + +rule "SourceCostsRules" + when + pricing : PricingDataModel( sourceListValue != null , sourceDiscountPercentage != null , sourceMaintenancePercentage != null ) + report : InitialSavingsEstimationReportModel(environmentModel != null) + then + SourceCostsModel sourceCostsModel = new SourceCostsModel(); + sourceCostsModel.setSourceLicenseValue(pricing.getSourceListValue() * (1 - pricing.getSourceDiscountPercentage())); + sourceCostsModel.setSourceMaintenanceValue(sourceCostsModel.getSourceLicenseValue() * pricing.getSourceMaintenancePercentage()); + modify(report) + { + setSourceCostsModel(sourceCostsModel) + } +end diff --git a/src/test/java/com/myspace/sample_analytics/pojo/.gitkeep b/src/main/resources/org/jboss/xavier/analytics/test/.gitkeep similarity index 100% rename from src/test/java/com/myspace/sample_analytics/pojo/.gitkeep rename to src/main/resources/org/jboss/xavier/analytics/test/.gitkeep diff --git a/src/test/java/com/myspace/sample_analytics/pojo/input/.gitkeep b/src/main/resources/org/jboss/xavier/analytics/test/scenario/.gitkeep similarity index 100% rename from src/test/java/com/myspace/sample_analytics/pojo/input/.gitkeep rename to src/main/resources/org/jboss/xavier/analytics/test/scenario/.gitkeep diff --git a/src/test/java/com/myspace/sample_analytics/pojo/output/.gitkeep b/src/test/java/org/jboss/xavier/analytics/test/.gitkeep similarity index 100% rename from src/test/java/com/myspace/sample_analytics/pojo/output/.gitkeep rename to src/test/java/org/jboss/xavier/analytics/test/.gitkeep diff --git a/src/test/java/org/jboss/xavier/analytics/test/BaseTest.java b/src/test/java/org/jboss/xavier/analytics/test/BaseTest.java new file mode 100644 index 00000000..e8fb0eb3 --- /dev/null +++ b/src/test/java/org/jboss/xavier/analytics/test/BaseTest.java @@ -0,0 +1,89 @@ +package org.jboss.xavier.analytics.test; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.kie.api.KieServices; +import org.kie.api.builder.KieBuilder; +import org.kie.api.builder.KieFileSystem; +import org.kie.api.builder.KieRepository; +import org.kie.api.builder.Message; +import org.kie.api.definition.KiePackage; +import org.kie.api.event.rule.DebugAgendaEventListener; +import org.kie.api.event.rule.DebugRuleRuntimeEventListener; +import org.kie.api.io.ResourceType; +import org.kie.api.runtime.KieContainer; +import org.kie.api.runtime.StatelessKieSession; +import org.kie.internal.io.ResourceFactory; + +import java.io.File; +import java.net.URL; + +import static org.junit.Assert.assertEquals; + +public abstract class BaseTest { + protected static final String GET_OBJECTS_KEY = "_getObjects"; + protected static final String NUMBER_OF_FIRED_RULE_KEY = "numberOfFiredRules"; + + protected final String rulePath; + protected final ResourceType ruleResourceType; + + protected StatelessKieSession kieSession; + protected KieFileSystem kieFileSystem; + protected KieServices kieServices; + + public BaseTest(String rulePath, ResourceType resourceType) + { + this.rulePath = rulePath; + this.ruleResourceType = resourceType; + } + + @Before + public void setup() + { + URL resource = getClass().getResource(rulePath); + if (resource == null){ + throw new IllegalArgumentException(ruleResourceType + " file '" + rulePath + "' does not resolve to a resource"); + } + + kieServices = KieServices.Factory.get(); + kieFileSystem = kieServices.newKieFileSystem(); + + KieBuilder kieBuilder = createAndBuildKieBuilder(resource); + assertEquals(0, kieBuilder.getResults().getMessages(Message.Level.ERROR).size()); + + KieRepository kieRepository = kieServices.getRepository(); + KieContainer kContainer = kieServices.newKieContainer(kieRepository.getDefaultReleaseId()); + kieSession = kContainer.newStatelessKieSession(); + kieSession.addEventListener(new DebugRuleRuntimeEventListener()); + kieSession.addEventListener(new DebugAgendaEventListener()); + } + + public void checkLoadedRulesNumber(int expectedLoadedRules) + { + KiePackage kiePackage = kieSession.getKieBase().getKiePackage("org.jboss.xavier.analytics.rules"); + Assert.assertNotNull("No rules have been loaded from 'org.jboss.xavier.analytics.rules' package", kiePackage); + assertEquals("Wrong number of rules loaded", expectedLoadedRules, kiePackage.getRules().size()); + } + + protected KieBuilder createAndBuildKieBuilder(URL resource) + { + File ruleFile = new File(resource.getPath()); + kieFileSystem.write(ResourceFactory.newFileResource(ruleFile).setResourceType(ruleResourceType)); + addAgendaGroupRuleToKieFileSystem(kieFileSystem); + KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem); + kieBuilder.buildAll(); + return kieBuilder; + } + + protected void addAgendaGroupRuleToKieFileSystem(KieFileSystem kieFileSystem) + { + File agendaFocusForTestFile = new File(getClass().getResource("/org/jboss/xavier/analytics/test/rules/AgendaFocusForTest.drl").getPath()); + kieFileSystem.write(ResourceFactory.newFileResource(agendaFocusForTestFile).setResourceType(ResourceType.DRL)); + } + + @After + public void tearDown() + { + } +} diff --git a/src/test/java/org/jboss/xavier/analytics/test/EnvironmentTest.java b/src/test/java/org/jboss/xavier/analytics/test/EnvironmentTest.java new file mode 100644 index 00000000..57694b1f --- /dev/null +++ b/src/test/java/org/jboss/xavier/analytics/test/EnvironmentTest.java @@ -0,0 +1,76 @@ +package org.jboss.xavier.analytics.test; + +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.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 EnvironmentTest extends BaseTest { + private static final String CUSTOMER_ID = "123"; + private static final Integer NUMBER_OF_HYPERVISORS = 101; + private static final double GROWTH_RATE_PERCENTAGE = 0.05; + private static final String FILE_NAME = "example_payload.zip"; + private static final int DEFAULT_SOURCE_PRODUCT_INDICATOR = 1; + + public EnvironmentTest() { + super("/org/jboss/xavier/analytics/rules/Environment.drl", ResourceType.DRL); + } + + @Test + public void test() { + checkLoadedRulesNumber(1); + + Map facts = new HashMap<>(); + + UploadFormInputDataModel inputDataModel = new UploadFormInputDataModel(); + inputDataModel.setCustomerId(CUSTOMER_ID); + inputDataModel.setHypervisor(NUMBER_OF_HYPERVISORS); + inputDataModel.setGrowthRatePercentage(GROWTH_RATE_PERCENTAGE); + inputDataModel.setYear1HypervisorPercentage(0.5); + inputDataModel.setYear2HypervisorPercentage(0.3); + inputDataModel.setYear3HypervisorPercentage(0.1); + inputDataModel.setFileName(FILE_NAME); + facts.put("inputDataModel", inputDataModel); + + List commands = new ArrayList<>(); + commands.addAll(Utils.newInsertCommands(facts)); + commands.add(CommandFactory.newFireAllRules(NUMBER_OF_FIRED_RULE_KEY)); + commands.add(CommandFactory.newGetObjects(GET_OBJECTS_KEY)); + + Map results = Utils.executeCommandsAndGetResults(kieSession, commands); + + Assert.assertEquals(1, results.get(NUMBER_OF_FIRED_RULE_KEY)); + + List objects = (List) results.get((GET_OBJECTS_KEY)); + List reports = objects.stream() + .filter(object -> object instanceof InitialSavingsEstimationReportModel) + .map(object -> (InitialSavingsEstimationReportModel) object) + .collect(Collectors.toList()); + + // just one report has to be created + Assert.assertEquals(1, reports.size()); + + InitialSavingsEstimationReportModel report = reports.get(0); + Assert.assertEquals(CUSTOMER_ID, report.getCustomerId()); + Assert.assertNotNull(report.getCreationDate()); + Assert.assertEquals(FILE_NAME, report.getFileName()); + + EnvironmentModel environmentModel = report.getEnvironmentModel(); + Assert.assertEquals(NUMBER_OF_HYPERVISORS, environmentModel.getHypervisors()); + Assert.assertEquals(GROWTH_RATE_PERCENTAGE, environmentModel.getGrowthRatePercentage(), 0); + Assert.assertEquals(51, environmentModel.getYear1Hypervisor().intValue()); + Assert.assertEquals(30, environmentModel.getYear2Hypervisor().intValue()); + Assert.assertEquals(Integer.valueOf(10), environmentModel.getYear3Hypervisor()); + Assert.assertEquals(Integer.valueOf(DEFAULT_SOURCE_PRODUCT_INDICATOR), environmentModel.getSourceProductIndicator()); + } +} diff --git a/src/test/java/org/jboss/xavier/analytics/test/PricingTest.java b/src/test/java/org/jboss/xavier/analytics/test/PricingTest.java new file mode 100644 index 00000000..8f2be851 --- /dev/null +++ b/src/test/java/org/jboss/xavier/analytics/test/PricingTest.java @@ -0,0 +1,106 @@ +package org.jboss.xavier.analytics.test; + +import org.jboss.xavier.analytics.pojo.output.EnvironmentModel; +import org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel; +import org.jboss.xavier.analytics.pojo.support.PricingDataModel; +import org.junit.Assert; +import org.junit.Test; +import org.kie.api.builder.KieBuilder; +import org.kie.api.command.Command; +import org.kie.api.io.ResourceType; +import org.kie.internal.command.CommandFactory; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class PricingTest extends BaseTest +{ + private static final int DEFAULT_SOURCE_PRODUCT_INDICATOR = 1; + + public PricingTest() + { + super("/org/jboss/xavier/analytics/rules/PricingRule.xlsx", ResourceType.DTABLE); + } + + @Override + protected KieBuilder createAndBuildKieBuilder(URL resource) + { + FileInputStream ruleFile = null; + try { + ruleFile = new FileInputStream(resource.getPath()); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + kieFileSystem.write("src/main/resources/" + this.rulePath, kieServices.getResources().newInputStreamResource(ruleFile).setResourceType(this.ruleResourceType)); + +/* + Resource dt = ResourceFactory.newClassPathResource(this.rulePath, getClass()); + DecisionTableProviderImpl decisionTableProvider = new DecisionTableProviderImpl(); + DecisionTableConfiguration decisionTableConfiguration = new DecisionTableConfigurationImpl(); + decisionTableConfiguration.setInputType(DecisionTableInputType.XLSX); + String drl = decisionTableProvider.loadFromResource(dt, decisionTableConfiguration); + kieFileSystem.write("src/main/resources/org/jboss/xavier/analytics/rules/PricingRule.drl", drl); +*/ + + addAgendaGroupRuleToKieFileSystem(kieFileSystem); + + KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem); + kieBuilder.buildAll(); + return kieBuilder; + } + + @Test + public void test() + { + checkLoadedRulesNumber(4); + + EnvironmentModel environmentModel = new EnvironmentModel(); + environmentModel.setSourceProductIndicator(DEFAULT_SOURCE_PRODUCT_INDICATOR); + InitialSavingsEstimationReportModel reportModel = new InitialSavingsEstimationReportModel(); + reportModel.setEnvironmentModel(environmentModel); + + Map facts = new HashMap<>(); + facts.put("reportModel", reportModel); + facts.put("agendaGroup", "Pricing"); + + List commands = new ArrayList<>(); + commands.addAll(Utils.newInsertCommands(facts)); + commands.add(CommandFactory.newFireAllRules(NUMBER_OF_FIRED_RULE_KEY)); + commands.add(CommandFactory.newGetObjects(GET_OBJECTS_KEY)); + + Map results = Utils.executeCommandsAndGetResults(kieSession, commands); + + Assert.assertEquals(4, results.get(NUMBER_OF_FIRED_RULE_KEY)); + + List objects = (List) results.get((GET_OBJECTS_KEY)); + + List reports = objects.stream() + .filter(object -> object instanceof InitialSavingsEstimationReportModel) + .map(object -> (InitialSavingsEstimationReportModel) object) + .collect(Collectors.toList()); + + // just one InitialSavingsEstimationReportModel has to be available + Assert.assertEquals(1, reports.size()); + + List pricingDataModelList = objects.stream() + .filter(object -> object instanceof PricingDataModel) + .map(object -> (PricingDataModel) object) + .collect(Collectors.toList()); + + // just one PricingDataModel has to be created + Assert.assertEquals(1, pricingDataModelList.size()); + PricingDataModel pricingDataModel = pricingDataModelList.get(0); + Assert.assertEquals(10000, pricingDataModel.getSourceListValue(), 0); + Assert.assertEquals(0.1, pricingDataModel.getSourceDiscountPercentage(), 0); + Assert.assertEquals(0.75, pricingDataModel.getSourceMaintenancePercentage(), 0); + Assert.assertEquals(3.5, pricingDataModel.getSourceRenewHighFactor(), 0); + Assert.assertEquals(2.75, pricingDataModel.getSourceRenewLikelyFactor(), 0); + Assert.assertEquals(2.0, pricingDataModel.getSourceRenewLowFactor(), 0); + } +} diff --git a/src/test/java/org/jboss/xavier/analytics/test/SourceCostsTest.java b/src/test/java/org/jboss/xavier/analytics/test/SourceCostsTest.java new file mode 100644 index 00000000..34b9ddd2 --- /dev/null +++ b/src/test/java/org/jboss/xavier/analytics/test/SourceCostsTest.java @@ -0,0 +1,86 @@ +package org.jboss.xavier.analytics.test; + +import org.jboss.xavier.analytics.pojo.output.EnvironmentModel; +import org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel; +import org.jboss.xavier.analytics.pojo.output.SourceCostsModel; +import org.jboss.xavier.analytics.pojo.support.PricingDataModel; +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 SourceCostsTest extends BaseTest +{ + public SourceCostsTest() + { + // provide the name of the DRL file you want to test + super("/org/jboss/xavier/analytics/rules/SourceCosts.drl", ResourceType.DRL); + } + + @Test + public void test() + { + // check that the numbers of rule from the DRL file is the number of rules loaded + checkLoadedRulesNumber(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", "SourceCosts"); + + // define the objects needed to define the "When" side of the test + PricingDataModel pricingDataModel = new PricingDataModel(); + pricingDataModel.setSourceListValue(1000.0); + pricingDataModel.setSourceDiscountPercentage(0.2); + pricingDataModel.setSourceMaintenancePercentage(0.7); + // and add each object to the Map + facts.put("pricingDataModel", pricingDataModel); + + // another object needed as input for the test + EnvironmentModel environmentModel = new EnvironmentModel(); + InitialSavingsEstimationReportModel reportModel = new InitialSavingsEstimationReportModel(); + reportModel.setEnvironmentModel(environmentModel); + // 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); + SourceCostsModel sourceCostsModel = report.getSourceCostsModel(); + Assert.assertEquals(800, sourceCostsModel.getSourceLicenseValue(), 0); + Assert.assertEquals(560, sourceCostsModel.getSourceMaintenanceValue(), 0); + } +} diff --git a/src/test/java/org/jboss/xavier/analytics/test/Utils.java b/src/test/java/org/jboss/xavier/analytics/test/Utils.java new file mode 100644 index 00000000..f54fe370 --- /dev/null +++ b/src/test/java/org/jboss/xavier/analytics/test/Utils.java @@ -0,0 +1,60 @@ +package org.jboss.xavier.analytics.test; + +import org.drools.core.command.runtime.rule.FireAllRulesCommand; +import org.drools.core.reteoo.RuleTerminalNodeLeftTuple; +import org.drools.core.spi.AgendaGroup; +import org.kie.api.command.Command; +import org.kie.api.runtime.CommandExecutor; +import org.kie.api.runtime.ExecutionResults; +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 Utils +{ + public static FireAllRulesCommand newFireAllRulesCommand(final String agendaGroupFilter) + { + FireAllRulesCommand fireAllRulesCommand = new FireAllRulesCommand(); + fireAllRulesCommand.setAgendaFilter(match -> { + String ruleAgendaGroup = ((RuleTerminalNodeLeftTuple) match).getAgendaGroup().getName(); + System.out.printf("Rule has agenda group '%s' and the test executes only the '%s' agenda group or the default '%s' agenda group\n", ruleAgendaGroup, agendaGroupFilter, AgendaGroup.MAIN); + return agendaGroupFilter.equals(ruleAgendaGroup) || AgendaGroup.MAIN.equals(ruleAgendaGroup); + }); + return fireAllRulesCommand; + } + + public static List newInsertCommands(Map facts) + { + List commands = new ArrayList<>(); + for (Map.Entry entry : facts.entrySet()) { + Command insertFactCommand = CommandFactory.newInsert(entry.getValue(), entry.getKey()); + commands.add(insertFactCommand); + } + return commands; + } + + public static Map executeCommandsAndGetResults(CommandExecutor kieSession, List commands) + { + ExecutionResults executionResults = kieSession.execute(CommandFactory.newBatchExecution(commands)); + Map results = new HashMap(executionResults.getIdentifiers().size()); + for (String identifier : executionResults.getIdentifiers()) { + results.put(identifier, executionResults.getValue(identifier)); + } + return results; + } + + public static List getListOf(Class t, Map results, String objectKey) + { + List objects = (List) results.get((objectKey)); + List tList = objects.stream() + .filter(object -> t.isAssignableFrom(object.getClass())) + .map(object -> (T) object) + .collect(Collectors.toList()); + return tList; + } + +} diff --git a/src/test/java/com/myspace/sample_analytics/rules/.gitkeep b/src/test/java/org/jboss/xavier/analytics/test/scenario/.gitkeep similarity index 100% rename from src/test/java/com/myspace/sample_analytics/rules/.gitkeep rename to src/test/java/org/jboss/xavier/analytics/test/scenario/.gitkeep diff --git a/src/test/java/com/myspace/sample_analytics/test/.gitkeep b/src/test/resources/org/jboss/xavier/analytics/test/.gitkeep similarity index 100% rename from src/test/java/com/myspace/sample_analytics/test/.gitkeep rename to src/test/resources/org/jboss/xavier/analytics/test/.gitkeep diff --git a/src/test/resources/org/jboss/xavier/analytics/test/EnvironmentTest.scenario b/src/test/resources/org/jboss/xavier/analytics/test/EnvironmentTest.scenario new file mode 100644 index 00000000..2b26a63e --- /dev/null +++ b/src/test/resources/org/jboss/xavier/analytics/test/EnvironmentTest.scenario @@ -0,0 +1,169 @@ + + EnvironmentTest.scenario + 100000 + + + + UploadFormInputDataModel + + + customerId + 123 + 4 + + + hypervisor + 101 + 4 + + + growthRatePercentage + 0.5 + 4 + + + year1HypervisorPercentage + 0.5 + 4 + + + year2HypervisorPercentage + 0.3 + 4 + + + year3HypervisorPercentage + 0.2 + 4 + + + fileName + example_payload.zip + 4 + + + input + false + + + env + + + 282 + 5 + + + + + customerId + 123 + + true + [InitialSavingsEstimationReportModel] field [customerId] was [123]. + == + 1 + + + hypervisors + 101 + + true + [InitialSavingsEstimationReportModel] field [hypervisors] was [101]. + == + 1 + + + growthRatePercentage + 0.5 + 0.0 + true + [InitialSavingsEstimationReportModel] field [growthRatePercentage] was [0.5]. + == + 1 + + + year1Hypervisor + 51 + 0 + true + [InitialSavingsEstimationReportModel] field [year1Hypervisor] was [51]. + == + 1 + + + year2Hypervisor + 30 + 0 + true + [InitialSavingsEstimationReportModel] field [year2Hypervisor] was [30]. + == + 1 + + + year3Hypervisor + 20 + 0 + true + [InitialSavingsEstimationReportModel] field [year3Hypervisor] was [20]. + == + 1 + + + fileName + example_payload.zip + + true + [InitialSavingsEstimationReportModel] field [fileName] was [example_payload.zip]. + == + 1 + + + sourceProductIndicator + 1 + 0 + true + [InitialSavingsEstimationReportModel] field [sourceProductIndicator] was [1]. + == + 1 + + + dealIndicator + 1 + 0 + true + [InitialSavingsEstimationReportModel] field [dealIndicator] was [1]. + == + 1 + + + openStackIndicator + 2 + 0 + true + [InitialSavingsEstimationReportModel] field [openStackIndicator] was [2]. + == + 1 + + + InitialSavingsEstimationReportModel + true + + + 2019-06-19 15:31:25.151 UTC + + false + org.jboss.xavier.analytics.test + + + + org.jboss.xavier.analytics.pojo.input.UploadFormInputDataModel + + + org.jboss.xavier.analytics.pojo.output.InitialSavingsEstimationReportModel + + + + + testStatefullSession + + \ No newline at end of file diff --git a/src/test/resources/org/jboss/xavier/analytics/test/PricingTest.scenario b/src/test/resources/org/jboss/xavier/analytics/test/PricingTest.scenario new file mode 100644 index 00000000..36cb5d5a --- /dev/null +++ b/src/test/resources/org/jboss/xavier/analytics/test/PricingTest.scenario @@ -0,0 +1,86 @@ + + PricingTest.scenario + 100000 + + + + PricingDataModel + + + sourceListValue + 10000 + 4 + + + pricing + false + + + 39 + 4 + + + + + sourceDiscountPercentage + 0.5 + true + [pricing] field [sourceDiscountPercentage] was [0.5]. + == + 1 + + + sourceMaintenancePercentage + 0.2 + true + [pricing] field [sourceMaintenancePercentage] was [0.2]. + == + 1 + + + sourceRenewHighFactor + 2.5 + true + [pricing] field [sourceRenewHighFactor] was [2.5]. + == + 1 + + + sourceRenewLikelyFactor + 2.0 + true + [pricing] field [sourceRenewLikelyFactor] was [2.0]. + == + 1 + + + sourceRenewLowFactor + 1.5 + true + [pricing] field [sourceRenewLowFactor] was [1.5]. + == + 1 + + + pricing + false + + + 2019-06-19 13:48:06.49 UTC + + false + org.jboss.xavier.analytics.test + + + + org.jboss.xavier.analytics.pojo.support.PricingDataModel + + + org.jboss.xavier.analytics.pojo.input.UploadFormInputDataModel + + + + + testStatefullSession + + \ No newline at end of file diff --git a/src/test/resources/org/jboss/xavier/analytics/test/rules/AgendaFocusForTest.drl b/src/test/resources/org/jboss/xavier/analytics/test/rules/AgendaFocusForTest.drl new file mode 100644 index 00000000..996d8707 --- /dev/null +++ b/src/test/resources/org/jboss/xavier/analytics/test/rules/AgendaFocusForTest.drl @@ -0,0 +1,12 @@ +package org.jboss.xavier.analytics.test.rules; +import java.lang.String; +dialect "java" + +rule "AgendaFocusForTest" + when + agendaGroup : String() + then + System.out.printf("Focusing the '%s' agenda group\n", agendaGroup); + kcontext.getKieRuntime().getAgenda().getAgendaGroup(agendaGroup).setFocus(); + System.out.printf("Focused the '%s' agenda group\n", agendaGroup); +end diff --git a/src/test/resources/org/jboss/xavier/analytics/test/scenario/.gitkeep b/src/test/resources/org/jboss/xavier/analytics/test/scenario/.gitkeep new file mode 100644 index 00000000..e69de29b