package com.eactive.eai.message.layout;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;

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.data.CommonJPATestConfiguration;
import com.eactive.eai.data.jpa.BaseRepositoryImpl;
import com.eactive.eai.message.StandardItem;

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

	@Autowired
	DatabaseReader databaseReader;

	String layoutName = "HANA_POC_SAMPLE";

	@Test
	void testParse() throws Exception {

		List<StandardItem> list = databaseReader.parse(layoutName);

		assertThat(list).isNotEmpty();
	}

}
