Search in sources :

Example 81 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_008_001_01.Document in project sscs-evidence-share by hmcts.

the class SendLetterServiceConsumerTest method buildLetter.

private LetterV3 buildLetter() throws IOException, URISyntaxException {
    Path pdfPath = Paths.get(ClassLoader.getSystemResource("files/myPdf.pdf").toURI());
    byte[] pdf = Files.readAllBytes(pdfPath);
    String response = Base64.getEncoder().encodeToString(pdf);
    Map<String, Object> additionalData = new HashMap<>();
    additionalData.put(ADDITIONAL_DATA_CASE_REFERENCE, "123421323");
    return new LetterV3(XEROX_TYPE_PARAMETER, Arrays.asList(new Document(response, 2)), additionalData);
}
Also used : Path(java.nio.file.Path) LetterV3(uk.gov.hmcts.reform.sendletter.api.model.v3.LetterV3) HashMap(java.util.HashMap) Document(uk.gov.hmcts.reform.sendletter.api.model.v3.Document)

Example 82 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_008_001_01.Document in project maven-release by apache.

the class JDomBuildTest method testGetPlugins.

@Test
public void testGetPlugins() throws Exception {
    String content = "<build></build>";
    Document document = builder.build(new StringReader(content));
    assertNotNull(new JDomBuild(document.getRootElement()).getPlugins());
    assertEquals(0, new JDomBuild(document.getRootElement()).getPlugins().size());
    content = "<build><plugins/></build>";
    document = builder.build(new StringReader(content));
    assertEquals(0, new JDomBuild(document.getRootElement()).getPlugins().size());
    content = "<build><plugins><plugin/></plugins></build>";
    document = builder.build(new StringReader(content));
    assertEquals(1, new JDomBuild(document.getRootElement()).getPlugins().size());
}
Also used : StringReader(java.io.StringReader) Document(org.jdom2.Document) Test(org.junit.Test)

Example 83 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_008_001_01.Document in project maven-release by apache.

the class JDomDependencyManagementTest method testGetDependencies.

@Test
public void testGetDependencies() throws Exception {
    String content = "<dependencyManamgement></dependencyManamgement>";
    Document document = builder.build(new StringReader(content));
    assertNotNull(new JDomDependencyManagement(document.getRootElement()).getDependencies());
    assertEquals(0, new JDomDependencyManagement(document.getRootElement()).getDependencies().size());
    content = "<dependencyManamgement><dependencies/></dependencyManamgement>";
    document = builder.build(new StringReader(content));
    assertEquals(0, new JDomDependencyManagement(document.getRootElement()).getDependencies().size());
    content = "<dependencyManamgement><dependencies><dependency/></dependencies></dependencyManamgement>";
    document = builder.build(new StringReader(content));
    assertEquals(1, new JDomDependencyManagement(document.getRootElement()).getDependencies().size());
}
Also used : StringReader(java.io.StringReader) Document(org.jdom2.Document) Test(org.junit.Test)

Example 84 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_008_001_01.Document in project maven-release by apache.

the class JDomModelTest method testSetScm.

@Test
public void testSetScm() throws Exception {
    String content = "<project></project>";
    Document document = builder.build(new StringReader(content));
    Model model = new JDomModel(document);
    assertNull(model.getScm());
    model.setScm(new Scm());
    assertNotNull(model.getScm());
    model.setScm(null);
    assertNull(model.getScm());
}
Also used : StringReader(java.io.StringReader) Model(org.apache.maven.model.Model) Document(org.jdom2.Document) Scm(org.apache.maven.model.Scm) Test(org.junit.Test)

Example 85 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_008_001_01.Document in project maven-release by apache.

the class JDomModelTest method testGetScm.

@Test
public void testGetScm() throws Exception {
    String content = "<project></project>";
    Document document = builder.build(new StringReader(content));
    assertNull(new JDomModel(document).getScm());
}
Also used : StringReader(java.io.StringReader) Document(org.jdom2.Document) Test(org.junit.Test)

Aggregations

Document (org.jdom2.Document)1034 Element (org.jdom2.Element)587 Test (org.junit.Test)340 SAXBuilder (org.jdom2.input.SAXBuilder)271 IOException (java.io.IOException)266 XMLOutputter (org.jdom2.output.XMLOutputter)182 JDOMException (org.jdom2.JDOMException)162 File (java.io.File)148 ArrayList (java.util.ArrayList)75 InputStream (java.io.InputStream)74 StringReader (java.io.StringReader)63 Path (java.nio.file.Path)59 HashMap (java.util.HashMap)57 DocumentHelper.getDocument (com.mulesoft.tools.migration.helper.DocumentHelper.getDocument)53 DocumentHelper.getElementsFromDocument (com.mulesoft.tools.migration.helper.DocumentHelper.getElementsFromDocument)53 MCRJDOMContent (org.mycore.common.content.MCRJDOMContent)48 PID (edu.unc.lib.boxc.model.api.ids.PID)47 Attribute (org.jdom2.Attribute)44 List (java.util.List)42 Namespace (org.jdom2.Namespace)39