use of com.sun.xml.txw2.output.DomSerializer in project metro-jax-ws by eclipse-ee4j.
the class PolicyModelMarshallerTest method testMarshal_Collection_Object.
/**
* Test of marshal method, of class PolicyModelMarshaller.
*/
public void testMarshal_Collection_Object() throws PolicyException {
Collection<PolicySourceModel> models = new LinkedList<PolicySourceModel>();
PolicySourceModel model = PolicySourceModel.createPolicySourceModel(NamespaceVersion.v1_2);
PolicySourceModel model2 = PolicySourceModel.createPolicySourceModel(NamespaceVersion.v1_5);
models.add(model);
models.add(model2);
Document document = builder.newDocument();
TypedXmlWriter storage = TXW.create(new QName("policies"), TypedXmlWriter.class, new DomSerializer(document));
PolicyModelMarshaller instance = PolicyModelMarshaller.getXmlMarshaller(false);
instance.marshal(models, storage);
storage.commit();
Element element = document.getDocumentElement();
Node policyElement = element.getFirstChild();
assertEquals(policyElement.getLocalName(), "Policy");
}
use of com.sun.xml.txw2.output.DomSerializer in project metro-jax-ws by eclipse-ee4j.
the class PolicyModelMarshallerTest method testMarshal_PolicySourceModel_Object.
/**
* Test of marshal method, of class PolicyModelMarshaller.
*/
public void testMarshal_PolicySourceModel_Object() throws PolicyException {
PolicySourceModel model = PolicySourceModel.createPolicySourceModel(NamespaceVersion.v1_2);
Document document = builder.newDocument();
TypedXmlWriter storage = TXW.create(new QName("root"), TypedXmlWriter.class, new DomSerializer(document));
PolicyModelMarshaller instance = PolicyModelMarshaller.getXmlMarshaller(false);
instance.marshal(model, storage);
storage.commit();
Element element = document.getDocumentElement();
Node policyElement = element.getFirstChild();
assertEquals(policyElement.getLocalName(), "Policy");
}
use of com.sun.xml.txw2.output.DomSerializer in project metro-jax-ws by eclipse-ee4j.
the class PolicyModelMarshallerTest method testMarshalPrefixWrite.
public void testMarshalPrefixWrite() throws PolicyException {
PolicySourceModel model = PolicySourceModel.createPolicySourceModel(NamespaceVersion.v1_5, "id", null);
ModelNode root = model.getRootNode();
ModelNode all = root.createChildAllNode();
AssertionData assertion = AssertionData.createAssertionData(new QName("http://schemas.foo.com/", "Assertion"));
all.createChildAssertionNode(assertion);
Document document = builder.newDocument();
TypedXmlWriter storage = TXW.create(new QName("root"), TypedXmlWriter.class, new DomSerializer(document));
PolicyModelMarshaller instance = PolicyModelMarshaller.getXmlMarshaller(false);
instance.marshal(model, storage);
storage.commit();
Element element = document.getDocumentElement();
Node policyElement = element.getFirstChild();
assertEquals(NamespaceVersion.v1_5.getDefaultNamespacePrefix(), policyElement.getPrefix());
NamedNodeMap map = policyElement.getAttributes();
Node id = map.getNamedItemNS(PolicyConstants.WSU_ID.getNamespaceURI(), PolicyConstants.WSU_ID.getLocalPart());
assertEquals(PolicyConstants.WSU_NAMESPACE_PREFIX, id.getPrefix());
}
Aggregations