use of org.codehaus.plexus.util.xml.Xpp3Dom in project meecrowave by apache.
the class MeecrowaveBundleMojoTest method bundle.
@Test
public void bundle() throws Exception {
final File moduleBase = jarLocation(MeecrowaveBundleMojoTest.class).getParentFile().getParentFile();
final File basedir = new File(moduleBase, "src/test/resources/" + getClass().getSimpleName());
final File pom = new File(basedir, "pom.xml");
final MavenExecutionRequest request = new DefaultMavenExecutionRequest();
request.setBaseDirectory(basedir);
final ProjectBuildingRequest configuration = request.getProjectBuildingRequest();
final DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory().newInstance(repositorySession, new LocalRepository(new File(moduleBase, "target/fake"), "")));
configuration.setRepositorySession(repositorySession);
final MavenProject project = mojo.lookup(ProjectBuilder.class).build(pom, configuration).getProject();
final Build build = new Build();
final File buildDir = new File("target/" + getClass().getName() + "/build");
build.setDirectory(buildDir.getAbsolutePath());
project.setBuild(build);
final MavenSession session = mojo.newMavenSession(project);
final MojoExecution execution = mojo.newMojoExecution("bundle");
execution.getConfiguration().addChild(new Xpp3Dom("enforceMeecrowave") {
{
setValue(Boolean.FALSE.toString());
}
});
execution.getConfiguration().addChild(new Xpp3Dom("enforceCommonsCli") {
{
setValue(Boolean.FALSE.toString());
}
});
execution.getConfiguration().addChild(new Xpp3Dom("conf") {
{
setValue("src/main/meecrowave/conf");
}
});
execution.getConfiguration().addChild(new Xpp3Dom("webapp") {
{
setValue("src/main/webapp");
}
});
mojo.executeMojo(session, project, execution);
assertTrue(buildDir.exists());
try (final ZipFile zip = new ZipFile(new File(buildDir, "test-meecrowave-distribution.zip"))) {
assertTrue(zip.getEntry("test-distribution/docBase/sub/index.html") != null);
}
}
use of org.codehaus.plexus.util.xml.Xpp3Dom in project docker-maven-plugin by fabric8io.
the class AuthConfigFactory method extractFromServerConfiguration.
private String extractFromServerConfiguration(Object configuration, String prop) {
if (configuration != null) {
Xpp3Dom dom = (Xpp3Dom) configuration;
Xpp3Dom element = dom.getChild(prop);
if (element != null) {
return element.getValue();
}
}
return null;
}
use of org.codehaus.plexus.util.xml.Xpp3Dom in project docker-maven-plugin by fabric8io.
the class MojoExecutionService method toXpp3Dom.
private Xpp3Dom toXpp3Dom(PlexusConfiguration config) {
Xpp3Dom result = new Xpp3Dom(config.getName());
result.setValue(config.getValue(null));
for (String name : config.getAttributeNames()) {
result.setAttribute(name, config.getAttribute(name));
}
for (PlexusConfiguration child : config.getChildren()) {
result.addChild(toXpp3Dom(child));
}
return result;
}
use of org.codehaus.plexus.util.xml.Xpp3Dom in project docker-maven-plugin by fabric8io.
the class AuthConfigFactoryTest method setupServers.
private void setupServers() {
new Expectations() {
{
List<Server> servers = new ArrayList<>();
servers.add(create(ECR_NAME, "roland", "secret", "roland@jolokia.org"));
servers.add(create("test.org", "fabric8io", "secret2", "fabric8io@redhat.com"));
servers.add(create("test.org/roland", "roland", "secret", "roland@jolokia.org"));
servers.add(create("docker.io", "tanja", "doublesecret", "tanja@jolokia.org"));
servers.add(create("another.repo.org/joe", "joe", "3secret", "joe@foobar.com"));
settings.getServers();
result = servers;
}
private Server create(String id, String user, String password, String email) {
Server server = new Server();
server.setId(id);
server.setUsername(user);
server.setPassword(password);
Xpp3Dom dom = new Xpp3Dom("configuration");
Xpp3Dom emailD = new Xpp3Dom("email");
emailD.setValue(email);
dom.addChild(emailD);
server.setConfiguration(dom);
return server;
}
};
}
use of org.codehaus.plexus.util.xml.Xpp3Dom in project kie-wb-common by kiegroup.
the class MavenProjectConfigExecutor method extractConfig.
private void extractConfig(final Map<String, Object> content, final Xpp3Dom xmlData) {
if (xmlData.getChildCount() > 0) {
final Map<String, Object> config = new HashMap<>(xmlData.getChildCount());
for (final Xpp3Dom child : xmlData.getChildren()) {
extractConfig(config, child);
}
content.put(xmlData.getName(), config);
} else {
content.put(xmlData.getName(), xmlData.getValue());
}
}
Aggregations