/******************************************************************************* * Copyright (c) 2011, 2015 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 v1.0 and Eclipse Distribution License v. 1.0 * which accompanies this distribution. * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * Contributors: * Denise Smith - September 2013 ******************************************************************************/ package org.eclipse.persistence.testing.jaxb.xmlelement.self; import java.io.IOException; import java.io.InputStream; import javax.xml.transform.Result; import javax.xml.transform.stream.StreamResult; import org.eclipse.persistence.jaxb.json.JsonSchemaOutputResolver; import org.eclipse.persistence.testing.jaxb.JAXBTestCases; import org.eclipse.persistence.testing.jaxb.JAXBWithJSONTestCases; import org.w3c.dom.Document; import org.w3c.dom.Element; public class XmlElementSelfTestCases extends JAXBWithJSONTestCases{ private final static String XML_RESOURCE = "org/eclipse/persistence/testing/jaxb/xmlelement/selfNode.xml"; private final static String JSON_RESOURCE = "org/eclipse/persistence/testing/jaxb/xmlelement/selfNode.json"; private final static String JSON_SCHEMA_RESOURCE = "org/eclipse/persistence/testing/jaxb/xmlelement/selfNodeSchema.json"; public XmlElementSelfTestCases(String name) throws Exception { super(name); setControlDocument(XML_RESOURCE); setControlJSON(JSON_RESOURCE); Class[] classes = new Class[2]; classes[0] = Root.class; classes[1] = Thing.class; setClasses(classes); } @Override protected Object getControlObject() { Root r = new Root(); Thing thing = new Thing(); Document doc = parser.newDocument(); Element elem = doc.createElement("content"); thing.content = elem; r.child = thing; return r; } public void testJSONSchemaGen() throws Exception{ InputStream controlSchema = classLoader.getResourceAsStream(JSON_SCHEMA_RESOURCE); super.generateJSONSchema(controlSchema); } }