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 fu...@apache.org on 2007/02/16 00:03:46 UTC
svn commit: r508231 - in /db/derby/code/trunk/java:
drda/org/apache/derby/impl/drda/
testing/org/apache/derbyTesting/functionTests/master/DerbyNet/
testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/
testing/org/apache/derbyTesting/fun...
Author: fuzzylogic
Date: Thu Feb 15 15:03:45 2007
New Revision: 508231
URL: http://svn.apache.org/viewvc?view=rev&rev=508231
Log:
DERBY-2305: Convert tests in derbynet that will run via HarnessJavaTest.
Added:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/BadConnectionTest.java (with props)
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetHarnessJavaTest.java (with props)
Removed:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/badConnection.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/badConnection.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/badConnection.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/badConnection_sed.properties
Modified:
db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/TestProto.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/TestProto.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/TestProto.java?view=diff&rev=508231&r1=508230&r2=508231
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/TestProto.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/TestProto.java Thu Feb 15 15:03:45 2007
@@ -189,7 +189,7 @@
// the location is different, try it
String userdir = System.getProperty("user.dir");
String sep = System.getProperty("file.separator");
- fr = new BufferedReader (new InputStreamReader(new FileInputStream(userdir + sep + ".." + sep + filename),"UTF-8"));
+ fr = new BufferedReader (new InputStreamReader(new FileInputStream(userdir + sep + "extin" + sep + filename),"UTF-8"));
}
tkn = new StreamTokenizer(fr);
int val;
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude?view=diff&rev=508231&r1=508230&r2=508231
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude Thu Feb 15 15:03:45 2007
@@ -26,7 +26,6 @@
# derbynet/testProperties - tries to use NetworkServerControl statements
# derbynet/timeslice - tries to use NetworkServerControl statements
# derbynet/DerbyNetAutoStart - tries to start networkserver
-# derbynet/DerbyNetNewServer - tries to start networkserver and uses local connections to the db.
# tools/ieptests - names files in extin dir, but they are on the server
# tools/importExport - tries to confirm correct export by file-comparing the exported files,
# which may be on a different machine and thus not found.
@@ -56,7 +55,6 @@
derbynet/testSecMec.java
derbynet/timeslice.java
derbynet/DerbyNetAutoStart.java
-derbynet/DerbyNetNewServer.java
tools/ieptests.sql
tools/importExport.java
lang/wisconsin.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude?view=diff&rev=508231&r1=508230&r2=508231
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude Thu Feb 15 15:03:45 2007
@@ -23,7 +23,6 @@
# derbynet/sysinfo.java - needs other properties
# derbynet/sysinfo_withproperties.java - needs other properties
# following fail for various reasons, many related to not being able to connect:
-# derbynet/badConnection.java
# jdbcapi/odbc_metadata.java
# lang/optimizerOverrides.sql
# lang/big.sql
@@ -56,7 +55,6 @@
derbynet/sysinfo.java
derbynet/sysinfo_withproperties.java
stress/stress.multi
-derbynet/badConnection.java
jdbcapi/odbc_metadata.java
lang/optimizerOverrides.sql
lang/big.sql
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude?view=diff&rev=508231&r1=508230&r2=508231
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude Thu Feb 15 15:03:45 2007
@@ -26,7 +26,6 @@
# derbynet/DerbyNetAutoStart - tries to start networkserver
# derbynet/sysinfo_withproperties - tries to use NetworkServerControl statements and test requires server to
# be started with a specific property. see DERBY-928 for reference
-# derbynet/DerbyNetNewServer - tries to start networkserver and uses local connections to the db.
# tools/ieptests - names files in extin dir, but they are on the server
# tools/importExport - tries to confirm correct export by file-comparing the exported files,
# which may be on a different machine and thus not found.
@@ -50,7 +49,6 @@
derbynet/testSecMec.java
derbynet/timeslice.java
derbynet/DerbyNetAutoStart.java
-derbynet/DerbyNetNewServer.java
tools/ieptests.sql
tools/importExport.java
lang/wisconsin.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall?view=diff&rev=508231&r1=508230&r2=508231
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall Thu Feb 15 15:03:45 2007
@@ -1,19 +1,15 @@
derbynet/NSinSameJVM.java
-derbynet/badConnection.java
derbynet/callable.java
derbynet/checkSecMgr.java
derbynet/csPrepStmt.java
derbynet/dblook_test_net.java
derbynet/dataSourcePermissions_net.java
derbynet/DerbyNetAutoStart.java
-derbynet/DerbyNetNewServer.java
-derbynet/executeUpdate.java
derbynet/getCurrentProperties.java
derbynet/maxthreads.java
derbynet/runtimeinfo.java
derbynet/sysinfo.java
derbynet/sysinfo_withproperties.java
-derbynet/testProtocol.java
derbynet/testProperties.java
derbynet/testconnection.java
derbynet/testij.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall?view=diff&rev=508231&r1=508230&r2=508231
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall Thu Feb 15 15:03:45 2007
@@ -1,10 +1,8 @@
derbynet/NSinSameJVM.java
-derbynet/badConnection.java
derbynet/callable.java
derbynet/csPrepStmt.java
derbynet/dblook_test_net.java
derbynet/dataSourcePermissions_net.java
-derbynet/executeUpdate.java
derbynet/getCurrentProperties.java
derbynet/maxthreads.java
derbynet/runtimeinfo.java
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/BadConnectionTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/BadConnectionTest.java?view=auto&rev=508231
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/BadConnectionTest.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/BadConnectionTest.java Thu Feb 15 15:03:45 2007
@@ -0,0 +1,109 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.derbynet.BadConnectionTest
+
+ 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.derbynet;
+
+import java.sql.*;
+import java.util.Properties;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+
+/**
+ * This tests some bad attempts at a client connection:
+ * - non-existant database
+ * - lack of user / password attributes
+ * - bad values for valid connection attributes
+ */
+
+public class BadConnectionTest extends BaseJDBCTestCase
+{
+
+ public void setUp() throws SQLException
+ {
+ // get the default connection so the driver is loaded.
+ Connection c = getConnection();
+ c.close();
+ }
+
+ /**
+ * Try to connect without a username or password.
+ * Should fail with SQLState 08004.
+ */
+ public void testNoUserOrPassword()
+ {
+ try {
+ Connection c = DriverManager.getConnection("jdbc:derby://localhost:1527/testbase");
+ } catch (SQLException e) {
+ assertSQLState("08004", e);
+ assertEquals(-4499, e.getErrorCode());
+ }
+ }
+
+ /**
+ * Try to connect to a non-existent database without create=true.
+ * Should fail with SQLState 08004.
+ */
+ public void testDatabaseNotFound()
+ {
+ try {
+ Properties p = new Properties();
+ p.put("user", "admin");
+ p.put("password", "admin");
+ Connection c = DriverManager.getConnection("jdbc:derby://localhost:1527/testbase", p);
+ } catch (SQLException e)
+ {
+ assertSQLState("08004", e);
+ assertEquals(-4499, e.getErrorCode());
+ }
+ }
+
+ /**
+ * Check that only valid values for connection attributes are accepted.
+ * For this check, we attempt to connect using the upgrade attribute
+ * with an invalid value.
+ *
+ * Should fail with SQLState XJ05B.
+ */
+ public void testBadConnectionAttribute()
+ {
+ try {
+ Connection c = DriverManager.getConnection("jdbc:derby://localhost:1527/badAttribute;upgrade=notValidValue");
+ } catch (SQLException e)
+ {
+ assertSQLState("XJ05B", e);
+ assertEquals(-1, e.getErrorCode());
+ }
+ }
+
+ public BadConnectionTest(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return TestConfiguration.clientServerDecorator(
+ new TestSuite(BadConnectionTest.class, "BadConnection"));
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/BadConnectionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetHarnessJavaTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetHarnessJavaTest.java?view=auto&rev=508231
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetHarnessJavaTest.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetHarnessJavaTest.java Thu Feb 15 15:03:45 2007
@@ -0,0 +1,95 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.jdbcapi.NetworkClientHarnessJavaTest
+
+ 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.derbynet;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.derbyTesting.functionTests.util.HarnessJavaTest;
+import org.apache.derbyTesting.junit.TestConfiguration;
+import org.apache.derbyTesting.junit.SecurityManagerSetup;
+import org.apache.derbyTesting.junit.SupportFilesSetup;
+
+/**
+ * NetHarnessJavaTest includes .java tests in the derbynet directory that
+ * have not been converted to junit and do not have multiple masters.
+ *
+ * The following tests could not be run this way, reasons for the
+ *
+ * dblook_test_net - filters output
+ * dataSourcePermissions_net - InvocationTargetException, needs investigation
+ * getCurrentProperties - ExceptionInInitializerError, needs investigation
+ * maxthreads - forks VM
+ * runtimeinfo" - filters output
+ * sysinfo" - forks VM
+ * sysinfo_withproperties" - forks VM
+ * testProperties" - filters output
+ * testconnection" - forks VM
+ * testij" - filters output
+ * timeslice" - forks VM
+ * NSinSameJVM" - filters output
+ * DerbyNetAutoStart" - forks VM
+ */
+public class NetHarnessJavaTest extends HarnessJavaTest {
+
+ /**
+ * Only allow construction from our suite method.
+ *
+ * @param name the name of the test to execute
+ */
+ private NetHarnessJavaTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Run tests from the functionTests/tests/derbynet directory.
+ */
+ protected String getArea() {
+ return "derbynet";
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("jdbcapi: old harness java tests");
+
+ suite.addTest(TestConfiguration.clientServerDecorator(
+ decorate(new NetHarnessJavaTest("executeUpdate"))));
+
+ suite.addTest(TestConfiguration.clientServerDecorator(
+ SecurityManagerSetup.noSecurityManager(
+ decorate(new NetHarnessJavaTest("testProtocol")))));
+
+ suite.addTest(SecurityManagerSetup.noSecurityManager(
+ decorate(new NetHarnessJavaTest("DerbyNetNewServer"))));
+
+ return new SupportFilesSetup(suite,
+ new String[] {
+ "functionTests/tests/derbynet/protocol.tests",
+ "functionTests/tests/derbynet/excsat_accsecrd1.inc",
+ "functionTests/tests/derbynet/excsat_accsecrd2.inc",
+ "functionTests/tests/derbynet/excsat_secchk.inc",
+ "functionTests/tests/derbynet/connect.inc",
+ "functionTests/tests/derbynet/values1.inc",
+ "functionTests/tests/derbynet/values64kblksz.inc"
+ });
+ }
+
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetHarnessJavaTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java?view=diff&rev=508231&r1=508230&r2=508231
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/_Suite.java Thu Feb 15 15:03:45 2007
@@ -50,6 +50,8 @@
suite.addTest(SuicideOfStreamingTest.suite());
suite.addTest(DRDAProtocolTest.suite());
suite.addTest(ClientSideSystemPropertiesTest.suite());
+ suite.addTest(BadConnectionTest.suite());
+ suite.addTest(NetHarnessJavaTest.suite());
// These tests references a client class directly
// thus causing class not found exceptions if the
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol.java?view=diff&rev=508231&r1=508230&r2=508231
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProtocol.java Thu Feb 15 15:03:45 2007
@@ -30,7 +30,7 @@
public class testProtocol {
- private static final String DEFAULT_FILENAME = "protocol.tests";
+ private static final String DEFAULT_FILENAME = "extin/protocol.tests";
// constructor
public testProtocol() {}
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java?view=diff&rev=508231&r1=508230&r2=508231
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java Thu Feb 15 15:03:45 2007
@@ -76,7 +76,7 @@
* to re-install the security manager. So the passed in test
* will be skipped.
*/
- public static Test noSecurityManager(BaseTestCase test)
+ public static Test noSecurityManager(Test test)
{
if (externalSecurityManagerInstalled)
return new TestSuite();