package com.teltonikaServer.testing;

import com.teltonikaServer.persistence.Asset;
import java.sql.SQLException;

import com.teltonikaServer.persistence.Persistor;
import com.teltonikaServer.protocol.GpsElementSection;

public class DoTest {

    static public Persistor persistor;

    private static String HOST = "protracking.com.uy";
    private static String SCHEMA = "roman_suite";
    private static String USER = "romanSuite";
    private static String PASS = "Su1732077!";

    private static void openPersistor() {

        try {
            persistor = new Persistor(HOST, SCHEMA, USER, PASS);
        } catch (ClassNotFoundException classNotFoundException) {
            classNotFoundException.printStackTrace();
            System.exit(-1);
        } catch (IllegalAccessException illegalAccessException) {
            illegalAccessException.printStackTrace();
            System.exit(-2);
        } catch (InstantiationException instantiationException) {
            instantiationException.printStackTrace();
            System.exit(-3);
        } catch (SQLException sqlException) {
            sqlException.printStackTrace();
            System.exit(-4);
        }

    }

    static public void main(String[] args) throws SQLException{
        System.out.println("DO TEST");
        System.out.println("============================");
        openPersistor();
        System.out.println("Test: OVERSPEEDING");
        GpsElementSection gps = new GpsElementSection();
        gps.setLat(-10);
        gps.setLng(10);
        gps.setSpeed(31);
        gps.setUtcTimestamp(1737631436);

        DoTest.persistor.persistOverspeeding(gps, 88550599, 2, 6348630, 0, new Asset());
    }
}
