Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
maven-mongodb-plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
We are moving to Forgejo!
You are on a read-only GitLab instance.
Show more breadcrumbs
Jeffrey Phillips Freeman
maven-mongodb-plugin
Commits
ec0bc30c
Commit
ec0bc30c
authored
12 years ago
by
Joe Littlejohn
Browse files
Options
Downloads
Patches
Plain Diff
Update to flapdoodle api 1.31 (some associated refactoring required)
parent
ceacd151
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pom.xml
+1
-1
1 addition, 1 deletion
pom.xml
src/main/java/com/github/joelittlejohn/embedmongo/StartEmbeddedMongoMojo.java
+34
-20
34 additions, 20 deletions
...thub/joelittlejohn/embedmongo/StartEmbeddedMongoMojo.java
with
35 additions
and
21 deletions
pom.xml
+
1
−
1
View file @
ec0bc30c
...
...
@@ -105,7 +105,7 @@
<dependency>
<groupId>
de.flapdoodle.embed
</groupId>
<artifactId>
de.flapdoodle.embed.mongo
</artifactId>
<version>
1.
27
</version>
<version>
1.
31
</version>
</dependency>
</dependencies>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/github/joelittlejohn/embedmongo/StartEmbeddedMongoMojo.java
+
34
−
20
View file @
ec0bc30c
...
...
@@ -37,12 +37,17 @@ import org.apache.maven.plugin.MojoFailureException;
import
com.github.joelittlejohn.embedmongo.log.Loggers
;
import
com.github.joelittlejohn.embedmongo.log.Loggers.LoggingStyle
;
import
de.flapdoodle.embed.mongo.Command
;
import
de.flapdoodle.embed.mongo.MongodExecutable
;
import
de.flapdoodle.embed.mongo.MongodProcess
;
import
de.flapdoodle.embed.mongo.MongodStarter
;
import
de.flapdoodle.embed.mongo.config.AbstractMongoConfig.Net
;
import
de.flapdoodle.embed.mongo.config.AbstractMongoConfig.Storage
;
import
de.flapdoodle.embed.mongo.config.AbstractMongoConfig.Timeout
;
import
de.flapdoodle.embed.mongo.config.MongodConfig
;
import
de.flapdoodle.embed.mongo.config.RuntimeConfig
;
import
de.flapdoodle.embed.mongo.config.RuntimeConfig
Builder
;
import
de.flapdoodle.embed.mongo.distribution.Version
;
import
de.flapdoodle.embed.process.config.IRuntimeConfig
;
import
de.flapdoodle.embed.process.config.io.ProcessOutput
;
import
de.flapdoodle.embed.process.distribution.GenericVersion
;
import
de.flapdoodle.embed.process.distribution.IVersion
;
...
...
@@ -86,9 +91,10 @@ public class StartEmbeddedMongoMojo extends AbstractMojo {
* @since 0.1.0
*/
private
File
databaseDirectory
;
/**
* An IP address for the MongoDB instance to be bound to during its execution.
* An IP address for the MongoDB instance to be bound to during its
* execution.
*
* @parameter expression="${embedmongo.bindIp}"
* @since 0.1.4
...
...
@@ -126,15 +132,15 @@ public class StartEmbeddedMongoMojo extends AbstractMojo {
* @since 0.1.3
*/
private
String
logging
;
/**
* The proxy user to be used when downloading MongoDB
*
* @parameter expression="${embedmongo.proxyUser}"
* @parameter expression="${embedmongo.proxyUser}"
* @since 0.1.6
*/
private
String
proxyUser
;
/**
* The proxy password to be used when downloading MondoDB
*
...
...
@@ -146,17 +152,25 @@ public class StartEmbeddedMongoMojo extends AbstractMojo {
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
execute
()
throws
MojoExecutionException
,
MojoFailureException
{
if
(
this
.
proxyHost
!=
null
&&
this
.
proxyHost
.
length
()
>
0
)
{
this
.
addProxySelector
();
}
MongodExecutable
executable
;
try
{
RuntimeConfig
config
=
new
RuntimeConfig
();
config
.
setProcessOutput
(
getOutputConfig
());
executable
=
MongodStarter
.
getInstance
(
config
).
prepare
(
new
MongodConfig
(
getVersion
(),
bindIp
,
port
,
Network
.
localhostIsIPv6
(),
getDataDirectory
(),
null
,
0
));
IRuntimeConfig
runtimeConfig
=
new
RuntimeConfigBuilder
()
.
defaults
(
Command
.
MongoD
)
.
processOutput
(
getOutputConfig
())
.
build
();
MongodConfig
mongoConfig
=
new
MongodConfig
(
getVersion
(),
new
Net
(
bindIp
,
port
,
Network
.
localhostIsIPv6
()),
new
Storage
(
getDataDirectory
(),
null
,
0
),
new
Timeout
());
executable
=
MongodStarter
.
getInstance
(
runtimeConfig
).
prepare
(
mongoConfig
);
}
catch
(
UnknownHostException
e
)
{
throw
new
MojoExecutionException
(
"Unable to determine if localhost is ipv6"
,
e
);
}
catch
(
DistributionException
e
)
{
...
...
@@ -200,16 +214,16 @@ public class StartEmbeddedMongoMojo extends AbstractMojo {
}
private
void
addProxySelector
()
{
// Add authenticator with proxyUser and proxyPassword
if
(
proxyUser
!=
null
&&
proxyPassword
!=
null
)
{
// Add authenticator with proxyUser and proxyPassword
if
(
proxyUser
!=
null
&&
proxyPassword
!=
null
)
{
Authenticator
.
setDefault
(
new
Authenticator
()
{
public
PasswordAuthentication
getPasswordAuthentication
()
{
return
new
PasswordAuthentication
(
proxyUser
,
proxyPassword
.
toCharArray
());
}
});
public
PasswordAuthentication
getPasswordAuthentication
()
{
return
new
PasswordAuthentication
(
proxyUser
,
proxyPassword
.
toCharArray
());
}
});
}
final
ProxySelector
defaultProxySelector
=
ProxySelector
.
getDefault
();
ProxySelector
.
setDefault
(
new
ProxySelector
()
{
@Override
...
...
@@ -227,10 +241,10 @@ public class StartEmbeddedMongoMojo extends AbstractMojo {
});
}
private
IVersion
getVersion
()
throws
MojoExecutionException
{
private
IVersion
getVersion
()
{
String
versionEnumName
=
this
.
version
.
toUpperCase
().
replaceAll
(
"\\."
,
"_"
);
if
(
this
.
version
.
charAt
(
0
)
!=
'V'
)
{
if
(
version
EnumName
.
charAt
(
0
)
!=
'V'
)
{
versionEnumName
=
"V"
+
versionEnumName
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment