use of com.yahoo.elide.ElideSettingsBuilder in project elide by yahoo.
the class ResourceIT method elideSecurityEnabled.
@Test
public void elideSecurityEnabled() {
Elide elide = new Elide(new ElideSettingsBuilder(dataStore).withEntityDictionary(EntityDictionary.builder().checks(TestCheckMappings.MAPPINGS).build()).withAuditLogger(new TestAuditLogger()).build());
elide.doScans();
com.yahoo.elide.core.security.User user = new com.yahoo.elide.core.security.User(() -> "-1");
ElideResponse response = elide.get(baseUrl, "parent/1/children", new MultivaluedHashMap<>(), user, NO_VERSION);
assertEquals(HttpStatus.SC_OK, response.getResponseCode());
assertEquals("{\"data\":[]}", response.getBody());
}
use of com.yahoo.elide.ElideSettingsBuilder in project elide by yahoo.
the class StandardTestBinder method configure.
@Override
protected void configure() {
EntityDictionary dictionary = EntityDictionary.builder().injector(injector::inject).checks(TestCheckMappings.MAPPINGS).build();
bind(dictionary).to(EntityDictionary.class);
// Elide instance
bindFactory(new Factory<Elide>() {
@Override
public Elide provide() {
DefaultFilterDialect defaultFilterStrategy = new DefaultFilterDialect(dictionary);
RSQLFilterDialect rsqlFilterStrategy = RSQLFilterDialect.builder().dictionary(dictionary).build();
MultipleFilterDialect multipleFilterStrategy = new MultipleFilterDialect(Arrays.asList(rsqlFilterStrategy, defaultFilterStrategy), Arrays.asList(rsqlFilterStrategy, defaultFilterStrategy));
Elide elide = new Elide(new ElideSettingsBuilder(IntegrationTest.getDataStore()).withAuditLogger(auditLogger).withJoinFilterDialect(multipleFilterStrategy).withSubqueryFilterDialect(multipleFilterStrategy).withEntityDictionary(dictionary).withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", Calendar.getInstance().getTimeZone()).build());
elide.doScans();
return elide;
}
@Override
public void dispose(Elide elide) {
}
}).to(Elide.class).named("elide");
bind(BILLING_SERVICE).to(BillingService.class);
}
use of com.yahoo.elide.ElideSettingsBuilder in project elide by yahoo.
the class SubscriptionWebSocketConfigurator method buildElide.
protected Elide buildElide(DataStore store, EntityDictionary dictionary) {
RSQLFilterDialect rsqlFilterStrategy = RSQLFilterDialect.builder().dictionary(dictionary).build();
ElideSettingsBuilder builder = new ElideSettingsBuilder(store).withAuditLogger(auditLogger).withErrorMapper(errorMapper).withBaseUrl(baseUrl).withJoinFilterDialect(rsqlFilterStrategy).withSubqueryFilterDialect(rsqlFilterStrategy).withEntityDictionary(dictionary).withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", Calendar.getInstance().getTimeZone());
if (verboseErrors) {
builder = builder.withVerboseErrors();
}
Elide elide = new Elide(builder.build());
elide.doScans();
return elide;
}
use of com.yahoo.elide.ElideSettingsBuilder in project elide by yahoo.
the class ElideStandaloneTestSettings method getElideSettings.
@Override
public ElideSettings getElideSettings(EntityDictionary dictionary, DataStore dataStore, JsonApiMapper mapper) {
String jsonApiBaseUrl = getBaseUrl() + getJsonApiPathSpec().replaceAll("/\\*", "") + "/";
ElideSettingsBuilder builder = new ElideSettingsBuilder(dataStore).withEntityDictionary(dictionary).withErrorMapper(getErrorMapper()).withJoinFilterDialect(RSQLFilterDialect.builder().dictionary(dictionary).build()).withSubqueryFilterDialect(RSQLFilterDialect.builder().dictionary(dictionary).build()).withJSONApiLinks(new DefaultJSONApiLinks(jsonApiBaseUrl)).withBaseUrl("https://elide.io").withAuditLogger(getAuditLogger()).withVerboseErrors().withJsonApiMapper(mapper).withJsonApiPath(getJsonApiPathSpec().replaceAll("/\\*", "")).withGraphQLApiPath(getGraphQLApiPathSpec().replaceAll("/\\*", "")).withExportApiPath(getAsyncProperties().getExportApiPathSpec().replaceAll("/\\*", ""));
if (enableISO8601Dates()) {
builder = builder.withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC"));
}
return builder.build();
}
use of com.yahoo.elide.ElideSettingsBuilder in project elide by yahoo.
the class IntegrationTestSetup method initializeElide.
// Initialize beans here if needed.
// We recreate the Elide bean here without @RefreshScope so that it can be used With @SpyBean.
@Bean
public RefreshableElide initializeElide(EntityDictionary dictionary, DataStore dataStore, ElideConfigProperties settings, JsonApiMapper mapper, ErrorMapper errorMapper) {
ElideSettingsBuilder builder = new ElideSettingsBuilder(dataStore).withEntityDictionary(dictionary).withErrorMapper(errorMapper).withJsonApiMapper(mapper).withDefaultMaxPageSize(settings.getMaxPageSize()).withDefaultPageSize(settings.getPageSize()).withJoinFilterDialect(RSQLFilterDialect.builder().dictionary(dictionary).build()).withSubqueryFilterDialect(RSQLFilterDialect.builder().dictionary(dictionary).build()).withAuditLogger(new Slf4jLogger()).withBaseUrl(settings.getBaseUrl()).withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")).withJsonApiPath(settings.getJsonApi().getPath()).withGraphQLApiPath(settings.getGraphql().getPath());
if (settings.isVerboseErrors()) {
builder.withVerboseErrors();
}
if (settings.getAsync() != null && settings.getAsync().getExport() != null && settings.getAsync().getExport().isEnabled()) {
builder.withExportApiPath(settings.getAsync().getExport().getPath());
}
if (settings.getJsonApi() != null && settings.getJsonApi().isEnabled() && settings.getJsonApi().isEnableLinks()) {
String baseUrl = settings.getBaseUrl();
if (StringUtils.isEmpty(baseUrl)) {
builder.withJSONApiLinks(new DefaultJSONApiLinks());
} else {
String jsonApiBaseUrl = baseUrl + settings.getJsonApi().getPath() + "/";
builder.withJSONApiLinks(new DefaultJSONApiLinks(jsonApiBaseUrl));
}
}
Elide elide = new Elide(builder.build(), new TransactionRegistry(), dictionary.getScanner(), true);
return new RefreshableElide(spy(elide));
}
Aggregations