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

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
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.constantes.Constantes;
import com.ejie.ad74a.ws.client.dokusi.gestDocumental.T65AuditUser;
import com.ejie.ad74a.ws.client.dokusi.gestDocumental.T65BFsdJaxbInterface;
import com.ejie.ad74a.ws.client.dokusi.gestDocumental.T65Content;
import com.ejie.ad74a.ws.client.dokusi.gestDocumental.T65DocumentId;

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

	@Autowired
	private T65BFsdJaxbInterface t65BFsdJaxbInterface;

	@Test
	@Transactional(propagation = Propagation.SUPPORTS)
	@Rollback(false)
	public void dowloadDocumentMessage() {

		try {
			T65AuditUser t65AuditUser = new T65AuditUser();
			t65AuditUser.setDni(Constantes.COD_APLICACION);
			t65AuditUser.setName(Constantes.COD_APLICACION);
			t65AuditUser.setUser(Constantes.COD_APLICACION);
			T65DocumentId t65DocumentID = new T65DocumentId();
			t65DocumentID.setId("09f424018102f6b7");
			T65Content t65Content = new T65Content();
			t65Content.setPifId("/ad74a/dokusi");

			t65Content = this.t65BFsdJaxbInterface.retrieveDocumentOrSuperLocator(t65AuditUser, t65DocumentID,
					t65Content);
			System.out.println("aaa");

		} catch (Throwable e) {
			e.printStackTrace();
			Assert.fail("Error al procesar el message");
		}
		// Assert.assertTrue("Se ha encontrado un registro que no existe", true);
	}

}
