/** {@inheritDoc} */ @Test public void testSingleElementUnmarshall() { OriginatorKeyInfo keyInfo = (OriginatorKeyInfo) unmarshallElement(singleElementFile); Assert.assertNotNull(keyInfo, "OriginatorKeyInfo"); Assert.assertNull(keyInfo.getID(), "Id attribute"); Assert.assertEquals(keyInfo.getXMLObjects().size(), 0, "Total # of XMLObject child elements"); }
/** {@inheritDoc} */ @Test public void testSingleElementOptionalAttributesMarshall() { OriginatorKeyInfo keyInfo = (OriginatorKeyInfo) buildXMLObject(OriginatorKeyInfo.DEFAULT_ELEMENT_NAME); keyInfo.setID(expectedID); assertXMLEquals(expectedOptionalAttributesDOM, keyInfo); }
/** {@inheritDoc} */ @Test public void testChildElementsUnmarshall() { OriginatorKeyInfo keyInfo = (OriginatorKeyInfo) unmarshallElement(childElementsFile); Assert.assertNotNull(keyInfo, "OriginatorKeyInfo"); Assert.assertEquals(keyInfo.getXMLObjects().size(), 11, "Total # of XMLObject child elements"); Assert.assertEquals(keyInfo.getKeyNames().size(), 2, "# of KeyName child elements"); Assert.assertEquals(keyInfo.getKeyValues().size(), 2, "# of KeyValue child elements"); Assert.assertEquals( keyInfo.getRetrievalMethods().size(), 1, "# of RetrievalMethod child elements"); Assert.assertEquals(keyInfo.getX509Datas().size(), 2, "# of X509Data child elements"); Assert.assertEquals(keyInfo.getPGPDatas().size(), 1, "# of PGPData child elements"); Assert.assertEquals(keyInfo.getSPKIDatas().size(), 1, "# of SPKIData child elements"); Assert.assertEquals(keyInfo.getMgmtDatas().size(), 1, "# of MgmtData child elements"); Assert.assertEquals( keyInfo.getXMLObjects(SimpleXMLObject.ELEMENT_NAME).size(), 1, "# of SimpleElement child elements"); }
/** {@inheritDoc} */ @Test public void testChildElementsMarshall() { OriginatorKeyInfo keyInfo = (OriginatorKeyInfo) buildXMLObject(OriginatorKeyInfo.DEFAULT_ELEMENT_NAME); keyInfo.getXMLObjects().add(buildXMLObject(KeyName.DEFAULT_ELEMENT_NAME)); keyInfo.getXMLObjects().add(buildXMLObject(KeyValue.DEFAULT_ELEMENT_NAME)); keyInfo.getXMLObjects().add(buildXMLObject(X509Data.DEFAULT_ELEMENT_NAME)); keyInfo.getXMLObjects().add(buildXMLObject(KeyName.DEFAULT_ELEMENT_NAME)); keyInfo.getXMLObjects().add(buildXMLObject(KeyValue.DEFAULT_ELEMENT_NAME)); keyInfo.getXMLObjects().add(buildXMLObject(X509Data.DEFAULT_ELEMENT_NAME)); keyInfo.getXMLObjects().add(buildXMLObject(RetrievalMethod.DEFAULT_ELEMENT_NAME)); keyInfo.getXMLObjects().add(buildXMLObject(PGPData.DEFAULT_ELEMENT_NAME)); keyInfo.getXMLObjects().add(buildXMLObject(SPKIData.DEFAULT_ELEMENT_NAME)); keyInfo.getXMLObjects().add(buildXMLObject(MgmtData.DEFAULT_ELEMENT_NAME)); keyInfo.getXMLObjects().add(buildXMLObject(SimpleXMLObject.ELEMENT_NAME)); assertXMLEquals(expectedChildElementsDOM, keyInfo); }