Resolvers of all kinds can be implemented via the
resolvers module as
Jython or Groovy scripts as described in section 49.1.
Unless you want to understand how the
resolvers module itself works
or want to implement a resolver in Java you may skip the following sections.
This section describes how to implement a resolver directly by Java classes. However, this will make the code of your application depend on QF-Test classes. The preferred alternative is to implement the resolver interfaces in Jython or Groovy. That way the whole mechanism can be strictly separated from the SUT and will not interfere with the build process.
Additionally to the resolver registration described in this section you need to implement the resolver interfaces described from subsection 49.1.6 and following.
The need for describing such a method as an interface that has to implemented by a class makes resolvers difficult at Java level. Then an instance of that class has to be created and registered for use by QF-Test. If you don't get it right on first try, that instance has to be deregistered before a new instance from a new class can be created and instance thereof registered, otherwise there may be interference between the two versions of the resolver. Add some code for error handling and you've got many times more glue code than actual "flesh".
As stated in section Implementation all exceptions thrown
inside a name resolver will be caught and handled by the
ResolverRegistry. However, instead of dumping a stack trace, the registry
will only print a short message like "Exception inside NameResolver" because some resolvers
may be called very often, and a buggy resolver printing a stack trace for every error
would flood the net and the client terminal. Therefore name resolvers should include
their own error handling. This can still generate a lot of output in some cases, but
the output will be more useful than a Java stack trace.
Before implementing a
resolver in Java please have a look at sections
subsection 49.1.1 and
subsection 49.1.2, where everything not specific to scripts and the
resolvers module itself holds true for resolvers implemented in Java as well.
The singleton class
de.qfs.apps.qftest.extensions.ResolverRegistry is the central agent for
registering and removing name resolvers.
ResolverRegistry API is pretty straightforward:
|Last update: 3/9/2021
Copyright © 1999-2021 Quality First Software GmbH