XAdESUtils extends XSDAbstractUtils { @Override public JAXBContext getJAXBContext() throws JAXBException { if (jc == null) { jc = JAXBContext.newInstance(ObjectFactory.class, eu.europa.esig.xades.jaxb.xades132.ObjectFactory.class, eu.europa.esig.xades.jaxb.xades141.ObjectFactory.class); } return jc; } private  XAdESUtils(); static XAdESUtils getInstance(); @Override JAXBContext getJAXBContext(); @Override List<Source> getXSDSources(); static final String XADES_SCHEMA_LOCATION; static final String XADES_141_SCHEMA_LOCATION; }
@Test @SuppressWarnings("unchecked") public void test() throws JAXBException, SAXException { File xmldsigFile = new File("src/test/resources/xades-lta.xml"); JAXBContext jc = xadesUtils.getJAXBContext(); assertNotNull(jc); Schema schema = xadesUtils.getSchema(); assertNotNull(schema); Unmarshaller unmarshaller = jc.createUnmarshaller(); unmarshaller.setSchema(schema); JAXBElement<SignatureType> unmarshalled = (JAXBElement<SignatureType>) unmarshaller.unmarshal(xmldsigFile); assertNotNull(unmarshalled); Marshaller marshaller = jc.createMarshaller(); marshaller.setSchema(schema); StringWriter sw = new StringWriter(); marshaller.marshal(unmarshalled, sw); String xadesString = sw.toString(); JAXBElement<SignatureType> unmarshalled2 = (JAXBElement<SignatureType>) unmarshaller.unmarshal(new StringReader(xadesString)); assertNotNull(unmarshalled2); }
@Test public void getJAXBContext() throws JAXBException { assertNotNull(xadesUtils.getJAXBContext()); assertNotNull(xadesUtils.getJAXBContext()); }
@Test public void getJAXBContextETSI_EN_319_132() throws JAXBException { assertNotNull(xades319132Utils.getJAXBContext()); assertNotNull(xades319132Utils.getJAXBContext()); }
@Test public void getJAXBContextXAdES111() throws JAXBException { assertNotNull(xades111Utils.getJAXBContext()); assertNotNull(xades111Utils.getJAXBContext()); }
@Test public void getJAXBContextXAdES122() throws JAXBException { assertNotNull(xades122Utils.getJAXBContext()); assertNotNull(xades122Utils.getJAXBContext()); }