Christian, I was reviewing the Spring code again to answer your questions and I think I arrived at a solution that won't require copying. I misunderstood the inheritance mechanism used by Spring with respect to their testing related annotations and I have found an acceptable compromise solution for dealing with the fact that the super class precludes custom initialization of some member variables.
With these two developments, I can avoid needing to duplicate any of the Spring code in the Camel sub-class. Sorry I wasted your time, but your questions helped me to reevaluate the situation. Thanks for your help! David Valeri ------------------- Twitter: DavidValeri Blog: http://davidvaleri.wordpress.com/ FuseSource: http://fusesource.com On Feb 26, 2012, at 5:32 PM, Christian Müller wrote: > Hi David! > > Here are some questions: > - What's exactly the problem to subclass this class? > - Is it really necessary to copy the code or is it possible to create a own > class that is very similar? > - In which package this class will be live (org.apache.camel.xxx or > com.springframework.yyy)? > > Best, > Christian > > On Tue, Feb 7, 2012 at 3:02 PM, David Valeri <dval...@apache.org> wrote: > >> I'm working on CAMEL-4987 [1] and I have a situation where a class >> from Spring cannot be extended. The class in question, >> AbstractTestNGSpringContextTests [2], is a part of the Spring Test >> library. It uses an annotation that precludes extension in this use >> case. The Spring documentation indicates that extension of the class >> may not always be desirable and provides guidance on implementing the >> class on your own. >> >> The class is extremely simple and does not represent a significant >> maintenance issue going forward; however, in order to maintain the >> functionality of the class, two methods need to be lifted as-is from >> the original class. The methods are "run" and >> "springTestContextAfterTestMethod". The methods contain about 10 >> lines of code that are core to the functionality of the class. The >> original class also contains a number of trivial one-line methods. >> The Camel implementation would contain methods that produce similar >> outcomes but are not strictly identical. >> >> In my own code I would retain the copyright header, document >> departures from the original in accordance with the ASL, and move on; >> however, I realize that Apache needs to be careful about ownership of >> the code. What is the correct solution when doing this on code >> intended for Apache? I want to make sure that I can protect Apache >> and also honor the license of the original code. >> >> [1] - https://issues.apache.org/jira/browse/CAMEL-4987 >> [2] - >> http://grepcode.com/file_/repo1.maven.org/maven2/org.springframework/spring-test/3.0.7.RELEASE/org/springframework/test/context/testng/AbstractTestNGSpringContextTests.java/?v=source >> >> -- >> David Valeri >> ------------------- >> Twitter: DavidValeri >> Blog: http://davidvaleri.wordpress.com/ >>