Search in sources :

Example 1 with ElideStandalone

use of com.yahoo.elide.standalone.ElideStandalone in project elide by yahoo.

the class ElideStandaloneDisableAggStoreTest method init.

@Override
@BeforeAll
public void init() throws Exception {
    elide = new ElideStandalone(new ElideStandaloneTestSettings() {

        @Override
        public ElideStandaloneAnalyticSettings getAnalyticProperties() {
            ElideStandaloneAnalyticSettings analyticProperties = new ElideStandaloneAnalyticSettings() {

                @Override
                public boolean enableDynamicModelConfig() {
                    return true;
                }

                @Override
                public boolean enableAggregationDataStore() {
                    return false;
                }

                @Override
                public String getDynamicConfigPath() {
                    return "src/test/resources/configs/";
                }
            };
            return analyticProperties;
        }
    });
    elide.start(false);
}
Also used : ElideStandalone(com.yahoo.elide.standalone.ElideStandalone) ElideStandaloneAnalyticSettings(com.yahoo.elide.standalone.config.ElideStandaloneAnalyticSettings) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with ElideStandalone

use of com.yahoo.elide.standalone.ElideStandalone in project elide by yahoo.

the class ElideStandaloneDisableMetaDataStoreTest method init.

@BeforeAll
public void init() throws Exception {
    elide = new ElideStandalone(new ElideStandaloneTestSettings() {

        @Override
        public ElideStandaloneAnalyticSettings getAnalyticProperties() {
            ElideStandaloneAnalyticSettings analyticProperties = new ElideStandaloneAnalyticSettings() {

                @Override
                public boolean enableDynamicModelConfig() {
                    return true;
                }

                @Override
                public boolean enableAggregationDataStore() {
                    return true;
                }

                @Override
                public boolean enableMetaDataStore() {
                    return false;
                }

                @Override
                public String getDynamicConfigPath() {
                    return "src/test/resources/configs/";
                }
            };
            return analyticProperties;
        }
    });
    elide.start(false);
}
Also used : ElideStandalone(com.yahoo.elide.standalone.ElideStandalone) ElideStandaloneAnalyticSettings(com.yahoo.elide.standalone.config.ElideStandaloneAnalyticSettings) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with ElideStandalone

use of com.yahoo.elide.standalone.ElideStandalone in project elide by yahoo.

the class ElideStandaloneTest method init.

@BeforeAll
public void init() throws Exception {
    settings = new ElideStandaloneTestSettings();
    elide = new ElideStandalone(settings);
    elide.start(false);
}
Also used : ElideStandalone(com.yahoo.elide.standalone.ElideStandalone) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 4 with ElideStandalone

use of com.yahoo.elide.standalone.ElideStandalone in project elide by yahoo.

the class ElideStandaloneConfigStoreTest method init.

