Search in sources :

Example 26 with ConfigurationServiceImpl

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

Example 27 with ConfigurationServiceImpl

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

the class ConfigurationServiceTest method testAddAnchors.

/**
     * Test the addAnchors method.
     */
public void testAddAnchors() throws Exception {
    final AnchorService anchorService = context.mock(AnchorService.class);
    final Collection<Anchor> collection = Arrays.asList(new Anchor());
    context.checking(new Expectations() {

        {
            oneOf(anchorService).addAnchors(collection);
        }
    });
    ConfigurationServiceImpl service = new ConfigurationServiceImpl();
    service.setAnchorSvc(anchorService);
    try {
        service.addAnchors(collection);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) Anchor(org.nhindirect.config.store.Anchor) ConfigurationServiceImpl(org.nhindirect.config.service.impl.ConfigurationServiceImpl)

Example 28 with ConfigurationServiceImpl

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

the class ConfigurationServiceTest method testDeleteSetting.

/**
     * Test the deleteSetting method.
     */
public void testDeleteSetting() throws Exception {
    final SettingService settingService = context.mock(SettingService.class);
    final Collection<String> names = Arrays.asList(UUID.randomUUID().toString());
    context.checking(new Expectations() {

        {
            oneOf(settingService).deleteSetting(names);
        }
    });
    ConfigurationServiceImpl service = new ConfigurationServiceImpl();
    service.setSettingSvc(settingService);
    try {
        service.deleteSetting(names);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) ConfigurationServiceImpl(org.nhindirect.config.service.impl.ConfigurationServiceImpl)

Example 29 with ConfigurationServiceImpl

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

the class ConfigurationServiceTest method testListAddress.

/**
     * Test the listAddress method.
     */
public void testListAddress() throws Exception {
    final AddressService addressService = context.mock(AddressService.class);
    final String lastAddressName = "address";
    final int maxResults = 1;
    context.checking(new Expectations() {

        {
            oneOf(addressService).listAddresss(lastAddressName, maxResults);
        }
    });
    ConfigurationServiceImpl service = new ConfigurationServiceImpl();
    service.setAddressSvc(addressService);
    try {
        service.listAddresss(lastAddressName, maxResults);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) ConfigurationServiceImpl(org.nhindirect.config.service.impl.ConfigurationServiceImpl)

Example 30 with ConfigurationServiceImpl

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

the class ConfigurationServiceTest method testGetAnchor.

/**
     * Test the getAnchor method.
     */
public void testGetAnchor() throws Exception {
    final AnchorService anchorService = context.mock(AnchorService.class);
    final String owner = "owner";
    final String thumbprint = "thumbprint";
    final CertificateGetOptions options = CertificateGetOptions.DEFAULT;
    context.checking(new Expectations() {

        {
            oneOf(anchorService).getAnchor(owner, thumbprint, options);
        }
    });
    ConfigurationServiceImpl service = new ConfigurationServiceImpl();
    service.setAnchorSvc(anchorService);
    try {
        service.getAnchor(owner, thumbprint, options);
    } catch (Exception e) {
        fail("Exception thrown");
    }
}
Also used : Expectations(org.jmock.Expectations) CertificateGetOptions(org.nhindirect.config.service.impl.CertificateGetOptions) ConfigurationServiceImpl(org.nhindirect.config.service.impl.ConfigurationServiceImpl)

Aggregations

Expectations (org.jmock.Expectations)41 ConfigurationServiceImpl (org.nhindirect.config.service.impl.ConfigurationServiceImpl)41 CertificateGetOptions (org.nhindirect.config.service.impl.CertificateGetOptions)10 EntityStatus (org.nhindirect.config.store.EntityStatus)5 Domain (org.nhindirect.config.store.Domain)4 Address (org.nhindirect.config.store.Address)2 Certificate (org.nhindirect.config.store.Certificate)2 Anchor (org.nhindirect.config.store.Anchor)1