Search in sources :

Example 1 with MockJdomResourceResolverAdapter

use of org.onehippo.cms7.crisp.mock.resource.MockJdomResourceResolverAdapter in project hippo by NHS-digital-website.

the class SubscriptionResourceTest method setUp.

@Before
public void setUp() {
    final Map<String, ResourceResolver> resourceResolverMap = new HashMap<>();
    resourceResolverMap.put("govDeliveryApi", new MockJdomResourceResolverAdapter() {

        @Override
        public Resource resolve(String absPath, Map<String, Object> pathVariables, ExchangeHint exchangeHint) throws ResourceException {
            return urlToResource(SubscriptionResourceTest.class.getResource("/subscriber-output.xml"));
        }
    });
    final ResourceServiceBroker mockBroker = new MockResourceServiceBroker(resourceResolverMap);
    MockCrispHstServices.setDefaultResourceServiceBroker(mockBroker);
}
Also used : MockJdomResourceResolverAdapter(org.onehippo.cms7.crisp.mock.resource.MockJdomResourceResolverAdapter) MockResourceServiceBroker(org.onehippo.cms7.crisp.mock.broker.MockResourceServiceBroker) HashMap(java.util.HashMap) Resource(org.onehippo.cms7.crisp.api.resource.Resource) MockResourceServiceBroker(org.onehippo.cms7.crisp.mock.broker.MockResourceServiceBroker) ResourceServiceBroker(org.onehippo.cms7.crisp.api.broker.ResourceServiceBroker) ExchangeHint(org.onehippo.cms7.crisp.api.exchange.ExchangeHint) ResourceResolver(org.onehippo.cms7.crisp.api.resource.ResourceResolver) ResourceException(org.onehippo.cms7.crisp.api.resource.ResourceException) Before(org.junit.Before)

Aggregations

HashMap (java.util.HashMap)1 Before (org.junit.Before)1 ResourceServiceBroker (org.onehippo.cms7.crisp.api.broker.ResourceServiceBroker)1 ExchangeHint (org.onehippo.cms7.crisp.api.exchange.ExchangeHint)1 Resource (org.onehippo.cms7.crisp.api.resource.Resource)1 ResourceException (org.onehippo.cms7.crisp.api.resource.ResourceException)1 ResourceResolver (org.onehippo.cms7.crisp.api.resource.ResourceResolver)1 MockResourceServiceBroker (org.onehippo.cms7.crisp.mock.broker.MockResourceServiceBroker)1 MockJdomResourceResolverAdapter (org.onehippo.cms7.crisp.mock.resource.MockJdomResourceResolverAdapter)1