import org.bdware.doip.audit.EndpointConfig;
import org.bdware.doip.audit.client.AuditIrpClient;
import org.bdware.doip.audit.config.TempConfigStorage;
import org.bdware.doip.audit.writer.AuditConfig;
import org.junit.Test;

public class AuditConfigTest {
    @Test
    public void run() {

        long start = System.currentTimeMillis();
        String str = "{\n" +
                "    \"privateKey\": \"4616ff0e2a4f982364914f9be30b51c6bc6ccb6602114a9ee8792f2ccf67465b\",\n" +
                "    \"publicKey\": \"04f9b9b8f324908464f78a6235e2dd93e4dfdaf045e9b1b5cfd57374516cc61a79a86fc2b42d3321a5b49a0f25381a7bed61901b40b729f72354e716673d551e98\",\n" +
                "    \"prefix\": \"shanxi\",\n" +
                "    \"router\": \"GlobalRouter\",\n" +
                "    \"routerURI\": \"tcp://127.0.0.1:18041\",\n" +
                "    \"auditType\": \"OnlyHash\"\n" +
                "  }";
        TempConfigStorage storage = new TempConfigStorage(str);
        long end = (System.currentTimeMillis() - start);
        System.out.println("time1:" + end);

        EndpointConfig endpointConfig = storage.loadAsEndpointConfig();
        end = (System.currentTimeMillis() - start);
        System.out.println("time2:" + end);
        AuditIrpClient irpClient = new AuditIrpClient(endpointConfig);
        end = (System.currentTimeMillis() - start);
        System.out.println("time3:" + end);
        AuditConfig auditConfig = irpClient.getAuditConfig();
        end = (System.currentTimeMillis() - start);
        System.out.println("time4:" + end);
        //   System.out.println(new Gson().toJson(auditConfig));
        for (; ; ) ;
    }
}
