-
Notifications
You must be signed in to change notification settings - Fork 0
/
CreateTableTest.java
32 lines (27 loc) · 1.11 KB
/
CreateTableTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.reminder.service.integration;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
/**
* This class is used to create a Table in HSQLDB database
*/
public class CreateTableTest {
@Test
public void testCreateTable() {
Connection con = null;
Statement stmt = null;
int result = 0;
try {
Class.forName("org.hsqldb.jdbcDriver");
con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/reminderservdb", "sa", "");
stmt = con.createStatement();
String create = "CREATE MEMORY TABLE PUBLIC.REMINDER(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL, NAME VARCHAR(50)NOT NULL, DESCRIPTION VARCHAR(200), DUE_DATE BIGINT NOT NULL, STATUS VARCHAR(20) NOT NULL, CONSTRAINT PKID PRIMARY KEY(ID))" ;
result = stmt.executeUpdate(create);
} catch (Exception e) {
e.printStackTrace(System.out);
Assert.assertEquals(result, 1, "Table REMINDER creation is failed!");
}
}
}