当前位置: 首页>>代码示例>>Java>>正文


Java DomHelper.save方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:funktionio,项目名称:funktion-connectors,代码行数:10,代码来源:ConnectorGenerator.java

示例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);
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:5,代码来源:PomFileXml.java

示例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());
}
 
开发者ID:fabric8io,项目名称:ipaas-quickstarts,代码行数:80,代码来源:ArchetypeTest.java


注:本文中的io.fabric8.utils.DomHelper.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。