You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by co...@apache.org on 2015/04/15 03:11:33 UTC
incubator-sentry git commit: SENTRY-537: Refactor
AbstractTestWithHiveServer to cut down some test cases runtime (Colin Ma,
reviewed by Dapeng Sun)
Repository: incubator-sentry
Updated Branches:
refs/heads/master 8cc22bee5 -> 58adbe44e
SENTRY-537: Refactor AbstractTestWithHiveServer to cut down some test cases runtime (Colin Ma, reviewed by Dapeng Sun)
Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/58adbe44
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/58adbe44
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/58adbe44
Branch: refs/heads/master
Commit: 58adbe44e9e69a049e450f1bc5342135c8f92b3a
Parents: 8cc22be
Author: Colin Ma <co...@apache.org>
Authored: Wed Apr 15 08:50:51 2015 +0800
Committer: Colin Ma <co...@apache.org>
Committed: Wed Apr 15 08:50:51 2015 +0800
----------------------------------------------------------------------
.../dbprovider/AbstractTestWithDbProvider.java | 51 +++++++++-----------
.../TestDbSentryOnFailureHookLoading.java | 43 +++++++++++++----
.../TestPrivilegeWithHAGrantOption.java | 24 +++++----
.../e2e/hive/AbstractTestWithHiveServer.java | 32 ++++++------
.../tests/e2e/hive/TestServerConfiguration.java | 50 ++++++++++---------
.../tests/e2e/hive/TestViewPrivileges.java | 21 +++++---
6 files changed, 124 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/58adbe44/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
index 04f50ed..0c9feab 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
@@ -25,14 +25,10 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeoutException;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Maps;
-import com.google.common.io.Files;
import org.apache.commons.io.FileUtils;
import org.apache.curator.test.TestingServer;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
import org.apache.sentry.binding.hive.SentryHiveAuthorizationTaskFactoryImpl;
import org.apache.sentry.provider.db.SimpleDBProviderBackend;
import org.apache.sentry.provider.file.PolicyFile;
@@ -44,36 +40,34 @@ import org.apache.sentry.tests.e2e.hive.AbstractTestWithHiveServer;
import org.apache.sentry.tests.e2e.hive.Context;
import org.apache.sentry.tests.e2e.hive.StaticUserGroup;
import org.apache.sentry.tests.e2e.hive.hiveserver.HiveServerFactory;
-import org.junit.After;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import com.google.common.io.Files;
+
public abstract class AbstractTestWithDbProvider extends AbstractTestWithHiveServer {
protected static final String SERVER_HOST = "localhost";
- private Map<String, String> properties = Maps.newHashMap();
- private File dbDir;
- private int sentryServerCount = 1;
- private List<SentryService> servers = new ArrayList<SentryService>(sentryServerCount);
- private Configuration conf;
- private PolicyFile policyFile;
- private File policyFilePath;
- protected Context context;
+ protected static Map<String, String> properties = Maps.newHashMap();
+ private static File dbDir;
+ private static int sentryServerCount = 1;
+ private static List<SentryService> servers = new ArrayList<SentryService>(sentryServerCount);
+ private static Configuration conf;
+ private static PolicyFile policyFile;
+ private static File policyFilePath;
+ protected static Context context;
- protected boolean haEnabled;
- private TestingServer zkServer;
+ protected static boolean haEnabled;
+ private static TestingServer zkServer;
@BeforeClass
public static void setupTest() throws Exception {
}
- @Override
- public Context createContext(Map<String, String> properties) throws Exception {
- this.properties = properties;
- return createContext();
- }
-
- public Context createContext() throws Exception {
+ public static void createContext() throws Exception {
conf = new Configuration(false);
policyFile = PolicyFile.setAdminOnServer1(ADMINGROUP);
properties.put(HiveServerFactory.AUTHZ_PROVIDER_BACKEND, SimpleDBProviderBackend.class.getName());
@@ -111,17 +105,16 @@ public abstract class AbstractTestWithDbProvider extends AbstractTestWithHiveSer
String.valueOf(server.getAddress().getPort()));
}
- context = super.createContext(properties);
+ context = AbstractTestWithHiveServer.createContext(properties);
policyFile
.setUserGroupMapping(StaticUserGroup.getStaticMapping())
.write(context.getPolicyFile(), policyFilePath);
startSentryService();
- return context;
}
- @After
- public void tearDown() throws Exception {
+ @AfterClass
+ public static void tearDown() throws Exception {
for (SentryService server : servers) {
if (server != null) {
server.stop();
@@ -149,7 +142,7 @@ public abstract class AbstractTestWithDbProvider extends AbstractTestWithHiveSer
connection.close();
}
- private void startSentryService() throws Exception {
+ private static void startSentryService() throws Exception {
for (SentryService server : servers) {
server.start();
final long start = System.currentTimeMillis();
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/58adbe44/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestDbSentryOnFailureHookLoading.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestDbSentryOnFailureHookLoading.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestDbSentryOnFailureHookLoading.java
index 1af8baa..66e81a8 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestDbSentryOnFailureHookLoading.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestDbSentryOnFailureHookLoading.java
@@ -21,34 +21,34 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.sql.Connection;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Map;
+import java.util.List;
import junit.framework.Assert;
import org.apache.hadoop.hive.ql.plan.HiveOperation;
import org.apache.sentry.binding.hive.conf.HiveAuthzConf;
import org.apache.sentry.provider.db.SentryAccessDeniedException;
-import org.apache.sentry.provider.file.PolicyFile;
import org.apache.sentry.tests.e2e.hive.DummySentryOnFailureHook;
-import org.apache.sentry.tests.e2e.hive.StaticUserGroup;
import org.apache.sentry.tests.e2e.hive.hiveserver.HiveServerFactory;
+import org.junit.After;
import org.junit.Assume;
-import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
public class TestDbSentryOnFailureHookLoading extends AbstractTestWithDbProvider {
- Map<String, String > testProperties;
- @Before
- public void setup() throws Exception {
- testProperties = new HashMap<String, String>();
- testProperties.put(HiveAuthzConf.AuthzConfVars.AUTHZ_ONFAILURE_HOOKS.getVar(),
+ @BeforeClass
+ public static void setup() throws Exception {
+ properties = new HashMap<String, String>();
+ properties.put(HiveAuthzConf.AuthzConfVars.AUTHZ_ONFAILURE_HOOKS.getVar(),
DummySentryOnFailureHook.class.getName());
- createContext(testProperties);
+ createContext();
DummySentryOnFailureHook.invoked = false;
// Do not run these tests if run with external HiveServer2
@@ -62,6 +62,29 @@ public class TestDbSentryOnFailureHookLoading extends AbstractTestWithDbProvider
}
}
+ @After
+ public void clearDB() throws Exception {
+ Connection connection;
+ Statement statement;
+ connection = context.createConnection(ADMIN1);
+ statement = context.createStatement(connection);
+ ResultSet resultSet;
+ resultSet = statement.executeQuery("SHOW roles");
+ List<String> roles = new ArrayList<String>();
+ while ( resultSet.next()) {
+ roles.add(resultSet.getString(1));
+ }
+ for(String role:roles) {
+ statement.execute("DROP Role " + role);
+ }
+
+ statement.close();
+ connection.close();
+ if (context != null) {
+ context.close();
+ }
+ }
+
/* Admin creates database DB_2
* user1 tries to drop DB_2, but it has permissions for DB_1.
*/
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/58adbe44/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java
index 84f998e..9791790 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java
@@ -17,36 +17,34 @@
package org.apache.sentry.tests.e2e.dbprovider;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.hadoop.hive.ql.plan.HiveOperation;
import junit.framework.Assert;
+
+import org.apache.hadoop.hive.ql.plan.HiveOperation;
import org.apache.sentry.binding.hive.conf.HiveAuthzConf;
import org.apache.sentry.provider.db.SentryAccessDeniedException;
import org.apache.sentry.tests.e2e.hive.DummySentryOnFailureHook;
import org.apache.sentry.tests.e2e.hive.hiveserver.HiveServerFactory;
import org.junit.Assume;
-import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
public class TestPrivilegeWithHAGrantOption extends AbstractTestWithDbProvider {
- Map<String, String > testProperties;
-
- @Before
- public void setup() throws Exception {
+ @BeforeClass
+ public static void setup() throws Exception {
haEnabled = true;
- testProperties = new HashMap<String, String>();
- testProperties.put(HiveAuthzConf.AuthzConfVars.AUTHZ_ONFAILURE_HOOKS.getVar(),
+ properties = new HashMap<String, String>();
+ properties.put(HiveAuthzConf.AuthzConfVars.AUTHZ_ONFAILURE_HOOKS.getVar(),
DummySentryOnFailureHook.class.getName());
- createContext(testProperties);
+ createContext();
DummySentryOnFailureHook.invoked = false;
// Do not run these tests if run with external HiveServer2
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/58adbe44/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithHiveServer.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithHiveServer.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithHiveServer.java
index 9b3c04a..56ed955 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithHiveServer.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithHiveServer.java
@@ -16,30 +16,32 @@
*/
package org.apache.sentry.tests.e2e.hive;
-import com.google.common.io.Files;
+import java.io.File;
+import java.util.Map;
+
import junit.framework.Assert;
+
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.sentry.tests.e2e.hive.hiveserver.HiveServer;
import org.apache.sentry.tests.e2e.hive.hiveserver.HiveServerFactory;
-import org.junit.After;
+import org.junit.AfterClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.File;
-import java.util.Map;
+import com.google.common.io.Files;
public abstract class AbstractTestWithHiveServer {
private static final Logger LOGGER = LoggerFactory
.getLogger(AbstractTestWithHiveServer.class);
- protected File baseDir;
- protected File logDir;
- protected File confDir;
- protected File dataDir;
- protected File policyFile;
- protected HiveServer hiveServer;
- protected FileSystem fileSystem;
+ protected static File baseDir;
+ protected static File logDir;
+ protected static File confDir;
+ protected static File dataDir;
+ protected static File policyFile;
+ protected static HiveServer hiveServer;
+ protected static FileSystem fileSystem;
protected static final String ADMIN1 = StaticUserGroup.ADMIN1,
ADMINGROUP = StaticUserGroup.ADMINGROUP,
@@ -50,7 +52,7 @@ public abstract class AbstractTestWithHiveServer {
USERGROUP2 = StaticUserGroup.USERGROUP2,
USERGROUP3 = StaticUserGroup.USERGROUP3;
- public Context createContext(Map<String, String> properties)
+ public static Context createContext(Map<String, String> properties)
throws Exception {
fileSystem = FileSystem.get(new Configuration());
baseDir = Files.createTempDir();
@@ -61,7 +63,7 @@ public abstract class AbstractTestWithHiveServer {
policyFile = new File(confDir, HiveServerFactory.AUTHZ_PROVIDER_FILENAME);
hiveServer = HiveServerFactory.create(properties, baseDir, confDir, logDir, policyFile.getPath(), fileSystem);
hiveServer.start();
- return new Context(hiveServer, getFileSystem(),
+ return new Context(hiveServer, fileSystem,
baseDir, confDir, dataDir, policyFile);
}
@@ -76,8 +78,8 @@ public abstract class AbstractTestWithHiveServer {
return fileSystem;
}
- @After
- public void tearDownWithHiveServer() throws Exception {
+ @AfterClass
+ public static void tearDownWithHiveServer() throws Exception {
if(hiveServer != null) {
hiveServer.shutdown();
hiveServer = null;
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/58adbe44/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestServerConfiguration.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestServerConfiguration.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestServerConfiguration.java
index d8ebea6..18fc5d9 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestServerConfiguration.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestServerConfiguration.java
@@ -35,9 +35,10 @@ import org.apache.sentry.binding.hive.HiveAuthzBindingSessionHook;
import org.apache.sentry.binding.hive.conf.HiveAuthzConf;
import org.apache.sentry.provider.file.PolicyFile;
import org.apache.sentry.tests.e2e.hive.hiveserver.HiveServerFactory;
-import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import com.google.common.base.Charsets;
@@ -45,32 +46,37 @@ import com.google.common.collect.Maps;
public class TestServerConfiguration extends AbstractTestWithHiveServer {
- private Context context;
- private Map<String, String> properties;
+ private static Context context;
+ private static Map<String, String> properties;
private PolicyFile policyFile;
- @Before
- public void setup() throws Exception {
+ @BeforeClass
+ public static void setup() throws Exception {
properties = Maps.newHashMap();
- policyFile = PolicyFile.setAdminOnServer1(ADMINGROUP);
-
+ context = createContext(properties);
}
- @After
- public void tearDown() throws Exception {
+ @AfterClass
+ public static void tearDown() throws Exception {
if(context != null) {
context.close();
}
}
+ @Before
+ public void setupPolicyFile() throws Exception {
+ policyFile = PolicyFile.setAdminOnServer1(ADMINGROUP);
+ }
+
/**
* hive.server2.enable.impersonation must be disabled
*/
@Test
public void testImpersonationIsDisabled() throws Exception {
+ Map<String, String> properties = Maps.newHashMap();
properties.put(HiveServerFactory.ACCESS_TESTING_MODE, "false");
properties.put("hive.server2.enable.impersonation", "true");
- verifyInvalidConfigurationException();
+ verifyInvalidConfigurationException(properties);
}
/**
@@ -78,13 +84,14 @@ public class TestServerConfiguration extends AbstractTestWithHiveServer {
*/
@Test
public void testAuthenticationIsStrong() throws Exception {
+ Map<String, String> properties = Maps.newHashMap();
properties.put(HiveServerFactory.ACCESS_TESTING_MODE, "false");
properties.put("hive.server2.authentication", "NONE");
- verifyInvalidConfigurationException();
+ verifyInvalidConfigurationException(properties);
}
- private void verifyInvalidConfigurationException() throws Exception{
- context = createContext(properties);
+ private void verifyInvalidConfigurationException(Map<String, String> properties) throws Exception{
+ Context context = createContext(properties);
policyFile
.setUserGroupMapping(StaticUserGroup.getStaticMapping())
.write(context.getPolicyFile());
@@ -95,6 +102,10 @@ public class TestServerConfiguration extends AbstractTestWithHiveServer {
Assert.fail("Expected SQLException");
} catch (SQLException e) {
context.verifyInvalidConfigurationException(e);
+ } finally {
+ if (context != null) {
+ context.close();
+ }
}
}
@@ -103,10 +114,10 @@ public class TestServerConfiguration extends AbstractTestWithHiveServer {
*/
@Test
public void testRemovalOfPolicyFile() throws Exception {
- context = createContext(properties);
Connection connection = context.createConnection(ADMIN1);
Statement statement = context.createStatement(connection);
try {
+ statement.execute("DROP TABLE IF EXISTS test CASCADE");
statement.execute("create table test (a string)");
Assert.fail("Expected SQLException");
} catch (SQLException e) {
@@ -119,7 +130,6 @@ public class TestServerConfiguration extends AbstractTestWithHiveServer {
*/
@Test
public void testCorruptionOfPolicyFile() throws Exception {
- context = createContext(properties);
File policyFile = context.getPolicyFile();
FileOutputStream out = new FileOutputStream(policyFile);
out.write("this is not valid".getBytes(Charsets.UTF_8));
@@ -127,6 +137,7 @@ public class TestServerConfiguration extends AbstractTestWithHiveServer {
Connection connection = context.createConnection(ADMIN1);
Statement statement = context.createStatement(connection);
try {
+ statement.execute("DROP TABLE IF EXISTS test CASCADE");
statement.execute("create table test (a string)");
Assert.fail("Expected SQLException");
} catch (SQLException e) {
@@ -136,8 +147,6 @@ public class TestServerConfiguration extends AbstractTestWithHiveServer {
@Test
public void testAddDeleteDFSRestriction() throws Exception {
- context = createContext(properties);
-
policyFile
.addRolesToGroup(USERGROUP1, "all_db1")
.addRolesToGroup(USERGROUP2, "select_tb1")
@@ -164,7 +173,6 @@ public class TestServerConfiguration extends AbstractTestWithHiveServer {
*/
@Test
public void testAccessConfigRestrictions() throws Exception {
- context = createContext(properties);
policyFile
.setUserGroupMapping(StaticUserGroup.getStaticMapping())
.write(context.getPolicyFile());
@@ -208,8 +216,9 @@ public class TestServerConfiguration extends AbstractTestWithHiveServer {
*/
@Test
public void testDefaultDbRestrictivePrivilege() throws Exception {
+ Map<String, String> properties = Maps.newHashMap();
properties.put(HiveAuthzConf.AuthzConfVars.AUTHZ_RESTRICT_DEFAULT_DB.getVar(), "true");
- context = createContext(properties);
+ Context context = createContext(properties);
policyFile
.addRolesToGroup(USERGROUP1, "all_default")
@@ -224,17 +233,14 @@ public class TestServerConfiguration extends AbstractTestWithHiveServer {
Connection connection = context.createConnection(ADMIN1);
Statement statement = context.createStatement(connection);
statement.execute("use default");
- context.close();
connection = context.createConnection(USER1_1);
statement = context.createStatement(connection);
statement.execute("use default");
- context.close();
connection = context.createConnection(USER2_1);
statement = context.createStatement(connection);
statement.execute("use default");
- context.close();
connection = context.createConnection(USER3_1);
statement = context.createStatement(connection);
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/58adbe44/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestViewPrivileges.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestViewPrivileges.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestViewPrivileges.java
index c8a054f..8e3d4c9 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestViewPrivileges.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestViewPrivileges.java
@@ -31,9 +31,10 @@ import java.util.Map;
import junit.framework.Assert;
import org.apache.sentry.provider.file.PolicyFile;
-import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Assume;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import com.google.common.collect.Maps;
@@ -42,25 +43,29 @@ import com.google.common.io.Resources;
public class TestViewPrivileges extends AbstractTestWithHiveServer {
protected static final String SERVER_HOST = "localhost";
- private Context context;
- private Map<String, String> properties;
+ private static Context context;
+ private static Map<String, String> properties;
private PolicyFile policyFile;
private final String SINGLE_TYPE_DATA_FILE_NAME = "kv1.dat";
- @Before
- public void setUp() throws Exception {
+ @BeforeClass
+ public static void setUp() throws Exception {
properties = Maps.newHashMap();
- policyFile = PolicyFile.setAdminOnServer1(ADMINGROUP);
context = createContext(properties);
}
- @After
- public void tearDown() throws Exception {
+ @AfterClass
+ public static void tearDown() throws Exception {
if(context != null) {
context.close();
}
}
+
+ @Before
+ public void setupPolicyFile() throws Exception {
+ policyFile = PolicyFile.setAdminOnServer1(ADMINGROUP);
+ }
@Test
public void testPartitioned() throws Exception {