use of com.yahoo.elide.core.dictionary.EntityDictionary in project elide by yahoo.
the class JsonApiModelResolverTest method setup.
@BeforeAll
public void setup() {
EntityDictionary dictionary = EntityDictionary.builder().build();
dictionary.bindEntity(ENTITIES.get(KEY_BOOK));
dictionary.bindEntity(ENTITIES.get(KEY_PUBLISHER));
dictionary.bindEntity(ENTITIES.get(KEY_AUTHOR));
converters = ModelConverters.getInstance();
converters.addConverter(new JsonApiModelResolver(dictionary));
}
use of com.yahoo.elide.core.dictionary.EntityDictionary in project elide by yahoo.
the class ConfigStoreIntegrationTestSetup method buildDictionary.
@Bean
public EntityDictionary buildDictionary(AutowireCapableBeanFactory beanFactory, ClassScanner scanner, @Autowired(required = false) DynamicConfiguration dynamicConfig, ElideConfigProperties settings, @Qualifier("entitiesToExclude") Set<Type<?>> entitiesToExclude) {
Map<String, Class<? extends Check>> checks = new HashMap<>();
if (settings.getDynamicConfig().isConfigApiEnabled()) {
checks.put(ConfigChecks.CAN_CREATE_CONFIG, ConfigChecks.CanCreate.class);
checks.put(ConfigChecks.CAN_READ_CONFIG, ConfigChecks.CanRead.class);
checks.put(ConfigChecks.CAN_DELETE_CONFIG, ConfigChecks.CanDelete.class);
checks.put(ConfigChecks.CAN_UPDATE_CONFIG, ConfigChecks.CanNotUpdate.class);
}
EntityDictionary dictionary = new EntityDictionary(// Checks
checks, // Role Checks
new HashMap<>(), new Injector() {
@Override
public void inject(Object entity) {
beanFactory.autowireBean(entity);
}
@Override
public <T> T instantiate(Class<T> cls) {
return beanFactory.createBean(cls);
}
}, // Serde Lookup
CoerceUtil::lookup, entitiesToExclude, scanner);
return dictionary;
}
use of com.yahoo.elide.core.dictionary.EntityDictionary in project elide by yahoo.
the class VerifyFieldAccessFilterExpressionVisitorTest method setupMocks.
@BeforeEach
public void setupMocks() {
// this will test with the default interface implementation
scope = mock(RequestScope.class);
PermissionExecutor permissionExecutor = mock(PermissionExecutor.class);
DataStoreTransaction transaction = mock(DataStoreTransaction.class);
EntityDictionary dictionary = EntityDictionary.builder().build();
dictionary.bindEntity(Book.class);
dictionary.bindEntity(Author.class);
when(scope.getDictionary()).thenReturn(dictionary);
when(scope.getPermissionExecutor()).thenReturn(permissionExecutor);
when(scope.getTransaction()).thenReturn(transaction);
when(permissionExecutor.evaluateFilterJoinUserChecks(any(), any())).thenCallRealMethod();
when(permissionExecutor.handleFilterJoinReject(any(), any(), any())).thenCallRealMethod();
}
use of com.yahoo.elide.core.dictionary.EntityDictionary in project elide by yahoo.
the class RSQLFilterDialectWithFIQLCompliantStrategyTest method init.
@BeforeAll
public static void init() {
EntityDictionary dictionary = EntityDictionary.builder().build();
dictionary.bindEntity(Author.class);
dictionary.bindEntity(Book.class);
dialect = RSQLFilterDialect.builder().dictionary(dictionary).caseSensitivityStrategy(new CaseSensitivityStrategy.FIQLCompliant()).build();
}
use of com.yahoo.elide.core.dictionary.EntityDictionary in project elide by yahoo.
the class PermissionExecutorTest method newResource.
public <T> PersistentResource<T> newResource(T obj, Class<T> cls, boolean markNew) {
EntityDictionary dictionary = EntityDictionary.builder().checks(TestCheckMappings.MAPPINGS).build();
dictionary.bindEntity(cls);
RequestScope requestScope = new RequestScope(null, null, NO_VERSION, null, null, null, null, null, UUID.randomUUID(), getElideSettings(dictionary));
PersistentResource resource = new PersistentResource<>(obj, requestScope.getUUIDFor(obj), requestScope);
if (markNew) {
requestScope.getNewPersistentResources().add(resource);
}
return resource;
}
Aggregations