Search in sources :

Example 1 with GeoWaveStoreType

use of org.locationtech.geowave.test.annotation.GeoWaveTestStore.GeoWaveStoreType in project geowave by locationtech.

the class GeoWaveITRunner method getTestEnvironments.

private TestEnvironment[] getTestEnvironments() throws NullPointerException {
    final Set<Environment> environments = new HashSet<>();
    final Environments es = getTestClass().getJavaClass().getAnnotation(Environments.class);
    if (es != null) {
        final Environment[] envs = es.value();
        for (final Environment env : envs) {
            environments.add(env);
        }
    }
    final List<FrameworkMethod> envMethods = getTestEnvAnnotatedMethods();
    for (final FrameworkMethod m : envMethods) {
        final Environment[] envs = m.getMethod().getAnnotation(Environments.class).value();
        for (final Environment env : envs) {
            environments.add(env);
        }
    }
    final TestEnvironment[] testEnvs = new TestEnvironment[environments.size() + storeTypes.size()];
    int i = 0;
    for (final GeoWaveStoreType t : storeTypes) {
        testEnvs[i++] = t.getTestEnvironment();
    }
    for (final Environment e : environments) {
        testEnvs[i++] = e.getTestEnvironment();
    }
    return processDependencies(testEnvs);
}
Also used : Environments(org.locationtech.geowave.test.annotation.Environments) GeoWaveStoreType(org.locationtech.geowave.test.annotation.GeoWaveTestStore.GeoWaveStoreType) Environment(org.locationtech.geowave.test.annotation.Environments.Environment) FrameworkMethod(org.junit.runners.model.FrameworkMethod) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 2 with GeoWaveStoreType

use of org.locationtech.geowave.test.annotation.GeoWaveTestStore.GeoWaveStoreType in project geowave by locationtech.

the class GeoWaveITRunner method addRunnerConfigsForField.

private static List<GeoWaveStoreRunnerConfig> addRunnerConfigsForField(final FrameworkField field, final List<GeoWaveStoreRunnerConfig> currentConfigs, final Set<GeoWaveStoreType> storeTypes) throws GeoWaveITException {
    final GeoWaveTestStore store = field.getField().getAnnotation(GeoWaveTestStore.class);
    final GeoWaveStoreType[] types = store.value();
    if ((types == null) || (types.length == 0)) {
        throw new GeoWaveITException(MessageFormat.format("{0} must have at least one GeoWaveStoreType", field.getName()));
    }
    final List<GeoWaveStoreRunnerConfig> newConfigs = new ArrayList<>();
    for (final GeoWaveStoreRunnerConfig config : currentConfigs) {
        for (final GeoWaveStoreType type : types) {
            newConfigs.add(new GeoWaveStoreRunnerConfig(config, field.getName(), type));
            storeTypes.add(type);
        }
    }
    return newConfigs;
}
Also used : GeoWaveStoreType(org.locationtech.geowave.test.annotation.GeoWaveTestStore.GeoWaveStoreType) ArrayList(java.util.ArrayList) GeoWaveTestStore(org.locationtech.geowave.test.annotation.GeoWaveTestStore)

Example 3 with GeoWaveStoreType

use of org.locationtech.geowave.test.annotation.GeoWaveTestStore.GeoWaveStoreType in project geowave by locationtech.

the class GeoWaveITRunner method createRunnersForDataStores.

private void createRunnersForDataStores() throws InitializationError, SecurityException, GeoWaveITException {
    List<GeoWaveStoreRunnerConfig> configs = new ArrayList<>();
    String storeTypeProp = System.getenv(STORE_TYPE_ENVIRONMENT_VARIABLE_NAME);
    if (!TestUtils.isSet(storeTypeProp)) {
        storeTypeProp = System.getProperty(STORE_TYPE_PROPERTY_NAME);
    }
    final GeoWaveStoreType storeType;
    final Set<String> dataStoreOptionFields = getDataStoreOptionFieldsForTypeAnnotation();
    // See if user specified a single store type
    if (TestUtils.isSet(storeTypeProp)) {
        storeType = GeoWaveStoreType.valueOf(storeTypeProp);
    } else {
        // No user override - just use RocksDB
        storeType = GeoWaveStoreType.ROCKSDB;
    }
    if (containsAnnotationForType(storeType)) {
        configs.add(new GeoWaveStoreRunnerConfig(storeType, dataStoreOptionFields));
        storeTypes.add(storeType);
    }
    // Get the set of profile options from the profile, if any
    final String[][] profileOptionSets = getProfileOptionSets();
    // Iterate through option sets to create runners
    for (final String[] profileOptions : profileOptionSets) {
        // Create a test runner for each store type / config
        for (final GeoWaveStoreRunnerConfig config : configs) {
            final TestClassRunnerForStoreTypes runner = new TestClassRunnerForStoreTypes(getTestClass().getJavaClass(), config.fieldNameStoreTypePair, profileOptions);
            runners.add(runner);
        }
    }
}
Also used : GeoWaveStoreType(org.locationtech.geowave.test.annotation.GeoWaveTestStore.GeoWaveStoreType) ArrayList(java.util.ArrayList)

Aggregations

GeoWaveStoreType (org.locationtech.geowave.test.annotation.GeoWaveTestStore.GeoWaveStoreType)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 FrameworkMethod (org.junit.runners.model.FrameworkMethod)1 Environments (org.locationtech.geowave.test.annotation.Environments)1 Environment (org.locationtech.geowave.test.annotation.Environments.Environment)1 GeoWaveTestStore (org.locationtech.geowave.test.annotation.GeoWaveTestStore)1