package cz.senslog.connector.push.theros;

import cz.senslog.connector.model.config.DefaultConfig;
import cz.senslog.connector.tools.http.HttpClient;
import org.junit.jupiter.api.Test;

import java.util.HashMap;

import static org.junit.jupiter.api.Assertions.*;

class TherosPusherTest {

    @Test
    void onlineTest() throws Exception {

        DefaultConfig defaultConfig = new DefaultConfig(null, null);
        defaultConfig.setProperty("baseUrl", "https://theros.iccs.gr/iot/api/v1");
        defaultConfig.setProperty("auth", new HashMap<String, String>() {{
            put("url", "https://auth-theros.iccs.gr/realms/theros/protocol/openid-connect/token");
            put("clientId", "iot-client");
            put("clientSecret", "cKIhqWuk6foyn2taKwEzgWBJdqu5HkMv");
            put("username", "lcerny@lesprojekt.cz");
            put("password", "PF7n4Nc*b2AKTzr9L_");
        }});

        TherosConfig config = new TherosConfig(defaultConfig);
        AuthService authService = new AuthService(config.getAuthConfig(), HttpClient.newHttpSSLClient());

        TherosPusher pusher = new TherosPusher(config, authService, HttpClient.newHttpSSLClient());

        pusher.init();
//        pusher.push(null);

    }
}