On 18.11.2011, at 12:19, Ali Anil SINACI wrote:

> Hi,
> 
> AFAICS org.apache.stanbol.commons.testing.http.RequestBuilder class only 
> makes use of "query parameters". In contenthub, to test the interfaces which 
> do not accept query parameters, T think we will
> 
>   * write corresponding interfaces which accept query paramters (this
>     way, we can make use of RequestBuilder class through RequestExecutor)
>   * extend the related classes (Request, RequestBuilder etc.) to allow
>     posting other types of parameters (I'm not sure about this)
>   * make use of Jersey client to write our integration tests (I prefer
>     this one)
> 

As far as I can see there is a Method for building a POST request and an other 
that takes HttpRequestBase as an parameter. The later allows you to create any 
HttpRequst you want.


> I wonder whether it creates any problem to use Jersey client to write 
> integration tests or not.
> 
> Regarding the unit tests, we need to instantiate the components independent 
> of an OSGi environment. To do this, I plan to implement the constructors of 
> each component, however they should be highly parametric since they also 
> depend on other components which should also be instantiated through 
> constructors. But, having a good design in the parameters, it may be an 
> opportunity to provide some functionalities of Stanbol independent of OSGi 
> (standalone jars). On the other hand, we might make use of Pax-Exam testing 
> framework, but afaik it starts an independent OSGi environment (to load the 
> dependencies) for each test class. I am also not sure about the duration of 
> tests with Pax-Exam.
> 
In the Entityhub some Components are also useable outside of OSGI. The same is 
true for the commons.solr stuff. 

For this components I have used:

* java.util.ServiceLoader in the case I need to find implementations of an 
interface
* Singelton Pattern (static getInstance() metods) in case I do only need a 
singe service instance
* Constructors with additional parameters to create instances if only some 
parameters are needed
* Configuration classes that wrap Dictionary<String,Object> in cases where a 
lot of parameters are required to create instances. see e.g. the 
YardConfiguration and SolrYardConfiguration classes.

In general it is very painful to also support the use of components within and 
outside of OSGI and I would rather remove the existing support than trying to 
extend it to other parts of Stanbol.

best
Rupert


> I will appreciate your comments in these issues.
> 
> Best,
> 
> Anil.
> 
> -- 
> Ali Anil SINACI
> 
> Software Research, Development and Consultancy Ltd.
> Phone: +90 (312) 2101763
> Fax: +90 (312) 2101837
> E-mail:[email protected]
> 

Reply via email to