net.snowflake.client

## Class HeartbeatIT

- java.lang.Object
- - net.snowflake.client.AbstractDriverIT
  - - net.snowflake.client.HeartbeatIT

    public class HeartbeatIT
    extends AbstractDriverIT

This test assumes that GS has been set up

Author:
  jhuang

### Constructor Summary

Constructors
Constructor and Description
`HeartbeatIT()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static void` `setUpClass()` set up: change the master token validity to 10 seconds change the session token validity to 5 seconds change the SESSION_RECORD_ACCESS_INTERVAL_SECS to 1 second
`static void` `tearDownClass()` Reset master_token_validity, session_token_validity, SESSION_RECORD_ACCESS_INTERVAL_SECS to default.
`void` `testFailure()` Test no heartbeat by starting 1 thread.
`void` `testSuccess()` Test heartbeat by starting 10 threads.

### Methods inherited from class net.snowflake.client.AbstractDriverIT

`getConnection, getConnection, setUp, tearDown`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### HeartbeatIT

    public HeartbeatIT()

### Method Detail

#### setUpClass

    public static void setUpClass()
                           throws Exception

set up: change the master token validity to 10 seconds change the session token validity to 5 seconds change the SESSION_RECORD_ACCESS_INTERVAL_SECS to 1 second

Throws:
  `Exception`

#### tearDownClass

    public static void tearDownClass()
                              throws SQLException

Reset master_token_validity, session_token_validity, SESSION_RECORD_ACCESS_INTERVAL_SECS to default.

Throws:
  `SQLException`

#### testSuccess

    public void testSuccess()
                     throws SQLException

Test heartbeat by starting 10 threads. Each get a connection and wait for a time longer than master token validity and issue a query to make sure the query succeeds.

Throws:
  `SQLException`

#### testFailure

    public void testFailure()
                     throws SQLException

Test no heartbeat by starting 1 thread. It gets a connection and wait for a time longer than master token validity and issue a query to make sure the query fails.

Throws:
  `SQLException`