Search in sources :

Example 1 with SettingServiceImpl

use of org.nhindirect.config.service.impl.SettingServiceImpl in project nhin-d by DirectProject.

the class SettingServiceTest method testDeleteSettings.

/**
     * Test the addAnchors method.
     */
public void testDeleteSettings() {
    final SettingDao settingDao = context.mock(SettingDao.class);
    final Collection<String> name = Arrays.asList(UUID.randomUUID().toString());
    context.checking(new Expectations() {

        {
            oneOf(settingDao).delete(name);
        }
    });
    SettingServiceImpl service = new SettingServiceImpl();
    service.setDao(settingDao);
    try {
        service.deleteSetting(name);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) SettingServiceImpl(org.nhindirect.config.service.impl.SettingServiceImpl) SettingDao(org.nhindirect.config.store.dao.SettingDao)

Example 2 with SettingServiceImpl

use of org.nhindirect.config.service.impl.SettingServiceImpl in project nhin-d by DirectProject.

the class SettingServiceTest method testGetSettingsByNames.

/**
     * Test the addAnchors method.
     */
public void testGetSettingsByNames() {
    final SettingDao settingDao = context.mock(SettingDao.class);
    final Collection<String> names = Arrays.asList(UUID.randomUUID().toString(), UUID.randomUUID().toString());
    context.checking(new Expectations() {

        {
            oneOf(settingDao).getByNames(names);
        }
    });
    SettingServiceImpl service = new SettingServiceImpl();
    service.setDao(settingDao);
    try {
        service.getSettingsByNames(names);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) SettingServiceImpl(org.nhindirect.config.service.impl.SettingServiceImpl) SettingDao(org.nhindirect.config.store.dao.SettingDao)

Example 3 with SettingServiceImpl

use of org.nhindirect.config.service.impl.SettingServiceImpl in project nhin-d by DirectProject.

the class SettingServiceTest method testGetSettingByName.

/**
     * Test the addAnchors method.
     */
public void testGetSettingByName() {
    final SettingDao settingDao = context.mock(SettingDao.class);
    final String name = UUID.randomUUID().toString();
    context.checking(new Expectations() {

        {
            oneOf(settingDao).getByNames(Arrays.asList(name));
        }
    });
    SettingServiceImpl service = new SettingServiceImpl();
    service.setDao(settingDao);
    try {
        service.getSettingByName(name);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) SettingServiceImpl(org.nhindirect.config.service.impl.SettingServiceImpl) SettingDao(org.nhindirect.config.store.dao.SettingDao)

Example 4 with SettingServiceImpl

use of org.nhindirect.config.service.impl.SettingServiceImpl in project nhin-d by DirectProject.

the class SettingServiceTest method testAddSetting.

/**
     * Test the addAnchors method.
     */
public void testAddSetting() {
    final SettingDao settingDao = context.mock(SettingDao.class);
    final String name = UUID.randomUUID().toString();
    final String value = UUID.randomUUID().toString();
    context.checking(new Expectations() {

        {
            oneOf(settingDao).add(name, value);
        }
    });
    SettingServiceImpl service = new SettingServiceImpl();
    service.setDao(settingDao);
    try {
        service.addSetting(name, value);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) SettingServiceImpl(org.nhindirect.config.service.impl.SettingServiceImpl) SettingDao(org.nhindirect.config.store.dao.SettingDao)

Example 5 with SettingServiceImpl

use of org.nhindirect.config.service.impl.SettingServiceImpl in project nhin-d by DirectProject.

the class SettingServiceTest method testUpdateSetting.

/**
     * Test the addAnchors method.
     */
public void testUpdateSetting() {
    final SettingDao settingDao = context.mock(SettingDao.class);
    final String name = UUID.randomUUID().toString();
    final String value = UUID.randomUUID().toString();
    context.checking(new Expectations() {

        {
            oneOf(settingDao).update(name, value);
        }
    });
    SettingServiceImpl service = new SettingServiceImpl();
    service.setDao(settingDao);
    try {
        service.updateSetting(name, value);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) SettingServiceImpl(org.nhindirect.config.service.impl.SettingServiceImpl) SettingDao(org.nhindirect.config.store.dao.SettingDao)

Aggregations

Expectations (org.jmock.Expectations)6 SettingServiceImpl (org.nhindirect.config.service.impl.SettingServiceImpl)6 SettingDao (org.nhindirect.config.store.dao.SettingDao)6