package com.eactive.eai.common.messagekey; import static org.junit.jupiter.api.Assertions.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.common.lifecycle.LifecycleException; import com.eactive.eai.data.CommonJPATestConfiguration; import com.eactive.eai.data.jpa.BaseRepositoryImpl; @DataJpaTest @ContextConfiguration(classes = { CommonJPATestConfiguration.class }) @ComponentScan({ "com.eactive.eai.common.messagekey" }) @EnableJpaRepositories(repositoryBaseClass = BaseRepositoryImpl.class, basePackages = { "com.eactive.eai.common.messagekey" }) @EntityScan({ "com.eactive.eai.data.entity.onl.messagekey" }) @Sql({ "/com/eactive/eai/common/messagekey/init_tseaifr04.sql" }) class MessageKeyManagerTest { @Autowired MessageKeyManager messageKeyManager; @Test void testStart() throws LifecycleException { // given // when messageKeyManager.start(); // then assertTrue(messageKeyManager.getAllKeyNames().length > 0); MessageKeyVO vo = messageKeyManager.getMessageKey("_EAI_IN_NET_SyS" + "I"); System.out.println(vo); assertTrue(vo.getMessageKeyGroup(0).getMessageKeyFldLength() == 2); try { vo = messageKeyManager.getMessageKey("_EAI_IN_NET_SyS", "I"); } catch (DAOException e) { e.printStackTrace(); } System.out.println(vo); } }