You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2014/03/06 03:25:54 UTC
svn commit: r1574752 - in /db/derby/code/trunk/java:
engine/org/apache/derby/catalog/Java5SystemProcedures.java
testing/org/apache/derbyTesting/functionTests/tests/lang/Test_6496.java
testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Author: rhillegas
Date: Thu Mar 6 02:25:54 2014
New Revision: 1574752
URL: http://svn.apache.org/r1574752
Log:
DERBY-6496: Fix NPE while loading optional tools; tests passed cleanly on derby-6496-01-ab-useClassFactoryContext.diff.
Added:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/Test_6496.java (with props)
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/catalog/Java5SystemProcedures.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/Java5SystemProcedures.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/Java5SystemProcedures.java?rev=1574752&r1=1574751&r2=1574752&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/Java5SystemProcedures.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/Java5SystemProcedures.java Thu Mar 6 02:25:54 2014
@@ -23,7 +23,6 @@ package org.apache.derby.catalog;
import java.sql.SQLException;
-import org.apache.derby.iapi.sql.compile.CompilerContext;
import org.apache.derby.iapi.sql.conn.ConnectionUtil;
import org.apache.derby.iapi.sql.dictionary.OptionalTool;
import org.apache.derby.iapi.error.PublicAPI;
@@ -31,6 +30,7 @@ import org.apache.derby.iapi.error.Stand
import org.apache.derby.iapi.reference.SQLState;
import org.apache.derby.iapi.services.context.ContextService;
import org.apache.derby.iapi.services.loader.ClassFactory;
+import org.apache.derby.iapi.services.loader.ClassFactoryContext;
import org.apache.derby.shared.common.sanity.SanityManager;
/**
@@ -94,8 +94,8 @@ public class Java5SystemProcedures
throws SQLException
{
try {
- CompilerContext cc = (CompilerContext) ContextService.getContext( CompilerContext.CONTEXT_ID );
- ClassFactory classFactory = cc.getClassFactory();
+ ClassFactoryContext cfc = (ClassFactoryContext) ContextService.getContext( ClassFactoryContext.CONTEXT_ID );
+ ClassFactory classFactory = cfc.getClassFactory();
String toolClassName = findToolClassName( toolName, optionalArgs );
OptionalTool tool = null;
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/Test_6496.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/Test_6496.java?rev=1574752&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/Test_6496.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/Test_6496.java Thu Mar 6 02:25:54 2014
@@ -0,0 +1,140 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.lang.Test_6496
+
+ 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 org.apache.derbyTesting.functionTests.tests.lang;
+
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.DriverManager;
+import java.util.ArrayList;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.DatabasePropertyTestSetup;
+import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.SecurityManagerSetup;
+import org.apache.derbyTesting.junit.TestConfiguration;
+import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
+import org.apache.derbyTesting.junit.JDBC;
+
+/**
+ * <p>
+ * Test the loading of optional tools when the CompilerContext is not available
+ * at execution time. See DERBY-6496.
+ * </p>
+ */
+public class Test_6496 extends GeneratedColumnsHelper
+{
+ ///////////////////////////////////////////////////////////////////////////////////
+ //
+ // CONSTANTS
+ //
+ ///////////////////////////////////////////////////////////////////////////////////
+
+ private static final String TEST_DBO = "TEST_DBO";
+
+ private static final String LOAD_TOOL = "call syscs_util.syscs_register_tool( 'databaseMetaData', true )";
+ private static final String UNLOAD_TOOL = "call syscs_util.syscs_register_tool( 'databaseMetaData', false )";
+
+ ///////////////////////////////////////////////////////////////////////////////////
+ //
+ // STATE
+ //
+ ///////////////////////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////////////////////
+ //
+ // CONSTRUCTOR
+ //
+ ///////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create a new instance.
+ */
+
+ public Test_6496(String name)
+ {
+ super(name);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////
+ //
+ // JUnit BEHAVIOR
+ //
+ ///////////////////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * Construct top level suite in this JUnit test
+ */
+ public static Test suite()
+ {
+ TestSuite suite = (TestSuite) TestConfiguration.embeddedSuite(Test_6496.class);
+
+ return suite;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////
+ //
+ // TESTS
+ //
+ ///////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * <p>
+ * Test baseline permissions where no grants are made.
+ * </p>
+ */
+ public void test_001()
+ throws Exception
+ {
+ Connection dboConnection = openUserConnection( TEST_DBO );
+
+ goodStatement( dboConnection, LOAD_TOOL );
+ goodStatement( dboConnection, UNLOAD_TOOL );
+ }
+
+ /**
+ * <p>
+ * Test that a user can grant access to her indexes.
+ * </p>
+ */
+ public void test_002()
+ throws Exception
+ {
+ Connection dboConnection = openUserConnection( TEST_DBO );
+
+ goodStatement( dboConnection, LOAD_TOOL );
+ goodStatement( dboConnection, UNLOAD_TOOL );
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////
+ //
+ // MINIONS
+ //
+ ///////////////////////////////////////////////////////////////////////////////////
+
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/Test_6496.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=1574752&r1=1574751&r2=1574752&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java Thu Mar 6 02:25:54 2014
@@ -243,6 +243,7 @@ public class _Suite extends BaseTestCase
suite.addTest(NewOptimizerOverridesTest.suite());
suite.addTest(XMLOptimizerTraceTest.suite());
suite.addTest(MergeStatementTest.suite());
+ suite.addTest(Test_6496.suite());
suite.addTest(ConstraintCharacteristicsTest.suite());
suite.addTest(DB2IsolationLevelsTest.suite());
suite.addTest(Derby5866TriggerOrderTest.suite());