/** * Starts mysqld passing it the parameters specified in the arguments map. * No effect if MySQL is already running */ public synchronized void start(String threadName, Map mysqldArgs) { start(threadName, mysqldArgs, false); }
/** * Starts mysqld passing it the parameters specified in the arguments map. * No effect if MySQL is already running */ @Override public synchronized void start(String threadName, Map mysqldArgs) { start(threadName, mysqldArgs, false); }
private void startMysql(String threadName) { Map map = new HashMap(); map.put(MysqldResourceI.PORT, "" + testUtil.testPort()); mysqldResource.start(threadName, map); }
/** * Start the database. */ public void startDb() { Map<String, String> databaseOptions = new HashMap<>(); databaseOptions.put(MysqldResourceI.PORT, Integer.toString(port)); mysqldResource = new MysqldResource(new File(databaseDir, databaseName)); mysqldResource.start("embedded-mysqld-db-thread-" + System.currentTimeMillis(), databaseOptions); if (!mysqldResource.isRunning()) { throw new RuntimeException("Failed to start embedded MySQL DB!"); } LOG.debug("MySQL started successfully"); }
/** * Start the database. */ public void startDb() { Map<String, String> databaseOptions = new HashMap<>(); databaseOptions.put(MysqldResourceI.PORT, Integer.toString(port)); mysqldResource = new MysqldResource(new File(databaseDir, databaseName)); mysqldResource.start("embedded-mysqld-db-thread-" + System.currentTimeMillis(), databaseOptions); if (!mysqldResource.isRunning()) { throw new RuntimeException("Failed to start embedded MySQL DB!"); } LOG.debug("MySQL started successfully"); }
public static MysqldResource startDatabase(File databaseDir, int port, String userName, String password) { MysqldResource mysqldResource = new MysqldResource(databaseDir); Map database_options = new HashMap(); database_options.put(MysqldResourceI.PORT, Integer.toString(port)); database_options.put(MysqldResourceI.INITIALIZE_USER, "true"); database_options.put(MysqldResourceI.INITIALIZE_USER_NAME, userName); database_options.put(MysqldResourceI.INITIALIZE_PASSWORD, password); mysqldResource.start("test-mysqld-thread", database_options); if (!mysqldResource.isRunning()) { throw new RuntimeException("MySQL did not start."); } System.out.println("MySQL is running."); return mysqldResource; } }
private void startMysql(String threadName) { Map map = new HashMap(); map.put(MysqldResourceI.PORT, "" + testUtil.testPort()); mysqldResource.start(threadName, map); assertTrue(mysqldResource.isRunning()); }
dbOpts.put("default-time-zone", "+00:00"); mysqldResource.start("test-mysqld-thread", dbOpts); if (!mysqldResource.isRunning()) { throw new IllegalStateException("MySQL did not start.");
dbOpts.put("default-time-zone", "+00:00"); mysqldResource.start("test-mysqld-thread", dbOpts); if (!mysqldResource.isRunning()) { throw new IllegalStateException("MySQL did not start.");
mysqldResource.start("test-mysqld-thread", options);
database_options.put(MysqldResourceI.INITIALIZE_PASSWORD, password); mysqldResource.start("embedded-mysqld-thread-" + System.currentTimeMillis(), database_options);
public void testLaunch() throws Exception { Map args = new HashMap(); String port = "" + testUtil.testPort(); args.put(MysqldResourceI.PORT, port); String url = "jdbc:mysql://localhost:" + port + "/test"; String threadName = "testLaunch"; assertFalse("mysqld should not be running", mysqldResource.isRunning()); mysqldResource.start(threadName, args); Shell s1 = mysqldResource.getShell(); /* this asserts the thread starts */ assertRunning(); /* pause for mysqld to bind to port */ for (int i = 0; i < 100 && !mysqldResource.isReadyForConnections(); i++) { threads.pause(25); } testUtil.assertConnectViaJDBC(url, true); mysqldResource.start(threadName, args); Shell s2 = mysqldResource.getShell(); assertEquals(s1, s2); assertTrue(s1.isDaemon()); assertRunningThenShutdown(); }
public void testLaunch() throws Exception { Map args = new HashMap(); String port = "" + testUtil.testPort(); args.put(MysqldResourceI.PORT, port); String url = "jdbc:mysql://localhost:" + port + "/test"; String threadName = "testLaunch"; assertFalse("mysqld should not be running", mysqldResource.isRunning()); mysqldResource.start(threadName, args); Shell s1 = mysqldResource.getShell(); /* this asserts the thread starts */ assertRunning(); /* pause for mysqld to bind to port */ for (int i = 0; i < 100 && !mysqldResource.isReadyForConnections(); i++) { utils.threads().pause(25); } testUtil.assertConnectViaJDBC(url, true); mysqldResource.start(threadName, args); Shell s2 = mysqldResource.getShell(); assertEquals(s1, s2); assertTrue(s1.isDaemon()); assertRunningThenShutdown(); }
public static void main(String[] args) { CommandLineOptionsParser clop = new CommandLineOptionsParser(args); MysqldResource mysqld = new MysqldResource(clop.getBaseDir()); if (args.length == 0) { mysqld.printUsage(); } else if (clop.isShutdown()) { mysqld.shutdown(); } else { mysqld.start(new Threads().newName(), clop.asMap()); } } }
public void testUseDatabase() throws Exception { String url = "jdbc:mysql://localhost:" + testUtil.testPort() + "/test"; String threadName = "testLaunch"; assertFalse("mysqld should not be running", mysqldResource.isRunning()); startMysql(threadName); Shell s1 = mysqldResource.getShell(); /* this asserts the thread starts */ assertRunning(); /* pause for mysqld to bind to port */ for (int i = 0; i < 100 && !mysqldResource.isReadyForConnections(); i++) { utils.threads().pause(25); } testUtil.assertConnectViaJDBC(url); if (!mysqldResource.isWindows()) { File sockFile = new File(mysqldResource.getDataDir(), "mysql.sock"); assertTrue(sockFile.exists()); } mysqldResource.start(threadName, new HashMap()); Shell s2 = mysqldResource.getShell(); assertEquals(s1, s2); assertTrue(s1.isDaemon()); assertRunningThenShutdown(); }
public void testUseDatabase() throws Exception { String url = "jdbc:mysql://localhost:" + testUtil.testPort() + "/test"; String threadName = "testLaunch"; assertFalse("mysqld should not be running", mysqldResource.isRunning()); startMysql(threadName); Shell s1 = mysqldResource.getShell(); /* this asserts the thread starts */ assertRunning(); /* pause for mysqld to bind to port */ for (int i = 0; i < 100 && !mysqldResource.isReadyForConnections(); i++) { threads.pause(25); } testUtil.assertConnectViaJDBC(url); mysqldResource.start(threadName, new HashMap()); Shell s2 = mysqldResource.getShell(); assertEquals(s1, s2); assertTrue(s1.isDaemon()); assertRunningThenShutdown(); }
mysqld.start(new Threads().newName(), clop.asMap());