Search in sources :

Example 1 with CacheController

use of me.retrodaredevil.solarthing.rest.cache.CacheController in project solarthing by wildmountainfarms.

the class GraphQLProviderTest method testGeneration.

@Test
void testGeneration() {
    CouchDbDatabaseSettings couchDbDatabaseSettings = new CouchDbDatabaseSettings(new CouchPropertiesBuilder("http", "localhost", 5984, null, null).build(), new OkHttpPropertiesBuilder().build());
    ObjectMapper mapper = JacksonUtil.defaultMapper();
    // Use DefaultInstanceOptions.REQUIRE_NO_DEFAULTS while testing because first, we don't actually query any data,
    // and second, we're trying to get rid of usages of DefaultInstanceOptions.DEFAULT_DEFAULT_INSTANCE_OPTIONS
    CacheController cacheController = new CacheController(new CacheHandler(mapper, DefaultInstanceOptions.REQUIRE_NO_DEFAULTS, CouchDbUtil.createInstance(couchDbDatabaseSettings.getCouchProperties(), couchDbDatabaseSettings.getOkHttpProperties())));
    GraphQLSchema schema = GraphQLProvider.createGraphQLSchemaGenerator(JacksonUtil.defaultMapper(), couchDbDatabaseSettings, DefaultInstanceOptions.REQUIRE_NO_DEFAULTS, new SolcastConfig(Collections.emptyMap()), cacheController).generate();
    GraphQL.newGraphQL(schema).build();
}
Also used : SolcastConfig(me.retrodaredevil.solarthing.rest.graphql.solcast.SolcastConfig) CouchDbDatabaseSettings(me.retrodaredevil.solarthing.config.databases.implementations.CouchDbDatabaseSettings) CacheController(me.retrodaredevil.solarthing.rest.cache.CacheController) CacheHandler(me.retrodaredevil.solarthing.rest.cache.CacheHandler) CouchPropertiesBuilder(me.retrodaredevil.couchdb.CouchPropertiesBuilder) GraphQLSchema(graphql.schema.GraphQLSchema) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) OkHttpPropertiesBuilder(me.retrodaredevil.okhttp3.OkHttpPropertiesBuilder) Test(org.junit.jupiter.api.Test)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 GraphQLSchema (graphql.schema.GraphQLSchema)1 CouchPropertiesBuilder (me.retrodaredevil.couchdb.CouchPropertiesBuilder)1 OkHttpPropertiesBuilder (me.retrodaredevil.okhttp3.OkHttpPropertiesBuilder)1 CouchDbDatabaseSettings (me.retrodaredevil.solarthing.config.databases.implementations.CouchDbDatabaseSettings)1 CacheController (me.retrodaredevil.solarthing.rest.cache.CacheController)1 CacheHandler (me.retrodaredevil.solarthing.rest.cache.CacheHandler)1 SolcastConfig (me.retrodaredevil.solarthing.rest.graphql.solcast.SolcastConfig)1 Test (org.junit.jupiter.api.Test)1