[
https://issues.apache.org/jira/browse/SOLR-9966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15873643#comment-15873643
]
Uwe Schindler commented on SOLR-9966:
-------------------------------------
Sorry, misunderstood your comment: The problem is with passing "driver" to
theDriverManager, not the InitialContextFactory.
On Java 9 with module system, Class.forName() cannot work, as the class is
injected into the JVM using special sun.misc.Unsafe tricks as anonymous class
(without any public class name, you only see
"codegen.java.sql.Driver$MockitoMock$...randomunicodechars..."). The class name
is just there for display purposes, but you cannot load it. In fact this
*could* also break with Java 8, if Mockito would implement injecting of mock
classes different there (e.g. on IBM's JVM).
So this test should be removed or rewritten to not use class names and instead
pass instances. The class names of Mock classes can by default not used to call
Class#forName.
> Convert/migrate tests using EasyMock to Mockito
> -----------------------------------------------
>
> Key: SOLR-9966
> URL: https://issues.apache.org/jira/browse/SOLR-9966
> Project: Solr
> Issue Type: Task
> Security Level: Public(Default Security Level. Issues are Public)
> Components: Tests
> Reporter: Uwe Schindler
> Assignee: Cao Manh Dat
> Labels: Java9
> Fix For: 6.5, master (7.0)
>
> Attachments: SOLR-9966.patch
>
>
> In SOLR-9893 I disabled all tests on Java 9 that use EasyMock, because
> Easymock is not compatible with Java 9 (it uses outdated cglib version that
> does not work with Jigsaw module system). To me the project seems dead (no
> releases since more than 2 years).
> Mockito latest version is compatible to Java 9 because it no longer uses
> cglib and the more modern and powerful Byte-Buddy lib; SOLR-9893 updated to
> it.
> I found this about more or less "automated rewrite" of EasyMock tests to
> Mockito:
> -
> https://wiki.magnolia-cms.com/display/DEV/Converting+Easymock-Tests+to+Mockito
> - A script doing this:
> https://gist.github.com/stefanbirkner/1095194/904909cc229b6acb55c18f529e396089129e20e9
> It is not many tests, so this would be a great cleanup:
> - core/src/test/org/apache/solr/cloud/ClusterStateTest.java
> -
> core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java
> - core/src/test/org/apache/solr/core/BlobRepositoryMockingTest.java
> - core/src/test/org/apache/solr/core/CoreSorterTest.java
> - core/src/test/org/apache/solr/security/TestPKIAuthenticationPlugin.java
> - core/src/test/org/apache/solr/servlet/SolrRequestParserTest.java
> -
> solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientCacheTest.java
> There is one special case:
> -
> contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestJdbcDataSource.java
> I am not sure how to convert this one, because it uses some strange system
> properties and a handler that intercepts some EasyMock stuff. I may need help
> to convert that one!
> After this is resolved we can remove the following dependencies from Solr:
> - cglib-nodep
> - easymock
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]