Repository: drill
Updated Branches:
  refs/heads/master 8bb6b08e5 -> f7ef5ec78


DRILL-2130: Fixed JUnit/Hamcrest/Mockito/Paranamer class path problem.


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/b0faf708
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/b0faf708
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/b0faf708

Branch: refs/heads/master
Commit: b0faf708bdbeb53bc3a446d3782554640bdfd6df
Parents: 8bb6b08
Author: dbarclay <dbarc...@maprtech.com>
Authored: Sun Feb 22 00:45:42 2015 -0800
Committer: Aditya Kishore <a...@apache.org>
Committed: Wed Feb 25 11:08:20 2015 -0800

----------------------------------------------------------------------
 ...rill2130CommonHamcrestConfigurationTest.java | 46 ++++++++++++++++++++
 ...30StorageHBaseHamcrestConfigurationTest.java | 46 ++++++++++++++++++++
 ...torageHiveCoreHamcrestConfigurationTest.java | 46 ++++++++++++++++++++
 ...130InterpreterHamcrestConfigurationTest.java | 46 ++++++++++++++++++++
 exec/java-exec/pom.xml                          |  9 ++++
 ...ll2130JavaExecHamcrestConfigurationTest.java | 46 ++++++++++++++++++++
 ...ll2130JavaJdbcHamcrestConfigurationTest.java | 46 ++++++++++++++++++++
 pom.xml                                         |  8 ++++
 8 files changed, 293 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/common/src/test/java/org/apache/drill/test/Drill2130CommonHamcrestConfigurationTest.java
----------------------------------------------------------------------
diff --git 
a/common/src/test/java/org/apache/drill/test/Drill2130CommonHamcrestConfigurationTest.java
 
