本文整理汇总了Java中com.mysql.management.MysqldResourceI类的典型用法代码示例。如果您正苦于以下问题:Java MysqldResourceI类的具体用法?Java MysqldResourceI怎么用?Java MysqldResourceI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MysqldResourceI类属于com.mysql.management包,在下文中一共展示了MysqldResourceI类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: start
import com.mysql.management.MysqldResourceI; //导入依赖的package包/类
@Override
public String start() {
Map<String,String> args = new HashMap<>();
args.put(MysqldResourceI.PORT, Integer.toString(DB_PORT));
args.put(MysqldResourceI.INITIALIZE_USER, "true");
args.put(MysqldResourceI.INITIALIZE_USER_NAME, DB_USER);
args.put(MysqldResourceI.INITIALIZE_PASSWORD, DB_PASS);
engine = new MysqldResource(new File(DB_PATH));
engine.start("jdbdt-mysqld-thread", args);
if (!engine.isRunning()) {
throw new RuntimeException("MySQL did not start.");
}
return String.format
(
"jdbc:mysql://127.0.0.1:%d/jdbdt?user=%s&password=%s&createDatabaseIfNotExist=true",
DB_PORT,
DB_USER,
DB_PASS
);
}
开发者ID:edrdo,项目名称:jdbdt,代码行数:23,代码来源:MySQLDBSetup.java
示例2: setUp
import com.mysql.management.MysqldResourceI; //导入依赖的package包/类
public void setUp() {
File databaseDir = new File(new File(baseDatabaseDir), databaseName);
PrintStream nps = this.getNullAppender();
mysqldResource = new MysqldResource(databaseDir, null, null, nps, nps);
Map<String, String> database_options = new HashMap<String, String>();
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("embedded-mysqld-thread-" + System.currentTimeMillis(), database_options);
if (!mysqldResource.isRunning()) {
throw new RuntimeException("MySQL did not start.");
}
}
开发者ID:0xC70FF3,项目名称:java-gems,代码行数:19,代码来源:EmbeddedMySQLDb.java
示例3: EmbeddedMySQL
import com.mysql.management.MysqldResourceI; //导入依赖的package包/类
private EmbeddedMySQL() throws InterruptedException
{
port = AvailablePortFinder.getNextAvailable(internalCounter.getAndIncrement());
dataDir = Files.createTempDir();
mysqld = new MysqldResource(dataDir);
Map<String, String> props = ImmutableMap.of(MysqldResourceI.PORT, Integer.toString(port),
MysqldResourceI.INITIALIZE_USER, "true",
MysqldResourceI.INITIALIZE_USER_NAME, "user",
MysqldResourceI.INITIALIZE_PASSWORD, "pass",
"default-time-zone", "+00:00");
mysqld.start("mysql-daemon", props);
if (!mysqld.isRunning()) {
throw new IllegalStateException("MySQL failed to start");
}
while (!mysqld.isReadyForConnections()) { Thread.sleep(100); }
}
开发者ID:groupon,项目名称:mysql-junit4,代码行数:20,代码来源:EmbeddedMySQL.java
示例4: startDb
import com.mysql.management.MysqldResourceI; //导入依赖的package包/类
/**
* 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");
}
开发者ID:airbnb,项目名称:reair,代码行数:18,代码来源:EmbeddedMySqlDb.java
示例5: defaultArchitecture
import com.mysql.management.MysqldResourceI; //导入依赖的package包/类
public boolean defaultArchitecture() {
String guessArchStr = (String) params
.get(MysqldResourceI.USE_DEFAULT_ARCHITECTURE);
if (guessArchStr == null) {
return true;
}
return Boolean.valueOf(guessArchStr).booleanValue();
}
开发者ID:codeine-cd,项目名称:codeine,代码行数:9,代码来源:CommandLineOptionsParser.java
示例6: start
import com.mysql.management.MysqldResourceI; //导入依赖的package包/类
public void start(String databaseName) {
String tmpDir = System.getProperty("java.io.tmpdir");
File baseDir = new File(tmpDir, databaseName);
FileUtils.deleteQuietly(baseDir);
int port = getFreePort();
Map<String, String> databaseOptions = new HashMap<>();
databaseOptions.put(MysqldResourceI.PORT, Integer.toString(port));
mysqldResource = new MysqldResource(baseDir);
mysqldResource.start("mysql", databaseOptions);
url = "jdbc:mysql://localhost:" + port + "/" + databaseName + "?" + "createDatabaseIfNotExist=true";
}
开发者ID:aerogear,项目名称:aerogear-unifiedpush-server,代码行数:15,代码来源:EmbeddedMysqlDatabase.java
示例7: getBaseDir
import com.mysql.management.MysqldResourceI; //导入依赖的package包/类
public File getBaseDir() {
return newFile(MysqldResourceI.BASEDIR);
}
开发者ID:codeine-cd,项目名称:codeine,代码行数:4,代码来源:CommandLineOptionsParser.java
示例8: getDataDir
import com.mysql.management.MysqldResourceI; //导入依赖的package包/类
public File getDataDir() {
return newFile(MysqldResourceI.DATADIR);
}
开发者ID:codeine-cd,项目名称:codeine,代码行数:4,代码来源:CommandLineOptionsParser.java
示例9: getVersion
import com.mysql.management.MysqldResourceI; //导入依赖的package包/类
public String getVersion() {
return (String) params.get(MysqldResourceI.MYSQLD_VERSION);
}
开发者ID:codeine-cd,项目名称:codeine,代码行数:4,代码来源:CommandLineOptionsParser.java
示例10: ensureMysqlStarted
import com.mysql.management.MysqldResourceI; //导入依赖的package包/类
private void ensureMysqlStarted(int port, Properties props) {
Map serverOpts = new HashMap();
for (Enumeration enums = props.propertyNames(); enums.hasMoreElements();) {
String key = enums.nextElement().toString();
if (key.startsWith(SERVER_DOT)) {
String val = replaceNullStringWithNull(props.getProperty(key));
serverOpts.put(key.substring(SERVER_DOT.length()), val);
}
}
serverOpts.put(MysqldResourceI.PORT, Integer.toString(port));
Object baseDirStr = serverOpts.get(MysqldResourceI.BASEDIR);
File baseDir = new Files().newFile(baseDirStr);
String dataDirString = (String) serverOpts.get(MysqldResourceI.DATADIR);
File dataDir = null;
if (dataDirString != null) {
File ddir = new File(dataDirString);
dataDir = new Files().validCononicalDir(ddir);
}
boolean guessArch = true;
String guessArchStr = (String) serverOpts
.get(MysqldResourceI.USE_DEFAULT_ARCHITECTURE);
if (guessArchStr != null) {
guessArch = Boolean.valueOf(guessArchStr).booleanValue();
}
String mysqldVersion = (String) serverOpts
.get(MysqldResourceI.MYSQLD_VERSION);
MysqldResourceI mysqld = resourceFactory.newMysqldResource(baseDir,
dataDir, mysqldVersion, guessArch);
if (mysqld.isRunning()) {
int runningPort = mysqld.getPort();
if (port != runningPort) {
String location = mysqld.getBaseDir().getPath();
if (dataDir != null) {
location += " with data at " + dataDir;
}
String msg = "Mysqld at " + location + " is running on port "
+ runningPort + " not " + port;
throw new RuntimeException(msg);
}
return;
}
launchCount++;
String threadName = "driver_launched_mysqld_" + launchCount;
mysqld.start(threadName, serverOpts);
}
开发者ID:codeine-cd,项目名称:codeine,代码行数:53,代码来源:ServerLauncherSocketFactory.java
注:本文中的com.mysql.management.MysqldResourceI类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论