| /******************************************************************************* |
| * Copyright (c) 2011 Oracle. 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: |
| * Mike Norman - June 10 2011, created DDL parser package |
| * David McCann - July 2011, visit tests |
| ******************************************************************************/ |
| package org.eclipse.persistence.tools.oracleddl.test.ddlparser; |
| |
| //javase imports |
| import java.io.IOException; |
| import java.io.InputStream; |
| import java.io.StringReader; |
| |
| //JUnit4 imports |
| import org.junit.BeforeClass; |
| import org.junit.Test; |
| import static org.junit.Assert.assertTrue; |
| |
| //DDL imports |
| import org.eclipse.persistence.tools.oracleddl.metadata.PLSQLPackageType; |
| import org.eclipse.persistence.tools.oracleddl.parser.DDLParser; |
| import org.eclipse.persistence.tools.oracleddl.parser.ParseException; |
| import org.eclipse.persistence.tools.oracleddl.util.DatabaseTypesRepository; |
| |
| public class CaseSensitivePackageTestSuite { |
| |
| //JUnit fixture(s) |
| static DDLParser parser = null; |
| |
| @BeforeClass |
| static public void setUp() { |
| parser = new DDLParser(new InputStream() { |
| public int read() throws IOException { |
| return 0; |
| } |
| }); |
| parser.setTypesRepository(new DatabaseTypesRepository()); |
| } |
| static final String TEST_TYPES_PACKAGE = "CREATE OR REPLACE PACKAGE \"WSERV\".\"TEST_TYPES2\" AS" + |
| "\n\n\tfunction echo_number (pNumber in number) return number ;" + |
| "\nEND TEST_TYPES2;"; |
| @Test |
| public void testTypesPackage() { |
| parser.ReInit(new StringReader(TEST_TYPES_PACKAGE)); |
| boolean worked = true; |
| @SuppressWarnings("unused") PLSQLPackageType packageType = null; |
| try { |
| packageType = parser.parsePLSQLPackage(); |
| } |
| catch (ParseException pe) { |
| worked = false; |
| } |
| assertTrue("simple package should parse", worked); |
| } |
| } |