本文整理汇总了Java中io.fabric8.utils.DomHelper.save方法的典型用法代码示例。如果您正苦于以下问题:Java DomHelper.save方法的具体用法?Java DomHelper.save怎么用?Java DomHelper.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.fabric8.utils.DomHelper
的用法示例。
在下文中一共展示了DomHelper.save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateDocument
import io.fabric8.utils.DomHelper; //导入方法依赖的package包/类
protected void updateDocument(File file, Document doc) throws FileNotFoundException, TransformerException {
LOG.info("Updating the pom " + file);
try {
DomHelper.save(doc, file);
} catch (Exception e) {
LOG.error("Failed to update pom " + file + ". " + e, e);
throw e;
}
}
示例2: updateDocument
import io.fabric8.utils.DomHelper; //导入方法依赖的package包/类
public PomFileXml updateDocument(Document document) throws FileNotFoundException, TransformerException {
DomHelper.save(document, file);
return new PomFileXml(file, document);
}
示例3: assertArchetypeCreated
import io.fabric8.utils.DomHelper; //导入方法依赖的package包/类
private void assertArchetypeCreated(String artifactId, String groupId, String version, File archetypejar) throws Exception {
artifactId = Strings.stripSuffix(artifactId, "-archetype");
artifactId = Strings.stripSuffix(artifactId, "-example");
File outDir = new File(projectsOutputFolder, artifactId);
LOG.info("Creating Archetype " + groupId + ":" + artifactId + ":" + version);
Map<String, String> properties = new ArchetypeHelper(archetypejar, outDir, groupId, artifactId, version, null, null).parseProperties();
LOG.info("Has preferred properties: " + properties);
ArchetypeHelper helper = new ArchetypeHelper(archetypejar, outDir, groupId, artifactId, version, null, null);
helper.setPackageName(packageName);
// lets override some properties
HashMap<String, String> overrideProperties = new HashMap<String, String>();
// for camel-archetype-component
overrideProperties.put("scheme", "mycomponent");
helper.setOverrideProperties(overrideProperties);
// this is where the magic happens
helper.execute();
LOG.info("Generated archetype " + artifactId);
// expected pom file
File pom = new File(outDir, "pom.xml");
// this archetype might not be a maven project
if (!pom.isFile()) {
return;
}
String pomText = Files.toString(pom);
String badText = "${camel-";
if (pomText.contains(badText)) {
if (verbose) {
LOG.info(pomText);
}
fail("" + pom + " contains " + badText);
}
// now lets ensure we have the necessary test dependencies...
boolean updated = false;
Document doc = XmlUtils.parseDoc(pom);
boolean funktion = isFunktionProject(doc);
LOG.debug("Funktion project: " + funktion);
if (!funktion) {
if (ensureMavenDependency(doc, "io.fabric8", "fabric8-arquillian", "test")) {
updated = true;
}
if (ensureMavenDependency(doc, "org.jboss.arquillian.junit", "arquillian-junit-container", "test")) {
updated = true;
}
if (ensureMavenDependency(doc, "org.jboss.shrinkwrap.resolver", "shrinkwrap-resolver-impl-maven", "test")) {
updated = true;
}
if (ensureMavenDependencyBOM(doc, "io.fabric8", "fabric8-project-bom-with-platform-deps", fabric8Version)) {
updated = true;
}
}
if (ensureFailsafePlugin(doc)) {
updated = true;
}
if (updated) {
DomHelper.save(doc, pom);
}
// lets generate the system test
if (!hasGoodSystemTest(new File(outDir, "src/test/java"))) {
File systemTest = new File(outDir, "src/test/java/io/fabric8/systests/KubernetesIntegrationKT.java");
systemTest.getParentFile().mkdirs();
String javaFileName = "KubernetesIntegrationKT.java";
URL javaUrl = getClass().getClassLoader().getResource(javaFileName);
assertNotNull("Could not load resource on the classpath: " + javaFileName, javaUrl);
IOHelpers.copy(javaUrl.openStream(), new FileOutputStream(systemTest));
}
outDirs.add(outDir.getPath());
}