package com.ejie.ad74a.service.test.basic;

import static org.junit.Assert.assertTrue;

import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.ejie.ad74a.dao.ExpedientesDao;
import com.ejie.ad74a.model.Expedientes;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:test/application-context.xml")
public class TestAOPQueryService {

	@Autowired
	private ExpedientesDao expedientesDao;

	@Test
	@Transactional(propagation = Propagation.REQUIRES_NEW)
	// @Rollback(true)
	public void testAopHistorico() {
		Expedientes ex = new Expedientes();
		ex.setIdExpediente00(41L);
		ex.setHistorico(true);
		List<Expedientes> total = this.expedientesDao.findAll(ex, null);
		System.out.println("Total: " + total);
		assertTrue("No se ha recuperado el solicitante", total != null);

		// template.queryHist("asasda", null, null, true);

	}

}
