use of org.nhindirect.config.store.dao.CertificateDao in project nhin-d by DirectProject.
the class CertificateServiceTest method testSetCertificateStatusForOwner.
/**
* Test the setCertificateStatusForOwner method.
*/
public void testSetCertificateStatusForOwner() {
final CertificateDao certificateDao = context.mock(CertificateDao.class);
final String owner = "beau";
final EntityStatus status = EntityStatus.ENABLED;
context.checking(new Expectations() {
{
oneOf(certificateDao).setStatus(owner, status);
}
});
CertificateServiceImpl service = new CertificateServiceImpl();
service.setDao(certificateDao);
try {
service.setCertificateStatusForOwner(owner, status);
} catch (Exception e) {
fail("Exception thrown");
}
}
use of org.nhindirect.config.store.dao.CertificateDao in project nhin-d by DirectProject.
the class CertificateServiceTest method testRemoveCertificates.
/**
* Test the removeCertificate method.
*/
public void testRemoveCertificates() {
final CertificateDao certificateDao = context.mock(CertificateDao.class);
final List<Long> certificateIds = Arrays.asList(7L, 8L);
context.checking(new Expectations() {
{
oneOf(certificateDao).delete(certificateIds);
}
});
CertificateServiceImpl service = new CertificateServiceImpl();
service.setDao(certificateDao);
try {
service.removeCertificates(certificateIds);
} catch (Exception e) {
fail("Exception thrown");
}
}
use of org.nhindirect.config.store.dao.CertificateDao in project nhin-d by DirectProject.
the class CertificateServiceTest method testGetCertificatesForOwner.
/**
* Test the getCertificatesForOwner method.
*/
public void testGetCertificatesForOwner() {
final CertificateDao certificateDao = context.mock(CertificateDao.class);
final String owner = "beau";
final CertificateGetOptions certificateOptions = CertificateGetOptions.DEFAULT;
context.checking(new Expectations() {
{
oneOf(certificateDao).list(owner);
will(returnValue(Collections.<Certificate>emptyList()));
}
});
CertificateServiceImpl service = new CertificateServiceImpl();
service.setDao(certificateDao);
try {
Collection<Certificate> output = service.getCertificatesForOwner(owner, certificateOptions);
assertNotNull("Output is null when using valid params", output);
assertEquals("Output does not match mocked return value when using valid params", Collections.<Certificate>emptyList(), output);
} catch (Exception e) {
fail("Exception thrown");
}
}
use of org.nhindirect.config.store.dao.CertificateDao in project nhin-d by DirectProject.
the class CertificateServiceTest method testRemoveCertificatesForOwner.
/**
* Test the removeCertificatesForOwner method.
*/
public void testRemoveCertificatesForOwner() {
final CertificateDao certificateDao = context.mock(CertificateDao.class);
final String owner = "beau";
context.checking(new Expectations() {
{
oneOf(certificateDao).delete(owner);
}
});
CertificateServiceImpl service = new CertificateServiceImpl();
service.setDao(certificateDao);
try {
service.removeCertificatesForOwner(owner);
} catch (Exception e) {
fail("Exception thrown");
}
}
use of org.nhindirect.config.store.dao.CertificateDao in project nhin-d by DirectProject.
the class CertificateServiceTest method testGetCertificates.
/**
* Test the getCertificates method.
*/
public void testGetCertificates() {
final CertificateDao certificateDao = context.mock(CertificateDao.class);
final Collection<Long> certificateIds = Arrays.asList(7L, 8L);
final CertificateGetOptions certificateOptions = CertificateGetOptions.DEFAULT;
context.checking(new Expectations() {
{
oneOf(certificateDao).list(new ArrayList<Long>(certificateIds));
will(returnValue(Collections.<Certificate>emptyList()));
}
});
CertificateServiceImpl service = new CertificateServiceImpl();
service.setDao(certificateDao);
try {
Collection<Certificate> output = service.getCertificates(certificateIds, certificateOptions);
assertEquals("Output does not match expected", Collections.<Certificate>emptyList(), output);
} catch (Exception e) {
fail("Exception thrown");
}
}
Aggregations