use of org.nhindirect.config.service.impl.DomainServiceImpl in project nhin-d by DirectProject.
the class DomainServiceTest method testSearchDomain.
/**
* Test the searchDomain method.
*/
public void testSearchDomain() {
final DomainDao domainDao = context.mock(DomainDao.class);
final String domainName = "domain.com";
final EntityStatus status = EntityStatus.ENABLED;
final List<Domain> expected = Arrays.asList(new Domain());
final List<Domain> expectedNull = null;
context.checking(new Expectations() {
{
oneOf(domainDao).searchDomain(domainName, status);
will(returnValue(expected));
oneOf(domainDao).searchDomain(domainName, status);
will(returnValue(expectedNull));
}
});
DomainServiceImpl service = new DomainServiceImpl();
service.setDao(domainDao);
try {
service.searchDomain(domainName, status);
service.searchDomain(domainName, status);
} catch (Exception e) {
fail("Exception thrown");
}
}
use of org.nhindirect.config.service.impl.DomainServiceImpl in project nhin-d by DirectProject.
the class DomainServiceTest method testGetDomains.
/**
* Test the getDomains method.
*
* TODO: This test needs to be improved.
*/
@SuppressWarnings("unchecked")
public void testGetDomains() {
final DomainDao domainDao = context.mock(DomainDao.class);
final Collection<String> domainNames = Arrays.asList("domain.com", "domain2.com");
final EntityStatus status = EntityStatus.ENABLED;
context.checking(new Expectations() {
{
oneOf(domainDao).getDomains(with(any(List.class)), with(any(EntityStatus.class)));
}
});
DomainServiceImpl service = new DomainServiceImpl();
service.setDao(domainDao);
try {
service.getDomains(domainNames, status);
} catch (Exception e) {
fail("Exception thrown");
}
}
use of org.nhindirect.config.service.impl.DomainServiceImpl in project nhin-d by DirectProject.
the class DomainServiceTest method testAddDomain.
/**
* Test the addDomain method.
*/
public void testAddDomain() {
final DomainDao domainDao = context.mock(DomainDao.class);
final Domain domain = new Domain();
context.checking(new Expectations() {
{
oneOf(domainDao).add(domain);
}
});
DomainServiceImpl service = new DomainServiceImpl();
service.setDao(domainDao);
try {
service.addDomain(domain);
} catch (Exception e) {
fail("Exception thrown");
}
}
use of org.nhindirect.config.service.impl.DomainServiceImpl in project nhin-d by DirectProject.
the class DomainServiceTest method testRemoveDomain.
/**
* Test the removeDomain method.
*/
public void testRemoveDomain() {
final DomainDao domainDao = context.mock(DomainDao.class);
final String domain = "domain.com";
context.checking(new Expectations() {
{
oneOf(domainDao).delete(domain);
}
});
DomainServiceImpl service = new DomainServiceImpl();
service.setDao(domainDao);
try {
service.removeDomain(domain);
} catch (Exception e) {
fail("Exception thrown");
}
}
Aggregations