Package lv.odylab.evemanage.client.rpc.dto.calculation

Examples of lv.odylab.evemanage.client.rpc.dto.calculation.CalculationItemDto


    public void testProcess_Capital_Obelisk() {
        CalculationDto calculation = new CalculationDto();
        calculation.setBlueprintTypeName("Obelisk Blueprint");
        calculation.setMaterialLevel(1);
        calculation.setProductivityLevel(1);
        CalculationItemDto capitalPropulsionEngineCalculationItem = new CalculationItemDto();
        capitalPropulsionEngineCalculationItem.setPathExpression(PathExpression.parsePath("/20187:1:1/21009"));
        capitalPropulsionEngineCalculationItem.setPerfectQuantity(15L);
        capitalPropulsionEngineCalculationItem.setItemTypeID(21009L);
        capitalPropulsionEngineCalculationItem.setPrice(new BigDecimal("4000000.00"));
        capitalPropulsionEngineCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalPropulsionEngineCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalArmorPlateCalculationItem = new CalculationItemDto();
        capitalArmorPlateCalculationItem.setPathExpression(PathExpression.parsePath("/20187:1:1/21017"));
        capitalArmorPlateCalculationItem.setPerfectQuantity(14L);
        capitalArmorPlateCalculationItem.setItemTypeID(21017L);
        capitalArmorPlateCalculationItem.setPrice(new BigDecimal("4200000.00"));
        capitalArmorPlateCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalArmorPlateCalculationItem.setWasteFactor(10);

        CalculationItemDto capitalCargoBayCalculationItem = new CalculationItemDto();
        capitalCargoBayCalculationItem.setPathExpression(PathExpression.parsePath("/20187:1:1/21027"));
        capitalCargoBayCalculationItem.setPerfectQuantity(80L);
        capitalCargoBayCalculationItem.setItemTypeID(21027L);
        capitalCargoBayCalculationItem.setPrice(new BigDecimal("3500000.00"));
        capitalCargoBayCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalCargoBayCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalCargoBayTritaniumCalculationItem = new CalculationItemDto();
        capitalCargoBayTritaniumCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21027:10:10/34"));
        capitalCargoBayTritaniumCalculationItem.setPerfectQuantity(787412L);
        capitalCargoBayTritaniumCalculationItem.setItemTypeID(34L);
        capitalCargoBayTritaniumCalculationItem.setPrice(new BigDecimal("2.20"));
        capitalCargoBayTritaniumCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalCargoBayTritaniumCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalCargoBayPyeriteCalculationItem = new CalculationItemDto();
        capitalCargoBayPyeriteCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21027:10:10/35"));
        capitalCargoBayPyeriteCalculationItem.setPerfectQuantity(64939L);
        capitalCargoBayPyeriteCalculationItem.setItemTypeID(35L);
        capitalCargoBayPyeriteCalculationItem.setPrice(new BigDecimal("3.00"));
        capitalCargoBayPyeriteCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalCargoBayPyeriteCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalCargoBayMexallonCalculationItem = new CalculationItemDto();
        capitalCargoBayMexallonCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21027:10:10/36"));
        capitalCargoBayMexallonCalculationItem.setPerfectQuantity(22154L);
        capitalCargoBayMexallonCalculationItem.setItemTypeID(36L);
        capitalCargoBayMexallonCalculationItem.setPrice(new BigDecimal("26.85"));
        capitalCargoBayMexallonCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalCargoBayMexallonCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalCargoBayIsogenCalculationItem = new CalculationItemDto();
        capitalCargoBayIsogenCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21027:10:10/37"));
        capitalCargoBayIsogenCalculationItem.setPerfectQuantity(3154L);
        capitalCargoBayIsogenCalculationItem.setItemTypeID(37L);
        capitalCargoBayIsogenCalculationItem.setPrice(new BigDecimal("51.00"));
        capitalCargoBayIsogenCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalCargoBayIsogenCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalCargoBayNocxiumCalculationItem = new CalculationItemDto();
        capitalCargoBayNocxiumCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21027:10:10/38"));
        capitalCargoBayNocxiumCalculationItem.setPerfectQuantity(898L);
        capitalCargoBayNocxiumCalculationItem.setItemTypeID(38L);
        capitalCargoBayNocxiumCalculationItem.setPrice(new BigDecimal("80.00"));
        capitalCargoBayNocxiumCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalCargoBayNocxiumCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalCargoBayZydrineCalculationItem = new CalculationItemDto();
        capitalCargoBayZydrineCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21027:10:10/39"));
        capitalCargoBayZydrineCalculationItem.setPerfectQuantity(129L);
        capitalCargoBayZydrineCalculationItem.setItemTypeID(39L);
        capitalCargoBayZydrineCalculationItem.setPrice(new BigDecimal("1000.01"));
        capitalCargoBayZydrineCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalCargoBayZydrineCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalCargoBayMegacyteCalculationItem = new CalculationItemDto();
        capitalCargoBayMegacyteCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21027:10:10/40"));
        capitalCargoBayMegacyteCalculationItem.setPerfectQuantity(29L);
        capitalCargoBayMegacyteCalculationItem.setItemTypeID(40L);
        capitalCargoBayMegacyteCalculationItem.setPrice(new BigDecimal("1800.00"));
        capitalCargoBayMegacyteCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalCargoBayMegacyteCalculationItem.setWasteFactor(10);

        CalculationItemDto capitalConstructionPartsCalculationItem = new CalculationItemDto();
        capitalConstructionPartsCalculationItem.setPathExpression(PathExpression.parsePath("/20187:1:1/21037"));
        capitalConstructionPartsCalculationItem.setPerfectQuantity(50L);
        capitalConstructionPartsCalculationItem.setItemTypeID(21037L);
        capitalConstructionPartsCalculationItem.setPrice(new BigDecimal("4000000.00"));
        capitalConstructionPartsCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalConstructionPartsCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalConstructionPartsTritaniumCalculationItem = new CalculationItemDto();
        capitalConstructionPartsTritaniumCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21037:15:15/34"));
        capitalConstructionPartsTritaniumCalculationItem.setPerfectQuantity(349387L);
        capitalConstructionPartsTritaniumCalculationItem.setItemTypeID(34L);
        capitalConstructionPartsTritaniumCalculationItem.setPrice(new BigDecimal("2.20"));
        capitalConstructionPartsTritaniumCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalConstructionPartsTritaniumCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalConstructionPartsPyeriteCalculationItem = new CalculationItemDto();
        capitalConstructionPartsPyeriteCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21037:15:15/35"));
        capitalConstructionPartsPyeriteCalculationItem.setPerfectQuantity(84399L);
        capitalConstructionPartsPyeriteCalculationItem.setItemTypeID(35L);
        capitalConstructionPartsPyeriteCalculationItem.setPrice(new BigDecimal("3.00"));
        capitalConstructionPartsPyeriteCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalConstructionPartsPyeriteCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalConstructionPartsMexallonCalculationItem = new CalculationItemDto();
        capitalConstructionPartsMexallonCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21037:15:15/36"));
        capitalConstructionPartsMexallonCalculationItem.setPerfectQuantity(33959L);
        capitalConstructionPartsMexallonCalculationItem.setItemTypeID(36L);
        capitalConstructionPartsMexallonCalculationItem.setPrice(new BigDecimal("26.85"));
        capitalConstructionPartsMexallonCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalConstructionPartsMexallonCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalConstructionPartsIsogenCalculationItem = new CalculationItemDto();
        capitalConstructionPartsIsogenCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21037:15:15/37"));
        capitalConstructionPartsIsogenCalculationItem.setPerfectQuantity(4549L);
        capitalConstructionPartsIsogenCalculationItem.setItemTypeID(37L);
        capitalConstructionPartsIsogenCalculationItem.setPrice(new BigDecimal("51.00"));
        capitalConstructionPartsIsogenCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalConstructionPartsIsogenCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalConstructionPartsNocxiumCalculationItem = new CalculationItemDto();
        capitalConstructionPartsNocxiumCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21037:15:15/38"));
        capitalConstructionPartsNocxiumCalculationItem.setPerfectQuantity(1377L);
        capitalConstructionPartsNocxiumCalculationItem.setItemTypeID(38L);
        capitalConstructionPartsNocxiumCalculationItem.setPrice(new BigDecimal("80.00"));
        capitalConstructionPartsNocxiumCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalConstructionPartsNocxiumCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalConstructionPartsZydrineCalculationItem = new CalculationItemDto();
        capitalConstructionPartsZydrineCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21037:15:15/39"));
        capitalConstructionPartsZydrineCalculationItem.setPerfectQuantity(242L);
        capitalConstructionPartsZydrineCalculationItem.setItemTypeID(39L);
        capitalConstructionPartsZydrineCalculationItem.setPrice(new BigDecimal("1000.01"));
        capitalConstructionPartsZydrineCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalConstructionPartsZydrineCalculationItem.setWasteFactor(10);
        CalculationItemDto capitalConstructionPartsMegacyteCalculationItem = new CalculationItemDto();
        capitalConstructionPartsMegacyteCalculationItem.setPathExpression(PathExpression.parsePath("/20187/21037:15:15/40"));
        capitalConstructionPartsMegacyteCalculationItem.setPerfectQuantity(95L);
        capitalConstructionPartsMegacyteCalculationItem.setItemTypeID(40L);
        capitalConstructionPartsMegacyteCalculationItem.setPrice(new BigDecimal("1800.00"));
        capitalConstructionPartsMegacyteCalculationItem.setDamagePerJob(BigDecimal.ONE);
        capitalConstructionPartsMegacyteCalculationItem.setWasteFactor(10);

        List<CalculationItemDto> items = new ArrayList<CalculationItemDto>();
        items.add(capitalPropulsionEngineCalculationItem);
        items.add(capitalArmorPlateCalculationItem);
        items.add(capitalCargoBayCalculationItem);
        items.add(capitalConstructionPartsCalculationItem);
        items.add(capitalCargoBayTritaniumCalculationItem);
        items.add(capitalCargoBayPyeriteCalculationItem);
        items.add(capitalCargoBayMexallonCalculationItem);
        items.add(capitalCargoBayIsogenCalculationItem);
        items.add(capitalCargoBayNocxiumCalculationItem);
        items.add(capitalCargoBayZydrineCalculationItem);
        items.add(capitalCargoBayMegacyteCalculationItem);
        items.add(capitalConstructionPartsTritaniumCalculationItem);
        items.add(capitalConstructionPartsPyeriteCalculationItem);
        items.add(capitalConstructionPartsMexallonCalculationItem);
        items.add(capitalConstructionPartsIsogenCalculationItem);
        items.add(capitalConstructionPartsNocxiumCalculationItem);
        items.add(capitalConstructionPartsZydrineCalculationItem);
        items.add(capitalConstructionPartsMegacyteCalculationItem);
        calculation.setItems(items);
        CalculationTree calculationTree = new CalculationTree();
        calculationTree.build(calculation);

        PricingProcessorResult pricingProcessorResult = pricingProcessor.process(1L, calculationTree, new HashMap<Long, CalculationPriceSetItemDto>());
        Map<Long, CalculationPriceSetItemDto> typeIdToCalculationPriceSetItemMap = pricingProcessorResult.getTypeIdToCalculationPriceSetItemMap();
        assertThat(typeIdToCalculationPriceSetItemMap.size(), equalTo(9));
        assertThat(pricingProcessorResult.getTotalPrice(), equalTo(new BigDecimal("519260766.67")));
        assertThat(capitalPropulsionEngineCalculationItem.getQuantity(), equalTo(16L));
        assertThat(capitalArmorPlateCalculationItem.getQuantity(), equalTo(15L));
        assertThat(capitalCargoBayCalculationItem.getQuantity(), equalTo(84L));
        assertThat(capitalConstructionPartsCalculationItem.getQuantity(), equalTo(53L));
        assertThat(capitalCargoBayTritaniumCalculationItem.getQuantity(), equalTo(794570L));
        assertThat(capitalCargoBayPyeriteCalculationItem.getQuantity(), equalTo(65529L));
        assertThat(capitalCargoBayMexallonCalculationItem.getQuantity(), equalTo(22355L));
        assertThat(capitalCargoBayIsogenCalculationItem.getQuantity(), equalTo(3183L));
        assertThat(capitalCargoBayNocxiumCalculationItem.getQuantity(), equalTo(906L));
        assertThat(capitalCargoBayZydrineCalculationItem.getQuantity(), equalTo(130L));
        assertThat(capitalCargoBayMegacyteCalculationItem.getQuantity(), equalTo(29L));
        assertThat(capitalConstructionPartsTritaniumCalculationItem.getQuantity(), equalTo(351571L));
        assertThat(capitalConstructionPartsPyeriteCalculationItem.getQuantity(), equalTo(84926L));
        assertThat(capitalConstructionPartsMexallonCalculationItem.getQuantity(), equalTo(34171L));
        assertThat(capitalConstructionPartsIsogenCalculationItem.getQuantity(), equalTo(4577L));
        assertThat(capitalConstructionPartsNocxiumCalculationItem.getQuantity(), equalTo(1386L));
        assertThat(capitalConstructionPartsZydrineCalculationItem.getQuantity(), equalTo(244L));
        assertThat(capitalConstructionPartsMegacyteCalculationItem.getQuantity(), equalTo(96L));
        assertThat(capitalPropulsionEngineCalculationItem.getParentQuantity(), equalTo(1L));
        assertThat(capitalArmorPlateCalculationItem.getParentQuantity(), equalTo(1L));
        assertThat(capitalCargoBayCalculationItem.getParentQuantity(), equalTo(1L));
        assertThat(capitalConstructionPartsCalculationItem.getParentQuantity(), equalTo(1L));
        assertThat(capitalCargoBayTritaniumCalculationItem.getParentQuantity(), equalTo(84L));
        assertThat(capitalCargoBayPyeriteCalculationItem.getParentQuantity(), equalTo(84L));
        assertThat(capitalCargoBayMexallonCalculationItem.getParentQuantity(), equalTo(84L));
        assertThat(capitalCargoBayIsogenCalculationItem.getParentQuantity(), equalTo(84L));
        assertThat(capitalCargoBayNocxiumCalculationItem.getParentQuantity(), equalTo(84L));
        assertThat(capitalCargoBayZydrineCalculationItem.getParentQuantity(), equalTo(84L));
        assertThat(capitalCargoBayMegacyteCalculationItem.getParentQuantity(), equalTo(84L));
        assertThat(capitalConstructionPartsTritaniumCalculationItem.getParentQuantity(), equalTo(53L));
        assertThat(capitalConstructionPartsPyeriteCalculationItem.getParentQuantity(), equalTo(53L));
        assertThat(capitalConstructionPartsMexallonCalculationItem.getParentQuantity(), equalTo(53L));
        assertThat(capitalConstructionPartsIsogenCalculationItem.getParentQuantity(), equalTo(53L));
        assertThat(capitalConstructionPartsNocxiumCalculationItem.getParentQuantity(), equalTo(53L));
        assertThat(capitalConstructionPartsZydrineCalculationItem.getParentQuantity(), equalTo(53L));
        assertThat(capitalConstructionPartsMegacyteCalculationItem.getParentQuantity(), equalTo(53L));
        assertThat(capitalPropulsionEngineCalculationItem.getTotalPrice(), equalTo(new BigDecimal("64000000.00")));
        assertThat(capitalArmorPlateCalculationItem.getTotalPrice(), equalTo(new BigDecimal("63000000.00")));
        assertThat(capitalCargoBayCalculationItem.getTotalPrice(), equalTo(new BigDecimal("248798512.20")));
        assertThat(capitalConstructionPartsCalculationItem.getTotalPrice(), equalTo(new BigDecimal("143462254.47")));
        assertThat(capitalCargoBayTritaniumCalculationItem.getTotalPrice(), equalTo(new BigDecimal("1748054.00")));
        assertThat(capitalCargoBayPyeriteCalculationItem.getTotalPrice(), equalTo(new BigDecimal("196587.00")));
        assertThat(capitalCargoBayMexallonCalculationItem.getTotalPrice(), equalTo(new BigDecimal("600231.75")));
        assertThat(capitalCargoBayIsogenCalculationItem.getTotalPrice(), equalTo(new BigDecimal("162333.00")));
        assertThat(capitalCargoBayNocxiumCalculationItem.getTotalPrice(), equalTo(new BigDecimal("72480.00")));
        assertThat(capitalCargoBayZydrineCalculationItem.getTotalPrice(), equalTo(new BigDecimal("130001.30")));
        assertThat(capitalCargoBayMegacyteCalculationItem.getTotalPrice(), equalTo(new BigDecimal("52200.00")));
        assertThat(capitalConstructionPartsTritaniumCalculationItem.getTotalPrice(), equalTo(new BigDecimal("773456.20")));
        assertThat(capitalConstructionPartsPyeriteCalculationItem.getTotalPrice(), equalTo(new BigDecimal("254778.00")));
        assertThat(capitalConstructionPartsMexallonCalculationItem.getTotalPrice(), equalTo(new BigDecimal("917491.35")));
        assertThat(capitalConstructionPartsIsogenCalculationItem.getTotalPrice(), equalTo(new BigDecimal("233427.00")));
        assertThat(capitalConstructionPartsNocxiumCalculationItem.getTotalPrice(), equalTo(new BigDecimal("110880.00")));
        assertThat(capitalConstructionPartsZydrineCalculationItem.getTotalPrice(), equalTo(new BigDecimal("244002.44")));
        assertThat(capitalConstructionPartsMegacyteCalculationItem.getTotalPrice(), equalTo(new BigDecimal("172800.00")));
        assertThat(capitalPropulsionEngineCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("64000000.00")));
        assertThat(capitalArmorPlateCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("63000000.00")));
        assertThat(capitalCargoBayCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("248798512.20")));
        assertThat(capitalConstructionPartsCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("143462254.47")));
        assertThat(capitalCargoBayTritaniumCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("146836536.00")));
        assertThat(capitalCargoBayPyeriteCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("16513308.00")));
        assertThat(capitalCargoBayMexallonCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("50419467.00")));
        assertThat(capitalCargoBayIsogenCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("13635972.00")));
        assertThat(capitalCargoBayNocxiumCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("6088320.00")));
        assertThat(capitalCargoBayZydrineCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("10920109.20")));
        assertThat(capitalCargoBayMegacyteCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("4384800.00")));
        assertThat(capitalConstructionPartsTritaniumCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("40993178.60")));
        assertThat(capitalConstructionPartsPyeriteCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("13503234.00")));
        assertThat(capitalConstructionPartsMexallonCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("48627041.55")));
        assertThat(capitalConstructionPartsIsogenCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("12371631.00")));
        assertThat(capitalConstructionPartsNocxiumCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("5876640.00")));
        assertThat(capitalConstructionPartsZydrineCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("12932129.32")));
        assertThat(capitalConstructionPartsMegacyteCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("9158400.00")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(21009L).getQuantity(), equalTo(16L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(21017L).getQuantity(), equalTo(15L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(21027L), nullValue());
        assertThat(typeIdToCalculationPriceSetItemMap.get(21037L), nullValue());
        assertThat(typeIdToCalculationPriceSetItemMap.get(34L).getQuantity(), equalTo(85377143L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(35L).getQuantity(), equalTo(10005514L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(36L).getQuantity(), equalTo(3688883L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(37L).getQuantity(), equalTo(509953L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(38L).getQuantity(), equalTo(149562L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(39L).getQuantity(), equalTo(23852L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(40L).getQuantity(), equalTo(7524L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(21009L).getPrice(), equalTo(new BigDecimal("4000000.00")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(21017L).getPrice(), equalTo(new BigDecimal("4200000.00")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(34L).getPrice(), equalTo(new BigDecimal("2.20")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(35L).getPrice(), equalTo(new BigDecimal("3.00")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(36L).getPrice(), equalTo(new BigDecimal("26.85")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(37L).getPrice(), equalTo(new BigDecimal("51.00")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(38L).getPrice(), equalTo(new BigDecimal("80.00")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(39L).getPrice(), equalTo(new BigDecimal("1000.01")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(40L).getPrice(), equalTo(new BigDecimal("1800.00")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(21009L).getTotalPrice(), equalTo(new BigDecimal("64000000.00")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(21017L).getTotalPrice(), equalTo(new BigDecimal("63000000.00")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(34L).getTotalPrice(), equalTo(new BigDecimal("187829714.60")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(35L).getTotalPrice(), equalTo(new BigDecimal("30016542.00")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(36L).getTotalPrice(), equalTo(new BigDecimal("99046508.55")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(37L).getTotalPrice(), equalTo(new BigDecimal("26007603.00")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(38L).getTotalPrice(), equalTo(new BigDecimal("11964960.00")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(39L).getTotalPrice(), equalTo(new BigDecimal("23852238.52")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(40L).getTotalPrice(), equalTo(new BigDecimal("13543200.00")));

        pricingProcessorResult = pricingProcessor.process(10L, calculationTree, new HashMap<Long, CalculationPriceSetItemDto>());
        typeIdToCalculationPriceSetItemMap = pricingProcessorResult.getTypeIdToCalculationPriceSetItemMap();
        assertThat(typeIdToCalculationPriceSetItemMap.size(), equalTo(9));
        assertThat(pricingProcessorResult.getTotalPrice(), equalTo(new BigDecimal("5192607666.70")));
        assertThat(capitalPropulsionEngineCalculationItem.getQuantity(), equalTo(16L));
        assertThat(capitalArmorPlateCalculationItem.getQuantity(), equalTo(15L));
        assertThat(capitalCargoBayCalculationItem.getQuantity(), equalTo(84L));
        assertThat(capitalConstructionPartsCalculationItem.getQuantity(), equalTo(53L));
        assertThat(capitalCargoBayTritaniumCalculationItem.getQuantity(), equalTo(794570L));
        assertThat(capitalCargoBayPyeriteCalculationItem.getQuantity(), equalTo(65529L));
        assertThat(capitalCargoBayMexallonCalculationItem.getQuantity(), equalTo(22355L));
        assertThat(capitalCargoBayIsogenCalculationItem.getQuantity(), equalTo(3183L));
        assertThat(capitalCargoBayNocxiumCalculationItem.getQuantity(), equalTo(906L));
        assertThat(capitalCargoBayZydrineCalculationItem.getQuantity(), equalTo(130L));
        assertThat(capitalCargoBayMegacyteCalculationItem.getQuantity(), equalTo(29L));
        assertThat(capitalConstructionPartsTritaniumCalculationItem.getQuantity(), equalTo(351571L));
        assertThat(capitalConstructionPartsPyeriteCalculationItem.getQuantity(), equalTo(84926L));
        assertThat(capitalConstructionPartsMexallonCalculationItem.getQuantity(), equalTo(34171L));
        assertThat(capitalConstructionPartsIsogenCalculationItem.getQuantity(), equalTo(4577L));
        assertThat(capitalConstructionPartsNocxiumCalculationItem.getQuantity(), equalTo(1386L));
        assertThat(capitalConstructionPartsZydrineCalculationItem.getQuantity(), equalTo(244L));
        assertThat(capitalConstructionPartsMegacyteCalculationItem.getQuantity(), equalTo(96L));
        assertThat(capitalPropulsionEngineCalculationItem.getParentQuantity(), equalTo(10L));
        assertThat(capitalArmorPlateCalculationItem.getParentQuantity(), equalTo(10L));
        assertThat(capitalCargoBayCalculationItem.getParentQuantity(), equalTo(10L));
        assertThat(capitalConstructionPartsCalculationItem.getParentQuantity(), equalTo(10L));
        assertThat(capitalCargoBayTritaniumCalculationItem.getParentQuantity(), equalTo(840L));
        assertThat(capitalCargoBayPyeriteCalculationItem.getParentQuantity(), equalTo(840L));
        assertThat(capitalCargoBayMexallonCalculationItem.getParentQuantity(), equalTo(840L));
        assertThat(capitalCargoBayIsogenCalculationItem.getParentQuantity(), equalTo(840L));
        assertThat(capitalCargoBayNocxiumCalculationItem.getParentQuantity(), equalTo(840L));
        assertThat(capitalCargoBayZydrineCalculationItem.getParentQuantity(), equalTo(840L));
        assertThat(capitalCargoBayMegacyteCalculationItem.getParentQuantity(), equalTo(840L));
        assertThat(capitalConstructionPartsTritaniumCalculationItem.getParentQuantity(), equalTo(530L));
        assertThat(capitalConstructionPartsPyeriteCalculationItem.getParentQuantity(), equalTo(530L));
        assertThat(capitalConstructionPartsMexallonCalculationItem.getParentQuantity(), equalTo(530L));
        assertThat(capitalConstructionPartsIsogenCalculationItem.getParentQuantity(), equalTo(530L));
        assertThat(capitalConstructionPartsNocxiumCalculationItem.getParentQuantity(), equalTo(530L));
        assertThat(capitalConstructionPartsZydrineCalculationItem.getParentQuantity(), equalTo(530L));
        assertThat(capitalConstructionPartsMegacyteCalculationItem.getParentQuantity(), equalTo(530L));
        assertThat(capitalPropulsionEngineCalculationItem.getTotalPrice(), equalTo(new BigDecimal("64000000.00")));
        assertThat(capitalArmorPlateCalculationItem.getTotalPrice(), equalTo(new BigDecimal("63000000.00")));
        assertThat(capitalCargoBayCalculationItem.getTotalPrice(), equalTo(new BigDecimal("248798512.20")));
        assertThat(capitalConstructionPartsCalculationItem.getTotalPrice(), equalTo(new BigDecimal("143462254.47")));
        assertThat(capitalCargoBayTritaniumCalculationItem.getTotalPrice(), equalTo(new BigDecimal("1748054.00")));
        assertThat(capitalCargoBayPyeriteCalculationItem.getTotalPrice(), equalTo(new BigDecimal("196587.00")));
        assertThat(capitalCargoBayMexallonCalculationItem.getTotalPrice(), equalTo(new BigDecimal("600231.75")));
        assertThat(capitalCargoBayIsogenCalculationItem.getTotalPrice(), equalTo(new BigDecimal("162333.00")));
        assertThat(capitalCargoBayNocxiumCalculationItem.getTotalPrice(), equalTo(new BigDecimal("72480.00")));
        assertThat(capitalCargoBayZydrineCalculationItem.getTotalPrice(), equalTo(new BigDecimal("130001.30")));
        assertThat(capitalCargoBayMegacyteCalculationItem.getTotalPrice(), equalTo(new BigDecimal("52200.00")));
        assertThat(capitalConstructionPartsTritaniumCalculationItem.getTotalPrice(), equalTo(new BigDecimal("773456.20")));
        assertThat(capitalConstructionPartsPyeriteCalculationItem.getTotalPrice(), equalTo(new BigDecimal("254778.00")));
        assertThat(capitalConstructionPartsMexallonCalculationItem.getTotalPrice(), equalTo(new BigDecimal("917491.35")));
        assertThat(capitalConstructionPartsIsogenCalculationItem.getTotalPrice(), equalTo(new BigDecimal("233427.00")));
        assertThat(capitalConstructionPartsNocxiumCalculationItem.getTotalPrice(), equalTo(new BigDecimal("110880.00")));
        assertThat(capitalConstructionPartsZydrineCalculationItem.getTotalPrice(), equalTo(new BigDecimal("244002.44")));
        assertThat(capitalConstructionPartsMegacyteCalculationItem.getTotalPrice(), equalTo(new BigDecimal("172800.00")));
        assertThat(capitalPropulsionEngineCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("640000000.00")));
        assertThat(capitalArmorPlateCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("630000000.00")));
        assertThat(capitalCargoBayCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("2487985122.00")));
        assertThat(capitalConstructionPartsCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("1434622544.70")));
        assertThat(capitalCargoBayTritaniumCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("1468365360.00")));
        assertThat(capitalCargoBayPyeriteCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("165133080.00")));
        assertThat(capitalCargoBayMexallonCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("504194670.00")));
        assertThat(capitalCargoBayIsogenCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("136359720.00")));
        assertThat(capitalCargoBayNocxiumCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("60883200.00")));
        assertThat(capitalCargoBayZydrineCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("109201092.00")));
        assertThat(capitalCargoBayMegacyteCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("43848000.00")));
        assertThat(capitalConstructionPartsTritaniumCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("409931786.00")));
        assertThat(capitalConstructionPartsPyeriteCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("135032340.00")));
        assertThat(capitalConstructionPartsMexallonCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("486270415.50")));
        assertThat(capitalConstructionPartsIsogenCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("123716310.00")));
        assertThat(capitalConstructionPartsNocxiumCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("58766400.00")));
        assertThat(capitalConstructionPartsZydrineCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("129321293.20")));
        assertThat(capitalConstructionPartsMegacyteCalculationItem.getTotalPriceForParent(), equalTo(new BigDecimal("91584000.00")));
        assertThat(typeIdToCalculationPriceSetItemMap.get(21009L).getQuantity(), equalTo(160L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(21017L).getQuantity(), equalTo(150L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(21027L), nullValue());
        assertThat(typeIdToCalculationPriceSetItemMap.get(21037L), nullValue());
        assertThat(typeIdToCalculationPriceSetItemMap.get(34L).getQuantity(), equalTo(853771430L));
View Full Code Here


    public void recalculate() {
        Long quantity = 0L;
        BigDecimal totalPrice = BigDecimal.ZERO;
        BigDecimal totalPriceForParent = BigDecimal.ZERO;
        CalculationItemDto firstCalculationItem = calculationItems.get(0);
        Long parentQuantity = firstCalculationItem.getParentQuantity();
        BigDecimal price = firstCalculationItem.getPrice();
        for (CalculationItemDto calculationItem : calculationItems) {
            quantity += calculationItem.getQuantity();
            totalPrice = totalPrice.add(calculationItem.getTotalPrice());
            totalPriceForParent = totalPriceForParent.add(calculationItem.getTotalPriceForParent());
        }
View Full Code Here

    public void testProcess_Scourge_T2_RAM_RocketFuel() {
        CalculationDto calculation = new CalculationDto();
        calculation.setBlueprintTypeName("Scourge Fury Heavy Missile Blueprint");
        calculation.setMaterialLevel(-4);
        calculation.setProductivityLevel(-4);
        CalculationItemDto tritaniumCalculationItem = new CalculationItemDto();
        tritaniumCalculationItem.setPathExpression(PathExpression.parsePath("/2629:-4:-4/34"));
        tritaniumCalculationItem.setPerfectQuantity(10112L);
        tritaniumCalculationItem.setItemTypeID(34L);
        tritaniumCalculationItem.setPrice(new BigDecimal("2.10"));
        tritaniumCalculationItem.setDamagePerJob(BigDecimal.ONE);
        tritaniumCalculationItem.setWasteFactor(10);
        CalculationItemDto nocxiumCalculationItem = new CalculationItemDto();
        nocxiumCalculationItem.setPathExpression(PathExpression.parsePath("/2629:-4:-4/38"));
        nocxiumCalculationItem.setPerfectQuantity(22L);
        nocxiumCalculationItem.setItemTypeID(38L);
        nocxiumCalculationItem.setPrice(new BigDecimal("284.53"));
        nocxiumCalculationItem.setDamagePerJob(BigDecimal.ONE);
        nocxiumCalculationItem.setWasteFactor(10);
        CalculationItemDto zydrineCalculationItem = new CalculationItemDto();
        zydrineCalculationItem.setPathExpression(PathExpression.parsePath("/2629:-4:-4/39"));
        zydrineCalculationItem.setPerfectQuantity(19L);
        zydrineCalculationItem.setItemTypeID(39L);
        zydrineCalculationItem.setPrice(new BigDecimal("1175.02"));
        zydrineCalculationItem.setDamagePerJob(BigDecimal.ONE);
        zydrineCalculationItem.setWasteFactor(10);
        CalculationItemDto megacyteCalculationItem = new CalculationItemDto();
        megacyteCalculationItem.setPathExpression(PathExpression.parsePath("/2629:-4:-4/40"));
        megacyteCalculationItem.setPerfectQuantity(30L);
        megacyteCalculationItem.setItemTypeID(40L);
        megacyteCalculationItem.setPrice(new BigDecimal("2883.51"));
        megacyteCalculationItem.setDamagePerJob(BigDecimal.ONE);
        megacyteCalculationItem.setWasteFactor(10);
        CalculationItemDto rocketFuelCalculationItem1 = new CalculationItemDto();
        rocketFuelCalculationItem1.setPathExpression(PathExpression.parsePath("/2629:-4:-4/9830"));
        rocketFuelCalculationItem1.setPerfectQuantity(80L);
        rocketFuelCalculationItem1.setItemTypeID(9830L);
        rocketFuelCalculationItem1.setPrice(new BigDecimal("7100.53"));
        rocketFuelCalculationItem1.setDamagePerJob(BigDecimal.ONE);
        rocketFuelCalculationItem1.setWasteFactor(10);
        CalculationItemDto rocketFuelCalculationItem2 = new CalculationItemDto();
        rocketFuelCalculationItem2.setPathExpression(PathExpression.parsePath("/2629::/9830"));
        rocketFuelCalculationItem2.setPerfectQuantity(4L);
        rocketFuelCalculationItem2.setItemTypeID(9830L);
        rocketFuelCalculationItem2.setPrice(new BigDecimal("7100.53"));
        rocketFuelCalculationItem2.setDamagePerJob(BigDecimal.ONE);
        rocketFuelCalculationItem2.setWasteFactor(10);
        CalculationItemDto morphiteCalculationItem = new CalculationItemDto();
        morphiteCalculationItem.setPathExpression(PathExpression.parsePath("/2629:-4:-4/11399"));
        morphiteCalculationItem.setPerfectQuantity(5L);
        morphiteCalculationItem.setItemTypeID(11399L);
        morphiteCalculationItem.setPrice(new BigDecimal("4310.03"));
        morphiteCalculationItem.setDamagePerJob(BigDecimal.ONE);
        morphiteCalculationItem.setWasteFactor(10);
        CalculationItemDto ramAmmunitionCalculationItem = new CalculationItemDto();
        ramAmmunitionCalculationItem.setPathExpression(PathExpression.parsePath("/2629::/11476"));
        ramAmmunitionCalculationItem.setPerfectQuantity(1L);
        ramAmmunitionCalculationItem.setItemTypeID(11476L);
        ramAmmunitionCalculationItem.setPrice(new BigDecimal("18004.50"));
        ramAmmunitionCalculationItem.setDamagePerJob(new BigDecimal("0.075"));
        ramAmmunitionCalculationItem.setWasteFactor(10);
        CalculationItemDto gravitonPulseGeneratorCalculationItem = new CalculationItemDto();
        gravitonPulseGeneratorCalculationItem.setPathExpression(PathExpression.parsePath("/2629:-4:-4/11693"));
        gravitonPulseGeneratorCalculationItem.setPerfectQuantity(9L);
        gravitonPulseGeneratorCalculationItem.setItemTypeID(11693L);
        gravitonPulseGeneratorCalculationItem.setPrice(new BigDecimal("12280.00"));
        gravitonPulseGeneratorCalculationItem.setDamagePerJob(BigDecimal.ONE);
        gravitonPulseGeneratorCalculationItem.setWasteFactor(10);
        CalculationItemDto phenolicCompositesCalculationItem = new CalculationItemDto();
        phenolicCompositesCalculationItem.setPathExpression(PathExpression.parsePath("/2629:-4:-4/16680"));
        phenolicCompositesCalculationItem.setPerfectQuantity(12L);
        phenolicCompositesCalculationItem.setItemTypeID(16680L);
        phenolicCompositesCalculationItem.setPrice(new BigDecimal("524.55"));
        phenolicCompositesCalculationItem.setDamagePerJob(BigDecimal.ONE);
        phenolicCompositesCalculationItem.setWasteFactor(10);
        List<CalculationItemDto> items = new ArrayList<CalculationItemDto>();
        items.add(tritaniumCalculationItem);
        items.add(nocxiumCalculationItem);
        items.add(zydrineCalculationItem);
        items.add(megacyteCalculationItem);
        items.add(rocketFuelCalculationItem1);
        items.add(rocketFuelCalculationItem2);
        items.add(morphiteCalculationItem);
        items.add(ramAmmunitionCalculationItem);
        items.add(gravitonPulseGeneratorCalculationItem);
        items.add(phenolicCompositesCalculationItem);
        calculation.setItems(items);
        CalculationTree calculationTree = new CalculationTree();
        calculationTree.build(calculation);

        PricingProcessorResult pricingProcessorResult = pricingProcessor.process(1L, calculationTree, new HashMap<Long, CalculationPriceSetItemDto>());
        Map<Long, CalculationPriceSetItemDto> typeIdToCalculationPriceSetItemMap = pricingProcessorResult.getTypeIdToCalculationPriceSetItemMap();
        assertThat(9, equalTo(typeIdToCalculationPriceSetItemMap.size()));
        assertThat(new BigDecimal("1302734.01750"), equalTo(pricingProcessorResult.getTotalPrice()));
        assertThat(tritaniumCalculationItem.getQuantity(), equalTo(15168L));
        assertThat(nocxiumCalculationItem.getQuantity(), equalTo(33L));
        assertThat(zydrineCalculationItem.getQuantity(), equalTo(29L));
        assertThat(megacyteCalculationItem.getQuantity(), equalTo(45L));
        assertThat(rocketFuelCalculationItem1.getQuantity(), equalTo(120L));
        assertThat(rocketFuelCalculationItem2.getQuantity(), equalTo(4L));
        assertThat(morphiteCalculationItem.getQuantity(), equalTo(8L));
        assertThat(ramAmmunitionCalculationItem.getQuantity(), equalTo(1L));
        assertThat(gravitonPulseGeneratorCalculationItem.getQuantity(), equalTo(14L));
        assertThat(phenolicCompositesCalculationItem.getQuantity(), equalTo(18L));
        assertThat(tritaniumCalculationItem.getParentQuantity(), equalTo(1L));
        assertThat(nocxiumCalculationItem.getParentQuantity(), equalTo(1L));
        assertThat(zydrineCalculationItem.getParentQuantity(), equalTo(1L));
        assertThat(megacyteCalculationItem.getParentQuantity(), equalTo(1L));
        assertThat(rocketFuelCalculationItem1.getParentQuantity(), equalTo(1L));
        assertThat(rocketFuelCalculationItem2.getParentQuantity(), equalTo(1L));
        assertThat(morphiteCalculationItem.getParentQuantity(), equalTo(1L));
        assertThat(ramAmmunitionCalculationItem.getParentQuantity(), equalTo(1L));
        assertThat(gravitonPulseGeneratorCalculationItem.getParentQuantity(), equalTo(1L));
        assertThat(phenolicCompositesCalculationItem.getParentQuantity(), equalTo(1L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(34L).getQuantity(), equalTo(15168L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(38L).getQuantity(), equalTo(33L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(39L).getQuantity(), equalTo(29L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(40L).getQuantity(), equalTo(45L));
        assertThat(typeIdToCalculationPriceSetItemMap.get(9830L).getQuantity(), equalTo(124L));
View Full Code Here

        calculationDto.setItems(calculationItemDtos);
        return calculationDto;
    }

    private CalculationItemDto map(CalculationItem calculationItem, Class<CalculationItemDto> calculationItemDtoClass) {
        CalculationItemDto calculationItemDto = new CalculationItemDto();
        calculationItemDto.setPathExpression(PathExpression.parsePath(calculationItem.getPath()));
        calculationItemDto.setItemTypeID(calculationItem.getItemTypeID());
        calculationItemDto.setItemCategoryID(calculationItem.getItemCategoryID());
        calculationItemDto.setItemTypeName(calculationItem.getItemTypeName());
        calculationItemDto.setItemTypeIcon(calculationItem.getItemTypeIcon());
        calculationItemDto.setQuantity(calculationItem.getQuantity());
        calculationItemDto.setParentQuantity(calculationItem.getParentQuantity());
        calculationItemDto.setPerfectQuantity(calculationItem.getPerfectQuantity());
        calculationItemDto.setWasteFactor(calculationItem.getWasteFactor());
        calculationItemDto.setDamagePerJob(new BigDecimal(calculationItem.getDamagePerJob()));
        calculationItemDto.setPrice(new BigDecimal(calculationItem.getPrice()));
        calculationItemDto.setTotalPrice(new BigDecimal(calculationItem.getTotalPrice()));
        calculationItemDto.setTotalPriceForParent(new BigDecimal(calculationItem.getTotalPriceForParent()));
        return calculationItemDto;
    }
View Full Code Here

TOP

Related Classes of lv.odylab.evemanage.client.rpc.dto.calculation.CalculationItemDto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.