[ 
https://issues.apache.org/jira/browse/CASSANDRA-16704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17356571#comment-17356571
 ] 

Angelo Polo commented on CASSANDRA-16704:
-----------------------------------------

If the 'provided' scope is intentionally part of the test dependencies (and not 
just the 'test' scope), then does it make sense to remove the exclusion of 
'provided' from [test jars 
resolution|https://github.com/apache/cassandra/blob/3282f5ecf187ecbb56b8d73ab9a9110c010898b0/.build/build-resolver.xml#L178]?
 Unless there's some other detail with the transitive dependencies, looks like 
this is what provided is for: "A dependency with this scope is added to the 
classpath used for compilation and test, but not the runtime classpath." 
([http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope).]

Then as a bonus, there's no need to duplicate dependencies across provided and 
test. For example:

./build.xml:733: <dependency groupId="org.jboss.byteman" 
artifactId="byteman-install" scope="test"/>
./build.xml:734: <dependency groupId="org.jboss.byteman" artifactId="byteman" 
scope="test"/>
./build.xml:735: <dependency groupId="org.jboss.byteman" 
artifactId="byteman-submit" scope="test"/>
./build.xml:736: <dependency groupId="org.jboss.byteman" 
artifactId="byteman-bmunit" scope="test"/>
./build.xml:830: <dependency groupId="org.jboss.byteman" 
artifactId="byteman-install" scope="provided"/>
./build.xml:831: <dependency groupId="org.jboss.byteman" artifactId="byteman" 
scope="provided"/>
./build.xml:832: <dependency groupId="org.jboss.byteman" 
artifactId="byteman-submit" scope="provided"/>
./build.xml:833: <dependency groupId="org.jboss.byteman" 
artifactId="byteman-bmunit" scope="provided"/>

Though in terms of classpath, we're effectively back where we started since 
instead of joining the compile and provided scopes from build/lib/ with the 
test scope in build/test/lib/ we'd be joining the compile scope in lib/ with 
the test and provided scopes in build/test/lib/.

So let me know if you me to remove the modification to build.xml from the 
patch. At a minimum, I think the two changes to src/ are required for runtime 
correctness.

> Fix imports; run tests with packaged dependencies
> -------------------------------------------------
>
>                 Key: CASSANDRA-16704
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16704
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Build, Test/burn, Test/unit
>            Reporter: Angelo Polo
>            Assignee: Angelo Polo
>            Priority: Normal
>             Fix For: 4.0.x, 4.x
>
>         Attachments: test-with-runtime-deps.patch
>
>
> Tests are currently run with a classpath containing _all_ downloaded jars. 
> The tests would be more reflective of the behavior of a runtime environment 
> if the test classpath only contained jars that are bundled with the binary 
> release, together with explicit test dependencies. Ideally we'd use the 
> build/lib/ jars for the classpath since that's what gets packaged, but since 
> these aren't available at test compile time and should be identical to lib/ 
> anyway, I've used the later.
> Doing so exposed a couple of references in src/java to 
> "org.apache.commons.lang", which is not available at runtime (should be 
> "org.apache.commons.lang*3*").
> Attached patch modifies the test classpath, fixes various imports in both 
> test/ and src/ classes, and makes some simple substitutions in the tests such 
> as using AbstractMap.SimpleEntry in place of 
> org.apache.commons.collections.keyvalue.AbstractMapEntry.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to