Search in sources :

Example 1 with DNSServiceImpl

use of org.nhindirect.config.service.impl.DNSServiceImpl 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 DNSServiceImpl

use of org.nhindirect.config.service.impl.DNSServiceImpl 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 DNSServiceImpl

use of org.nhindirect.config.service.impl.DNSServiceImpl 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 DNSServiceImpl

use of org.nhindirect.config.service.impl.DNSServiceImpl 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 DNSServiceImpl

use of org.nhindirect.config.service.impl.DNSServiceImpl 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

Expectations (org.jmock.Expectations)11 DNSServiceImpl (org.nhindirect.config.service.impl.DNSServiceImpl)11 DNSDao (org.nhindirect.config.store.dao.DNSDao)11 DNSRecord (org.nhindirect.config.store.DNSRecord)3