@BeforeAll
public void init() throws Exception {
    configRoot = Files.createTempDirectory("test");
    settings = new ElideStandaloneTestSettings() {

        @Override
        public EntityDictionary getEntityDictionary(ServiceLocator injector, ClassScanner scanner, Optional<DynamicConfiguration> dynamicConfiguration, Set<Type<?>> entitiesToExclude) {
            Map<String, Class<? extends Check>> checks = new HashMap<>();
            if (getAnalyticProperties().enableDynamicModelConfigAPI()) {
                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) {
                    injector.inject(entity);
                }

                @Override
                public <T> T instantiate(Class<T> cls) {
                    return injector.create(cls);
                }
            }, // Serde Lookup
            CoerceUtil::lookup, entitiesToExclude, scanner);
            dynamicConfiguration.map(DynamicConfiguration::getRoles).orElseGet(Collections::emptySet).forEach(role -> dictionary.addRoleCheck(role, new Role.RoleMemberCheck(role)));
            return dictionary;
        }

        @Override
        public ElideStandaloneAnalyticSettings getAnalyticProperties() {
            return new ElideStandaloneAnalyticSettings() {

                @Override
                public boolean enableDynamicModelConfig() {
                    return true;
                }

                @Override
                public boolean enableDynamicModelConfigAPI() {
                    return true;
                }

                @Override
                public String getDynamicConfigPath() {
                    return configRoot.toFile().getAbsolutePath();
                }

                @Override
                public boolean enableAggregationDataStore() {
                    return true;
                }

                @Override
                public boolean enableMetaDataStore() {
                    return true;
                }
            };
        }
    };
    elide = new ElideStandalone(settings);
    elide.start(false);
}
Also used : ElideStandalone(com.yahoo.elide.standalone.ElideStandalone) HttpStatus(com.yahoo.elide.core.exceptions.HttpStatus) DynamicConfiguration(com.yahoo.elide.modelconfig.DynamicConfiguration) JSONAPI_CONTENT_TYPE(com.yahoo.elide.Elide.JSONAPI_CONTENT_TYPE) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) ElideStandaloneSettings(com.yahoo.elide.standalone.config.ElideStandaloneSettings) HashMap(java.util.HashMap) Role(com.yahoo.elide.core.security.checks.prefab.Role) JsonApiDSL.attr(com.yahoo.elide.test.jsonapi.JsonApiDSL.attr) AfterAll(org.junit.jupiter.api.AfterAll) MediaType(javax.ws.rs.core.MediaType) TestInstance(org.junit.jupiter.api.TestInstance) BeforeAll(org.junit.jupiter.api.BeforeAll) GraphQLDSL.mutation(com.yahoo.elide.test.graphql.GraphQLDSL.mutation) ClassScanner(com.yahoo.elide.core.utils.ClassScanner) Injector(com.yahoo.elide.core.dictionary.Injector) Map(java.util.Map) RestAssured.when(io.restassured.RestAssured.when) GraphQLDSL.argument(com.yahoo.elide.test.graphql.GraphQLDSL.argument) JsonApiDSL.datum(com.yahoo.elide.test.jsonapi.JsonApiDSL.datum) Path(java.nio.file.Path) JsonApiDSL.type(com.yahoo.elide.test.jsonapi.JsonApiDSL.type) JsonApiDSL.links(com.yahoo.elide.test.jsonapi.JsonApiDSL.links) GraphQLDSL.selection(com.yahoo.elide.test.graphql.GraphQLDSL.selection) JsonApiDSL.attributes(com.yahoo.elide.test.jsonapi.JsonApiDSL.attributes) Check(com.yahoo.elide.core.security.checks.Check) Files(java.nio.file.Files) GraphQLDSL.selections(com.yahoo.elide.test.graphql.GraphQLDSL.selections) GraphQLDSL.field(com.yahoo.elide.test.graphql.GraphQLDSL.field) ElideStandaloneAnalyticSettings(com.yahoo.elide.standalone.config.ElideStandaloneAnalyticSettings) Set(java.util.Set) ConfigChecks(com.yahoo.elide.modelconfig.store.models.ConfigChecks) CoerceUtil(com.yahoo.elide.core.utils.coerce.CoerceUtil) EntityDictionary(com.yahoo.elide.core.dictionary.EntityDictionary) JsonApiDSL.resource(com.yahoo.elide.test.jsonapi.JsonApiDSL.resource) GraphQLDSL(com.yahoo.elide.test.graphql.GraphQLDSL) Test(org.junit.jupiter.api.Test) JsonApiDSL.id(com.yahoo.elide.test.jsonapi.JsonApiDSL.id) GraphQLDSL.arguments(com.yahoo.elide.test.graphql.GraphQLDSL.arguments) JsonApiDSL.data(com.yahoo.elide.test.jsonapi.JsonApiDSL.data) Type(com.yahoo.elide.core.type.Type) Optional(java.util.Optional) RestAssured.given(io.restassured.RestAssured.given) ServiceLocator(org.glassfish.hk2.api.ServiceLocator) Collections(java.util.Collections) HashMap(java.util.HashMap) ClassScanner(com.yahoo.elide.core.utils.ClassScanner) DynamicConfiguration(com.yahoo.elide.modelconfig.DynamicConfiguration) Injector(com.yahoo.elide.core.dictionary.Injector) Collections(java.util.Collections) EntityDictionary(com.yahoo.elide.core.dictionary.EntityDictionary) ElideStandaloneAnalyticSettings(com.yahoo.elide.standalone.config.ElideStandaloneAnalyticSettings) ServiceLocator(org.glassfish.hk2.api.ServiceLocator) Role(com.yahoo.elide.core.security.checks.prefab.Role) MediaType(javax.ws.rs.core.MediaType) Type(com.yahoo.elide.core.type.Type) ElideStandalone(com.yahoo.elide.standalone.ElideStandalone) HashMap(java.util.HashMap) Map(java.util.Map) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 5 with ElideStandalone

