Search in sources :

Example 1 with DNSDao

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

the class DNSServiceTest method testAddDNS.

/**
     * Test the addDNS method.
     */
public void testAddDNS() {
    final DNSDao dnsDao = context.mock(DNSDao.class);
    final Collection<DNSRecord> records = Arrays.asList(DNSRecordUtils.createARecord("example.domain.com", 84000L, "10.45.84.12"));
    context.checking(new Expectations() {

        {
            oneOf(dnsDao).add(records);
        }
    });
    DNSServiceImpl service = new DNSServiceImpl();
    service.setDao(dnsDao);
    try {
        service.addDNS(records);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) DNSDao(org.nhindirect.config.store.dao.DNSDao) DNSRecord(org.nhindirect.config.store.DNSRecord) DNSServiceImpl(org.nhindirect.config.service.impl.DNSServiceImpl)

Example 2 with DNSDao

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

the class DNSServiceTest method testRemoveDNSByRecordIds.

/**
     * Test the removeDNSByRecordIds method.
     */
public void testRemoveDNSByRecordIds() {
    final DNSDao dnsDao = context.mock(DNSDao.class);
    final long[] recIds = new long[] { 8387 };
    context.checking(new Expectations() {

        {
            oneOf(dnsDao).remove(recIds);
        }
    });
    DNSServiceImpl service = new DNSServiceImpl();
    service.setDao(dnsDao);
    try {
        service.removeDNSByRecordIds(recIds);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) DNSDao(org.nhindirect.config.store.dao.DNSDao) DNSServiceImpl(org.nhindirect.config.service.impl.DNSServiceImpl)

Example 3 with DNSDao

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

the class DNSServiceTest method testRemoveDNS.

/**
     * Test the removeDNS method.
     */
public void testRemoveDNS() {
    final DNSDao dnsDao = context.mock(DNSDao.class);
    final Collection<DNSRecord> records = Arrays.asList(DNSRecordUtils.createARecord("example.domain.com", 84000L, "10.45.84.12"));
    context.checking(new Expectations() {

        {
            oneOf(dnsDao).remove(records);
        }
    });
    DNSServiceImpl service = new DNSServiceImpl();
    service.setDao(dnsDao);
    try {
        service.removeDNS(records);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) DNSDao(org.nhindirect.config.store.dao.DNSDao) DNSRecord(org.nhindirect.config.store.DNSRecord) DNSServiceImpl(org.nhindirect.config.service.impl.DNSServiceImpl)

Example 4 with DNSDao

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

the class DNSServiceTest method testUpdateDNS.

/**
     * Test the updateDNS method.
     */
public void testUpdateDNS() {
    final DNSDao dnsDao = context.mock(DNSDao.class);
    final DNSRecord record = DNSRecordUtils.createARecord("example.domain.com", 84000L, "10.45.84.12");
    final long recId = 8387;
    context.checking(new Expectations() {

        {
            oneOf(dnsDao).update(recId, record);
        }
    });
    DNSServiceImpl service = new DNSServiceImpl();
    service.setDao(dnsDao);
    try {
        service.updateDNS(recId, record);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) DNSDao(org.nhindirect.config.store.dao.DNSDao) DNSRecord(org.nhindirect.config.store.DNSRecord) DNSServiceImpl(org.nhindirect.config.service.impl.DNSServiceImpl)

Example 5 with DNSDao

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

the class DNSServiceTest method testGetCount.

/**
     * Test the getDNSCount method.
     */
public void testGetCount() {
    final DNSDao dnsDao = context.mock(DNSDao.class);
    context.checking(new Expectations() {

        {
            oneOf(dnsDao).count();
        }
    });
    DNSServiceImpl service = new DNSServiceImpl();
    service.setDao(dnsDao);
    try {
        service.getDNSCount();
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) DNSDao(org.nhindirect.config.store.dao.DNSDao) DNSServiceImpl(org.nhindirect.config.service.impl.DNSServiceImpl)

Aggregations

DNSDao (org.nhindirect.config.store.dao.DNSDao)13 Expectations (org.jmock.Expectations)11 DNSServiceImpl (org.nhindirect.config.service.impl.DNSServiceImpl)11 DNSRecord (org.nhindirect.config.store.DNSRecord)5 ArrayList (java.util.ArrayList)2 Address (org.nhindirect.config.store.Address)2 Anchor (org.nhindirect.config.store.Anchor)2 CertPolicy (org.nhindirect.config.store.CertPolicy)2 CertPolicyGroup (org.nhindirect.config.store.CertPolicyGroup)2 Certificate (org.nhindirect.config.store.Certificate)2 Domain (org.nhindirect.config.store.Domain)2 Setting (org.nhindirect.config.store.Setting)2 TrustBundle (org.nhindirect.config.store.TrustBundle)2 AddressDao (org.nhindirect.config.store.dao.AddressDao)2 AnchorDao (org.nhindirect.config.store.dao.AnchorDao)2 CertPolicyDao (org.nhindirect.config.store.dao.CertPolicyDao)2 CertificateDao (org.nhindirect.config.store.dao.CertificateDao)2 DomainDao (org.nhindirect.config.store.dao.DomainDao)2 SettingDao (org.nhindirect.config.store.dao.SettingDao)2 TrustBundleDao (org.nhindirect.config.store.dao.TrustBundleDao)2