3889 magnus.blaudd@stripped 2012-04-16 [merge]
Merge 7.1 -> 7.2
added:
storage/ndb/clusterj/clusterj-unit/
storage/ndb/clusterj/clusterj-unit/pom.xml
storage/ndb/clusterj/clusterj-unit/src/
storage/ndb/clusterj/clusterj-unit/src/main/
storage/ndb/clusterj/clusterj-unit/src/main/java/
storage/ndb/clusterj/clusterj-unit/src/main/java/junit/
storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/
storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/AssertionFailedError.java
storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/Test.java
storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestCase.java
storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestListener.java
storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestResult.java
storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestSuite.java
storage/ndb/clusterj/clusterj-unit/src/main/java/junit/textui/
storage/ndb/clusterj/clusterj-unit/src/main/java/junit/textui/TestRunner.java
storage/ndb/clusterj/clusterj-unit/src/main/java/org/
storage/ndb/clusterj/clusterj-unit/src/main/java/org/junit/
storage/ndb/clusterj/clusterj-unit/src/main/java/org/junit/Ignore.java
modified:
storage/ndb/clusterj/clusterj-api/pom.xml
storage/ndb/clusterj/clusterj-core/pom.xml
storage/ndb/clusterj/clusterj-jdbc/pom.xml
storage/ndb/clusterj/clusterj-jpatest/pom.xml
storage/ndb/clusterj/clusterj-openjpa/pom.xml
storage/ndb/clusterj/clusterj-openjpa/src/test/java/com/mysql/clusterj/openjpatest/OneToManyRelationshipTest.java
storage/ndb/clusterj/clusterj-openjpa/src/test/java/com/mysql/clusterj/openjpatest/TestBadPersistenceUnitNoConnectString.java
storage/ndb/clusterj/clusterj-test/pom.xml
storage/ndb/clusterj/clusterj-test/src/main/java/testsuite/clusterj/AbstractQueryTest.java
storage/ndb/clusterj/clusterj-test/src/main/java/testsuite/clusterj/QueryMultiColumnIndexInTest.java
storage/ndb/clusterj/clusterj-tie/pom.xml
storage/ndb/clusterj/clusterj-tie/src/test/java/testsuite/clusterj/tie/ConnectionPoolTest.java
storage/ndb/clusterj/clusterj-tie/src/test/java/testsuite/clusterj/tie/StressTest.java
storage/ndb/clusterj/pom.xml
storage/ndb/src/mgmsrv/ConfigInfo.cpp
3888 John David Duncan 2012-04-13
Add test case for memcache INCR/DECR with binary protocol.
Fix binary INCR/DECR issues in My::Memcache.pm client lib.
Fix memcached server to return the math column as the value
when there is no value column defined.
added:
mysql-test/suite/ndb_memcache/r/math3.result
mysql-test/suite/ndb_memcache/t/math3.test
storage/ndb/memcache/unit/sequence.pl
modified:
mysql-test/lib/My/Memcache.pm
storage/ndb/memcache/include/QueryPlan.h
storage/ndb/memcache/src/Record.cc
storage/ndb/memcache/src/ndb_worker.cc
=== modified file 'storage/ndb/clusterj/clusterj-api/pom.xml'
--- a/storage/ndb/clusterj/clusterj-api/pom.xml 2012-03-29 17:42:19 +0000
+++ b/storage/ndb/clusterj/clusterj-api/pom.xml 2012-04-15 03:45:31 +0000
@@ -53,13 +53,6 @@
</plugin>
</plugins>
</build>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
<properties>
<netbeans.hint.useExternalMaven>false</netbeans.hint.useExternalMaven>
</properties>
=== modified file 'storage/ndb/clusterj/clusterj-core/pom.xml'
--- a/storage/ndb/clusterj/clusterj-core/pom.xml 2012-03-29 17:42:19 +0000
+++ b/storage/ndb/clusterj/clusterj-core/pom.xml 2012-04-15 03:45:31 +0000
@@ -96,8 +96,8 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>com.mysql.clusterj</groupId>
+ <artifactId>clusterj-unit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
=== modified file 'storage/ndb/clusterj/clusterj-jdbc/pom.xml'
--- a/storage/ndb/clusterj/clusterj-jdbc/pom.xml 2012-03-29 17:42:19 +0000
+++ b/storage/ndb/clusterj/clusterj-jdbc/pom.xml 2012-04-15 03:45:31 +0000
@@ -28,8 +28,8 @@
<version>7.1.22-SNAPSHOT</version>
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>com.mysql.clusterj</groupId>
+ <artifactId>clusterj-unit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
=== modified file 'storage/ndb/clusterj/clusterj-jpatest/pom.xml'
--- a/storage/ndb/clusterj/clusterj-jpatest/pom.xml 2012-03-29 17:42:19 +0000
+++ b/storage/ndb/clusterj/clusterj-jpatest/pom.xml 2012-04-15 03:45:31 +0000
@@ -107,8 +107,8 @@
<artifactId>openjpa</artifactId>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>com.mysql.clusterj</groupId>
+ <artifactId>clusterj-unit</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
=== modified file 'storage/ndb/clusterj/clusterj-openjpa/pom.xml'
--- a/storage/ndb/clusterj/clusterj-openjpa/pom.xml 2012-03-29 17:42:19 +0000
+++ b/storage/ndb/clusterj/clusterj-openjpa/pom.xml 2012-04-15 03:45:31 +0000
@@ -129,6 +129,11 @@
</dependency>
<dependency>
<groupId>com.mysql.clusterj</groupId>
+ <artifactId>clusterj-unit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.mysql.clusterj</groupId>
<artifactId>clusterj-api</artifactId>
<scope>compile</scope>
</dependency>
=== modified file 'storage/ndb/clusterj/clusterj-openjpa/src/test/java/com/mysql/clusterj/openjpatest/OneToManyRelationshipTest.java'
--- a/storage/ndb/clusterj/clusterj-openjpa/src/test/java/com/mysql/clusterj/openjpatest/OneToManyRelationshipTest.java 2011-07-05 12:46:07 +0000
+++ b/storage/ndb/clusterj/clusterj-openjpa/src/test/java/com/mysql/clusterj/openjpatest/OneToManyRelationshipTest.java 2012-04-16 10:34:32 +0000
@@ -125,16 +125,16 @@ public class OneToManyRelationshipTest e
B0 b = em.find(B0.class, i);
print(b.toString());
if (0 == i%2) {
- assertEquals("Mismatch in relationship a", as.get(0), b.getA());
- assertTrue("A.b0s should contain b", as.get(0).getB0s().contains(b));
+ errorIfNotEqual("Mismatch in relationship a", as.get(0), b.getA());
+ errorIfNotEqual("A.b0s should contain b", true, as.get(0).getB0s().contains(b));
} else {
- assertEquals("Mismatch in relationship a", as.get(1), b.getA());
- assertTrue("A.b0s should contain b", as.get(1).getB0s().contains(b));
+ errorIfNotEqual("Mismatch in relationship a", as.get(1), b.getA());
+ errorIfNotEqual("A.b0s should contain b", true, as.get(1).getB0s().contains(b));
}
}
commit();
em.close();
-
+ failOnError();
}
private void print(String string) {
=== modified file 'storage/ndb/clusterj/clusterj-openjpa/src/test/java/com/mysql/clusterj/openjpatest/TestBadPersistenceUnitNoConnectString.java'
--- a/storage/ndb/clusterj/clusterj-openjpa/src/test/java/com/mysql/clusterj/openjpatest/TestBadPersistenceUnitNoConnectString.java 2011-07-05 12:46:07 +0000
+++ b/storage/ndb/clusterj/clusterj-openjpa/src/test/java/com/mysql/clusterj/openjpatest/TestBadPersistenceUnitNoConnectString.java 2012-04-16 10:34:32 +0000
@@ -36,7 +36,10 @@ public class TestBadPersistenceUnitNoCon
EntityManagerFactory emf = Persistence.createEntityManagerFactory(
getPersistenceUnitName());
emf.createEntityManager();
- assertNull("Unexpected emf for null connectString", emf);
+ if(emf != null) {
+ fail("Unexpected emf for null connectString");
+ }
+
} catch (RuntimeException ex) {
// see if it has the connectString message
if (!(ex.getMessage().contains("connectString"))) {
=== modified file 'storage/ndb/clusterj/clusterj-test/pom.xml'
--- a/storage/ndb/clusterj/clusterj-test/pom.xml 2012-03-29 17:42:19 +0000
+++ b/storage/ndb/clusterj/clusterj-test/pom.xml 2012-04-15 03:45:31 +0000
@@ -102,8 +102,8 @@
<artifactId>clusterj-core</artifactId>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>com.mysql.clusterj</groupId>
+ <artifactId>clusterj-unit</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
=== modified file 'storage/ndb/clusterj/clusterj-test/src/main/java/testsuite/clusterj/AbstractQueryTest.java'
--- a/storage/ndb/clusterj/clusterj-test/src/main/java/testsuite/clusterj/AbstractQueryTest.java 2011-10-02 21:20:50 +0000
+++ b/storage/ndb/clusterj/clusterj-test/src/main/java/testsuite/clusterj/AbstractQueryTest.java 2012-04-15 03:43:47 +0000
@@ -457,6 +457,11 @@ abstract public class AbstractQueryTest
public void inQuery(String propertyName, Object parameterValue1,
String expectedIndex, int... expected) {
+ inQuery("", propertyName, parameterValue1, expectedIndex, expected);
+ }
+
+ public void inQuery(String extraInfo, String propertyName, Object parameterValue1,
+ String expectedIndex, int... expected) {
tx.begin();
QueryHolder holder = new QueryHolder(getInstanceType(), propertyName, expectedIndex);
// specify the where clause
@@ -467,7 +472,7 @@ abstract public class AbstractQueryTest
holder.setParameterIn(parameterValue1);
// get the results
holder.setExpectedResultIds(expected);
- holder.checkResults(propertyName + " in");
+ holder.checkResults(extraInfo + propertyName + " in");
tx.commit();
}
=== modified file 'storage/ndb/clusterj/clusterj-test/src/main/java/testsuite/clusterj/QueryMultiColumnIndexInTest.java'
--- a/storage/ndb/clusterj/clusterj-test/src/main/java/testsuite/clusterj/QueryMultiColumnIndexInTest.java 2012-04-04 06:46:06 +0000
+++ b/storage/ndb/clusterj/clusterj-test/src/main/java/testsuite/clusterj/QueryMultiColumnIndexInTest.java 2012-04-15 03:43:47 +0000
@@ -30,6 +30,7 @@ import testsuite.clusterj.model.LongIntS
* This test is based on AbstractQueryTest.
*/
public class QueryMultiColumnIndexInTest extends AbstractQueryTest {
+
/*
drop table if exists longintstringix;
create table longintstringix (
@@ -49,6 +50,9 @@ create table longintstringix (
return LongIntStringIndex.class;
}
+ /** The number of iterations of the multi-range IN test */
+ private static final int MULTI_RANGE_IN_ITERATIONS = 1;
+
protected int PK_MODULUS = 3;
protected long PRETTY_BIG_NUMBER = 1000000000000000L;
@@ -103,13 +107,15 @@ create table longintstringix (
}
public void testPrettyBigIn() {
- int arraySize = 20;
+ int arraySize = 4096;
Integer[] keys = new Integer[arraySize];
for (int i = 0; i < arraySize; ++i) {
keys[i] = i;
}
int[] expectedKeys = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- inQuery("id", keys, "PRIMARY", expectedKeys);
+ for (int i = 0; i < MULTI_RANGE_IN_ITERATIONS; ++i) {
+ inQuery("iteration " + Integer.toString(i) + " ", "id", keys, "PRIMARY", expectedKeys);
+ }
failOnError();
}
=== modified file 'storage/ndb/clusterj/clusterj-tie/pom.xml'
--- a/storage/ndb/clusterj/clusterj-tie/pom.xml 2012-03-29 17:42:19 +0000
+++ b/storage/ndb/clusterj/clusterj-tie/pom.xml 2012-04-15 03:45:31 +0000
@@ -141,8 +141,8 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>com.mysql.clusterj</groupId>
+ <artifactId>clusterj-unit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
=== modified file 'storage/ndb/clusterj/clusterj-tie/src/test/java/testsuite/clusterj/tie/ConnectionPoolTest.java'
--- a/storage/ndb/clusterj/clusterj-tie/src/test/java/testsuite/clusterj/tie/ConnectionPoolTest.java 2012-03-05 22:28:15 +0000
+++ b/storage/ndb/clusterj/clusterj-tie/src/test/java/testsuite/clusterj/tie/ConnectionPoolTest.java 2012-04-15 03:42:07 +0000
@@ -17,8 +17,7 @@
package testsuite.clusterj.tie;
-import org.junit.Ignore;
-
+@stripped
public class ConnectionPoolTest extends testsuite.clusterj.ConnectionPoolTest {
}
=== modified file 'storage/ndb/clusterj/clusterj-tie/src/test/java/testsuite/clusterj/tie/StressTest.java'
--- a/storage/ndb/clusterj/clusterj-tie/src/test/java/testsuite/clusterj/tie/StressTest.java 2012-02-08 17:27:45 +0000
+++ b/storage/ndb/clusterj/clusterj-tie/src/test/java/testsuite/clusterj/tie/StressTest.java 2012-04-15 03:42:07 +0000
@@ -17,6 +17,7 @@
package testsuite.clusterj.tie;
+@stripped
public class StressTest extends testsuite.clusterj.StressTest {
}
=== added directory 'storage/ndb/clusterj/clusterj-unit'
=== added file 'storage/ndb/clusterj/clusterj-unit/pom.xml'
--- a/storage/ndb/clusterj/clusterj-unit/pom.xml 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/clusterj/clusterj-unit/pom.xml 2012-04-14 21:37:35 +0000
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>com.mysql.clusterj</groupId>
+ <artifactId>clusterj-aggregate</artifactId>
+ <version>7.1.22-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.mysql.clusterj</groupId>
+ <artifactId>clusterj-unit</artifactId>
+ <packaging>jar</packaging>
+ <version>7.1.22-SNAPSHOT</version>
+ <name>ClusterJ Unit Test Framework</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <netbeans.hint.useExternalMaven>false</netbeans.hint.useExternalMaven>
+ </properties>
+ <licenses>
+ <license>
+ <name>GPLv2</name>
+ <url>http://www.gnu.org/licenses/gpl-2.0.txt</url>
+ </license>
+ </licenses>
+</project>
=== added directory 'storage/ndb/clusterj/clusterj-unit/src'
=== added directory 'storage/ndb/clusterj/clusterj-unit/src/main'
=== added directory 'storage/ndb/clusterj/clusterj-unit/src/main/java'
=== added directory 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit'
=== added directory 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework'
=== added file 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/AssertionFailedError.java'
--- a/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/AssertionFailedError.java 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/AssertionFailedError.java 2012-04-14 21:37:35 +0000
@@ -0,0 +1,50 @@
+/*
+ Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * This assortment of classes is a mock http://en.wikipedia.org/wiki/Mock_object
+ * implementation of junit http://en.wikipedia.org/wiki/Junit. It contains annotations,
+ * classes, and interfaces that mock junit for use with test classes
+ * that use a subset of junit functionality.
+ * <p>
+ * In clusterj, test classes can use either the real junit or this mock junit.
+ * The mock can be used stand-alone or invoked by the maven surefire junit plugin.
+ * Other test runners and harnesses might not have been tested and might not work.
+ * <p>
+ * There is no code copied from Junit itself. Only concepts and names of
+ * annotations, interfaces, classes, and methods are copied, which must exactly match
+ * the corresponding items from junit in order to be mocked.
+ */
+
+package junit.framework;
+
+public class AssertionFailedError extends AssertionError {
+
+ private static final long serialVersionUID= 1L;
+
+ /** Construct an AssertionFailedError with no failure message (highly unusual).
+ */
+ public AssertionFailedError() {
+ }
+
+ /** Construct an AssertionFailedError with the failure message.
+ * @param message the message
+ */
+ public AssertionFailedError(String message) {
+ super(message);
+ }
+}
=== added file 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/Test.java'
--- a/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/Test.java 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/Test.java 2012-04-14 21:37:35 +0000
@@ -0,0 +1,39 @@
+/*
+ Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * This assortment of classes is a mock http://en.wikipedia.org/wiki/Mock_object
+ * implementation of junit http://en.wikipedia.org/wiki/Junit. It contains annotations,
+ * classes, and interfaces that mock junit for use with test classes
+ * that use a subset of junit functionality.
+ * <p>
+ * In clusterj, test classes can use either the real junit or this mock junit.
+ * The mock can be used stand-alone or invoked by the maven surefire junit plugin.
+ * Other test runners and harnesses might not have been tested and might not work.
+ * <p>
+ * There is no code copied from Junit itself. Only concepts and names of
+ * annotations, interfaces, classes, and methods are copied, which must exactly match
+ * the corresponding items from junit in order to be mocked.
+ */
+
+package junit.framework;
+
+/** This interface is implemented by a TestCase class.
+ */
+public interface Test {
+ void run(TestResult result);
+}
=== added file 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestCase.java'
--- a/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestCase.java 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestCase.java 2012-04-14 21:37:35 +0000
@@ -0,0 +1,92 @@
+/*
+ Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * This assortment of classes is a mock http://en.wikipedia.org/wiki/Mock_object
+ * implementation of junit http://en.wikipedia.org/wiki/Junit. It contains annotations,
+ * classes, and interfaces that mock junit for use with test classes
+ * that use a subset of junit functionality.
+ * <p>
+ * In clusterj, test classes can use either the real junit or this mock junit.
+ * The mock can be used stand-alone or invoked by the maven surefire junit plugin.
+ * Other test runners and harnesses might not have been tested and might not work.
+ * <p>
+ * There is no code copied from Junit itself. Only concepts and names of
+ * annotations, interfaces, classes, and methods are copied, which must exactly match
+ * the corresponding items from junit in order to be mocked.
+ */
+
+package junit.framework;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+public abstract class TestCase implements Test {
+ public String name;
+ public Method method;
+
+ /** Run a single test case (method). If the test case fails an assertion
+ * via the fail(String) method, add the test to result.failures.
+ * If the test case fails by throwing an exception, or
+ * if the test case fails in setUp or tearDown, add the test case
+ * to result.errors.
+ */
+ public void run(TestResult result) {
+// System.out.println("--> TestCase.run(TestResult): " + name);
+ TestListener listener = result.listener;
+ listener.startTest(this);
+ try {
+ setUp();
+ try {
+ method.invoke(this);
+ result.successes.add(name);
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getCause();
+ if (t instanceof AssertionFailedError) {
+ result.failures.add(name);
+ listener.addFailure(this, (AssertionFailedError)t);
+ } else {
+ result.throwables.add(t);
+ listener.addError(this, t);
+ }
+ } finally {
+ tearDown();
+ }
+ } catch (Throwable t) {
+ result.throwables.add(t);
+ listener.addError(this, t);
+ }
+ listener.endTest(this);
+// System.out.println("<-- TestCase.run(TestResult): " + name);
+ }
+
+ /** The test case failed due to a failed assertion.
+ * @param message the failure message
+ */
+ static public void fail(String message) {
+ throw new AssertionFailedError(message);
+ }
+
+ protected void setUp() throws Exception {}
+
+ protected void tearDown() throws Exception {}
+
+ public int countTestCases() {
+ return 0;
+ }
+
+}
=== added file 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestListener.java'
--- a/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestListener.java 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestListener.java 2012-04-14 21:37:35 +0000
@@ -0,0 +1,55 @@
+/*
+ Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * This assortment of classes is a mock http://en.wikipedia.org/wiki/Mock_object
+ * implementation of junit http://en.wikipedia.org/wiki/Junit. It contains annotations,
+ * classes, and interfaces that mock junit for use with test classes
+ * that use a subset of junit functionality.
+ * <p>
+ * In clusterj, test classes can use either the real junit or this mock junit.
+ * The mock can be used stand-alone or invoked by the maven surefire junit plugin.
+ * Other test runners and harnesses might not have been tested and might not work.
+ * <p>
+ * There is no code copied from Junit itself. Only concepts and names of
+ * annotations, interfaces, classes, and methods are copied, which must exactly match
+ * the corresponding items from junit in order to be mocked.
+ */
+
+package junit.framework;
+
+/** This interface is used to monitor the execution of tests and track errors and failures.
+ * It is implemented as part of the test runner framework.
+ */
+public interface TestListener {
+
+ /** An error (exception) occurred during the execution of the test.
+ */
+ public void addError(Test test, Throwable t);
+
+ /** A failure (assertion) occurred during the execution of the test.
+ */
+ public void addFailure(Test test, AssertionFailedError t);
+
+ /** A test ended.
+ */
+ public void endTest(Test test);
+
+ /** A test started.
+ */
+ public void startTest(Test test);
+}
=== added file 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestResult.java'
--- a/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestResult.java 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestResult.java 2012-04-14 21:37:35 +0000
@@ -0,0 +1,54 @@
+/*
+ Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * This assortment of classes is a mock http://en.wikipedia.org/wiki/Mock_object
+ * implementation of junit http://en.wikipedia.org/wiki/Junit. It contains annotations,
+ * classes, and interfaces that mock junit for use with test classes
+ * that use a subset of junit functionality.
+ * <p>
+ * In clusterj, test classes can use either the real junit or this mock junit.
+ * The mock can be used stand-alone or invoked by the maven surefire junit plugin.
+ * Other test runners and harnesses might not have been tested and might not work.
+ * <p>
+ * There is no code copied from Junit itself. Only concepts and names of
+ * annotations, interfaces, classes, and methods are copied, which must exactly match
+ * the corresponding items from junit in order to be mocked.
+ */
+
+package junit.framework;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/** This class maintains the results of running a series of tests. It is the primary
+ * way for a test class to return results of tests.
+ */
+public class TestResult {
+ public final List<String> successes = new ArrayList<String>();
+ public final List<String> failures = new ArrayList<String>();
+ public final List<Throwable> throwables = new ArrayList<Throwable>();
+ public TestListener listener;
+
+ public void addListener(TestListener listener) {
+ this.listener = listener;
+ }
+
+ public synchronized boolean wasSuccessful() {
+ return failures.isEmpty();
+ }
+}
=== added file 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestSuite.java'
--- a/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestSuite.java 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/framework/TestSuite.java 2012-04-14 21:37:35 +0000
@@ -0,0 +1,130 @@
+/*
+ Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * This assortment of classes is a mock http://en.wikipedia.org/wiki/Mock_object
+ * implementation of junit http://en.wikipedia.org/wiki/Junit. It contains annotations,
+ * classes, and interfaces that mock junit for use with test classes
+ * that use a subset of junit functionality.
+ * <p>
+ * In clusterj, test classes can use either the real junit or this mock junit.
+ * The mock can be used stand-alone or invoked by the maven surefire junit plugin.
+ * Other test runners and harnesses might not have been tested and might not work.
+ * <p>
+ * There is no code copied from Junit itself. Only concepts and names of
+ * annotations, interfaces, classes, and methods are copied, which must exactly match
+ * the corresponding items from junit in order to be mocked.
+ */
+
+package junit.framework;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.junit.Ignore;
+
+public class TestSuite implements Test {
+ public final String name;
+ public final List<String> testClasses = new ArrayList<String>();
+ public final List<TestCase> tests = new ArrayList<TestCase>();
+
+ public Ignore ignoreTypeAnnotation = null;
+ public String ignoreTypeReason = null;
+
+ /** Create a new test suite; add tests later.
+ * @param name the name of the test suite
+ */
+ public TestSuite(String name) {
+ this.name = name;
+ }
+
+ /** Create a new test suite with a single test class.
+ * @param cls the test class
+ */
+ @SuppressWarnings("unchecked") // addTestSuite((Class<? extends TestCase>) cls);
+ public TestSuite(Class<?> cls) {
+ this.name = cls.getName();
+ if (TestCase.class.isAssignableFrom(cls)) {
+ addTestSuite((Class<? extends TestCase>) cls);
+ } else {
+ throw new RuntimeException("TestSuite<init>: " + cls.getName());
+ }
+ }
+
+ /** Add a test class to this suite. If the class is annotated with @Ignore,
+ * skip running any test methods. If a method is annotated with @Ignore,
+ * skip running that test.
+ * @param testClass the test class
+ */
+ public void addTestSuite(Class<? extends TestCase> testClass) {
+ ignoreTypeAnnotation = testClass.getAnnotation(Ignore.class);
+ ignoreTypeReason = ignoreTypeAnnotation == null? null: ignoreTypeAnnotation.value();
+ testClasses.add(testClass.getName());
+ final Method[] methods = testClass.getMethods();
+ Ignore ignoreMethodAnnotation = null;
+ String ignoreMethodReason = null;
+ for (Method m : methods) {
+ ignoreMethodAnnotation = m.getAnnotation(Ignore.class);
+ ignoreMethodReason = ignoreMethodAnnotation == null? null: ignoreMethodAnnotation.value();
+ // public void methods that begin with "test" and have no parameters are considered to be tests
+ if (m.getName().startsWith("test")
+ && m.getParameterTypes().length == 0
+ && m.getReturnType().equals(Void.TYPE)
+ && Modifier.isPublic(m.getModifiers())) {
+ try {
+// System.out.println("TestSuite found " + m.getName());
+ if (ignoreTypeAnnotation != null || ignoreMethodAnnotation != null) {
+ System.out.println(m.getName() +
+ " @Ignore: " + ignoreTypeReason + ":" + ignoreMethodReason);
+ } else {
+ TestCase t = testClass.newInstance();
+ t.name = testClass.getSimpleName() + "." + m.getName();
+ t.method = m;
+ tests.add(t);
+ }
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+ }
+
+ public int testCount() {
+ return tests.size();
+ }
+
+ public int countTestCases() {
+ return tests.size();
+ }
+
+ /** Run all tests in this suite. For each test, call the run method.
+ * @param result the result to receive the outcome of the test
+ */
+ public void run(TestResult result) {
+// System.out.println("--> TestSuite.run(TestResult)");
+// System.out.println(" test suite: " + name);
+// System.out.println(" test classes: " + testClasses.size());
+// System.out.println(" test cases: " + tests.size());
+ for (TestCase test : tests) {
+ test.run(result);
+ }
+// System.out.println("<-- TestSuite.run(TestResult)");
+ }
+
+}
=== added directory 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit/textui'
=== added file 'storage/ndb/clusterj/clusterj-unit/src/main/java/junit/textui/TestRunner.java'
--- a/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/textui/TestRunner.java 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/clusterj/clusterj-unit/src/main/java/junit/textui/TestRunner.java 2012-04-14 21:37:35 +0000
@@ -0,0 +1,47 @@
+/*
+ Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * This assortment of classes is a mock http://en.wikipedia.org/wiki/Mock_object
+ * implementation of junit http://en.wikipedia.org/wiki/Junit. It contains annotations,
+ * classes, and interfaces that mock junit for use with test classes
+ * that use a subset of junit functionality.
+ * <p>
+ * In clusterj, test classes can use either the real junit or this mock junit.
+ * The mock can be used stand-alone or invoked by the maven surefire junit plugin.
+ * Other test runners and harnesses might not have been tested and might not work.
+ * <p>
+ * There is no code copied from Junit itself. Only concepts and names of
+ * annotations, interfaces, classes, and methods are copied, which must exactly match
+ * the corresponding items from junit in order to be mocked.
+ */
+
+package junit.textui;
+
+import junit.framework.Test;
+import junit.framework.TestResult;
+
+/** Run a single test and return the result. Construct an instance of TestResult,
+ * pass it to the Test, and return it when the test completes.
+ */
+public class TestRunner {
+ static public TestResult run(Test test) {
+ final TestResult result = new TestResult();
+ test.run(result);
+ return result;
+ }
+}
=== added directory 'storage/ndb/clusterj/clusterj-unit/src/main/java/org'
=== added directory 'storage/ndb/clusterj/clusterj-unit/src/main/java/org/junit'
=== added file 'storage/ndb/clusterj/clusterj-unit/src/main/java/org/junit/Ignore.java'
--- a/storage/ndb/clusterj/clusterj-unit/src/main/java/org/junit/Ignore.java 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/clusterj/clusterj-unit/src/main/java/org/junit/Ignore.java 2012-04-14 21:37:35 +0000
@@ -0,0 +1,50 @@
+/*
+ Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * This assortment of classes is a mock http://en.wikipedia.org/wiki/Mock_object
+ * implementation of junit http://en.wikipedia.org/wiki/Junit. It contains annotations,
+ * classes, and interfaces that mock junit for use with test classes
+ * that use a subset of junit functionality.
+ * <p>
+ * In clusterj, test classes can use either the real junit or this mock junit.
+ * The mock can be used stand-alone or invoked by the maven surefire junit plugin.
+ * Other test runners and harnesses might not have been tested and might not work.
+ * <p>
+ * There is no code copied from Junit itself. Only concepts and names of
+ * annotations, interfaces, classes, and methods are copied, which must exactly match
+ * the corresponding items from junit in order to be mocked.
+ */
+
+package org.junit;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/** This annotation can be used either on a test class to skip all tests contained
+ * within, or on a test method to skip a specific test method. The optional value()
+ * can be used to document why a test class or test method should not be run.
+ * <p>
+ * For example: @Ignore("test uses excessive cpu")
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.TYPE})
+public @interface Ignore {
+ String value() default "";
+}
=== modified file 'storage/ndb/clusterj/pom.xml'
--- a/storage/ndb/clusterj/pom.xml 2012-03-29 17:42:19 +0000
+++ b/storage/ndb/clusterj/pom.xml 2012-04-15 03:45:31 +0000
@@ -35,6 +35,7 @@
<module>clusterj-jdbc</module>
<module>clusterj-jpatest</module>
<module>clusterj-openjpa</module>
+ <module>clusterj-unit</module>
</modules>
<build>
<pluginManagement>
@@ -63,12 +64,6 @@
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.7</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr</artifactId>
<version>3.2</version>
@@ -114,6 +109,12 @@
<artifactId>ndbjtie</artifactId>
<version>7.1.22-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>com.mysql.clusterj</groupId>
+ <artifactId>clusterj-unit</artifactId>
+ <version>7.1.22-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</dependencyManagement>
<licenses>
=== modified file 'storage/ndb/src/mgmsrv/ConfigInfo.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2012-03-12 09:57:10 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2012-04-16 10:34:32 +0000
@@ -3955,7 +3955,8 @@ public:
pairs.put("name", param_name);
pairs.put("comment", info.getDescription(section, param_name));
- switch (info.getType(section, param_name)) {
+ const ConfigInfo::Type param_type = info.getType(section, param_name);
+ switch (param_type) {
case ConfigInfo::CI_BOOL:
pairs.put("type", "bool");
@@ -3996,6 +3997,13 @@ public:
pairs.put("mandatory", "true");
else if (info.hasDefault(section, param_name))
pairs.put("default", info.getDefaultString(section, param_name));
+
+ if (param_type == ConfigInfo::CI_ENUM)
+ {
+ // Concatenate the allowed enum values to a space separated string
+ info.get_enum_values(section, param_name, buf);
+ require(pairs.put("allowed_values", buf.c_str()));
+ }
break;
case ConfigInfo::CI_SECTION:
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5-cluster-7.2 branch (magnus.blaudd:3888 to 3889) | magnus.blaudd | 20 Apr |