Search in sources :

Example 1 with SimpleJacksonRestTemplateResourceResolver

use of org.onehippo.cms7.crisp.core.resource.jackson.SimpleJacksonRestTemplateResourceResolver 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);
}
Also used : SimpleJacksonRestTemplateResourceResolver(org.onehippo.cms7.crisp.core.resource.jackson.SimpleJacksonRestTemplateResourceResolver) MockResourceServiceBroker(org.onehippo.cms7.crisp.mock.broker.MockResourceServiceBroker) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) MockEnvironment(org.springframework.mock.env.MockEnvironment) ResourceResolver(org.onehippo.cms7.crisp.api.resource.ResourceResolver) SimpleJacksonRestTemplateResourceResolver(org.onehippo.cms7.crisp.core.resource.jackson.SimpleJacksonRestTemplateResourceResolver)

Aggregations

ResourceResolver (org.onehippo.cms7.crisp.api.resource.ResourceResolver)1 SimpleJacksonRestTemplateResourceResolver (org.onehippo.cms7.crisp.core.resource.jackson.SimpleJacksonRestTemplateResourceResolver)1 MockResourceServiceBroker (org.onehippo.cms7.crisp.mock.broker.MockResourceServiceBroker)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1 MockEnvironment (org.springframework.mock.env.MockEnvironment)1