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

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


        log.debug("load() \ncto={} \nuto={}", cto, uto);
        if (getContext().getRequest().getParameter("cto.id") == null) {
            return;
        }
        Long id = Long.parseLong(getContext().getRequest().getParameter("cto.id"));
        CustomerUserTO cuto = cuFacade.getByCustomerId(id);
        cto = cuto.getCustomer();
        uto = cuto.getUser();

        log.debug("load() \ncuto={} \ncto={} \nuto={}", cuto, cto, uto);       
    }
View Full Code Here


    public Resolution save() {
        log.debug("save() cto={} \nuto={}", this.getCto(), this.getUto());       
        if (uto.getPassword().equals(password2)) {
            log.debug("save() cto={} \nid={}", cto, cto.getUser());
            cuFacade.update(new CustomerUserTO(cto, uto));           
            return new RedirectResolution("/customer/list.jsp");
        }
       
        return new RedirectResolution(this.getClass(), "all");
    }
View Full Code Here

            throw new IllegalArgumentException("id is null");
        }
       
        CustomerTO cto = cservice.get(id);
        UserTO uto = cto.getUser();       
        return new CustomerUserTO(cto, uto);
    }
View Full Code Here

    @Override
    public List<CustomerUserTO> findAll() {
        List<CustomerTO> customerTOList = cservice.findAll();
        List<CustomerUserTO> cuTOList = new ArrayList<>();
        for (CustomerTO c : customerTOList) {
            cuTOList.add(new CustomerUserTO(c, c.getUser()));
        }
        return cuTOList;
    }
View Full Code Here

    @Override
    public CustomerUserTO getByUsername(String username) {
        UserTO userTO = uservice.getByUsername(username);       
        CustomerTO customerTO = cservice.getByUsername(username);
       
        return new CustomerUserTO(customerTO, userTO);
    }
View Full Code Here

        user = createUser("mrkvicka", "345sac", false);
        user.setId(5L);
        userTO = mapper.map(user, UserTO.class);       
        customer = createCustomer(4L, "Adam", "Petrik", "Burzoazna 12", "112567");
        customerTO = mapper.map(customer, CustomerTO.class);       
        CustomerUserTO customerUserTO = new CustomerUserTO(customerTO, userTO);
        customerTO.setUser(userTO)
       
        when(ctoMock.getUser()).thenReturn(userTO);       
        when(cservice.get(4L)).thenReturn(customerTO);                     

        CustomerUserTO cuto = facade.getByCustomerId(4L);
        assertEquals(customerUserTO, cuto);
    }
View Full Code Here

        user = createUser("mrkvicka", "345sac", false);
        user.setId(5L);
        userTO = mapper.map(user, UserTO.class);       
        customer = createCustomer(4L, "Adam", "Petrik", "Burzoazna 12", "112567");
        customerTO = mapper.map(customer, CustomerTO.class);       
        CustomerUserTO customerUserTO = new CustomerUserTO(customerTO, userTO);
        customerTO.setUser(userTO)
       
        facade.remove(customerUserTO);
        verify(cservice).remove(customerTO);
        verify(uservice).remove(userTO);
View Full Code Here

        user = createUser("mrkvicka", "345sac", false);
        user.setId(5L);
        userTO = mapper.map(user, UserTO.class);       
        customer = createCustomer(4L, "Adam", "Petrik", "Burzoazna 12", "112567");
        customerTO = mapper.map(customer, CustomerTO.class);       
        CustomerUserTO customerUserTO = new CustomerUserTO(customerTO, userTO);
        customerTO.setUser(userTO);                
       
        facade.update(customerUserTO);
        verify(cservice).update(customerTO);
        verify(uservice).update(userTO);       
View Full Code Here

    public void testFindAll() {
        user = createUser("mrkvicka", "345sac", false);       
        userTO = mapper.map(user, UserTO.class);       
        customer = createCustomer(null, "Adam", "Petrik", "Burzoazna 12", "112567");
        customerTO = mapper.map(customer, CustomerTO.class);       
        CustomerUserTO customerUserTO = new CustomerUserTO(customerTO, userTO);
        customerTO.setUser(userTO)
               
        User user2 = createUser("ferko22", "bak!s$#", false);
        UserTO userTO2 = mapper.map(user2, UserTO.class);       
        Customer customer2 = createCustomer(null, "Petko", "Mravcek", "Teplicka nad Vahom 142", "772222222");
        CustomerTO customerTO2 = mapper.map(customer2, CustomerTO.class);       
        CustomerUserTO customerUserTO2 = new CustomerUserTO(customerTO2, userTO2);
        customerTO2.setUser(userTO2)
       
        List<CustomerTO> customerList = new ArrayList<>();
        customerList.add(customerTO);
        customerList.add(customerTO2);
View Full Code Here

    public void testGetByUsername() {
        user = createUser("mrkvicka", "345sac", false);       
        userTO = mapper.map(user, UserTO.class);       
        customer = createCustomer(null, "Adam", "Petrik", "Burzoazna 12", "112567");
        customerTO = mapper.map(customer, CustomerTO.class);       
        CustomerUserTO customerUserTO = new CustomerUserTO(customerTO, userTO);
        customerTO.setUser(userTO)
       
        when(uservice.getByUsername("mrkvicka")).thenReturn(userTO);
        when(cservice.getByUsername("mrkvicka")).thenReturn(customerTO);
        CustomerUserTO cuto = facade.getByUsername("mrkvicka");
              
        verify(uservice).getByUsername("mrkvicka");
        verify(cservice).getByUsername("mrkvicka");
        assertTrue(cuto.equals(customerUserTO));
    }
View Full Code Here

TOP

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

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.