use of com.yahoo.elide.standalone.ElideStandalone in project elide by yahoo.

the class ElideStandaloneExportTest method init.

@BeforeAll
public void init() throws Exception {
    elide = new ElideStandalone(new ElideStandaloneTestSettings() {

        @Override
        public ElideStandaloneAsyncSettings getAsyncProperties() {
            ElideStandaloneAsyncSettings asyncProperties = new ElideStandaloneAsyncSettings() {

                @Override
                public boolean enabled() {
                    return true;
                }

                @Override
                public boolean enableCleanup() {
                    return true;
                }

                @Override
                public Integer getThreadSize() {
                    return 5;
                }

                @Override
                public Integer getMaxRunTimeSeconds() {
                    return 1800;
                }

                @Override
                public Integer getQueryCleanupDays() {
                    return 3;
                }

                @Override
                public boolean enableExport() {
                    return true;
                }
            };
            return asyncProperties;
        }

        @Override
        public ElideStandaloneAnalyticSettings getAnalyticProperties() {
            ElideStandaloneAnalyticSettings analyticProperties = new ElideStandaloneAnalyticSettings() {

                @Override
                public boolean enableDynamicModelConfig() {
                    return true;
                }

                @Override
                public boolean enableAggregationDataStore() {
                    return true;
                }

                @Override
                public boolean enableMetaDataStore() {
                    return true;
                }

                @Override
                public String getDefaultDialect() {
                    return SQLDialectFactory.getDefaultDialect().getDialectType();
                }

                @Override
                public String getDynamicConfigPath() {
                    return "src/test/resources/configs/";
                }
            };
            return analyticProperties;
        }
    });
    elide.start(false);
}
Also used : ElideStandaloneAsyncSettings(com.yahoo.elide.standalone.config.ElideStandaloneAsyncSettings) ElideStandalone(com.yahoo.elide.standalone.ElideStandalone) ElideStandaloneAnalyticSettings(com.yahoo.elide.standalone.config.ElideStandaloneAnalyticSettings) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

ElideStandalone (com.yahoo.elide.standalone.ElideStandalone)6 BeforeAll (org.junit.jupiter.api.BeforeAll)6 ElideStandaloneAnalyticSettings (com.yahoo.elide.standalone.config.ElideStandaloneAnalyticSettings)4 JSONAPI_CONTENT_TYPE (com.yahoo.elide.Elide.JSONAPI_CONTENT_TYPE)1 EntityDictionary (com.yahoo.elide.core.dictionary.EntityDictionary)1 Injector (com.yahoo.elide.core.dictionary.Injector)1 HttpStatus (com.yahoo.elide.core.exceptions.HttpStatus)1 Check (com.yahoo.elide.core.security.checks.Check)1 Role (com.yahoo.elide.core.security.checks.prefab.Role)1 Type (com.yahoo.elide.core.type.Type)1 ClassScanner (com.yahoo.elide.core.utils.ClassScanner)1 CoerceUtil (com.yahoo.elide.core.utils.coerce.CoerceUtil)1 DynamicConfiguration (com.yahoo.elide.modelconfig.DynamicConfiguration)1 ConfigChecks (com.yahoo.elide.modelconfig.store.models.ConfigChecks)1 ElideStandaloneAsyncSettings (com.yahoo.elide.standalone.config.ElideStandaloneAsyncSettings)1 ElideStandaloneSettings (com.yahoo.elide.standalone.config.ElideStandaloneSettings)1 ElideStandaloneSubscriptionSettings (com.yahoo.elide.standalone.config.ElideStandaloneSubscriptionSettings)1 GraphQLDSL (com.yahoo.elide.test.graphql.GraphQLDSL)1 GraphQLDSL.argument (com.yahoo.elide.test.graphql.GraphQLDSL.argument)1 GraphQLDSL.arguments (com.yahoo.elide.test.graphql.GraphQLDSL.arguments)1