Search in sources :

Example 56 with Document

use of de.micromata.opengis.kml.v_2_2_0.Document in project gocd by gocd.

the class XmlUtils method buildXmlDocument.

private static Document buildXmlDocument(InputStream inputStream, SAXBuilder builder) throws JDOMException, IOException {
    XsdErrorTranslator errorHandler = new XsdErrorTranslator();
    builder.setErrorHandler(errorHandler);
    Document cruiseRoot = builder.build(inputStream);
    if (errorHandler.hasValidationError()) {
        throw new XsdValidationException(errorHandler.translate());
    }
    return cruiseRoot;
}
Also used : Document(org.jdom2.Document)

Example 57 with Document

use of de.micromata.opengis.kml.v_2_2_0.Document in project gocd by gocd.

the class FullConfigSaveMergeFlowTest method setup.

@Before
public void setup() throws Exception {
    configForEdit = mock(CruiseConfig.class);
    updateConfigCommand = new FullConfigUpdateCommand(configForEdit, "md5");
    loader = mock(MagicalGoConfigXmlLoader.class);
    writer = mock(MagicalGoConfigXmlWriter.class);
    document = mock(Document.class);
    systemEnvironment = mock(SystemEnvironment.class);
    fileWriter = mock(GoConfigFileWriter.class);
    serverVersion = mock(ServerVersion.class);
    timeProvider = mock(TimeProvider.class);
    configRepository = mock(ConfigRepository.class);
    cachedGoPartials = mock(CachedGoPartials.class);
    configElementImplementationRegistry = mock(ConfigElementImplementationRegistry.class);
    partials = new ArrayList<>();
    flow = new FullConfigSaveMergeFlow(loader, writer, configElementImplementationRegistry, serverVersion, timeProvider, configRepository, cachedGoPartials, fileWriter);
}
Also used : ServerVersion(com.thoughtworks.go.server.util.ServerVersion) TimeProvider(com.thoughtworks.go.util.TimeProvider) ConfigRepository(com.thoughtworks.go.service.ConfigRepository) Document(org.jdom2.Document) SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) FullConfigUpdateCommand(com.thoughtworks.go.config.update.FullConfigUpdateCommand) ConfigElementImplementationRegistry(com.thoughtworks.go.config.registry.ConfigElementImplementationRegistry) Before(org.junit.Before)

Example 58 with Document

use of de.micromata.opengis.kml.v_2_2_0.Document in project gocd by gocd.

the class FullConfigSaveNormalFlowTest method setup.

@Before
public void setup() throws Exception {
    configForEdit = new BasicCruiseConfig();
    updateConfigCommand = new FullConfigUpdateCommand(configForEdit, "md5");
    loader = mock(MagicalGoConfigXmlLoader.class);
    writer = mock(MagicalGoConfigXmlWriter.class);
    document = mock(Document.class);
    systemEnvironment = mock(SystemEnvironment.class);
    fileWriter = mock(GoConfigFileWriter.class);
    serverVersion = mock(ServerVersion.class);
    timeProvider = mock(TimeProvider.class);
    configRepository = mock(ConfigRepository.class);
    cachedGoPartials = mock(CachedGoPartials.class);
    configElementImplementationRegistry = mock(ConfigElementImplementationRegistry.class);
    partials = new ArrayList<>();
    flow = new FullConfigSaveNormalFlow(loader, writer, configElementImplementationRegistry, serverVersion, timeProvider, configRepository, cachedGoPartials, fileWriter);
}
Also used : ServerVersion(com.thoughtworks.go.server.util.ServerVersion) TimeProvider(com.thoughtworks.go.util.TimeProvider) ConfigRepository(com.thoughtworks.go.service.ConfigRepository) Document(org.jdom2.Document) SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) FullConfigUpdateCommand(com.thoughtworks.go.config.update.FullConfigUpdateCommand) ConfigElementImplementationRegistry(com.thoughtworks.go.config.registry.ConfigElementImplementationRegistry) Before(org.junit.Before)

Example 59 with Document

use of de.micromata.opengis.kml.v_2_2_0.Document in project gocd by gocd.

the class HgModificationSplitter method modifications.

public List<Modification> modifications() {
    try {
        SAXBuilder builder = new SAXBuilder();
        Document document = builder.build(new StringReader(output));
        return parseDOMTree(document);
    } catch (Exception e) {
        throw ExceptionUtils.bomb("Unable to parse hg log output: " + result.replaceSecretInfo(output), result.smudgedException(e));
    }
}
Also used : SAXBuilder(org.jdom2.input.SAXBuilder) StringReader(java.io.StringReader) Document(org.jdom2.Document) ParseException(java.text.ParseException)

Example 60 with Document

use of de.micromata.opengis.kml.v_2_2_0.Document in project gocd by gocd.

the class MagicalGoConfigXmlLoader method fromXmlPartial.

public <T> T fromXmlPartial(InputStream inputStream, Class<T> o) throws Exception {
    Document document = new SAXBuilder().build(inputStream);
    Element element = document.getRootElement();
    return classParser(element, o, configCache, new GoCipher(), registry, new ConfigReferenceElements()).parse();
}
Also used : SAXBuilder(org.jdom2.input.SAXBuilder) GoCipher(com.thoughtworks.go.security.GoCipher) Element(org.jdom2.Element) ConfigReferenceElements(com.thoughtworks.go.config.parser.ConfigReferenceElements) Document(org.jdom2.Document) XmlUtils.buildXmlDocument(com.thoughtworks.go.util.XmlUtils.buildXmlDocument)

Aggregations

Document (org.jdom2.Document)86 Element (org.jdom2.Element)57 File (java.io.File)29 Test (org.junit.Test)24 DocType (org.jdom2.DocType)23 SAXBuilder (org.jdom2.input.SAXBuilder)20 IOException (java.io.IOException)16 XMLOutputter (org.jdom2.output.XMLOutputter)14 ProcessingInstruction (org.jdom2.ProcessingInstruction)13 XmlFile (jmri.jmrit.XmlFile)11 Document (com.google.cloud.language.v1beta2.Document)10 ApiException (com.google.api.gax.grpc.ApiException)9 Document (com.google.cloud.language.v1.Document)9 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)9 StatusRuntimeException (io.grpc.StatusRuntimeException)9 EncodingType (com.google.cloud.language.v1beta2.EncodingType)8 FileOutputStream (java.io.FileOutputStream)7 EncodingType (com.google.cloud.language.v1.EncodingType)6 FileNotFoundException (java.io.FileNotFoundException)6 JDOMException (org.jdom2.JDOMException)6