summaryrefslogtreecommitdiffstats
path: root/java/sdo-cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDBaseTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/sdo-cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDBaseTestCase.java')
-rw-r--r--java/sdo-cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDBaseTestCase.java126
1 files changed, 0 insertions, 126 deletions
diff --git a/java/sdo-cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDBaseTestCase.java b/java/sdo-cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDBaseTestCase.java
deleted file mode 100644
index c903fe6e63..0000000000
--- a/java/sdo-cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDBaseTestCase.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package test.sdo21.tests.xsd;
-
-import junit.framework.TestCase;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Iterator;
-import java.net.URL;
-
-import commonj.sdo.helper.DataFactory;
-import commonj.sdo.helper.XSDHelper;
-import commonj.sdo.helper.TypeHelper;
-import commonj.sdo.Type;
-import commonj.sdo.Property;
-import test.sdo21.CTSSuite;
-import test.sdo21.framework.CTSTestCase;
-import test.sdo21.framework.TestHelper;
-
-import org.junit.After;
-import org.junit.Before;
-import static org.junit.Assert.*;
-
-/**
- * Base class for all XSD tests.
- */
-public class XSDBaseTestCase extends CTSTestCase {
-
- protected TestHelper testHelper;
- protected XSDHelper xsdHelper;
- protected TypeHelper typeHelper;
- protected DataFactory dataFactory;
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- testHelper = getTestHelper();
- xsdHelper = getScope().getXSDHelper();
- typeHelper = getScope().getTypeHelper();
- dataFactory = getScope().getDataFactory();
- }
-
- @After
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
- /**
- * Parse an XSD file.
- */
- protected List define(String filename) throws IOException {
-
- URL url = getClass().getResource(filename);
- if (url == null) {
- throw new RuntimeException("Could not locate " + filename);
- }
- InputStream inputStream = url.openStream();
- XSDHelper xsdHelper = getScope().getXSDHelper();
- List typeList = xsdHelper.define(inputStream, url.toString());
- inputStream.close();
- return typeList;
- }
-
- protected void assertBaseTypeExists(Type type, String baseTypeName) {
- boolean found = false;
- Iterator iter = type.getBaseTypes().iterator();
- while (!found && iter.hasNext()) {
- String s = (String) iter.next();
- if (s.equals(baseTypeName)) {
- found = true;
- }
- }
- if (!found) {
- fail("Type '" + type.getName() + "' should have base type '" + baseTypeName + "'");
- }
- }
-
- protected void assertPropertyExists(Type type, String propertyName, String propertyType, boolean isContainment, boolean isMany) {
- Property p = type.getProperty(propertyName);
- assertNotNull("property '" + propertyName + "'", p);
- assertEquals("propertyType", propertyType, p.getType().getName());
- assertEquals("isContainment", isContainment, p.isContainment());
- assertEquals("isMany", isMany, p.isMany());
- }
-
- protected void assertPropertyExists(Type type, String propertyName, String propertyType, boolean isContainment, boolean isMany, boolean isNullable) {
- Property p = type.getProperty(propertyName);
- assertNotNull("property '" + propertyName + "'", p);
- assertEquals("propertyType", propertyType, p.getType().getName());
- assertEquals("isContainment", isContainment, p.isContainment());
- assertEquals("isMany", isMany, p.isMany());
- assertEquals("isNullable", isNullable, p.isNullable());
- }
-
- public Type getType(List types, String name) {
- Iterator it = types.iterator();
- while (it.hasNext()) {
- Type t = (Type) it.next();
- if (t.getName().equals(name)) {
- return t;
- }
- }
- return null;
- }
-
-}