未验证 提交 e3f10342 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #2440 from taosdata/buildTaosdForJDBCTests

Build taosd before running jdbc tests
#!/bin/bash
ulimit -c unlimited
function buildTDengine {
cd /root/TDengine
git remote update
REMOTE_COMMIT=`git rev-parse --short remotes/origin/develop`
LOCAL_COMMIT=`git rev-parse --short @`
echo " LOCAL: $LOCAL_COMMIT"
echo "REMOTE: $REMOTE_COMMIT"
if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then
echo "repo up-to-date"
else
echo "repo need to pull"
git pull
LOCAL_COMMIT=`git rev-parse --short @`
cd /root/TDengine/debug
rm -rf /root/TDengine/debug/*
cmake ..
make > /dev/null
make install
fi
}
function restartTaosd {
systemctl stop taosd
pkill -KILL -x taosd
sleep 10
logDir=`grep 'logDir' /etc/taos/taos.cfg|awk 'END{print $2}'`
dataDir=`grep 'dataDir' /etc/taos/taos.cfg|awk '{print $2}'`
rm -rf $logDir/*
rm -rf $dataDir/*
taosd 2>&1 > /dev/null &
sleep 10
}
buildTDengine
restartTaosd
......@@ -12,7 +12,7 @@ import java.util.Properties;
import static org.junit.Assert.assertTrue;
public class AsyncSubscribeTest {
public class AsyncSubscribeTest extends BaseTest {
Connection connection = null;
Statement statement = null;
String dbName = "test";
......
package com.taosdata.jdbc;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import org.junit.BeforeClass;
public class BaseTest {
@BeforeClass
public static void setupEnv() {
try{
String path = System.getProperty("user.dir");
String bashPath = path + "/buildTDengine.sh";
Process ps = Runtime.getRuntime().exec(bashPath);
ps.waitFor();
BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
while(br.readLine() != null) {
System.out.println(br.readLine());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ import java.util.Properties;
import static org.junit.Assert.assertTrue;
public class ConnectionTest {
public class ConnectionTest extends BaseTest {
static Connection connection = null;
static Statement statement = null;
static String dbName = "test";
......
......@@ -7,7 +7,7 @@ import org.junit.Test;
import java.sql.*;
import java.util.Properties;
public class DatabaseMetaDataTest {
public class DatabaseMetaDataTest extends BaseTest {
static Connection connection = null;
static PreparedStatement statement = null;
static String dbName = "test";
......
......@@ -9,7 +9,7 @@ import java.util.Properties;
import static org.junit.Assert.assertEquals;
public class ImportTest {
public class ImportTest extends BaseTest {
Connection connection = null;
Statement statement = null;
String dbName = "test";
......
......@@ -13,7 +13,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@FixMethodOrder(MethodSorters.DEFAULT)
public class PreparedStatementTest {
public class PreparedStatementTest extends BaseTest {
static Connection connection = null;
static PreparedStatement statement = null;
static String dbName = "test";
......
......@@ -13,7 +13,7 @@ import java.util.Properties;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class ResultSetTest {
public class ResultSetTest extends BaseTest {
static Connection connection = null;
static Statement statement = null;
static String dbName = "test";
......
......@@ -9,7 +9,7 @@ import java.util.Properties;
import static org.junit.Assert.assertEquals;
public class SelectTest {
public class SelectTest extends BaseTest {
Connection connection = null;
Statement statement = null;
String dbName = "test";
......
......@@ -12,7 +12,7 @@ import java.util.Properties;
import static org.junit.Assert.assertEquals;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class StableTest {
public class StableTest extends BaseTest {
static Connection connection = null;
static Statement statement = null;
static String dbName = "test";
......
......@@ -10,7 +10,7 @@ import java.util.Properties;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class StatementTest {
public class StatementTest extends BaseTest {
static Connection connection = null;
static Statement statement = null;
static String dbName = "test";
......
......@@ -12,7 +12,7 @@ import java.util.Properties;
import static org.junit.Assert.assertTrue;
public class SubscribeTest {
public class SubscribeTest extends BaseTest {
Connection connection = null;
Statement statement = null;
String dbName = "test";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册