/*
 * Arrebol Consultancy copyright.
 * 
 * This code belongs to Arrebol Consultancy
 * its use, redistribution or modification are prohibited 
 * without written authorization from Arrebol Consultancy.
 */
package com.arrebol.taxiservicios.controller.admin;

import com.arrebol.taxiservicios.model.admin.ReleaseResource;
import com.arrebol.taxiservicios.model.admin.Taxi;
import com.arrebol.taxiservicios.model.core.Person;
import com.arrebol.taxiservicios.model.core.User;
import com.arrebol.taxiservicios.model.enums.GenericEnumType;
import java.util.Date;
import java.util.UUID;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;

/**
 *
 * @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
 */
public class ReleaseResourceControllerTest {

    private static final String janitzio_id = "0063e1ac-3daf-4a03-a2de-ac7187c7853b";
    private static final String balam_id = "1a24616e-9576-4879-b6f9-e52c6fdf400f";
    private static final Person driver_janitzio = new Person(janitzio_id);
    private static final Taxi taxi = new Taxi("19291d9d-e7f9-4d36-8696-0e361c0bebd0");
    private static final User user_ruben = new User("09ea84b8-b9d1-4a71-adfe-db653b2a9982", "");
    private ReleaseResourceController controller;

    @Before
    public void setUp() {
        controller = new ReleaseResourceController();
    }

    //@Test
    public void saveReleaseResource() {
        try {
            ReleaseResource releaseResource = new ReleaseResource(UUID.randomUUID().toString(), driver_janitzio, new Date(), GenericEnumType.ENABLED, user_ruben, new Date());
            assertTrue(controller.saveReleaseResource(releaseResource));
        } catch (Exception e) {
            assertFalse(true);
        }
    }

    //@Test
    public void updateReleaseResourceDetails() {
        try {
            assertTrue(controller.updateReleaseResourceDetails(null, taxi, new Date(), GenericEnumType.DISABLED, user_ruben, new Date()));
        } catch (Exception e) {
            assertFalse(true);
        }
    }

    //@Test
    public void existDriverEnebledInReleaseResource() {
        try {
            assertTrue(controller.existDriverEnebledInReleaseResource(janitzio_id));
        } catch (Exception e) {
            assertFalse(true);
        }
    }

    @Test
    public void findReleaseResourcesByIdAndActiveStatus() {
        try {
            assertTrue(controller.findReleaseResourcesByIdAndActiveStatus("e325712b-f26f-49f5-b518-07084c8c9685", GenericEnumType.ENABLED, true));
        } catch (Exception e) {
            assertFalse(true);
        }
    }
}
