自动化立体仓库 - WMS系统
zwl
2 天以前 909cc78ba290cefc3c4623eff234e85ca0140e6d
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
28
29
30
31
package com.zy.integration.iot;
 
import com.zy.iot.config.IotProperties;
import com.zy.iot.util.IotInstructionIdGenerator;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
 
public class IotSupportTest {
 
    @Test
    public void shouldResolveServerUriAndClientId() {
        IotProperties properties = new IotProperties();
        properties.setEndpoint("example-ats.iot.cn-north-1.amazonaws.com.cn");
        properties.setPort(8883);
        properties.setThingName("thing-a");
 
        Assertions.assertEquals("ssl://example-ats.iot.cn-north-1.amazonaws.com.cn:8883", properties.getServerUri());
        Assertions.assertEquals("thing-a", properties.getResolvedClientId());
 
        properties.setClientId("client-b");
        Assertions.assertEquals("client-b", properties.getResolvedClientId());
    }
 
    @Test
    public void shouldGenerateStableLengthInstructionId() {
        String instructionId = IotInstructionIdGenerator.generate("wrk-1001");
 
        Assertions.assertEquals(20, instructionId.length());
        Assertions.assertEquals(instructionId, instructionId.toUpperCase());
    }
}