OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
com.mapd.tests.ConcurrencyTest Class Referenceabstract
+ Inheritance diagram for com.mapd.tests.ConcurrencyTest:
+ Collaboration diagram for com.mapd.tests.ConcurrencyTest:

Classes

class  MonitoringThread
 
class  SqlCommandThread
 

Public Member Functions

abstract List< SqlCommandThread[]> createTestThreads ()
 
abstract void runTests (final List< SqlCommandThread[]> tests) throws Exception
 
abstract void setUpTests () throws Exception
 
abstract void cleanUpTests (final List< SqlCommandThread[]> tests) throws Exception
 
void testConcurrency () throws Exception
 
HeavyDBTestClient getAdminClient (String db) throws Exception
 
void runAndLog (HeavyDBTestClient client, String sql) throws Exception
 

Static Public Member Functions

static boolean deleteDirectory (File dir)
 
static int[] getPorts ()
 
static int getNumThreads ()
 
static int getNumIterations ()
 
static boolean getEnableHeavyConnect ()
 
static boolean getEnableMonitorThread ()
 
static String getConfig ()
 
static CyclicBarrier createBarrier (int numThreadsToWait)
 
static void printErrors (ArrayList< String > exceptionTexts)
 
static int getRandomPort ()
 

Public Attributes

CyclicBarrier barrier
 
ArrayList< String > exceptionTexts = new ArrayList<String>()
 

Static Public Attributes

static final String db = "TestDB"
 
static final int defaultPort = 6274
 
static final boolean defaultEnableHeavyConnect = true
 
static int numThreads = defaultNumThreads
 
static boolean enableHeavyConnect = defaultEnableHeavyConnect
 
static Logger logger = null
 
static String testName = ""
 
static int[] ports = null
 

Static Package Attributes

static final String userName = "admin"
 
static final String password = "HyperInteractive"
 
static final String localhost = "localhost"
 
static final String defaultDb = "heavyai"
 
static final int defaultNumThreads = 5
 
static final int defaultNumIterations = 5
 
static final boolean defaultEnableMonitorThread = false
 
static int numIterations = defaultNumIterations
 
static boolean enableMonitorThread = defaultEnableMonitorThread
 
static Random rand = new Random()
 

Detailed Description

Definition at line 33 of file ConcurrencyTest.java.

Member Function Documentation

abstract void com.mapd.tests.ConcurrencyTest.cleanUpTests ( final List< SqlCommandThread[]>  tests) throws Exception
pure virtual

Implemented in com.mapd.tests.DdlConcurrencyTest.

Referenced by com.mapd.tests.ConcurrencyTest.testConcurrency().

+ Here is the caller graph for this function:

static CyclicBarrier com.mapd.tests.ConcurrencyTest.createBarrier ( int  numThreadsToWait)
inlinestatic

Definition at line 141 of file ConcurrencyTest.java.

References run.

Referenced by com.mapd.tests.DdlConcurrencyTest.runTests().

141  {
142  return new CyclicBarrier(numThreadsToWait, new Runnable() {
143  @Override
144  public void run() {
145  logger.info("Threads Synched");
146  }
147  });
148  }
static bool run

+ Here is the caller graph for this function:

abstract List<SqlCommandThread[]> com.mapd.tests.ConcurrencyTest.createTestThreads ( )
pure virtual

Implemented in com.mapd.tests.DdlConcurrencyTest.

Referenced by com.mapd.tests.ConcurrencyTest.testConcurrency().

+ Here is the caller graph for this function:

static boolean com.mapd.tests.ConcurrencyTest.deleteDirectory ( File  dir)
inlinestatic

Definition at line 56 of file ConcurrencyTest.java.

Referenced by com.mapd.tests.DdlConcurrencyTest.cleanUpTests().

56  {
57  File[] files = dir.listFiles();
58  if (files != null) {
59  for (File file : files) {
60  deleteDirectory(file);
61  }
62  }
63  return dir.delete();
64  }
static boolean deleteDirectory(File dir)

+ Here is the caller graph for this function:

HeavyDBTestClient com.mapd.tests.ConcurrencyTest.getAdminClient ( String  db) throws Exception
inline

Definition at line 187 of file ConcurrencyTest.java.

References com.mapd.tests.ConcurrencyTest.db, com.mapd.tests.ConcurrencyTest.localhost, com.mapd.tests.ConcurrencyTest.password, com.mapd.tests.ConcurrencyTest.ports, and com.mapd.tests.ConcurrencyTest.userName.

Referenced by com.mapd.tests.DdlConcurrencyTest.cleanUpTests(), and com.mapd.tests.DdlConcurrencyTest.setUpTests().

187  {
188  return HeavyDBTestClient.getClient(localhost, ports[0], db, userName, password);
189  }

+ Here is the caller graph for this function:

