Skip to content

Commit

Permalink
Only start testing server once per class
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed Feb 11, 2014
1 parent 70105e0 commit d8ad60f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import com.facebook.presto.server.testing.TestingPrestoServer;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.sql.Connection;
Expand All @@ -43,14 +43,14 @@ public class TestDriver
{
private TestingPrestoServer server;

@BeforeMethod
@BeforeClass
public void setup()
throws Exception
{
server = new TestingPrestoServer();
}

@AfterMethod
@AfterClass
public void teardown()
{
closeQuietly(server);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
package com.facebook.presto.jdbc;

import com.facebook.presto.server.testing.TestingPrestoServer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

Expand All @@ -38,12 +40,24 @@ public class TestJdbcResultSet
private Connection connection;
private Statement statement;

@BeforeClass
public void setupServer()
throws Exception
{
server = new TestingPrestoServer();
}

@AfterClass
public void teardownServer()
{
closeQuietly(server);
}

@SuppressWarnings("JDBCResourceOpenedButNotSafelyClosed")
@BeforeMethod
public void setup()
throws Exception
{
server = new TestingPrestoServer();
connection = createConnection();
statement = connection.createStatement();
}
Expand All @@ -53,7 +67,6 @@ public void teardown()
{
closeQuietly(statement);
closeQuietly(connection);
closeQuietly(server);
}

@Test
Expand Down

0 comments on commit d8ad60f

Please sign in to comment.