Search in sources :

Example 11 with HashMapDataStore

use of com.yahoo.elide.core.datastore.inmemory.HashMapDataStore in project elide by yahoo.

the class GraphQLTableExportOperationTest method setupMocks.

@BeforeEach
public void setupMocks(@TempDir Path tempDir) {
    dataStore = new HashMapDataStore(DefaultClassScanner.getInstance(), new HashSet<>(Arrays.asList(TableExport.class.getPackage(), ArtifactGroup.class.getPackage())));
    Map<String, Class<? extends Check>> map = new HashMap<>();
    map.put(AsyncAPIInlineChecks.AsyncAPIOwner.PRINCIPAL_IS_OWNER, AsyncAPIInlineChecks.AsyncAPIOwner.class);
    map.put(AsyncAPIInlineChecks.AsyncAPIAdmin.PRINCIPAL_IS_ADMIN, AsyncAPIInlineChecks.AsyncAPIAdmin.class);
    map.put(AsyncAPIInlineChecks.AsyncAPIStatusValue.VALUE_IS_CANCELLED, AsyncAPIInlineChecks.AsyncAPIStatusValue.class);
    map.put(AsyncAPIInlineChecks.AsyncAPIStatusQueuedValue.VALUE_IS_QUEUED, AsyncAPIInlineChecks.AsyncAPIStatusQueuedValue.class);
    elide = new Elide(new ElideSettingsBuilder(dataStore).withEntityDictionary(EntityDictionary.builder().checks(map).build()).withAuditLogger(new Slf4jLogger()).withExportApiPath("/export").build());
    elide.doScans();
    user = mock(User.class);
    requestScope = mock(RequestScope.class);
    asyncExecutorService = mock(AsyncExecutorService.class);
    engine = new FileResultStorageEngine(tempDir.toString(), false);
    when(asyncExecutorService.getElide()).thenReturn(elide);
    when(requestScope.getApiVersion()).thenReturn(NO_VERSION);
    when(requestScope.getUser()).thenReturn(user);
    when(requestScope.getElideSettings()).thenReturn(elide.getElideSettings());
    when(requestScope.getBaseUrlEndPoint()).thenReturn("https://elide.io");
}
Also used : FileResultStorageEngine(com.yahoo.elide.async.service.storageengine.FileResultStorageEngine) User(com.yahoo.elide.core.security.User) HashMap(java.util.HashMap) Slf4jLogger(com.yahoo.elide.core.audit.Slf4jLogger) Check(com.yahoo.elide.core.security.checks.Check) AsyncAPIInlineChecks(com.yahoo.elide.async.models.security.AsyncAPIInlineChecks) RequestScope(com.yahoo.elide.core.RequestScope) ElideSettingsBuilder(com.yahoo.elide.ElideSettingsBuilder) AsyncExecutorService(com.yahoo.elide.async.service.AsyncExecutorService) HashMapDataStore(com.yahoo.elide.core.datastore.inmemory.HashMapDataStore) Elide(com.yahoo.elide.Elide) HashSet(java.util.HashSet) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 12 with HashMapDataStore

use of com.yahoo.elide.core.datastore.inmemory.HashMapDataStore in project elide by yahoo.

the class JsonAPITableExportOperationTest method setupMocks.

@BeforeEach
public void setupMocks(@TempDir Path tempDir) {
    dataStore = new HashMapDataStore(DefaultClassScanner.getInstance(), new HashSet<>(Arrays.asList(TableExport.class.getPackage(), ArtifactGroup.class.getPackage())));
    Map<String, Class<? extends Check>> map = new HashMap<>();
    map.put(AsyncAPIInlineChecks.AsyncAPIOwner.PRINCIPAL_IS_OWNER, AsyncAPIInlineChecks.AsyncAPIOwner.class);
    map.put(AsyncAPIInlineChecks.AsyncAPIAdmin.PRINCIPAL_IS_ADMIN, AsyncAPIInlineChecks.AsyncAPIAdmin.class);
    map.put(AsyncAPIInlineChecks.AsyncAPIStatusValue.VALUE_IS_CANCELLED, AsyncAPIInlineChecks.AsyncAPIStatusValue.class);
    map.put(AsyncAPIInlineChecks.AsyncAPIStatusQueuedValue.VALUE_IS_QUEUED, AsyncAPIInlineChecks.AsyncAPIStatusQueuedValue.class);
    elide = new Elide(new ElideSettingsBuilder(dataStore).withEntityDictionary(EntityDictionary.builder().checks(map).build()).withAuditLogger(new Slf4jLogger()).withExportApiPath("/export").build());
    elide.doScans();
    user = mock(User.class);
    requestScope = mock(RequestScope.class);
    asyncExecutorService = mock(AsyncExecutorService.class);
    engine = new FileResultStorageEngine(tempDir.toString(), true);
    when(asyncExecutorService.getElide()).thenReturn(elide);
    when(requestScope.getApiVersion()).thenReturn(NO_VERSION);
    when(requestScope.getUser()).thenReturn(user);
    when(requestScope.getElideSettings()).thenReturn(elide.getElideSettings());
    when(requestScope.getBaseUrlEndPoint()).thenReturn("https://elide.io");
}
Also used : FileResultStorageEngine(com.yahoo.elide.async.service.storageengine.FileResultStorageEngine) User(com.yahoo.elide.core.security.User) HashMap(java.util.HashMap) Slf4jLogger(com.yahoo.elide.core.audit.Slf4jLogger) Check(com.yahoo.elide.core.security.checks.Check) AsyncAPIInlineChecks(com.yahoo.elide.async.models.security.AsyncAPIInlineChecks) RequestScope(com.yahoo.elide.core.RequestScope) ElideSettingsBuilder(com.yahoo.elide.ElideSettingsBuilder) AsyncExecutorService(com.yahoo.elide.async.service.AsyncExecutorService) HashMapDataStore(com.yahoo.elide.core.datastore.inmemory.HashMapDataStore) Elide(com.yahoo.elide.Elide) HashSet(java.util.HashSet) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 13 with HashMapDataStore