static String com.mapd.tests.ConcurrencyTest.getConfig ( )
inlinestatic

Definition at line 129 of file ConcurrencyTest.java.

References com.mapd.tests.ConcurrencyTest.enableHeavyConnect, com.mapd.tests.ConcurrencyTest.enableMonitorThread, com.mapd.tests.ConcurrencyTest.numIterations, com.mapd.tests.ConcurrencyTest.numThreads, com.mapd.tests.ConcurrencyTest.ports, and com.mapd.tests.ConcurrencyTest.testName.

Referenced by com.mapd.tests.DdlConcurrencyTest.configure().

129  {
130  String log = "Config for " + testName + ":\n{\n ports = {\n";
131  for (int port : ports) {
132  log += " " + port + "\n";
133  }
134  log += " }\n num_threads = " + numThreads + "\n num_iterations = " + numIterations
135  + "\n enable_heavy_connect = " + enableHeavyConnect
136  + "\n enable_monitor_thread = " + enableMonitorThread + "\n}";
137  return log;
138  }

+ Here is the caller graph for this function:

static boolean com.mapd.tests.ConcurrencyTest.getEnableHeavyConnect ( )
inlinestatic

Definition at line 108 of file ConcurrencyTest.java.

References com.mapd.tests.ConcurrencyTest.defaultEnableHeavyConnect.

Referenced by com.mapd.tests.DdlConcurrencyTest.configure().

108  {
109  String propertyString = System.getProperty("ENABLE_HEAVY_CONNECT");
110  if (propertyString == null) {
112  } else {
113  return Boolean.parseBoolean(propertyString);
114  }
115  }
static final boolean defaultEnableHeavyConnect

+ Here is the caller graph for this function:

static boolean com.mapd.tests.ConcurrencyTest.getEnableMonitorThread ( )
inlinestatic

Definition at line 119 of file ConcurrencyTest.java.

References com.mapd.tests.ConcurrencyTest.defaultEnableMonitorThread.

Referenced by com.mapd.tests.DdlConcurrencyTest.configure().

119  {
120  String propertyString = System.getProperty("ENABLE_MONITOR_THREAD");
121  if (propertyString == null) {
123  } else {
124  return Boolean.parseBoolean(propertyString);
125  }
126  }
static final boolean defaultEnableMonitorThread

+ Here is the caller graph for this function:

static int com.mapd.tests.ConcurrencyTest.getNumIterations ( )
inlinestatic

Definition at line 98 of file ConcurrencyTest.java.

References com.mapd.tests.ConcurrencyTest.defaultNumIterations.

Referenced by com.mapd.tests.DdlConcurrencyTest.configure().

98  {
99  String propertyString = System.getProperty("NUM_ITERATIONS");
100  if (propertyString == null) {
101  return defaultNumIterations;
102  } else {
103  return Integer.parseInt(propertyString);
104  }
105  }

+ Here is the caller graph for this function:

static int com.mapd.tests.ConcurrencyTest.getNumThreads ( )
inlinestatic

Definition at line 88 of file ConcurrencyTest.java.

References com.mapd.tests.ConcurrencyTest.defaultNumThreads.

Referenced by com.mapd.tests.DdlConcurrencyTest.configure().

88  {
89  String propertyString = System.getProperty("NUM_THREADS");
90  if (propertyString == null) {
91  return defaultNumThreads;
92  } else {
93  return Integer.parseInt(propertyString);
94  }
95  }

+ Here is the caller graph for this function:

static int [] com.mapd.tests.ConcurrencyTest.getPorts ( )
inlinestatic

Definition at line 69 of file ConcurrencyTest.java.

References com.mapd.tests.ConcurrencyTest.defaultPort.

Referenced by com.mapd.tests.DdlConcurrencyTest.configure().

69  {
70  String portString = System.getProperty("PORT_LIST");
71  int[] retPorts;
72  if (portString != null) {
73  List<String> portList = Arrays.asList(portString.split(","));
74  if (portList.size() > 0) {
75  retPorts = new int[portList.size()];
76  for (int i = 0; i < portList.size(); ++i) {
77  retPorts[i] = Integer.parseInt(portList.get(i));
78  }
79  return retPorts;
80  }
81  }
82  retPorts = new int[1];
83  retPorts[0] = defaultPort;
84  return retPorts;
85  }

+ Here is the caller graph for this function:

static int com.mapd.tests.ConcurrencyTest.getRandomPort ( )
inlinestatic

Definition at line 161 of file ConcurrencyTest.java.

References com.mapd.tests.ConcurrencyTest.ports.

Referenced by com.mapd.tests.ConcurrencyTest.SqlCommandThread.SqlCommandThread().

161  {
162  return ports[rand.nextInt(ports.length)];
163  }

+ Here is the caller graph for this function:

static void com.mapd.tests.ConcurrencyTest.printErrors ( ArrayList< String >  exceptionTexts)
inlinestatic

