| /* |
| * 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.sdo.helper.xsdhelper.define; |
| |
| import java.util.ArrayList; |
| import java.util.List; |
| import javax.xml.transform.stream.StreamSource; |
| import junit.textui.TestRunner; |
| import org.eclipse.persistence.sdo.SDOType; |
| import org.eclipse.persistence.sdo.helper.DefaultSchemaResolver; |
| import org.eclipse.persistence.sdo.helper.SDOXSDHelper; |
| import org.eclipse.persistence.exceptions.SDOException; |
| |
| public class CyclicElementRefErrorTestCases extends XSDHelperDefineTestCases { |
| String uri = "my.uri"; |
| String uri2 = "my.uri2"; |
| |
| public CyclicElementRefErrorTestCases(String name) { |
| super(name); |
| } |
| |
| public static void main(String[] args) { |
| TestRunner.run(CyclicElementRefErrorTestCases.class); |
| } |
| |
| @Override |
| public String getSchemaToDefine() { |
| return FILE_PROTOCOL + USER_DIR + "/org/eclipse/persistence/testing/sdo/helper/xsdhelper/generate/Cyclic1ElementRefError.xsd"; |
| } |
| |
| @Override |
| protected String getSchemaLocation() { |
| return FILE_PROTOCOL + USER_DIR + "/org/eclipse/persistence/testing/sdo/helper/xsdhelper/generate/"; |
| } |
| |
| @Override |
| public void testDefine() { |
| |
| DefaultSchemaResolver schemaResolver = new DefaultSchemaResolver(); |
| |
| schemaResolver.setBaseSchemaLocation(getSchemaLocation()); |
| |
| try{ |
| ((SDOXSDHelper)xsdHelper).define(new StreamSource(getSchemaToDefine()), schemaResolver); |
| }catch(SDOException e){ |
| assertEquals(SDOException.REFERENCED_PROPERTY_NOT_FOUND, e.getErrorCode()); |
| return; |
| } |
| fail("An exception should have occurred but didn't"); |
| |
| } |
| |
| @Override |
| public List<SDOType> getControlTypes() { |
| return new ArrayList<SDOType>(); |
| } |
| } |