本文整理汇总了Java中de.flapdoodle.embed.process.io.Processors类的典型用法代码示例。如果您正苦于以下问题:Java Processors类的具体用法?Java Processors怎么用?Java Processors使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Processors类属于de.flapdoodle.embed.process.io包,在下文中一共展示了Processors类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: runtimeConfig
import de.flapdoodle.embed.process.io.Processors; //导入依赖的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();
}
开发者ID:cherimojava,项目名称:orchidae,代码行数:26,代码来源:cfgMongo.java
示例2: run
import de.flapdoodle.embed.process.io.Processors; //导入依赖的package包/类
void run(Process p, IRuntimeConfig runtimeConfig, long timeoutNanos) throws IOException {
CollectingAndForwardingStreamProcessor wrapped =
new CollectingAndForwardingStreamProcessor(runtimeConfig.getProcessOutput().getOutput());
IStreamProcessor loggingWatch = StreamToLineProcessor.wrap(wrapped);
try {
ReaderProcessor processorOne = Processors.connect(new InputStreamReader(p.getInputStream()), loggingWatch);
ReaderProcessor processorTwo = Processors.connect(new InputStreamReader(p.getErrorStream()), loggingWatch);
int retCode = tope.waitFor(p, timeoutNanos);
if (retCode != 0) {
processorOne.join(10000);
processorTwo.join(10000);
resolveException(retCode, wrapped.getOutput());
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
开发者ID:wix,项目名称:wix-embedded-mysql,代码行数:22,代码来源:ProcessRunner.java
示例3: onAfterProcessStart
import de.flapdoodle.embed.process.io.Processors; //导入依赖的package包/类
@Override
public void onAfterProcessStart(final ProcessControl process, final IRuntimeConfig runtimeConfig) throws IOException {
outputWatch = new NotifyingStreamProcessor(StreamToLineProcessor.wrap(runtimeConfig.getProcessOutput().getOutput()));
Processors.connect(process.getReader(), outputWatch);
Processors.connect(process.getError(), outputWatch);
ResultMatchingListener startupListener = outputWatch.addListener(new ResultMatchingListener("ready for connections"));
try {
startupListener.waitForResult(getConfig().getTimeout(MILLISECONDS));
if (!startupListener.isInitWithSuccess()) {
throw new RuntimeException("mysql start failed with error: " + startupListener.getFailureFound());
}
} catch (Exception e) {
// emit IO exception for {@link AbstractProcess} would try to stop running process gracefully
throw new IOException(e);
}
}
开发者ID:wix,项目名称:wix-embedded-mysql,代码行数:19,代码来源:MysqldProcess.java
示例4: embeddedMongoRuntimeConfig
import de.flapdoodle.embed.process.io.Processors; //导入依赖的package包/类
@Bean
public IRuntimeConfig embeddedMongoRuntimeConfig() {
Logger logger = LoggerFactory
.getLogger(getClass().getPackage().getName() + ".EmbeddedMongo");
ProcessOutput processOutput = new ProcessOutput(
Processors.logTo(logger, Slf4jLevel.INFO),
Processors.logTo(logger, Slf4jLevel.ERROR), Processors.named(
"[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG)));
return new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger)
.processOutput(processOutput).artifactStore(getArtifactStore(logger))
.build();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:EmbeddedMongoAutoConfiguration.java
示例5: embeddedMongoRuntimeConfig
import de.flapdoodle.embed.process.io.Processors; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
@ConditionalOnClass(Logger.class)
public IRuntimeConfig embeddedMongoRuntimeConfig() {
Logger logger = LoggerFactory
.getLogger(getClass().getPackage().getName() + ".EmbeddedMongo");
ProcessOutput processOutput = new ProcessOutput(
Processors.logTo(logger, Slf4jLevel.INFO),
Processors.logTo(logger, Slf4jLevel.ERROR), Processors.named("[console>]",
Processors.logTo(logger, Slf4jLevel.DEBUG)));
return new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger)
.processOutput(processOutput).artifactStore(getArtifactStore(logger))
.build();
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:15,代码来源:EmbeddedMongoAutoConfiguration.java
示例6: initialize
import de.flapdoodle.embed.process.io.Processors; //导入依赖的package包/类
private void initialize() {
if (db != null) {
return;
}
System.setProperty("mongodb.database", dbName);
System.setProperty("mongodb.host", mongoHostname);
System.setProperty("mongodb.port", String.valueOf(mongoPort));
try {
IStreamProcessor mongodOutput = Processors.named("[mongod>]",
new FileStreamProcessor(File.createTempFile("mongod", "log")));
IStreamProcessor mongodError = new FileStreamProcessor(File.createTempFile("mongod-error", "log"));
IStreamProcessor commandsOutput = Processors.namedConsole("[console>]");
IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder()
.defaults(Command.MongoD)
.processOutput(new ProcessOutput(mongodOutput, mongodError, commandsOutput))
.build();
MongodStarter runtime = MongodStarter.getInstance(runtimeConfig);
mongodExe = runtime.prepare(
new MongodConfigBuilder()
.version(de.flapdoodle.embed.mongo.distribution.Version.V2_6_8)
.net(new Net(mongoPort, Network.localhostIsIPv6()))
.build()
);
try {
mongod = mongodExe.start();
} catch (Throwable t) {
// try again, could be killed breakpoint in IDE
mongod = mongodExe.start();
}
if (MONGO_CREDENTIALS.isEmpty()) {
client = new MongoClient(mongoHostname + ":" + mongoPort);
} else {
client = new MongoClient(new ServerAddress(mongoHostname + ":" + mongoPort), MONGO_CREDENTIALS);
client.getDB("admin").command("{ user: \"siteUserAdmin\", pwd: \"password\", roles: [ { role: \"userAdminAnyDatabase\", db: \"admin\" } , { role: \"userAdminAnyDatabase\", db: \"" + dbName + "\" } ] }");
}
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
super.start();
if (mongodExe != null) {
mongodExe.stop();
}
db = null;
client = null;
mongod = null;
mongodExe = null;
}
});
db = client.getDB(dbName);
} catch (IOException e) {
throw new Error(e);
}
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:62,代码来源:EmbeddedMongo.java
注:本文中的de.flapdoodle.embed.process.io.Processors类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论