Definition at line 151 of file ConcurrencyTest.java.

Referenced by com.mapd.tests.DdlConcurrencyTest.runTests().

151  {
152  if (exceptionTexts.size() > 0) {
153  String errors = "\n";
154  for (String s : exceptionTexts) {
155  errors += s + "\n";
156  }
157  logger.error("Found exceptions:" + errors);
158  }
159  }
ArrayList< String > exceptionTexts

+ Here is the caller graph for this function:

void com.mapd.tests.ConcurrencyTest.runAndLog ( HeavyDBTestClient  client,
String  sql 
) throws Exception
inline

Definition at line 191 of file ConcurrencyTest.java.

Referenced by com.mapd.tests.DdlConcurrencyTest.cleanUpTests(), and com.mapd.tests.DdlConcurrencyTest.setUpTests().

191  {
192  client.runSql(sql);
193  logger.info(" " + sql);
194  }

+ Here is the caller graph for this function:

abstract void com.mapd.tests.ConcurrencyTest.runTests ( final List< SqlCommandThread[]>  tests) throws Exception
pure virtual

Implemented in com.mapd.tests.DdlConcurrencyTest.

Referenced by com.mapd.tests.ConcurrencyTest.testConcurrency().

+ Here is the caller graph for this function:

abstract void com.mapd.tests.ConcurrencyTest.setUpTests ( ) throws Exception
pure virtual

Implemented in com.mapd.tests.DdlConcurrencyTest.

Referenced by com.mapd.tests.ConcurrencyTest.testConcurrency().

+ Here is the caller graph for this function:

void com.mapd.tests.ConcurrencyTest.testConcurrency ( ) throws Exception
inline

Definition at line 172 of file ConcurrencyTest.java.

References com.mapd.tests.ConcurrencyTest.cleanUpTests(), com.mapd.tests.ConcurrencyTest.createTestThreads(), com.mapd.tests.ConcurrencyTest.logger, com.mapd.tests.ConcurrencyTest.runTests(), com.mapd.tests.ConcurrencyTest.setUpTests(), and com.mapd.tests.ConcurrencyTest.testName.

172  {
173  if (testName.equals("")) {
174  throw new RuntimeException("Derived test has not set a test name");
175  }
176  if (logger == null) {
177  throw new RuntimeException("Derived test has not initialized logger");
178  }
179  logger.info(testName + "()");
180  final List<SqlCommandThread[]> tests = createTestThreads();
181  setUpTests();
182  runTests(tests);
183  cleanUpTests(tests);
184  logger.info(testName + "() done");
185  }
abstract List< SqlCommandThread[]> createTestThreads()
abstract void runTests(final List< SqlCommandThread[]> tests)
abstract void cleanUpTests(final List< SqlCommandThread[]> tests)

+ Here is the call graph for this function:

Member Data Documentation

CyclicBarrier com.mapd.tests.ConcurrencyTest.barrier

Definition at line 53 of file ConcurrencyTest.java.

Referenced by com.mapd.tests.DdlConcurrencyTest.runTests().

final String com.mapd.tests.ConcurrencyTest.defaultDb = "heavyai"
staticpackage
final boolean com.mapd.tests.ConcurrencyTest.defaultEnableHeavyConnect = true
static
final boolean com.mapd.tests.ConcurrencyTest.defaultEnableMonitorThread = false
staticpackage
final int com.mapd.tests.ConcurrencyTest.defaultNumIterations = 5
staticpackage
final int com.mapd.tests.ConcurrencyTest.defaultNumThreads = 5
staticpackage

Definition at line 37 of file ConcurrencyTest.java.

Referenced by com.mapd.tests.ConcurrencyTest.getNumThreads().

final int com.mapd.tests.ConcurrencyTest.defaultPort = 6274
static

Definition at line 37 of file ConcurrencyTest.java.

Referenced by com.mapd.tests.ConcurrencyTest.getPorts().

boolean com.mapd.tests.ConcurrencyTest.enableMonitorThread = defaultEnableMonitorThread
staticpackage
ArrayList<String> com.mapd.tests.ConcurrencyTest.exceptionTexts = new ArrayList<String>()

Definition at line 54 of file ConcurrencyTest.java.

Referenced by com.mapd.tests.DdlConcurrencyTest.runTests().

final String com.mapd.tests.ConcurrencyTest.localhost = "localhost"
staticpackage
Logger com.mapd.tests.ConcurrencyTest.logger = null
static
final String com.mapd.tests.ConcurrencyTest.password = "HyperInteractive"
staticpackage
Random com.mapd.tests.ConcurrencyTest.rand = new Random()
staticpackage

Definition at line 46 of file ConcurrencyTest.java.

String com.mapd.tests.ConcurrencyTest.testName = ""
static

The documentation for this class was generated from the following file: