刘光辉
5 小时以前 06f314545ac3514d7ce28939920866ae8188d31c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package jnpf.dmsMapper;
 
import org.apache.ibatis.builder.xml.XMLMapperBuilder;
import org.apache.ibatis.session.Configuration;
import org.junit.jupiter.api.Test;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.*;
 
class DmsBupinghengRetryMapperXmlTest {
    @Test void parsesAllStatementsAndExplicitlyMapsRetryState() throws Exception {
        Configuration configuration = new Configuration();
        String resource = "mapper/DmsBupinghengRetryMapper.xml";
        try (java.io.InputStream input = getClass().getResourceAsStream("/" + resource)) {
            new XMLMapperBuilder(input, configuration, resource, configuration.getSqlFragments()).parse();
        }
        String ns = "jnpf.dmsMapper.DmsBupinghengRetryMapper.";
        assertFalse(configuration.getResultMap(ns + "RetryMap").getAutoMapping());
        assertEquals(Set.of("documentId", "tenantId", "version", "attempts"),
                configuration.getResultMap(ns + "RetryMap").getResultMappings().stream()
                        .map(m -> m.getProperty()).collect(Collectors.toSet()));
        for (String name : Set.of("selectPending", "claim", "selectClaim", "finish")) {
            assertTrue(configuration.getMappedStatement(ns + name).getBoundSql(Map.of()).getSql().contains("f_tenant_id"));
        }
    }
}