use of org.nhindirect.config.store.Domain in project nhin-d by DirectProject.
the class TrustBundleService_realDataTest method testAssociateDomainToBundle_incomingTrueOutgoingFalse_assertIncomingAndOutgoingFlags.
public void testAssociateDomainToBundle_incomingTrueOutgoingFalse_assertIncomingAndOutgoingFlags() throws Exception {
File bundleLocation = new File("./src/test/resources/bundles/signedbundle.p7b");
final ApplicationContext ctx = ConfigServiceRunner.getSpringApplicationContext();
// add a bundle
TrustBundleService trustService = (TrustBundleService) ctx.getBean("trustBundleSvc");
final TrustBundle bundle = new TrustBundle();
bundle.setBundleName("Test Bundle");
bundle.setBundleURL(filePrefix + bundleLocation.getAbsolutePath());
trustService.addTrustBundle(bundle);
// add a domain
DomainService domainService = (DomainService) ctx.getBean("domainSvc");
Domain domain = new Domain();
domain.setDomainName("Test Domain");
domain.setStatus(EntityStatus.ENABLED);
domainService.addDomain(domain);
//associate domain to bundle
trustService.associateTrustBundleToDomain(domain.getId(), bundle.getId(), true, false);
// assert the association
Collection<TrustBundleDomainReltn> associatedBundel = trustService.getTrustBundlesByDomain(domain.getId(), true);
assertEquals(1, associatedBundel.size());
TrustBundleDomainReltn reltn = associatedBundel.iterator().next();
assertTrue(reltn.isIncoming());
assertFalse(reltn.isOutgoing());
}
use of org.nhindirect.config.store.Domain in project nhin-d by DirectProject.
the class ConfigurationServiceTest method testAddAddress.
/**
* Test the addAddress method.
*/
public void testAddAddress() throws Exception {
final AddressService addressService = context.mock(AddressService.class);
final Collection<Address> collection = Arrays.asList(new Address(new Domain("domain"), "address"));
context.checking(new Expectations() {
{
oneOf(addressService).addAddress(collection);
}
});
ConfigurationServiceImpl service = new ConfigurationServiceImpl();
service.setAddressSvc(addressService);
try {
service.addAddress(collection);
} catch (Exception e) {
fail("Exception thrown");
}
}
use of org.nhindirect.config.store.Domain in project nhin-d by DirectProject.
the class ConfigurationServiceTest method testUpdateDomain.
/**
* Test the updateDomain method.
*/
public void testUpdateDomain() throws Exception {
final DomainService domainService = context.mock(DomainService.class);
final Domain domain = new Domain("domain");
context.checking(new Expectations() {
{
oneOf(domainService).updateDomain(domain);
}
});
ConfigurationServiceImpl service = new ConfigurationServiceImpl();
service.setDomainSvc(domainService);
try {
service.updateDomain(domain);
} catch (Exception e) {
fail("Exception thrown");
}
}
use of org.nhindirect.config.store.Domain 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.store.Domain in project nhin-d by DirectProject.
the class ConfigurationServiceTest method testAddDomain.
/**
* Test the addDomain method.
*/
public void testAddDomain() throws Exception {
final DomainService domainService = context.mock(DomainService.class);
final Domain domain = new Domain("domain");
context.checking(new Expectations() {
{
oneOf(domainService).addDomain(domain);
}
});
ConfigurationServiceImpl service = new ConfigurationServiceImpl();
service.setDomainSvc(domainService);
try {
service.addDomain(domain);
} catch (Exception e) {
fail("Exception thrown");
}
}
Aggregations