Task #6736
Updated by Rob Nahf almost 10 years ago
developed (with Andrei) CommonCallAdapter and ContextAwareAdapter to allow splitting out of test implementations into separate classes called by the JUnit test methods. CommonCallAdapter is a versionless wrapper that chooses the right NodeFactory for building either a v1.MNode, v2.MNode, v1.CNode, or v2.CNode based on parameters given to the constructor.
The design is to categorize methods into those in common between nodeType and version by API, and have interfaces for each: {API}TestDefinitions, MN{API}TestDefinitions, CN{API}TestDefinitions, V1{API}TestDefinitions, V2{API}TestDefinitions.
Also have implementation classes for each definition class that extend ContextAwareAdapter.
The JUnit IT classes implement the appropriate API test definition classes, and implement non-sharable test implementations.
For example:
CoreTestDefinitions, CoreTestImplementations
MNCoreTestDefinitions, MNCoreTestImplementations
CNCoreTestDefinitions, CNCoreTestImplementations
V1CoreTestDefinitions, V1CoreTestImplementations
V2CoreTestDefinitions, V2CoreTestImplementations
<pre>
public class MNodeV1CoreIT implements CoreTestDefinitions, MNCoreTestDefinitions, V1CoreTestDefinitions extends ContextAwareTestCaseDataone {
CoreTestDefinitions coreTests = new CoreTestImplementation(this);
MNCoreTestDefinitions mnCoreTests = new MNCoreTestImplementations(this);
V1CoreTestDefinitions v1CoreTests = new V1CoreTestImplementations(this);
@Test public void testPing() { coreTests.testPing("v1", getNodeUnderTest()); }
etc...
}
</pre>
The design is to categorize methods into those in common between nodeType and version by API, and have interfaces for each: {API}TestDefinitions, MN{API}TestDefinitions, CN{API}TestDefinitions, V1{API}TestDefinitions, V2{API}TestDefinitions.
Also have implementation classes for each definition class that extend ContextAwareAdapter.
The JUnit IT classes implement the appropriate API test definition classes, and implement non-sharable test implementations.
For example:
CoreTestDefinitions, CoreTestImplementations
MNCoreTestDefinitions, MNCoreTestImplementations
CNCoreTestDefinitions, CNCoreTestImplementations
V1CoreTestDefinitions, V1CoreTestImplementations
V2CoreTestDefinitions, V2CoreTestImplementations
<pre>
public class MNodeV1CoreIT implements CoreTestDefinitions, MNCoreTestDefinitions, V1CoreTestDefinitions extends ContextAwareTestCaseDataone {
CoreTestDefinitions coreTests = new CoreTestImplementation(this);
MNCoreTestDefinitions mnCoreTests = new MNCoreTestImplementations(this);
V1CoreTestDefinitions v1CoreTests = new V1CoreTestImplementations(this);
@Test public void testPing() { coreTests.testPing("v1", getNodeUnderTest()); }
etc...
}
</pre>