當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。