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 kr...@apache.org on 2012/06/28 13:58:19 UTC
svn commit: r1354960 [3/3] - in /db/derby/code/trunk/java/testing: ./
org/apache/derbyTesting/functionTests/tests/compatibility/
org/apache/derbyTesting/functionTests/tests/compatibility/helpers/
org/apache/derbyTesting/junit/
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java?rev=1354960&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java Thu Jun 28 11:58:16 2012
@@ -0,0 +1,330 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.compatibility.VersionCombinationConfigurator
+
+ 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.compatibility;
+
+import java.io.File;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import junit.extensions.TestSetup;
+import junit.framework.TestSuite;
+
+import org.apache.derby.tools.sysinfo;
+import org.apache.derbyTesting.junit.BaseTestCase;
+import org.apache.derbyTesting.junit.DerbyDistribution;
+import org.apache.derbyTesting.junit.DerbyVersion;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Generates a set of client-server combinations to run the compatibility
+ * tests for.
+ * <p>
+ * Due to the requirement for running with a variety of Derby versions, the
+ * compatibility test suite is run as multiple processes. The test is
+ * controlled from the main process (the process in which the test/suite is
+ * started), and this process spawns additional processes for each server
+ * version and each client version. In some cases it also has to spawn
+ * additional processes to accomplish other tasks.
+ * <p>
+ * For development purposes the default MATS suite is sufficient for ongoing
+ * work. Eventually, and at least before cutting a new release, the full
+ * development suite should be run, since it will test the trunk against all
+ * previous releases. The other suites will test old releases against each
+ * other, and as such they are of less interest since the old releases don't
+ * change. Note however that these suites can be used to test releases on
+ * branches where this version of the compatibility test doesn't exist (just
+ * add the JARs to the release repository and configure includes or excludes
+ * to suite your needs).
+ * <p>
+ * <strong>NOTE 1</strong>: The set of combinations computed by this class
+ * depends on the number of old releases available on the local computer. If
+ * there are no old releases available a warning will be emitted, but the test
+ * won't fail (it will test trunk vs trunk).
+ * <p>
+ * <strong>NOTE 2</strong>: trunk is defined as a distribution, although it
+ * hasn't been released yet. The reason is simple: we always want to test trunk
+ * for incompatibilities against older versions.
+ */
+public class VersionCombinationConfigurator {
+
+ /** Name of the configuration, only used for informational purposes. */
+ private final String name;
+ /** Decides if combinations have to involve trunk (as server or client). */
+ private final boolean limitToTrunk;
+ /** Decides if only the latest branch release is eligible for inclusion. */
+ private final boolean newestFixpackOnly;
+ private List<DerbyVersion> toInclude = Collections.emptyList();
+ private List<DerbyVersion> toExclude = Collections.emptyList();
+
+ /**
+ * Returns the default configuration intended to be run as part of
+ * <tt>suites.all</tt>, which is a kind of minimal acceptance test (MATS).
+ * <p>
+ * The default configuration is defined to be all combinations that have
+ * trunk as either the server or the client.
+ *
+ * @return A configurator generating the default set of tests.
+ */
+ public static VersionCombinationConfigurator getInstanceDevMATS() {
+ return new VersionCombinationConfigurator(
+ "default/MATS configuration", true, true);
+ }
+
+ /**
+ * Returns a configuration that will test trunk against all other available
+ * releases.
+ *
+ * @return A configurator generating the default set of tests.
+ */
+ public static VersionCombinationConfigurator getInstanceDevFull() {
+ return new VersionCombinationConfigurator(
+ "full development configuration", true, false);
+ }
+
+ /**
+ * Returns a configuration where the newest releases within each
+ * major-minor version are tested against each other.
+ * <p>
+ * Given releases designated <tt>M.m.f.p</tt> (i.e. 10.8.1.2), this
+ * configuration will include all major-minor releases with the highest
+ * <ff>f</ff>.
+ *
+ * @return A configurator generating a reasonably sized test set.
+ */
+ public static VersionCombinationConfigurator getInstanceOld() {
+ return new VersionCombinationConfigurator(
+ "historical configuration", false, true);
+ }
+
+ /**
+ * Returns a configuration where all versions found are tested against
+ * each other.
+ *
+ * @return A configurator generating the full set of tests.
+ */
+ public static VersionCombinationConfigurator getInstanceOldFull() {
+ return new VersionCombinationConfigurator(
+ "full historical configuration", false, false);
+ }
+
+ /**
+ * Creates a version combination configurator.
+ *
+ * @param name name of the configurator
+ * @param limitToTrunk if true, only add combinations including trunk
+ * @param newestFixpackOnly whether or not to only include the newest
+ * release within each pair of major-minor version.
+ */
+ private VersionCombinationConfigurator(String name,
+ boolean limitToTrunk,
+ boolean newestFixpackOnly) {
+ this.name = name;
+ this.limitToTrunk = limitToTrunk;
+ this.newestFixpackOnly = newestFixpackOnly;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Adds compatibility tests to the specified suite.
+ * <p>
+ * The following determines how many tests are added:
+ * <ul> <li>available distributions locally (release repository)</li>
+ * <li>list of includes and/or excludes (by default empty)</li>
+ * <li>the configurator's current settings</li>
+ * </ul>
+ *
+ * @param suite the suite to add the tests to
+ * @return Number of compatibility runs added.
+ */
+ public int addTests(TestSuite suite) {
+ int runsAdded = 0;
+ List<DerbyDistribution> dists = filterVersions();
+ DerbyDistribution newestDist = dists.get(0);
+ String newestTestingCode = newestDist.getTestingClasspath();
+ // Generate a list of all the combinations.
+ for (DerbyDistribution server : dists) {
+ DerbyVersion serverVersion = server.getVersion();
+ TestSuite clientSuites = new TestSuite(
+ "Client runs against server " + serverVersion.toString());
+ for (DerbyDistribution client : dists) {
+ if (limitToTrunk && !server.equals(newestDist) &&
+ !client.equals(newestDist)) {
+ continue;
+ }
+ clientSuites.addTest(
+ new ClientCompatibilityRunControl(
+ client, newestTestingCode, serverVersion));
+ runsAdded++;
+ }
+ TestSetup setup = new VersionedNetworkServerTestSetup(
+ clientSuites, server, newestTestingCode);
+ suite.addTest(setup);
+ }
+ return runsAdded;
+ }
+
+ public void setIncludes(List<DerbyVersion> toInclude) {
+ if (toInclude != null) {
+ this.toInclude = toInclude;
+ }
+ }
+
+ public void setExcludes(List<DerbyVersion> toExclude) {
+ if (toExclude != null) {
+ this.toExclude = toExclude;
+ }
+ }
+
+ /**
+ * Filters Derby distributions available in the distribution repository.
+ *
+ * @return A list of available and accepted Derby distributions.
+ */
+ private List<DerbyDistribution> filterVersions() {
+ DerbyDistribution[] dists =
+ TestConfiguration.getReleaseRepository().getDistributions();
+ List<DerbyDistribution> qualifiedDists =
+ new ArrayList<DerbyDistribution>();
+ for (DerbyDistribution dist: dists) {
+ // Handle includes and excludes.
+ DerbyVersion version = dist.getVersion();
+ if (!toInclude.isEmpty() && !toInclude.contains(version)) {
+ println(version.toString() + " not in include list");
+ continue;
+ }
+ if (!toExclude.isEmpty() && toExclude.contains(version)) {
+ println(version.toString() + " in exclude list");
+ continue;
+ }
+
+ qualifiedDists.add(dist);
+ }
+ // If there are no qualified old distributions at this point, sound the
+ // alarm as we're probably looking at a misconfiguration.
+ if (qualifiedDists.isEmpty()) {
+ alarm("No old releases found for current configuration/environment");
+ }
+
+ // Now add the version we are running off.
+ DerbyDistribution runningDist = getRunningDistribution();
+ if (!qualifiedDists.contains(runningDist)) {
+ qualifiedDists.add(runningDist);
+ }
+ qualifiedDists = sortAndFilterVersions(qualifiedDists);
+
+ println("--- " + qualifiedDists.size() + " distributions qualified");
+ for (DerbyDistribution d : qualifiedDists) {
+ println(d.getVersion().toString());
+ }
+
+ return qualifiedDists;
+ }
+
+ /**
+ * Returns the running distribution, which is typically trunk.
+ *
+ * @return Information about the running distribution.
+ * @throws IllegalArgumentException if parsing the version string fails, or
+ * if trunk is run off the classes directory
+ */
+ private DerbyDistribution getRunningDistribution() {
+ URL testingURL = getClassURL(getClass());
+ File libDir = new File(testingURL.getPath());
+ if (libDir.isDirectory()) {
+ throw new IllegalStateException("only running off jars is " +
+ "supported, currently running off " + libDir);
+ }
+ // Get the directory the JAR file is living in.
+ libDir = libDir.getParentFile();
+ DerbyVersion version = DerbyVersion.parseVersionString(
+ sysinfo.getVersionString());
+ return DerbyDistribution.getInstance(libDir, version);
+ }
+
+ /**
+ * Sorts and filters out distributions based on the configurator settings.
+ *
+ * @param distributions list of distributions to filter
+ * @return A filtered list of distributions.
+ */
+ private List<DerbyDistribution> sortAndFilterVersions(
+ List<DerbyDistribution> distributions) {
+ // Sort the releases based on the version number (highest first).
+ Collections.sort(distributions);
+ Collections.reverse(distributions);
+
+ DerbyDistribution prev = null;
+ if (newestFixpackOnly) {
+ List<DerbyDistribution> filtered =
+ new ArrayList<DerbyDistribution>();
+ for (DerbyDistribution d : distributions) {
+ DerbyVersion ver = d.getVersion();
+ if (prev == null || prev.getVersion().greaterMinorThan(ver)) {
+ filtered.add(d);
+ } else {
+ println("ignored " + ver.toString() +
+ ", not the newest fixpack version for " +
+ ver.getMajor() + "." + ver.getMinor());
+ }
+ prev = d;
+ }
+ distributions = filtered;
+ }
+ return distributions;
+ }
+
+ /**
+ * Returns the URL of the source for the specified class.
+ *
+ * @param cl class to find the source for
+ * @return A {@code URL} pointing to the source, or {@code null} it cannot
+ * be obtained.
+ */
+ static URL getClassURL(final Class cl) {
+ return (URL)
+ AccessController.doPrivileged(new PrivilegedAction() {
+
+ public Object run() {
+ if (cl.getProtectionDomain().getCodeSource() == null) {
+ return null;
+ }
+ return cl.getProtectionDomain().getCodeSource().getLocation();
+ }
+ });
+ }
+
+ // Forwarding convenience methods
+
+ private static void println(String msg) {
+ BaseTestCase.println(msg);
+ }
+
+ private static void alarm(String msg) {
+ BaseTestCase.alarm(msg);
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.policy?rev=1354960&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.policy (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionCombinationConfigurator.policy Thu Jun 28 11:58:16 2012
@@ -0,0 +1,29 @@
+//
+// * Derby - Class org.apache.derbyTesting.functionTests.tests.derbynet.VersionCombinationConfigurator.policy
+// *
+// * 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.
+// *
+//
+// Test specific permissions for test:
+// compatibility/_Suite (and variants)
+// The permissions below are expected to be added to the set of default
+// permissions granted to the test framework.
+//
+grant codeBase "${derbyTesting.testjar}derbyTesting.jar" {
+ permission java.lang.RuntimePermission "getProtectionDomain";
+};
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionedNetworkServerTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionedNetworkServerTestSetup.java?rev=1354960&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionedNetworkServerTestSetup.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionedNetworkServerTestSetup.java Thu Jun 28 11:58:16 2012
@@ -0,0 +1,227 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.compatibility.VersionedNetworkServerTestSetup
+
+ 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.compatibility;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import junit.framework.Test;
+
+import org.apache.derby.drda.NetworkServerControl;
+
+import org.apache.derbyTesting.junit.BaseTestCase;
+import org.apache.derbyTesting.junit.BaseTestSetup;
+import org.apache.derbyTesting.junit.DerbyDistribution;
+import org.apache.derbyTesting.junit.DerbyVersion;
+import org.apache.derbyTesting.junit.NetworkServerTestSetup;
+import org.apache.derbyTesting.junit.SpawnedProcess;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Starts a network server of the specified Derby version.
+ */
+public class VersionedNetworkServerTestSetup
+ extends BaseTestSetup {
+
+ /** The first version to support '-noSecurityManager'. */
+ private static final DerbyVersion SUPPORTS_NO_SECMAN_ARG =
+ new DerbyVersion(10, 3, 1, 4);
+ /**
+ * The first version that supports the optional arguments on shutdown.
+ * <p>
+ * See DERBY-4786 and related issues.
+ */
+ private static final DerbyVersion NO_BROKEN_SHUTDOWN =
+ new DerbyVersion(10, 4, 0, 0);
+ /** The Derby distribution to use. */
+ private final DerbyDistribution dist;
+ /** Paths for code to append to the server classpath. */
+ private final String appendToClasspath;
+ private SpawnedProcess spawned;
+ private NetworkServerControl networkServerControl;
+
+ public VersionedNetworkServerTestSetup(Test test, DerbyDistribution dist,
+ String appendToClasspath) {
+ super(test);
+ this.dist = dist;
+ this.appendToClasspath = appendToClasspath;
+ }
+
+ @Override
+ public void setUp() {
+ int port = TestConfiguration.getCurrent().getPort();
+ try {
+ networkServerControl =
+ NetworkServerTestSetup.getNetworkServerControl(port);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ // Make sure there is no server up already (on our port).
+ println("checking for running server on port " + port);
+ if (ping(false, null)) {
+ fail("a server is already running at port " + port);
+ }
+
+ // java -classpath ... org.apache.derby.drda...
+ // Don't use -jar derbyrun.jar because we may need additional classes
+ // to be on the classpath.
+ String classpath = dist.getProductionClasspath() +
+ (appendToClasspath == null
+ ? ""
+ : File.pathSeparator + appendToClasspath);
+ ArrayList cmd = new ArrayList();
+ cmd.add("org.apache.derby.drda.NetworkServerControl");
+ cmd.add("start");
+ cmd.add("-p");
+ cmd.add(Integer.toString(port));
+ if (dist.getVersion().compareTo(SUPPORTS_NO_SECMAN_ARG) >= 0) {
+ cmd.add("-noSecurityManager");
+ }
+
+ Process proc = null;
+ try {
+ proc = BaseTestCase.execJavaCmd(null, classpath,
+ (String[])cmd.toArray(new String[cmd.size()]), null);
+ } catch (IOException ioe) {
+ fail("failed to start server: " + ioe.getMessage());
+ }
+ spawned = new SpawnedProcess(proc, "NetworkServerControl");
+ boolean pingOk = ping(true, proc);
+ assertTrue(spawned.getFailMessage("server failed to come up"), pingOk);
+ println("--- Server " + dist.getVersion() + " up");
+ }
+
+ @Override
+ public void tearDown() {
+ String errorMsg = null;
+ boolean sawError = false;
+ if (dist.getVersion().compareTo(NO_BROKEN_SHUTDOWN) < 0) {
+ // We have to fork off a process to shut down the server.
+ errorMsg = shutDownInSeparateProcess();
+ sawError = errorMsg != null;
+ } else {
+ boolean pingOk = ping(true, spawned.getProcess());
+ if (pingOk) {
+ try {
+ networkServerControl.shutdown();
+ } catch (Exception e) {
+ String msg = spawned.getFailMessage("shutdown failed");
+ errorMsg = " (failed to shut down server (" +
+ dist.getVersion().toString() + "): " +
+ e.getMessage() + " :: " + msg + ")";
+ sawError = true;
+ }
+ }
+ }
+
+ try {
+ spawned.complete(5*1000);
+ } catch (Exception e) {
+ errorMsg = "process didn't die: " + e.getMessage() + (sawError ?
+ errorMsg : "");
+ sawError = true;
+ }
+ networkServerControl = null;
+ spawned = null;
+
+ try {
+ BaseTestCase.assertDirectoryDeleted(new File("wombat"));
+ } catch (AssertionError ae) {
+ // Catch this to generate a more complete error message.
+ if (sawError) {
+ errorMsg += " :: " + ae.getMessage();
+ } else {
+ throw ae;
+ }
+ }
+ if (sawError) {
+ fail(errorMsg);
+ }
+ }
+
+ /**
+ * Spawns a separate JVM process to shut down the running server using the
+ * code distributed with the release.
+ * <p>
+ * This method was added because some versions of Derby cannot be shut down
+ * using code from a newer release.
+ *
+ * @return An error message, or {@code null} if no errors.
+ */
+ private String shutDownInSeparateProcess() {
+ int port = TestConfiguration.getCurrent().getPort();
+ // java -classpath ... org.apache.derby.drda...
+ ArrayList cmd = new ArrayList();
+ cmd.add("org.apache.derby.drda.NetworkServerControl");
+ cmd.add("shutdown");
+ cmd.add("-p");
+ cmd.add(Integer.toString(port));
+ if (dist.getVersion().compareTo(SUPPORTS_NO_SECMAN_ARG) >= 0) {
+ cmd.add("-noSecurityManager");
+ }
+ Process proc;
+ try {
+ proc = BaseTestCase.execJavaCmd(null, dist.getProductionClasspath(),
+ (String[])cmd.toArray(new String[cmd.size()]), null);
+ } catch (IOException ioe) {
+ return "shutdown process failed to start: " + ioe.getMessage();
+ }
+
+ SpawnedProcess spawnedShutdown =
+ new SpawnedProcess(proc, "shutdown process");
+ int exitCode = -1;
+ try {
+ exitCode = spawnedShutdown.complete(10*1000L);
+ } catch (IOException ioe) {
+ fail(spawnedShutdown.getFailMessage("shutdown process failed"));
+ }
+ if (exitCode == 0) {
+ return null;
+ } else {
+ return spawnedShutdown.getFailMessage("abnormal process exit");
+ }
+ }
+
+ /**
+ * Pings the server.
+ *
+ * @param exepectServerUp whether the server is expected to be up or down
+ * @param proc the process in which the server runs (may be {@code null})
+ * @return Whether the ping is considered ok, which is determined by the
+ * response or lack of response from the server and the value of
+ * {@code expectedServerUp}.
+ */
+ private boolean ping(boolean exepectServerUp, Process proc) {
+ boolean pingOk = false;
+ try {
+ pingOk = NetworkServerTestSetup.pingForServerUp(
+ networkServerControl, proc, exepectServerUp);
+ } catch (InterruptedException ie) {
+ Thread.currentThread().interrupt();
+ }
+ return pingOk;
+ }
+
+ private static void println(String msg) {
+ BaseTestCase.println(msg);
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/VersionedNetworkServerTestSetup.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_Suite.java?rev=1354960&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_Suite.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_Suite.java Thu Jun 28 11:58:16 2012
@@ -0,0 +1,131 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.compatibility._Suite
+
+ 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.compatibility;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.DerbyVersion;
+import org.apache.derbyTesting.junit.SecurityManagerSetup;
+import org.apache.derbyTesting.junit.ServerSetup;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Runs a minimal set of compatibility tests aimed at discovering
+ * incompatibilities introduced in the latest development version (trunk).
+ * <p>
+ * Only combinations where trunk is the client or the server qualify for the
+ * MATS (Minimal Acceptance Test Suite), and only the latest releases from
+ * older branches are tested. For more coverage see
+ * {@link VersionCombinationConfigurator#getInstanceDevFull()}.
+ */
+public class _Suite
+ extends BaseJDBCTestCase {
+
+ /** Property for specifying versions to include. */
+ static final String INCLUDE_RELEASES =
+ "derby.tests.compat.includeReleases";
+
+ /** Property for specifying versions to exclude. */
+ static final String EXCLUDE_RELEASES =
+ "derby.tests.compat.excludeReleases";
+
+ /** Lazily set in {@linkplain #addVersionCombinations}, or by a subclass. */
+ protected static VersionCombinationConfigurator configurator;
+
+ /**
+ * Adds compatibility tests to the specified suite according to the
+ * current version combination configuration.
+ *
+ * @param suite the suite to add the tests to
+ * @return The number of tests added.
+ */
+ private static int addVersionCombinations(TestSuite suite) {
+ String include = getSystemProperty(INCLUDE_RELEASES);
+ String exclude = getSystemProperty(EXCLUDE_RELEASES);
+ List<DerbyVersion> toInclude = parseVersionList(include);
+ List<DerbyVersion> toExclude = parseVersionList(exclude);
+
+ if (configurator == null) {
+ // MATS = minimal acceptance test suite
+ configurator = VersionCombinationConfigurator.getInstanceDevMATS();
+ }
+ suite.setName("Compatibility suite, " + configurator.getName());
+ configurator.setIncludes(toInclude);
+ configurator.setExcludes(toExclude);
+ return configurator.addTests(suite);
+ }
+
+ /**
+ * Parses the list of version strings and returns a list of version objects.
+ * <p>
+ * <strong>NOTE</strong>: If invalid versions are found a warning is simply
+ * printed to the console.
+ *
+ * @param versions list of Derby versions, i.e '10.8.1.2,10.7.1.1'
+ * @return A list of parsed Derby versions.
+ */
+ private static List<DerbyVersion> parseVersionList(String versions) {
+ if (versions == null || versions.length() == 0) {
+ return Collections.EMPTY_LIST;
+ }
+ String[] vlist = versions.split(",");
+ List<DerbyVersion> ret = new ArrayList<DerbyVersion>(vlist.length);
+ for (String v : vlist) {
+ try {
+ ret.add(DerbyVersion.parseVersionString(v));
+ } catch (IllegalArgumentException iae) {
+ alarm("badly formatted version string: " + v);
+ }
+ }
+ return ret;
+ }
+
+ /** Don't use this. @see #suite() */
+ public _Suite(String name) {
+ super(name);
+ throw new IllegalStateException("invoke suite() instead");
+ }
+
+ /**
+ * Returns the default set of compatibility tests, intended to be run
+ * as part of suites.All.
+ *
+ * @return A default suite of compatibility tests.
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ addVersionCombinations(suite);
+ TestConfiguration config = TestConfiguration.getCurrent();
+ return new SecurityManagerSetup(
+ new ServerSetup(suite, "localhost", config.getPort()),
+ // Need permission for getProtectionDomain to determine what
+ // to put on the classpath for the spawned process(es).
+ VersionCombinationConfigurator.class.getName().
+ replaceAll("\\.", "/") + ".policy",
+ true);
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_Suite.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteDevFull.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteDevFull.java?rev=1354960&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteDevFull.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteDevFull.java Thu Jun 28 11:58:16 2012
@@ -0,0 +1,43 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.compatibility._SuiteDevFull
+
+ 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.compatibility;
+
+import junit.framework.Test;
+
+/**
+ * Tests trunk against all available versions of old Derby releases.
+ * <p>
+ * This is different from the MATS in that it also tests old releases on
+ * branches and not only the latest release on each branch.
+ */
+public class _SuiteDevFull
+ extends _Suite {
+
+ public _SuiteDevFull(String name) {
+ super(name);
+ throw new IllegalStateException("invoke suite() instead");
+ }
+
+ public static Test suite() {
+ configurator = VersionCombinationConfigurator.getInstanceDevFull();
+ return _Suite.suite();
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteDevFull.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteOld.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteOld.java?rev=1354960&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteOld.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteOld.java Thu Jun 28 11:58:16 2012
@@ -0,0 +1,50 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.compatibility._SuiteOld
+
+ 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.compatibility;
+
+import junit.framework.Test;
+
+/**
+ * Tests all the newest branch releases and trunk against each other.
+ * <p>
+ * This suite is limited in that only the latest releases of old branches
+ * are included in the test set. It is still testing old releases against
+ * each other, which is somewhat uninteresting since they the old releases
+ * don't change.
+ */
+public class _SuiteOld
+ extends _Suite {
+
+ public _SuiteOld(String name) {
+ super(name);
+ throw new IllegalStateException("invoke suite() instead");
+ }
+
+ /**
+ * Returns an extended suite of compatibility tests.
+ *
+ * @return A test suite.
+ */
+ public static Test suite() {
+ configurator = VersionCombinationConfigurator.getInstanceOld();
+ return _Suite.suite();
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteOld.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteOldFull.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteOldFull.java?rev=1354960&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteOldFull.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteOldFull.java Thu Jun 28 11:58:16 2012
@@ -0,0 +1,45 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.compatibility._SuiteOldFull
+
+ 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.compatibility;
+
+import junit.framework.Test;
+
+/**
+ * Tests all available versions of Derby against each other.
+ */
+public class _SuiteOldFull
+ extends _Suite {
+
+ public _SuiteOldFull(String name) {
+ super(name);
+ throw new IllegalStateException("invoke suite() instead");
+ }
+
+ /**
+ * Returns an extended suite of compatibility tests.
+ *
+ * @return A test suite.
+ */
+ public static Test suite() {
+ configurator = VersionCombinationConfigurator.getInstanceOldFull();
+ return _Suite.suite();
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/_SuiteOldFull.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml?rev=1354960&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml Thu Jun 28 11:58:16 2012
@@ -0,0 +1,77 @@
+<?xml version="1.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.
+-->
+<project default="compile" basedir="../../../../../../../..">
+
+ <property file="${user.home}/ant.properties"/>
+
+ <!-- Set property lib dir -->
+ <property name="properties.dir" value="tools/ant/properties" />
+
+ <!-- Significant dirs -->
+ <property file="${properties.dir}/dirs.properties"/>
+ <property file="${properties.dir}/derbytesting.properties"/>
+
+ <!-- Compiler settings -->
+ <property file="${properties.dir}/sane${sanity}.properties"/>
+ <property file="${properties.dir}/defaultcompiler.properties"/>
+ <property file="${properties.dir}/${build.compiler}.properties"/>
+
+ <!-- Parser properties -->
+ <!--property file="${properties.dir}/parser.properties"/-->
+
+ <!-- Compile-time classpath properties files -->
+ <property file="${properties.dir}/extrapath.properties"/>
+ <property file="${properties.dir}/compilepath.properties"/>
+
+ <!-- Release and Version info -->
+ <property file="${properties.dir}/release.properties"/>
+
+ <!-- derby testing specific properties files -->
+ <property file="${ant.home}/properties/derbytesting.properties"/>
+ <property file="${user.home}/properties/derbytesting.properties"/>
+ <property name="this.dir" value="${derby.testing.functest.dir}/tests/compatibility"/>
+
+ <target name="compile" depends="copyfiles">
+ <javac
+ source="${compilerLevel16}"
+ target="${compilerLevel16}"
+ bootclasspath="${empty}"
+ nowarn="on"
+ debug="true"
+ depend="${depend}"
+ deprecation="${deprecation}"
+ optimize="${optimize}"
+ proceed="${proceed}"
+ verbose="${verbose}"
+ srcdir="${derby.testing.src.dir}"
+ destdir="${out.dir}">
+ <classpath>
+ <pathelement path="${java15compile.classpath}"/>
+ <pathelement path="${junit}"/>
+ </classpath>
+ <include name="${this.dir}/*.java"/>
+ </javac>
+ </target>
+
+ <target name="copyfiles">
+ <copy todir="${out.dir}/${derby.testing.functest.dir}/tests/compatibility">
+ <fileset dir="${derby.testing.src.dir}/${this.dir}"
+ includes="*.policy"/>
+ </copy>
+ </target>
+</project>
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/helpers/DummyBlob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/helpers/DummyBlob.java?rev=1354960&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/helpers/DummyBlob.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/helpers/DummyBlob.java Thu Jun 28 11:58:16 2012
@@ -0,0 +1,109 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.compatibility.helpers.DummyBlob
+
+ 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.compatibility.helpers;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.sql.Blob;
+import java.sql.SQLException;
+
+/**
+ * A crude Blob implementation for datatype testing.
+ */
+public class DummyBlob
+ implements Blob {
+ private byte[] _bytes;
+
+ public DummyBlob( byte[] bytes )
+ {
+ _bytes = bytes;
+ }
+
+ public InputStream getBinaryStream()
+ {
+ return new ByteArrayInputStream( _bytes );
+ }
+
+ public byte[] getBytes( long position, int length ) { return _bytes; }
+
+ public long length() { return (long) _bytes.length; }
+
+ public long position( Blob pattern, long start ) { return 0L; }
+ public long position( byte[] pattern, long start ) { return 0L; }
+
+ public boolean equals( Object other )
+ {
+ if ( other == null ) { return false; }
+ if ( !( other instanceof Blob ) ) { return false; }
+
+ Blob that = (Blob) other;
+
+ try {
+ if ( this.length() != that.length() ) { return false; }
+
+ InputStream thisStream = this.getBinaryStream();
+ InputStream thatStream = that.getBinaryStream();
+
+ while( true )
+ {
+ int nextByte = thisStream.read();
+
+ if ( nextByte < 0 ) { break; }
+ if ( nextByte != thatStream.read() ) { return false; }
+ }
+ }
+ catch (Exception e)
+ {
+ System.err.println( e.getMessage() );
+ e.printStackTrace(System.err);
+ return false;
+ }
+
+ return true;
+ }
+
+ public int setBytes(long arg0, byte[] arg1) throws SQLException {
+ throw new SQLException("not implemented for this test");
+ }
+
+ public int setBytes(long arg0, byte[] arg1, int arg2, int arg3)
+ throws SQLException {
+ throw new SQLException("not implemented for this test");
+ }
+
+ public OutputStream setBinaryStream(long arg0) throws SQLException {
+ throw new SQLException("not implemented for this test");
+ }
+
+ public void truncate(long arg0) throws SQLException {
+ throw new SQLException("not implemented for this test");
+ }
+
+ public void free() throws SQLException {
+ _bytes = null;
+ }
+
+ public InputStream getBinaryStream(long pos, long length)
+ throws SQLException {
+ return new ByteArrayInputStream(_bytes, (int)pos -1, (int)length);
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/helpers/DummyBlob.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/helpers/DummyClob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/helpers/DummyClob.java?rev=1354960&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/helpers/DummyClob.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/helpers/DummyClob.java Thu Jun 28 11:58:16 2012
@@ -0,0 +1,126 @@
+/*
+
+ Derby - Class org.apache.derbyTesting.functionTests.tests.compatibility.helpers.DummyClob
+
+ 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.compatibility.helpers;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.Writer;
+import java.sql.Clob;
+import java.sql.SQLException;
+
+/**
+ * A crude Clob implementation for datatype testing.
+ */
+public class DummyClob
+ implements Clob {
+ private String _contents;
+
+ public DummyClob(String contents)
+ {
+ _contents = contents;
+ }
+
+ public InputStream getAsciiStream()
+ {
+ try {
+ return new ByteArrayInputStream( _contents.getBytes( "UTF-8" ) );
+ }
+ catch (Exception e) { return null; }
+ }
+
+ public Reader getCharacterStream()
+ {
+ return new StringReader(_contents);
+ }
+
+ public String getSubString( long position, int length )
+ {
+ return _contents.substring( (int) position -1, length );
+ }
+
+ public long length() { return (long) _contents.length(); }
+
+ public long position( Clob searchstr, long start ) { return 0L; }
+ public long position( String searchstr, long start ) { return 0L; }
+
+ public boolean equals( Object other )
+ {
+ if ( other == null ) { return false; }
+ if ( !( other instanceof Clob ) ) { return false; }
+
+ Clob that = (Clob) other;
+
+ try {
+ if ( this.length() != that.length() ) { return false; }
+
+ InputStream thisStream = this.getAsciiStream();
+ InputStream thatStream = that.getAsciiStream();
+
+ while( true )
+ {
+ int nextByte = thisStream.read();
+
+ if ( nextByte < 0 ) { break; }
+ if ( nextByte != thatStream.read() ) { return false; }
+ }
+ }
+ catch (Exception e)
+ {
+ System.err.println( e.getMessage() );
+ e.printStackTrace(System.err);
+ return false;
+ }
+
+ return true;
+ }
+
+ public int setString(long arg0, String arg1) throws SQLException {
+ throw new SQLException("not implemented for this test");
+ }
+
+ public int setString(long arg0, String arg1, int arg2, int arg3) throws SQLException {
+ throw new SQLException("not implemented for this test");
+ }
+
+ public OutputStream setAsciiStream(long arg0) throws SQLException {
+ throw new SQLException("not implemented for this test");
+ }
+
+ public Writer setCharacterStream(long arg0) throws SQLException {
+ throw new SQLException("not implemented for this test");
+ }
+
+ public void truncate(long arg0) throws SQLException {
+ throw new SQLException("not implemented for this test");
+ }
+
+ public void free() throws SQLException {
+ _contents = null;
+ }
+
+ public Reader getCharacterStream(long pos, long length) throws SQLException {
+ return new StringReader(
+ _contents.substring((int)pos -1, (int)(pos + length)));
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/helpers/DummyClob.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/package.html
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/package.html?rev=1354960&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/package.html (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/package.html Thu Jun 28 11:58:16 2012
@@ -0,0 +1,68 @@
+<!--
+ 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.
+-->
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Package documentation for
+ org.apache.derbyTesting.functionTests.tests.compatibility</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+ <body>
+ <p>Classes used to test the compatibility between different versions
+ of Derby clients and Derby servers. The main entry point is the
+ <tt>_Suite</tt> class, with the other suites as alternatives giving
+ more test coverage in terms of the number of combinations tested.</p>
+
+ <p>The MATS version of the compatibility test should be run as part of
+ <tt>suites.All</tt>. It is your responsibility to keep the local
+ release repository up to date (the default location is
+ <tt>$HOME/.derbyTestingReleases/</tt>, this can be overridden by using
+ <tt>derbyTesting.oldReleasePath</tt>).</p>
+
+ <p>For non-default runs, the following steps should be considered:</p>
+ <ol> <li>Update the release repository (typically a <tt>svn up</tt>)</li>
+ <li>If you want to run the LOB tests, set
+ <tt>derby.tests.compat.testLOBs</tt> to <tt>true</tt>. Note
+ that this will add around five minutes of runtime to each
+ combination</li>
+ <li>If you want to include only a specific set of releases, set
+ <tt>derby.tests.compat.includeReleases</tt>. The format is
+ <tt>M.m.f.p[,M.m.f.p]*</tt>, for instance
+ <tt>10.9.1.0,10.8.2.2</tt>.</li>
+
+ <li>If you want to exclude certain releases, set
+ <tt>derby.tests.compat.excludeReleases</tt>. The format is the
+ same as for the include option above.</li>
+ <li>Run the suite that best fits your needs; MATS, dev full, old,
+ or old full.</li>
+ </ol>
+
+ <p>Note that the set of combinations computed depends on the old Derby
+ releases that are available through the release repository. For this
+ reason it is important to keep the local repository updated. Once
+ initialized, i.e <tt>svn co http://svn.apache.org/repos/asf/db/derby/jars
+ $HOME/.derbyTestingReleases</tt>, you only have to update it each time
+ a new Derby release comes out.</p>
+
+ <p>Testing the compatibility between a given client driver and a given
+ server is best done by running those two components in separate
+ processes. This simplifies handling multiple versions of the code base,
+ but introduces some challenges for properly handling the external
+ processes.</p>
+
+ </body>
+</html>
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/compatibility/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?rev=1354960&r1=1354959&r2=1354960&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java Thu Jun 28 11:58:16 2012
@@ -1579,6 +1579,10 @@ public final class TestConfiguration {
return hostName;
}
+ public static int getBasePort() {
+ return basePort;
+ }
+
/**
* Get port number for network server.
*