Examples of CarDto


Examples of com.gwtplatform.carstore.shared.dto.CarDto

    ResourceDelegate<CarsResource> carsDelegate;

    @Test
    public void onEditCar(PlaceManager placeManager, ManufacturerDto manufacturerDto) {
        // Given
        CarDto carDto = mock(CarDto.class);
        given(carDto.getManufacturer()).willReturn(manufacturerDto);
        given(carProxyFactory.create(carDto, carDto.getManufacturer().getName() + carDto.getModel())).willReturn(proxy);
        given(proxy.getNameToken()).willReturn("token");

        PlaceRequest placeRequest = new PlaceRequest.Builder().nameToken("token").build();

        // When
View Full Code Here

Examples of com.gwtplatform.carstore.shared.dto.CarDto

    }

    @Test
    public void onDelete(HasData<CarDto> hasCarData, Range range, CarsResource carsResource, CarResource carResource) {
        // Given
        CarDto carDto = new CarDto();
        carDto.setId(3L);

        given(carsResource.car(carDto.getId())).willReturn(carResource);

        // We delete the car
        givenDelegate(carsDelegate).useResource(carsResource)
                .and().succeed()
                .when(carResource).delete();
View Full Code Here

Examples of com.gwtplatform.carstore.shared.dto.CarDto

    public static CarDto createDto(Car car) {
        if (car == null) {
            return null;
        }

        CarDto carDto = new CarDto();
        carDto.setCarProperties(CarProperties.createDto(car.getCarProperties()));
        carDto.setId(car.getId());
        carDto.setManufacturer(Manufacturer.createDto(car.getManufacturer()));
        carDto.setModel(car.getModel());

        return carDto;
    }
View Full Code Here

Examples of com.gwtplatform.carstore.shared.dto.CarDto

            carPropertiesLancer = carPropertiesDao.put(carPropertiesLancer);

            CarPropertiesDto carPropertiesMitsubishi = new CarPropertiesDto("Cow", 3, new Date());
            carPropertiesMitsubishi = carPropertiesDao.put(carPropertiesMitsubishi);

            CarDto civic = new CarDto("Civic", honda, carPropertiesCivic);
            CarDto accord = new CarDto("Accord", honda, carPropertiesAccord);
            CarDto lancer = new CarDto("Lancer", mitsubishi, carPropertiesLancer);
            CarDto galant = new CarDto("Galant", mitsubishi, carPropertiesMitsubishi);

            civic = Car.createDto(carDao.put(Car.create(civic)));
            accord = Car.createDto(carDao.put(Car.create(accord)));
            lancer = Car.createDto(carDao.put(Car.create(lancer)));
            galant = Car.createDto(carDao.put(Car.create(galant)));
View Full Code Here

Examples of com.gwtplatform.carstore.shared.dto.CarDto

public class ReportService {
    public List<ManufacturerRatingDto> getAverageCarRatings(List<RatingDto> ratingDtos) {
        HashMap<String, AveragingCounter> averages = new HashMap<>();

        for (RatingDto ratingDto : ratingDtos) {
            CarDto carDto = ratingDto.getCar();
            ManufacturerDto manufacturer = carDto.getManufacturer();
            String manufacturerName = manufacturer.getName();
            Double rating = Double.valueOf(ratingDto.getRating());

            if (averages.containsKey(manufacturerName)) {
                averages.get(manufacturerName).add(rating);
View Full Code Here

Examples of com.gwtplatform.carstore.shared.dto.CarDto

        this.carsDelegate = carsDelegate;
        this.manufacturersDelegate = manufacturersDelegate;
        this.messages = messages;
        this.placeManager = placeManager;
        this.carProxyFactory = carProxyFactory;
        this.carDto = carDto != null ? carDto : new CarDto();

        getView().setUiHandlers(this);
    }
View Full Code Here

Examples of com.gwtplatform.carstore.shared.dto.CarDto

    private void onCarSaved(CarDto oldCar, CarDto newCar) {
        DisplayMessageEvent.fire(CarPresenter.this, new Message(messages.carSaved(), MessageStyle.SUCCESS));
        CarAddedEvent.fire(CarPresenter.this, newCar, oldCar.getId() == null);

        if (oldCar.getId() == null) {
            carDto = new CarDto();
            getView().resetFields(carDto);

            MyProxy proxy = carProxyFactory.create(newCar, newCar.getManufacturer().getName() + newCar.getModel());

            placeManager.revealPlace(new PlaceRequest.Builder().nameToken(proxy.getNameToken()).build());
View Full Code Here

Examples of com.gwtplatform.carstore.shared.dto.CarDto

    }

    @Override
    protected void onBind() {
        addRegisteredHandler(ActionBarEvent.getType(), this);
        carProxyFactory.create(new CarDto(), NameTokens.NEW_CAR);
    }
View Full Code Here

Examples of org.mapstruct.ap.test.complex.target.CarDto

    }

    @Test
    public void shouldReverseMapIterableAttribute() {
        //given
        CarDto carDto = new CarDto(
            "Morris",
            2,
            "1980",
            new PersonDto( "Bob" ),
            new ArrayList<PersonDto>( Arrays.asList( new PersonDto( "Alice" ), new PersonDto( "Bill" ) ) )
View Full Code Here

Examples of org.mapstruct.ap.test.complex.target.CarDto

    public void shouldMapEnumToString() {
        //given
        Car car = new Car();
        car.setCategory( Category.CONVERTIBLE );
        //when
        CarDto carDto = CarMapper.INSTANCE.carToCarDto( car );

        //then
        assertThat( carDto ).isNotNull();
        assertThat( carDto.getCategory() ).isEqualTo( "CONVERTIBLE" );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.