Package cz.muni.fi.pa165.stis.dto

Examples of cz.muni.fi.pa165.stis.dto.TyreTO


       
        RepeatingView repeating = new RepeatingView("repeating");
        add(repeating);
        ReservationService reservationService = (ReservationService) ApplicationContextProvider.getApplicationContext().getBean("reservationService");
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
        AuthenticatedSession session = ((AuthenticatedSession)Session.get());
        List<ReservationTO> list = reservationService.findReservationsByReader(session.getReader());
        if(list != null){
            for (ReservationTO reservation : list) {
                AbstractItem item = new AbstractItem(repeating.newChildId());
                PageParameters pageParameters = new PageParameters();
                item.add(new BookmarkablePageLink<Void>("delete", ShowAllReservation.class, pageParameters));
View Full Code Here


        if (session.getUser()!=null){
            add(new Label("user",session.getUser()));
            add(new Label("login",new Model("")));
           add(new BookmarkablePageLink<>("logout", Logout.class));
           if (session.getCheckAdmin()){
                add(new MenuAdminPanel("menuPanel"));
            }else {
                add(new MenuReaderPanel("menuPanel"));
            }
        }else {
            add(new Label("user",""));
View Full Code Here

            add(new Label("login",new Model("")));
           add(new BookmarkablePageLink<>("logout", Logout.class));
           if (session.getCheckAdmin()){
                add(new MenuAdminPanel("menuPanel"));
            }else {
                add(new MenuReaderPanel("menuPanel"));
            }
        }else {
            add(new Label("user",""));
            add(new BookmarkablePageLink<>("login", Login.class));
            add(new Label("logout",new Model("")));
View Full Code Here

        } catch (IllegalArgumentException ex) {
            // ok
        }
       
        Tyre t = createTyre(19D, "P Zero", "235/40ZR19", "Pirelli", BigDecimal.valueOf(450));
        TyreTO tto = mapper.map(t, TyreTO.class);
        try {
            service.update(tto);
            fail("exception should be thrown");
        } catch (IllegalArgumentException ex) {
            // ok
        }
        try {
            service.remove(tto);
            fail("exception should be thrown");
        } catch (IllegalArgumentException ex) {
            // ok
        }
        tto.setId(1L);
        try {
            service.create(tto);
            fail("exception should be thrown");
        } catch (IllegalArgumentException ex) {
             //ok
View Full Code Here

    }
   
    @Test
    public void testCreate() {
        final Tyre tyre = createTyre(19D, "P Zero", "235/40ZR19", "Pirelli", BigDecimal.valueOf(420));
        TyreTO tto = mapper.map(tyre, TyreTO.class);
       
        service.create(tto);
        verify(dao).create(argThat(new BaseMatcher<Tyre>() {

            @Override
View Full Code Here

    @Test
    public void testGet() {
        Tyre tyre = createTyre(19D, "P Zero", "235/40ZR19", "Pirelli", BigDecimal.valueOf(420));
        tyre.setId(4L);
        TyreTO tto = mapper.map(tyre, TyreTO.class);       
       
        when(dao.get(4L)).thenReturn(tyre);
        TyreTO tyreTO = service.get(4L);
        assertEquals(tyreTO, tto);
    }
View Full Code Here

   
    @Test
    public void testUpdate() {
        Tyre tyre = createTyre(19D, "P Zero", "235/40ZR19", "Pirelli", BigDecimal.valueOf(420));
        tyre.setId(2L);
        TyreTO tto = mapper.map(tyre, TyreTO.class);
       
        service.update(tto);
        verify(dao).update(tyre);       
    }
View Full Code Here

   
    @Test
    public void testRemove() {
        Tyre tyre = createTyre(19D, "P Zero", "235/40ZR19", "Pirelli", BigDecimal.valueOf(420));
        tyre.setId(2L);
        TyreTO tto = mapper.map(tyre, TyreTO.class);
       
        service.remove(tto);
        verify(dao).remove(tyre);       
    }
View Full Code Here

                if (em.getValue() == null) {
                    continue;
                }
                Long id = em.getValue().getId();
                if (id != null) {
                    TyreTO tto = tyres.get(id);
                    if (tto == null) {
                        tto = tyreService.get(id);
                        tyres.put(id, tto);
                    }
                    if (tto != null && tto.getPrice() != null) {
                        price = price.add(tto.getPrice());
                    }
                }
            }
        }
        wrapper.setExtraServices(exSs);
View Full Code Here

        return tyre;
    }
   
    @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
    public @ResponseBody TyreTO delete(@PathVariable("id") Long id, HttpServletResponse resp) {
        TyreTO to = service.get(id);
        if (to != null) {
            service.remove(to);
        } else {
            throw new IllegalArgumentException("resource not found");
        }
View Full Code Here

TOP

Related Classes of cz.muni.fi.pa165.stis.dto.TyreTO

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.