| /* |
| * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0, |
| * or the Eclipse Distribution License v. 1.0 which is available at |
| * http://www.eclipse.org/org/documents/edl-v10.php. |
| * |
| * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause |
| */ |
| |
| // Contributors: |
| // Oracle - initial API and implementation from Oracle TopLink |
| package org.eclipse.persistence.testing.oxm.inheritance.typetests; |
| |
| import java.util.HashMap; |
| import java.util.Iterator; |
| import java.util.Map; |
| import java.util.Map.Entry; |
| |
| import org.eclipse.persistence.internal.oxm.record.namespaces.MapNamespacePrefixMapper; |
| import org.eclipse.persistence.jaxb.MarshallerProperties; |
| import org.eclipse.persistence.oxm.NamespacePrefixMapper; |
| import org.eclipse.persistence.oxm.NamespaceResolver; |
| import org.eclipse.persistence.oxm.XMLRoot; |
| import org.eclipse.persistence.testing.oxm.mappings.XMLWithJSONMappingTestCases; |
| |
| public class XmlRootWithContactXsiTestCases extends XMLWithJSONMappingTestCases { |
| private static final String READ_DOC = "org/eclipse/persistence/testing/oxm/inheritance/typetests/xmlroot_contactxsi.xml"; |
| private static final String JSON_READ_DOC = "org/eclipse/persistence/testing/oxm/inheritance/typetests/xmlroot_contactxsi.json"; |
| |
| public XmlRootWithContactXsiTestCases(String name) throws Exception { |
| super(name); |
| setProject(new TypeProject()); |
| setControlDocument(READ_DOC); |
| setControlJSON(JSON_READ_DOC); |
| } |
| |
| @Override |
| protected Map<String, String> getNamespaces() { |
| Map<String, String> namespaces = new HashMap<String, String>(); |
| namespaces.put("http://www.example.com/toplink-oxm", "oxm"); |
| namespaces.put(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi"); |
| return namespaces; |
| } |
| |
| @Override |
| public Object getControlObject() { |
| ContactMethod cm = new ContactMethod(); |
| cm.setId("123"); |
| XMLRoot root = new XMLRoot(); |
| root.setObject(cm); |
| root.setLocalName("some-root"); |
| return root; |
| } |
| |
| public static void main(String[] args) { |
| String[] arguments = { "-c", "org.eclipse.persistence.testing.oxm.inheritance.typetests.XmlRootWithContactXsiTestCases" }; |
| junit.textui.TestRunner.main(arguments); |
| } |
| } |