Package org.plugtree.training.handsonlabs.model

Examples of org.plugtree.training.handsonlabs.model.SpecialOffer


     
      StockItem sonyLCDTV1 = new StockItem(ItemType.LCD_TV,"Sony");
      StockItem sonyLCDTV2 = new StockItem(ItemType.LCD_TV,"Sony");
     
      //PROMOTIONAL PRICES
      SpecialOffer samsungLCDSpecialOffer = new SpecialOffer(ItemType.LCD_TV, "Samsung", 300d);
     
      SpecialOffer sonyLEDSpecialOffer = new SpecialOffer(ItemType.LED_TV, "Sony", 850d);
     
      //Insert promotional prices as globals
      ksession.setGlobal("samsung_led_price", samsung_led_price);
      ksession.setGlobal("samsung_lcd_price", samsung_lcd_price);
      ksession.setGlobal("samsung_tube_price", samsung_tube_price);
      ksession.setGlobal("sony_led_price", sony_led_price);
      ksession.setGlobal("sony_lcd_price", sony_lcd_price);
       
      //Insert Special prices as facts
      ksession.insert(samsungLCDSpecialOffer);
      ksession.insert(sonyLEDSpecialOffer);
     
      //Insert items as facts
        ksession.insert(samsungLEDTV1);
        ksession.insert(samsungLEDTV2);
        ksession.insert(samsungLCDTV1);
        ksession.insert(samsungTUBETV1);
        ksession.insert(sonyLEDTV1);
        ksession.insert(sonyLCDTV1);
        ksession.insert(sonyLCDTV2);
       
        //fire all rules
        ksession.fireAllRules();
       
       
        //Control
       
        //SAMSUNG
        Assert.assertEquals("",samsung_led_price.doubleValue(), samsungLEDTV1.getPrice(),0.1);
        Assert.assertEquals("",samsung_led_price.doubleValue(), samsungLEDTV2.getPrice(),0.1);

        Assert.assertEquals("",samsungLCDSpecialOffer.getPrice(), samsungLCDTV1.getPrice(),0.1);
       
        Assert.assertEquals("",samsung_tube_price.doubleValue(), samsungTUBETV1.getPrice(),0.1);
       
        //SONY
        Assert.assertEquals("",sonyLEDSpecialOffer.getPrice(), sonyLEDTV1.getPrice(),0.1);
       
        Assert.assertEquals("",sony_lcd_price.doubleValue(), sonyLCDTV1.getPrice(),0.1);
        Assert.assertEquals("",sony_lcd_price.doubleValue(), sonyLCDTV2.getPrice(),0.1);
       
       
View Full Code Here

TOP

Related Classes of org.plugtree.training.handsonlabs.model.SpecialOffer

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.