use of com.yahoo.elide.core.datastore.inmemory.HashMapDataStore in project elide by yahoo.

the class AsyncExecutorServiceTest method setupMockElide.

@BeforeAll
public void setupMockElide() {
    HashMapDataStore inMemoryStore = new HashMapDataStore(DefaultClassScanner.getInstance(), AsyncQuery.class.getPackage());
    Map<String, Class<? extends Check>> checkMappings = new HashMap<>();
    elide = new Elide(new ElideSettingsBuilder(inMemoryStore).withEntityDictionary(EntityDictionary.builder().checks(checkMappings).build()).build());
    asyncAPIDao = mock(DefaultAsyncAPIDAO.class);
    testUser = mock(User.class);
    scope = mock(RequestScope.class);
    resultStorageEngine = mock(FileResultStorageEngine.class);
    service = new AsyncExecutorService(elide, Executors.newFixedThreadPool(5), Executors.newFixedThreadPool(5), asyncAPIDao);
}
Also used : FileResultStorageEngine(com.yahoo.elide.async.service.storageengine.FileResultStorageEngine) User(com.yahoo.elide.core.security.User) HashMap(java.util.HashMap) Check(com.yahoo.elide.core.security.checks.Check) RequestScope(com.yahoo.elide.core.RequestScope) ElideSettingsBuilder(com.yahoo.elide.ElideSettingsBuilder) HashMapDataStore(com.yahoo.elide.core.datastore.inmemory.HashMapDataStore) AsyncQuery(com.yahoo.elide.async.models.AsyncQuery) Elide(com.yahoo.elide.Elide) DefaultAsyncAPIDAO(com.yahoo.elide.async.service.dao.DefaultAsyncAPIDAO) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 14 with HashMapDataStore

use of com.yahoo.elide.core.datastore.inmemory.HashMapDataStore in project elide by yahoo.

the class CSVExportFormatterTest method setupMocks.

@BeforeEach
public void setupMocks(@TempDir Path tempDir) {
    dataStore = new HashMapDataStore(DefaultClassScanner.getInstance(), TableExport.class.getPackage());
    Map<String, Class<? extends Check>> map = new HashMap<>();
    elide = new Elide(new ElideSettingsBuilder(dataStore).withEntityDictionary(EntityDictionary.builder().checks(map).build()).withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")).build());
    elide.doScans();
    scope = mock(RequestScope.class);
}
Also used : ElideSettingsBuilder(com.yahoo.elide.ElideSettingsBuilder) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) HashMapDataStore(com.yahoo.elide.core.datastore.inmemory.HashMapDataStore) Check(com.yahoo.elide.core.security.checks.Check) Elide(com.yahoo.elide.Elide) RequestScope(com.yahoo.elide.core.RequestScope) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 15 with HashMapDataStore

use of com.yahoo.elide.core.datastore.inmemory.HashMapDataStore in project elide by yahoo.

the class JSONExportFormatterTest method setupMocks.

@BeforeEach
public void setupMocks(@TempDir Path tempDir) {
    dataStore = new HashMapDataStore(DefaultClassScanner.getInstance(), TableExport.class.getPackage());
    Map<String, Class<? extends Check>> map = new HashMap<>();
    elide = new Elide(new ElideSettingsBuilder(dataStore).withEntityDictionary(EntityDictionary.builder().checks(map).build()).withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")).build());
    elide.doScans();
    scope = mock(RequestScope.class);
}
Also used : ElideSettingsBuilder(com.yahoo.elide.ElideSettingsBuilder) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) HashMapDataStore(com.yahoo.elide.core.datastore.inmemory.HashMapDataStore) Check(com.yahoo.elide.core.security.checks.Check) Elide(com.yahoo.elide.Elide) RequestScope(com.yahoo.elide.core.RequestScope) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

HashMapDataStore (com.yahoo.elide.core.datastore.inmemory.HashMapDataStore)15 Elide (com.yahoo.elide.Elide)11 ElideSettingsBuilder (com.yahoo.elide.ElideSettingsBuilder)10 HashMap (java.util.HashMap)9 Check (com.yahoo.elide.core.security.checks.Check)8 BeforeEach (org.junit.jupiter.api.BeforeEach)7 RequestScope (com.yahoo.elide.core.RequestScope)5 EntityDictionary (com.yahoo.elide.core.dictionary.EntityDictionary)4 AsyncQuery (com.yahoo.elide.async.models.AsyncQuery)3 DefaultAsyncAPIDAO (com.yahoo.elide.async.service.dao.DefaultAsyncAPIDAO)3 FileResultStorageEngine (com.yahoo.elide.async.service.storageengine.FileResultStorageEngine)3 DataStoreTransaction (com.yahoo.elide.core.datastore.DataStoreTransaction)3 User (com.yahoo.elide.core.security.User)3 AsyncAPIInlineChecks (com.yahoo.elide.async.models.security.AsyncAPIInlineChecks)2 AsyncExecutorService (com.yahoo.elide.async.service.AsyncExecutorService)2 Slf4jLogger (com.yahoo.elide.core.audit.Slf4jLogger)2 DataStore (com.yahoo.elide.core.datastore.DataStore)2 DuplicateMappingException (com.yahoo.elide.core.exceptions.DuplicateMappingException)2 ClassScanner (com.yahoo.elide.core.utils.ClassScanner)2 FirstBean (com.yahoo.elide.example.beans.FirstBean)2