sdk
liriming
2025-03-19 63108d80c9dfa941f43b72ab58acccf1ddfc03aa
iailab-plat-sdk/src/test/java/com/iailab/sdk/IailabClientTest.java
@@ -1,12 +1,13 @@
package com.iailab.sdk;
import com.iailab.framework.test.core.ut.BaseMockitoUnitTest;
import com.iailab.sdk.auth.client.IailabAuthClient;
import com.iailab.sdk.auth.client.dto.TokenDTO;
import com.iailab.sdk.auth.client.vo.AuthLoginReqVO;
import org.junit.jupiter.api.Test;
import com.iailab.sdk.auth.client.IailabClient;
import com.iailab.sdk.auth.client.common.pojo.CommonResult;
import com.iailab.sdk.auth.client.dto.PowerRunStateDTO;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -18,17 +19,19 @@
 *
 * @author iailab
 */
public class IailabClientTest extends BaseMockitoUnitTest {
@RunWith(SpringRunner.class)
@SpringBootTest
public class IailabClientTest {
    @Test
    public void testLogin() {
        IailabAuthClient.authenticate();
        IailabClient.authenticate();
    }
    @Test
    public void testRefreshToken() throws Exception {
        // 准备参数
        IailabAuthClient.refreshToken();
        IailabClient.refreshToken();
    }
    @Test
@@ -40,9 +43,22 @@
        itemNos.add("P0000100010");
        params.put("itemNos", itemNos);
        // 准备参数
        String s = IailabAuthClient.doHttp("POST", "http://172.16.8.100/admin-api/data/api/query-plans/chart", params);
        String s = IailabClient.doHttp("POST", "http://172.16.8.100/admin-api/data/api/query-plans/chart", params);
        System.out.println(s);
    }
    @Test
    public void testQueryPointsRealValue() {
        List<String> pointNos = new ArrayList<>();
        pointNos.add("111");
        CommonResult<Map<String, Object>> stringObjectMap = IailabClient.getInstance().queryPointsRealValue(pointNos);
        System.out.println(stringObjectMap);
    }
    @Test
    public void testGetPowerRunState() {
        CommonResult<List<PowerRunStateDTO>> list = IailabClient.getInstance().getPowerRunState();
        System.out.println(list);
    }
}