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

import static org.junit.Assert.assertTrue;

import java.text.ParseException;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.annotation.Rollback;
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.jms.util.UtilJms;

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

	private static String factoriaJNDI = "ad74a.ad74aJMSFactory";
	private static String colaJNDI = "ad74a.ad74aPeticionPrestadorJMS";

	@Test
	@Transactional(propagation = Propagation.NOT_SUPPORTED)
	@Rollback(false)
	public void testEnviarCola() throws ParseException {

		try {
			UtilJms.enviarJMS(1L, factoriaJNDI, colaJNDI, null, null);
			assertTrue("Fin petición envío a cola", 1 == 1);
		} catch (Exception e) {
			assertTrue("Fin petición envio a cola", 1 != 1);
		}

	}

}
