use of org.onehippo.cms7.crisp.api.resource.ResourceResolver in project hippo by NHS-digital-website.
the class RemoteContentService method getContentObjectFrom.
@HystrixCommand(fallbackMethod = "getReliableFallBackObject", commandProperties = { @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "400") })
public Object getContentObjectFrom(URL url, String resourceResolver, Class type) {
LOGGER.debug("Inside RemoteContentService ");
ResourceServiceBroker broker = CrispHstServices.getDefaultResourceServiceBroker(HstServices.getComponentManager());
LOGGER.debug("Inside RemoteContentService broker is " + broker + " URL is " + url);
Resource r = broker.resolve(resourceResolver, url.toString());
LOGGER.debug("Inside RemoteContentService Resource r is " + r);
return broker.getResourceBeanMapper(resourceResolver).map(r, type);
}
use of org.onehippo.cms7.crisp.api.resource.ResourceResolver 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.api.resource.ResourceResolver 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.api.resource.ResourceResolver 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