Hi,

On 24/05/14 05:02, Qihong Lin wrote:
I've completed the code of LdpServiceSPARQLImpl.exist() for RDF
resource. The unit test has been made as well.
Please check my last 2 commits:
https://github.com/confidencesun/marmotta/commits/MARMOTTA-444

Great. I reviewed and commented directly there.

However, the unit test seems to be ugly. You can see in
LdpServiceSPARQLImplTest.testResourceExist() that I directly new the
object of LdpServiceSPARQLImpl. Is there other more elegant way to
test LdpServiceSPARQLImpl?
Also, I find that LdpServiceSPARQLImpl uses LdpBinaryStoreService,
ConfigurationService and ldpContext. How can I make the unit test by
injecting them into LdpServiceSPARQLImpl?

You can get services from the EmbeddedMarmotta, see this example:

https://github.com/confidencesun/marmotta/blob/MARMOTTA-444/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/prefix/PrefixServiceTest.java#L39

But for preventing random behaviors, since now you have two implementations of the LdpService, you have to take a look how to have alternatives with CDI and get the right one:

http://docs.jboss.org/weld/reference/latest/en-US/html_single/#alternatives

Cheers,

--
Sergio Fernández
Senior Researcher
Knowledge and Media Technologies
Salzburg Research Forschungsgesellschaft mbH
Jakob-Haringer-Straße 5/3 | 5020 Salzburg, Austria
T: +43 662 2288 318 | M: +43 660 2747 925
[email protected]
http://www.salzburgresearch.at

Reply via email to