Search in sources :

Example 6 with EntityStatus

use of org.nhindirect.config.store.EntityStatus in project nhin-d by DirectProject.

the class AddressServiceTest method testGetAddress.

/**
     * Test the getAddress method.
     */
public void testGetAddress() {
    final AddressDao addressDao = context.mock(AddressDao.class);
    final Collection<String> addresses = Arrays.asList("beau@healthdomain.com", "beau@helthdomain2.com");
    final EntityStatus status = EntityStatus.ENABLED;
    context.checking(new Expectations() {

        {
            oneOf(addressDao).listAddresses(with(equal(new ArrayList<String>(addresses))), with(same(status)));
        }
    });
    AddressServiceImpl service = new AddressServiceImpl();
    service.setDao(addressDao);
    try {
        service.getAddress(addresses, status);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) AddressServiceImpl(org.nhindirect.config.service.impl.AddressServiceImpl) ArrayList(java.util.ArrayList) EntityStatus(org.nhindirect.config.store.EntityStatus) AddressDao(org.nhindirect.config.store.dao.AddressDao)

Example 7 with EntityStatus

use of org.nhindirect.config.store.EntityStatus in project nhin-d by DirectProject.

the class AnchorServiceTest method testSetAnchorStatusForOwner.

/**
     * Test the setAnchorStatusForOwner method.
     */
public void testSetAnchorStatusForOwner() {
    final AnchorDao anchorDao = context.mock(AnchorDao.class);
    final String owner = "beau";
    final EntityStatus status = EntityStatus.ENABLED;
    final Anchor anchor = new Anchor();
    anchor.setOwner(owner);
    context.checking(new Expectations() {

        {
            oneOf(anchorDao).setStatus(owner, status);
        }
    });
    AnchorServiceImpl service = new AnchorServiceImpl();
    service.setDao(anchorDao);
    try {
        service.setAnchorStatusForOwner(owner, status);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) Anchor(org.nhindirect.config.store.Anchor) AnchorServiceImpl(org.nhindirect.config.service.impl.AnchorServiceImpl) EntityStatus(org.nhindirect.config.store.EntityStatus) AnchorDao(org.nhindirect.config.store.dao.AnchorDao)

Example 8 with EntityStatus

use of org.nhindirect.config.store.EntityStatus 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");
    }
}
Also used : Expectations(org.jmock.Expectations) DomainDao(org.nhindirect.config.store.dao.DomainDao) EntityStatus(org.nhindirect.config.store.EntityStatus) DomainServiceImpl(org.nhindirect.config.service.impl.DomainServiceImpl) Domain(org.nhindirect.config.store.Domain)

Example 9 with EntityStatus

use of org.nhindirect.config.store.EntityStatus 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");
    }
}
Also used : Expectations(org.jmock.Expectations) DomainDao(org.nhindirect.config.store.dao.DomainDao) EntityStatus(org.nhindirect.config.store.EntityStatus) List(java.util.List) DomainServiceImpl(org.nhindirect.config.service.impl.DomainServiceImpl)

Example 10 with EntityStatus

use of org.nhindirect.config.store.EntityStatus in project nhin-d by DirectProject.

the class ConfigurationServiceTest method testGetDomains.

/**
     * Test the getDomains method.
     */
public void testGetDomains() throws Exception {
    final DomainService domainService = context.mock(DomainService.class);
    final Collection<String> collection = Arrays.asList("domain1", "domain2");
    final EntityStatus status = EntityStatus.ENABLED;
    context.checking(new Expectations() {

        {
            oneOf(domainService).getDomains(collection, status);
        }
    });
    ConfigurationServiceImpl service = new ConfigurationServiceImpl();
    service.setDomainSvc(domainService);
    try {
        service.getDomains(collection, status);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) EntityStatus(org.nhindirect.config.store.EntityStatus) ConfigurationServiceImpl(org.nhindirect.config.service.impl.ConfigurationServiceImpl)

Aggregations

EntityStatus (org.nhindirect.config.store.EntityStatus)12 Expectations (org.jmock.Expectations)10 ConfigurationServiceImpl (org.nhindirect.config.service.impl.ConfigurationServiceImpl)5 ArrayList (java.util.ArrayList)3 List (java.util.List)3 X509Certificate (java.security.cert.X509Certificate)2 Collection (java.util.Collection)2 HashMap (java.util.HashMap)2 DomainServiceImpl (org.nhindirect.config.service.impl.DomainServiceImpl)2 DomainDao (org.nhindirect.config.store.dao.DomainDao)2 Message (org.nhindirect.config.ui.flash.FlashMap.Message)2 AddressForm (org.nhindirect.config.ui.form.AddressForm)2 AnchorForm (org.nhindirect.config.ui.form.AnchorForm)2 CertificateForm (org.nhindirect.config.ui.form.CertificateForm)2 DNSEntryForm (org.nhindirect.config.ui.form.DNSEntryForm)2 DomainForm (org.nhindirect.config.ui.form.DomainForm)2 SearchDomainForm (org.nhindirect.config.ui.form.SearchDomainForm)2 SettingsForm (org.nhindirect.config.ui.form.SettingsForm)2 SimpleForm (org.nhindirect.config.ui.form.SimpleForm)2 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)2