Package springapp.service

Examples of springapp.service.SimpleProductManager


    ds.setUrl("jdbc:hsqldb:hsql://localhost");
    ds.setUsername("sa");
   
    JdbcProductDao dao = new JdbcProductDao();
    dao.setDataSource(ds);
    SimpleProductManager spm = new SimpleProductManager();
    spm.setProductDao(dao);
   
    StringBuffer sb = new StringBuffer();
    sb.append("{'msg':");
    if("increase".equals(strAction))
    {
      int percentage = Integer.parseInt(arg0.getParameter("percentage"));
      spm.increasePrice(percentage);
      sb.append("'Price Increase ");
      sb.append(percentage);
      sb.append("%!'");
    }
    else if("reset".equals(strAction))
    {
      sb.append("'Price Reset!'");
      spm.resetPrice();
    }
    else
    {
      sb.append("'ERROR!'");
     
    }
   
    sb.append(",'products':[");
   
    List<Product> prods = spm.getProducts();
    int cnt = prods.size();
    Product prod = null;
    for(int i=0;i<cnt;i++)
    {
      prod = prods.get(i);
View Full Code Here


import springapp.service.SimpleProductManager;

public class InventoryControllerTests extends TestCase {
  public void testHandleRequestView() throws Exception {
    InventoryController controller = new InventoryController();
    SimpleProductManager spm = new SimpleProductManager();
    spm.setProductDao(new InMemoryProductDao(new ArrayList<Product>()));
    controller.setProductManager(spm);
    ModelAndView modelAndView = controller.handleRequest(null, null);
    assertEquals("hello", modelAndView.getViewName());
    assertNotNull(modelAndView.getModel());
    Map modelMap = (Map) modelAndView.getModel().get("model");
View Full Code Here

TOP

Related Classes of springapp.service.SimpleProductManager

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.