本文整理汇总了Java中de.flapdoodle.embed.process.io.directories.FixedPath类的典型用法代码示例。如果您正苦于以下问题:Java FixedPath类的具体用法?Java FixedPath怎么用?Java FixedPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FixedPath类属于de.flapdoodle.embed.process.io.directories包,在下文中一共展示了FixedPath类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runtimeConfig
import de.flapdoodle.embed.process.io.directories.FixedPath; //导入依赖的package包/类
private IRuntimeConfig runtimeConfig()
{
FixedPath path = new FixedPath( "bin/" );
IStreamProcessor mongodOutput;
IStreamProcessor mongodError;
IStreamProcessor commandsOutput;
try
{
mongodOutput = Processors.named( "[mongod>]", new FileStreamProcessor( new File( logPath, "mongo.log" ) ) );
mongodError = new FileStreamProcessor( new File( logPath, "mongo-err.log" ) );
commandsOutput =
Processors.named( "[mongod>]", new FileStreamProcessor( new File( logPath, "mongo.log" ) ) );
}
catch ( FileNotFoundException e )
{
throw Throwables.propagate( e );
}
return new RuntimeConfigBuilder().defaults( Command.MongoD )
.processOutput( new ProcessOutput( mongodOutput, mongodError, commandsOutput ) )
.artifactStore( new ArtifactStoreBuilder().downloader( new Downloader() )
.executableNaming( new UserTempNaming() ).tempDir( path ).download(
new DownloadConfigBuilder().defaultsForCommand( Command.MongoD ).artifactStorePath( path ) ) )
.build();
}
示例2: defaults
import de.flapdoodle.embed.process.io.directories.FixedPath; //导入依赖的package包/类
public SafeExtractedArtifactStoreBuilder defaults(
final MysqldConfig mysqldConfig,
final DownloadConfig downloadConfig) {
String tempExtractDir = String.format("mysql-%s-%s", mysqldConfig.getVersion().getMajorVersion(), UUID.randomUUID());
String combinedPath = new File(mysqldConfig.getTempDir(), tempExtractDir).getPath();
IDirectory preExtractDir = new FixedPath(new File(downloadConfig.getCacheDir(), "extracted").getPath());
executableNaming().setDefault(new PathPrefixingNaming("bin/"));
download().setDefault(new DownloadConfigBuilder().defaults(downloadConfig).build());
downloader().setDefault(new Downloader());
extractDir().setDefault(preExtractDir);
extractExecutableNaming().setDefault(new NoopNaming());
tempDir().setDefault(new TargetGeneratedFixedPath(combinedPath));
return this;
}
示例3: start
import de.flapdoodle.embed.process.io.directories.FixedPath; //导入依赖的package包/类
public synchronized void start() throws IOException {
if (process != null) {
throw new IllegalStateException();
}
Command command = Command.Postgres;
IDownloadConfig downloadConfig = new PostgresDownloadConfigBuilder()
.defaultsForCommand(command)
.artifactStorePath(new FixedPath(artifactStorePath))
.build();
ArtifactStoreBuilder artifactStoreBuilder = new PostgresArtifactStoreBuilder()
.defaults(command)
.download(downloadConfig);
LogWatchStreamProcessor logWatch = new LogWatchStreamProcessor("started",
new HashSet<>(singletonList("failed")),
new Slf4jStreamProcessor(getLogger("postgres"), Slf4jLevel.TRACE));
IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder()
.defaults(command)
.processOutput(new ProcessOutput(logWatch, logWatch, logWatch))
.artifactStore(artifactStoreBuilder)
.build();
PostgresStarter<PostgresExecutable, PostgresProcess> starter = new PostgresStarter<>(PostgresExecutable.class, runtimeConfig);
PostgresConfig config = new PostgresConfig(version,
new AbstractPostgresConfig.Net(host, port == 0 ? Network.getFreeServerPort() : port),
new AbstractPostgresConfig.Storage(dbName),
new AbstractPostgresConfig.Timeout(),
new AbstractPostgresConfig.Credentials(username, password));
process = starter.prepare(config).start();
jdbcUrl = "jdbc:postgresql://" + config.net().host() + ":" + config.net().port() + "/" + config.storage().dbName();
}
示例4: defaults
import de.flapdoodle.embed.process.io.directories.FixedPath; //导入依赖的package包/类
public DownloadConfigBuilder defaults(
final DownloadConfig downloadConfig) {
fileNaming().setDefault(new UUIDTempNaming());
downloadPath().setDefault(new DownloadPath(downloadConfig.getBaseUrl()));
progressListener().setDefault(new ConsoleProgressListener());
artifactStorePath().setDefault(new FixedPath(downloadConfig.getCacheDir()));
downloadPrefix().setDefault(new DownloadPrefix("embedmysql-download"));
userAgent().setDefault(new UserAgent("Mozilla/5.0 (compatible; Embedded MySql; +https://github.com/wix/wix-embedded-mysql)"));
packageResolver().setDefault(new PackagePaths());
timeoutConfig().setDefault(new TimeoutConfigBuilder().connectionTimeout(10000).readTimeout(60000).build());
proxyFactory().setDefault(downloadConfig.getProxyFactory());
return this;
}
示例5: runtimeConfig
import de.flapdoodle.embed.process.io.directories.FixedPath; //导入依赖的package包/类
private static IRuntimeConfig runtimeConfig()
{
FixedPath path = new FixedPath( "bin/" );
return new RuntimeConfigBuilder().defaults( Command.MongoD )
.artifactStore( new ArtifactStoreBuilder().downloader( new Downloader() )
.executableNaming( new UserTempNaming() ).tempDir( path ).download(
new DownloadConfigBuilder().defaultsForCommand( Command.MongoD ).artifactStorePath( path ) ) )
.build();
}
示例6: initializePostgresql
import de.flapdoodle.embed.process.io.directories.FixedPath; //导入依赖的package包/类
String initializePostgresql() throws SQLException, IOException,
URISyntaxException {
String password = System.getProperty(NAVI_PASSWORD, "changeMe"); // TODO no default
final Command cmd = Command.Postgres;
// the cached directory should contain pgsql folder
final FixedPath cachedDir = new FixedPath(UAAS_POSTGRES);
ArtifactStoreBuilder download = new CachedArtifactStoreBuilder().defaults(cmd)
.tempDir(cachedDir)
.download(new DownloadConfigBuilder().defaultsForCommand(cmd)
.packageResolver(new PackagePaths(cmd,
cachedDir))
.build());
IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder().defaults(cmd)
.artifactStore(download)
.build();
PostgresStarter<PostgresExecutable, PostgresProcess> runtime = PostgresStarter.getInstance(runtimeConfig);
log.info("Starting Postgres");
final PostgresConfig config = new PostgresConfig(PRODUCTION,
new Net("localhost",
findFreePort()),
new Storage(NAVI,
UAAS_STATE),
new Timeout(),
new Credentials(NAVI,
password));
// pass info regarding encoding, locale, collate, ctype, instead of setting global environment settings
config.getAdditionalInitDbParams()
.addAll(Arrays.asList("-E", "UTF-8", "--locale=en_US.UTF-8",
"--lc-collate=en_US.UTF-8",
"--lc-ctype=en_US.UTF-8"));
PostgresExecutable exec = runtime.prepare(config);
PostgresProcess process = exec.start();
Runtime.getRuntime()
.addShutdownHook(new Thread(() -> process.stop(),
"Local NAVI shutdown"));
String uri = String.format("jdbc:postgresql://%s:%s/%s?user=%s&password=%s",
config.net()
.host(),
config.net()
.port(),
config.storage()
.dbName(),
config.credentials()
.username(),
config.credentials()
.password());
DbaConfiguration dbaConfig = new DbaConfiguration();
dbaConfig.coreDb = config.storage()
.dbName();
dbaConfig.corePort = config.net()
.port();
dbaConfig.coreServer = config.net()
.host();
dbaConfig.coreUsername = config.credentials()
.username();
dbaConfig.corePassword = config.credentials()
.password();
try {
new Loader(dbaConfig).bootstrap();
} catch (Exception e) {
throw new IllegalStateException("Cannot bootstrap CORE", e);
}
return uri;
}