use of org.onehippo.cms7.crisp.mock.broker.MockResourceServiceBroker 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);
}
use of org.onehippo.cms7.crisp.mock.broker.MockResourceServiceBroker in project hippo by NHS-digital-website.
the class RemoteContentServiceTest method before.
@Before
public void before() {
Map<String, ResourceResolver> resourceResolverMap = new HashMap<>();
resourceResolverMap.put("testResourceResolver", testResourceResolver);
ResourceServiceBroker mockBroker = new MockResourceServiceBroker(resourceResolverMap);
MockCrispHstServices.setDefaultResourceServiceBroker(mockBroker);
}
use of org.onehippo.cms7.crisp.mock.broker.MockResourceServiceBroker in project hippo by NHS-digital-website.
the class ApiSpecSyncFromApigeeJobIntegrationTest method crispApiConfiguredForOAuth2.
private void crispApiConfiguredForOAuth2() {
crispApiSpringApplicationContextEnvironment = new MockEnvironment().withProperty(PARAM_APIGEE_RESOURCES_SPECS_ALL_URL, apigeeAllSpecsUrl).withProperty(PARAM_APIGEE_OAUTH_TOKEN_URL, oauthTokenUrl).withProperty(PARAM_APIGEE_RESOURCES_SPECS_INDIVIDUAL_URL, apigeeSingleSpecUrlTemplate).withProperty(PARAM_APIGEE_OAUTH_USERNAME, OAUTH_USERNAME).withProperty(PARAM_APIGEE_OAUTH_PASSWORD, OAUTH_PASSWORD).withProperty(PARAM_APIGEE_OAUTH_BASICAUTHTOKEN, OAUTH_BASIC_AUTH_TOKEN).withProperty(PARAM_APIGEE_OAUTH_OTPKEY, OAUTH_OTP_KEY);
// See https://documentation.bloomreach.com/14/library/concepts/crisp-api/unit-testing.html
final ClassPathXmlApplicationContext crispApiSpringApplicationContext = new ClassPathXmlApplicationContext();
crispApiSpringApplicationContext.setEnvironment(crispApiSpringApplicationContextEnvironment);
crispApiSpringApplicationContext.setConfigLocations(testDataFileLocation("crisp-spring-context-properties-support.xml"), "/META-INF/hst-assembly/addon/crisp/overrides/custom-resource-resolvers.xml");
crispApiSpringApplicationContext.refresh();
final String apigeeManagementApiCrispApiNamespace = "apigeeManagementApi";
final SimpleJacksonRestTemplateResourceResolver simpleJacksonRestTemplateResourceResolver = crispApiSpringApplicationContext.getBean(apigeeManagementApiCrispApiNamespace, SimpleJacksonRestTemplateResourceResolver.class);
final ImmutableMap<String, ResourceResolver> resourceResolverMap = ImmutableMap.<String, ResourceResolver>builder().put(apigeeManagementApiCrispApiNamespace, simpleJacksonRestTemplateResourceResolver).build();
final MockResourceServiceBroker mockResourceServiceBroker = new MockResourceServiceBroker(resourceResolverMap);
MockCrispHstServices.setDefaultResourceServiceBroker(mockResourceServiceBroker);
}
Aggregations