package com.eactive.eai.common.c2rservice;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.jdbc.Sql;

import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.data.CommonJPATestConfiguration;
import com.eactive.eai.data.jpa.BaseRepositoryImpl;

@DataJpaTest
@ContextConfiguration(classes = { CommonJPATestConfiguration.class })
@ComponentScan({ "com.eactive.eai.common.c2rservice" })
@EnableJpaRepositories(repositoryBaseClass = BaseRepositoryImpl.class, basePackages = {
		"com.eactive.eai.common.c2rservice" })
@EntityScan({ "com.eactive.eai.data.entity.onl.c2rservice" })
@Sql({ "/com/eactive/eai/common/c2rservice/init_tseaihe04.sql" })
class C2RServiceDAOTest {

	@Autowired
	C2RServiceDAO c2rServiceDAO;

	@Test
	void getAllC2RServices() throws DAOException {
		// given

		// when
		c2rServiceDAO.getAllC2RServices();

		// then
		assertNotNull(c2rServiceDAO.getAllC2RServices());
		assertTrue(c2rServiceDAO.getAllC2RServices().size() > 0);
	}

//	@Test
//	void testStart() throws DAOException {
//		// given
//		String c2rExtnlInstiCd = "50500226";
//		
//		// when
//		c2rServiceDAO.getC2RService(c2rExtnlInstiCd);
//		
//		// then
////		assertNotNull(c2rServiceDAO.getC2RService(c2rExtnlInstiCd));
//		assertTrue(c2rServiceDAO.getC2RService(c2rExtnlInstiCd).size() > 0);
//	}
}
