commit bf7b6048db5ecd249ee9b49b7d4967cdcd003f8f parent ba6eee4075d6f1a702059a6ff2b6021e171d2907 Author: Marcello Stanisci <stanisci.m@gmail.com> Date: Wed, 16 Oct 2019 15:21:25 +0200 resolving JAXB instantiation for non-XmlRootElement(s) Diffstat:
| M | sandbox/src/test/kotlin/IniLoadJaxbTest.kt | | | 23 | +++++++++++++++++++---- |
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/sandbox/src/test/kotlin/IniLoadJaxbTest.kt b/sandbox/src/test/kotlin/IniLoadJaxbTest.kt @@ -4,8 +4,13 @@ import kotlinx.coroutines.io.jvm.javaio.toByteReadChannel import org.junit.Assert import org.junit.Test import org.junit.Assert.* +import org.xml.sax.InputSource import tech.libeufin.messages.ebics.keyrequest.SignaturePubKeyOrderDataType import java.io.File +import java.io.InputStream +import java.io.StringReader +import javax.xml.bind.JAXBContext +import javax.xml.bind.JAXBElement import javax.xml.transform.Source import javax.xml.transform.stream.StreamSource @@ -16,11 +21,21 @@ class IniKeyMaterialTest { @Test fun importKey(){ val classLoader = ClassLoader.getSystemClassLoader() - val ini = classLoader.getResource("ebics_ini_inner_key.xml") - val obj = processor.convertStringToJaxb<SignaturePubKeyOrderDataType>( - "tech.libeufin.messages.ebics.keyrequest", - ini.readText() + val ini = classLoader.getResource( + "ebics_ini_inner_key.xml" ) + // manual unmarshalling now. + val jc = JAXBContext.newInstance( + "tech.libeufin.messages.ebics.keyrequest" + ) + + /* Marshalling the object into the document. */ + val u = jc.createUnmarshaller() + + val js = u.unmarshal( + StreamSource(((StringReader(ini.readText())))), + SignaturePubKeyOrderDataType::class.java) + } } \ No newline at end of file