Search in sources :

Example 1 with MarshallingResourceFailureException

use of org.opennms.core.xml.MarshallingResourceFailureException in project opennms by OpenNMS.

the class JdbcDataCollectionConfigDaoJaxbTest method testAfterPropertiesSetWithBogusFileResource.

public void testAfterPropertiesSetWithBogusFileResource() throws Exception {
    Resource resource = new FileSystemResource("/bogus-file");
    JdbcDataCollectionConfigDaoJaxb dao = new JdbcDataCollectionConfigDaoJaxb();
    dao.setConfigResource(resource);
    ThrowableAnticipator ta = new ThrowableAnticipator();
    ta.anticipate(new MarshallingResourceFailureException(ThrowableAnticipator.IGNORE_MESSAGE));
    try {
        dao.afterPropertiesSet();
    } catch (Throwable t) {
        ta.throwableReceived(t);
    }
    ta.verifyAnticipated();
}
Also used : MarshallingResourceFailureException(org.opennms.core.xml.MarshallingResourceFailureException) InputStreamResource(org.springframework.core.io.InputStreamResource) FileSystemResource(org.springframework.core.io.FileSystemResource) Resource(org.springframework.core.io.Resource) FileSystemResource(org.springframework.core.io.FileSystemResource) ThrowableAnticipator(org.opennms.test.ThrowableAnticipator)

Example 2 with MarshallingResourceFailureException

use of org.opennms.core.xml.MarshallingResourceFailureException in project opennms by OpenNMS.

the class XmlDataCollectionConfigDaoJaxbTest method testAfterPropertiesSetWithBogusFileResource.

/**
     * Test after properties set with bogus file resource.
     *
     * @throws Exception the exception
     */
@Test
public void testAfterPropertiesSetWithBogusFileResource() throws Exception {
    Resource resource = new FileSystemResource("/bogus-file");
    XmlDataCollectionConfigDaoJaxb dao = new XmlDataCollectionConfigDaoJaxb();
    dao.setConfigResource(resource);
    ThrowableAnticipator ta = new ThrowableAnticipator();
    ta.anticipate(new MarshallingResourceFailureException(ThrowableAnticipator.IGNORE_MESSAGE));
    try {
        dao.afterPropertiesSet();
    } catch (Throwable t) {
        ta.throwableReceived(t);
    }
    ta.verifyAnticipated();
}
Also used : MarshallingResourceFailureException(org.opennms.core.xml.MarshallingResourceFailureException) InputStreamResource(org.springframework.core.io.InputStreamResource) FileSystemResource(org.springframework.core.io.FileSystemResource) Resource(org.springframework.core.io.Resource) FileSystemResource(org.springframework.core.io.FileSystemResource) ThrowableAnticipator(org.opennms.test.ThrowableAnticipator) Test(org.junit.Test)

Example 3 with MarshallingResourceFailureException

use of org.opennms.core.xml.MarshallingResourceFailureException in project opennms by OpenNMS.

the class AbstractJaxbConfigDaoTest method testAfterPropertiesSetWithBogusFileResource.

public void testAfterPropertiesSetWithBogusFileResource() throws Exception {
    Resource resource = new FileSystemResource("/bogus-file");
    TestJaxbConfigDao dao = new TestJaxbConfigDao();
    dao.setConfigResource(resource);
    ThrowableAnticipator ta = new ThrowableAnticipator();
    ta.anticipate(new MarshallingResourceFailureException(ThrowableAnticipator.IGNORE_MESSAGE));
    try {
        dao.afterPropertiesSet();
    } catch (Throwable t) {
        ta.throwableReceived(t);
    }
    ta.verifyAnticipated();
}
Also used : MarshallingResourceFailureException(org.opennms.core.xml.MarshallingResourceFailureException) InputStreamResource(org.springframework.core.io.InputStreamResource) FileSystemResource(org.springframework.core.io.FileSystemResource) Resource(org.springframework.core.io.Resource) FileSystemResource(org.springframework.core.io.FileSystemResource) ThrowableAnticipator(org.opennms.test.ThrowableAnticipator)

Example 4 with MarshallingResourceFailureException

use of org.opennms.core.xml.MarshallingResourceFailureException in project opennms by OpenNMS.

the class AccessPointMonitorConfigDaoJaxbTest method testAfterPropertiesSetWithBogusFileResource.

public void testAfterPropertiesSetWithBogusFileResource() throws Exception {
    Resource resource = new FileSystemResource("/bogus-file");
    AccessPointMonitorConfigDaoJaxb dao = new AccessPointMonitorConfigDaoJaxb();
    dao.setConfigResource(resource);
    ThrowableAnticipator ta = new ThrowableAnticipator();
    ta.anticipate(new MarshallingResourceFailureException(ThrowableAnticipator.IGNORE_MESSAGE));
    try {
        dao.afterPropertiesSet();
    } catch (Throwable t) {
        ta.throwableReceived(t);
    }
    ta.verifyAnticipated();
}
Also used : MarshallingResourceFailureException(org.opennms.core.xml.MarshallingResourceFailureException) InputStreamResource(org.springframework.core.io.InputStreamResource) FileSystemResource(org.springframework.core.io.FileSystemResource) Resource(org.springframework.core.io.Resource) FileSystemResource(org.springframework.core.io.FileSystemResource) ThrowableAnticipator(org.opennms.test.ThrowableAnticipator)

Aggregations

MarshallingResourceFailureException (org.opennms.core.xml.MarshallingResourceFailureException)4 ThrowableAnticipator (org.opennms.test.ThrowableAnticipator)4 FileSystemResource (org.springframework.core.io.FileSystemResource)4 InputStreamResource (org.springframework.core.io.InputStreamResource)4 Resource (org.springframework.core.io.Resource)4 Test (org.junit.Test)1