b/common/src/test/java/org/apache/drill/test/Drill2130CommonHamcrestConfigurationTest.java
new file mode 100644
index 0000000..99643b1
--- /dev/null
+++ 
b/common/src/test/java/org/apache/drill/test/Drill2130CommonHamcrestConfigurationTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.drill.test;
+
+import org.junit.Test;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+
+public class Drill2130CommonHamcrestConfigurationTest {
+
+  @SuppressWarnings("unused")
+  private org.hamcrest.MatcherAssert forCompileTimeCheckForNewEnoughHamcrest;
+
+  @Test
+  public void testJUnitHamcrestMatcherFailureWorks() {
+    try {
+      assertThat( 1, equalTo( 2 ) );
+    }
+    catch ( NoSuchMethodError e ) {
+      fail( "Class search path seems broken re new JUnit and old Hamcrest."
+             + "  Got NoSuchMethodError;  e: " + e );
+    }
+    catch ( AssertionError e ) {
+      System.out.println( "Class path seems fine re new JUnit vs. old 
Hamcrest."
+                          + " (Got AssertionError, not NoSuchMethodError.)" );
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/test/Drill2130StorageHBaseHamcrestConfigurationTest.java
----------------------------------------------------------------------
diff --git 
a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/test/Drill2130StorageHBaseHamcrestConfigurationTest.java
 
b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/test/Drill2130StorageHBaseHamcrestConfigurationTest.java
new file mode 100644
index 0000000..b52654d
--- /dev/null
+++ 
b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/test/Drill2130StorageHBaseHamcrestConfigurationTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.drill.hbase.test;
+
+import org.junit.Test;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+
+public class Drill2130StorageHBaseHamcrestConfigurationTest {
+
+  @SuppressWarnings("unused")
+  private org.hamcrest.MatcherAssert forCompileTimeCheckForNewEnoughHamcrest;
+
+  @Test
+  public void testJUnitHamcrestMatcherFailureWorks() {
+    try {
+      assertThat( 1, equalTo( 2 ) );
+    }
+    catch ( NoSuchMethodError e ) {
+      fail( "Class search path seems broken re new JUnit and old Hamcrest."
+             + "  Got NoSuchMethodError;  e: " + e );
+    }
+    catch ( AssertionError e ) {
+      System.out.println( "Class path seems fine re new JUnit vs. old 
Hamcrest."
+                          + " (Got AssertionError, not NoSuchMethodError.)" );
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/test/Drill2130StorageHiveCoreHamcrestConfigurationTest.java
----------------------------------------------------------------------
diff --git 
a/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/test/Drill2130StorageHiveCoreHamcrestConfigurationTest.java
 
b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/test/Drill2130StorageHiveCoreHamcrestConfigurationTest.java
new file mode 100644
index 0000000..eaa1b45
--- /dev/null
+++ 
b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/test/Drill2130StorageHiveCoreHamcrestConfigurationTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.drill.exec.test;
+
+import org.junit.Test;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+
+public class Drill2130StorageHiveCoreHamcrestConfigurationTest {
+
+  @SuppressWarnings("unused")
+  private org.hamcrest.MatcherAssert forCompileTimeCheckForNewEnoughHamcrest;
+
+  @Test
+  public void testJUnitHamcrestMatcherFailureWorks() {
+    try {
+      assertThat( 1, equalTo( 2 ) );
+    }
+    catch ( NoSuchMethodError e ) {
+      fail( "Class search path seems broken re new JUnit and old Hamcrest."
+             + "  Got NoSuchMethodError;  e: " + e );
+    }
+    catch ( AssertionError e ) {
+      System.out.println( "Class path seems fine re new JUnit vs. old 
Hamcrest."
+                          + " (Got AssertionError, not NoSuchMethodError.)" );
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/exec/interpreter/src/test/java/org/apache/drill/exec/expr/test/Drill2130InterpreterHamcrestConfigurationTest.java
----------------------------------------------------------------------
diff --git 
a/exec/interpreter/src/test/java/org/apache/drill/exec/expr/test/Drill2130InterpreterHamcrestConfigurationTest.java
 
b/exec/interpreter/src/test/java/org/apache/drill/exec/expr/test/Drill2130InterpreterHamcrestConfigurationTest.java
new file mode 100644
index 0000000..41cf75b
--- /dev/null
+++ 
b/exec/interpreter/src/test/java/org/apache/drill/exec/expr/test/Drill2130InterpreterHamcrestConfigurationTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.drill.exec.expr.test;
+
+import org.junit.Test;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+
+public class Drill2130InterpreterHamcrestConfigurationTest {
+
+  @SuppressWarnings("unused")
+  private org.hamcrest.MatcherAssert forCompileTimeCheckForNewEnoughHamcrest;
+
+  @Test
+  public void testJUnitHamcrestMatcherFailureWorks() {
+    try {
+      assertThat( 1, equalTo( 2 ) );
+    }
+    catch ( NoSuchMethodError e ) {
+      fail( "Class search path seems broken re new JUnit and old Hamcrest."
+             + "  Got NoSuchMethodError;  e: " + e );
+    }
+    catch ( AssertionError e ) {
+      System.out.println( "Class path seems fine re new JUnit vs. old 
Hamcrest."
+                          + " (Got AssertionError, not NoSuchMethodError.)" );
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/exec/java-exec/pom.xml
----------------------------------------------------------------------
diff --git a/exec/java-exec/pom.xml b/exec/java-exec/pom.xml
index 06f60fb..28eca2b 100644
--- a/exec/java-exec/pom.xml
+++ b/exec/java-exec/pom.xml
@@ -57,6 +57,15 @@
       <groupId>com.thoughtworks.paranamer</groupId>
       <artifactId>paranamer</artifactId>
       <version>2.5.6</version>
+      <exclusions>
+        <!-- Exclude Paranamer's dependency on mockito-all, which has a Jar 
+             file that contains old Hamcrest 1.1 classes (rather than declaring
+             a dependency on Hamcrest).  (See DRILL-2130.) -->
+        <exclusion>
+          <artifactId>mockito-all</artifactId>
+          <groupId>org.mockito</groupId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>xerces</groupId>

http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/exec/java-exec/src/test/java/org/apache/drill/exec/test/Drill2130JavaExecHamcrestConfigurationTest.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/test/java/org/apache/drill/exec/test/Drill2130JavaExecHamcrestConfigurationTest.java
 
b/exec/java-exec/src/test/java/org/apache/drill/exec/test/Drill2130JavaExecHamcrestConfigurationTest.java
new file mode 100644
index 0000000..03d858c
--- /dev/null
+++ 
b/exec/java-exec/src/test/java/org/apache/drill/exec/test/Drill2130JavaExecHamcrestConfigurationTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.drill.exec.test;
+
+import org.junit.Test;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+
+public class Drill2130JavaExecHamcrestConfigurationTest {
+
+  @SuppressWarnings("unused")
+  private org.hamcrest.MatcherAssert forCompileTimeCheckForNewEnoughHamcrest;
+
+  @Test
+  public void testJUnitHamcrestMatcherFailureWorks() {
+    try {
+      assertThat( 1, equalTo( 2 ) );
+    }
+    catch ( NoSuchMethodError e ) {
+      fail( "Class search path seems broken re new JUnit and old Hamcrest."
+             + "  Got NoSuchMethodError;  e: " + e );
+    }
+    catch ( AssertionError e ) {
+      System.out.println( "Class path seems fine re new JUnit vs. old 
Hamcrest."
+                          + " (Got AssertionError, not NoSuchMethodError.)" );
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2130JavaJdbcHamcrestConfigurationTest.java
----------------------------------------------------------------------
diff --git 
a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2130JavaJdbcHamcrestConfigurationTest.java
 
b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2130JavaJdbcHamcrestConfigurationTest.java
new file mode 100644
index 0000000..ada9ad2
--- /dev/null
+++ 
b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2130JavaJdbcHamcrestConfigurationTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.drill.jdbc.test;
+
+import org.junit.Test;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+
+public class Drill2130JavaJdbcHamcrestConfigurationTest {
+
+  @SuppressWarnings("unused")
+  private org.hamcrest.MatcherAssert forCompileTimeCheckForNewEnoughHamcrest;
+
+  @Test
+  public void testJUnitHamcrestMatcherFailureWorks() {
+    try {
+      assertThat( 1, equalTo( 2 ) );
+    }
+    catch ( NoSuchMethodError e ) {
+      fail( "Class search path seems broken re new JUnit and old Hamcrest."
+             + "  Got NoSuchMethodError;  e: " + e );
+    }
+    catch ( AssertionError e ) {
+      System.out.println( "Class path seems fine re new JUnit vs. old 
Hamcrest."
+                          + " (Got AssertionError, not NoSuchMethodError.)" );
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index dc1448c..525579a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -525,6 +525,7 @@
 
     <!-- Test Dependencies -->
     <dependency>
+      <!-- JMockit needs to be on class path before JUnit. -->
       <groupId>com.googlecode.jmockit</groupId>
       <artifactId>jmockit</artifactId>
       <version>1.3</version>
@@ -537,6 +538,13 @@
       <scope>test</scope>
     </dependency>
     <dependency>
+      <!-- Mockito needs to be on the class path after JUnit (or Hamcrest) as 
+           long as Mockito _contains_ older Hamcrest classes.  See DRILL-2130. 
--> 
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <version>1.9.5</version>
+    </dependency>
+    <dependency>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
       <version>1.0.13</version>

Reply via email to