use of org.locationtech.geowave.core.store.memory.MemoryStoreFactoryFamily in project geowave by locationtech.
the class KMeansDistortionMapReduceTest method setUp.
@Before
public void setUp() throws IOException {
final KMeansDistortionMapReduce.KMeansDistortionMapper mapper = new KMeansDistortionMapReduce.KMeansDistortionMapper();
final KMeansDistortionMapReduce.KMeansDistortionReduce reducer = new KMeansDistortionMapReduce.KMeansDistortionReduce();
mapDriver = MapDriver.newMapDriver(mapper);
reduceDriver = ReduceDriver.newReduceDriver(reducer);
mapDriver.getConfiguration().setClass(GeoWaveConfiguratorBase.enumToConfKey(KMeansDistortionMapReduce.class, CommonParameters.Common.DISTANCE_FUNCTION_CLASS), FeatureCentroidDistanceFn.class, DistanceFn.class);
JobContextAdapterStore.addDataAdapter(mapDriver.getConfiguration(), testObjectAdapter);
JobContextAdapterStore.addDataAdapter(reduceDriver.getConfiguration(), testObjectAdapter);
JobContextInternalAdapterStore.addTypeName(mapDriver.getConfiguration(), testObjectAdapter.getTypeName(), adapterId);
JobContextInternalAdapterStore.addTypeName(reduceDriver.getConfiguration(), testObjectAdapter.getTypeName(), adapterId);
final PropertyManagement propManagement = new PropertyManagement();
propManagement.store(CentroidParameters.Centroid.INDEX_NAME, SpatialDimensionalityTypeProvider.createIndexFromOptions(new SpatialOptions()).getName());
propManagement.store(CentroidParameters.Centroid.DATA_TYPE_ID, ftype.getTypeName());
propManagement.store(CentroidParameters.Centroid.DATA_NAMESPACE_URI, ftype.getName().getNamespaceURI());
propManagement.store(GlobalParameters.Global.BATCH_ID, batchId);
propManagement.store(CentroidParameters.Centroid.EXTRACTOR_CLASS, SimpleFeatureCentroidExtractor.class);
propManagement.store(CentroidParameters.Centroid.WRAPPER_FACTORY_CLASS, SimpleFeatureItemWrapperFactory.class);
final DataStorePluginOptions pluginOptions = new DataStorePluginOptions();
GeoWaveStoreFinder.getRegisteredStoreFactoryFamilies().put("memory", new MemoryStoreFactoryFamily());
pluginOptions.selectPlugin("memory");
final MemoryRequiredOptions opts = (MemoryRequiredOptions) pluginOptions.getFactoryOptions();
final String namespace = "test_" + getClass().getName() + "_" + name.getMethodName();
opts.setGeoWaveNamespace(namespace);
final PersistableStore store = new PersistableStore(pluginOptions);
propManagement.store(StoreParam.INPUT_STORE, store);
NestedGroupCentroidAssignment.setParameters(mapDriver.getConfiguration(), KMeansDistortionMapReduce.class, propManagement);
serializations();
capturedObjects.clear();
final SimpleFeature feature = AnalyticFeature.createGeometryFeature(ftype, batchId, "123", "fred", grp1, 20.30203, factory.createPoint(new Coordinate(02.33, 0.23)), new String[] { "extra1" }, new double[] { 0.022 }, 1, 1, 0);
propManagement.store(CentroidParameters.Centroid.ZOOM_LEVEL, 1);
ingest(pluginOptions.createDataStore(), testObjectAdapter, index, feature);
CentroidManagerGeoWave.setParameters(reduceDriver.getConfiguration(), KMeansDistortionMapReduce.class, propManagement);
}
use of org.locationtech.geowave.core.store.memory.MemoryStoreFactoryFamily in project geowave by locationtech.
the class KSamplerMapReduceTest method setUp.
@Before
public void setUp() throws IOException {
final KSamplerMapReduce.SampleMap<TestObject> mapper = new KSamplerMapReduce.SampleMap<>();
final KSamplerMapReduce.SampleReducer<TestObject> reducer = new KSamplerMapReduce.SampleReducer<>();
mapDriver = MapDriver.newMapDriver(mapper);
reduceDriver = ReduceDriver.newReduceDriver(reducer);
final DataTypeAdapter<?> adapter = AnalyticFeature.createGeometryFeatureAdapter("altoids", new String[] {}, "http://geowave.test.net", ClusteringUtils.CLUSTERING_CRS);
final PropertyManagement propManagement = new PropertyManagement();
final DataStorePluginOptions pluginOptions = new DataStorePluginOptions();
GeoWaveStoreFinder.getRegisteredStoreFactoryFamilies().put("memory", new MemoryStoreFactoryFamily());
pluginOptions.selectPlugin("memory");
final MemoryRequiredOptions opts = (MemoryRequiredOptions) pluginOptions.getFactoryOptions();
final String namespace = "test_" + getClass().getName() + "_" + name.getMethodName();
opts.setGeoWaveNamespace(namespace);
final PersistableStore store = new PersistableStore(pluginOptions);
propManagement.store(StoreParam.INPUT_STORE, store);
propManagement.store(CentroidParameters.Centroid.INDEX_NAME, SpatialDimensionalityTypeProvider.createIndexFromOptions(new SpatialOptions()).getName());
propManagement.store(CentroidParameters.Centroid.DATA_TYPE_ID, "altoids");
propManagement.store(CentroidParameters.Centroid.DATA_NAMESPACE_URI, "http://geowave.test.net");
propManagement.store(GlobalParameters.Global.BATCH_ID, "b1");
propManagement.store(CentroidParameters.Centroid.EXTRACTOR_CLASS, TestObjectExtractor.class);
propManagement.store(CentroidParameters.Centroid.WRAPPER_FACTORY_CLASS, TestObjectItemWrapperFactory.class);
CentroidManagerGeoWave.setParameters(reduceDriver.getConfiguration(), KSamplerMapReduce.class, propManagement);
CentroidManagerGeoWave.setParameters(mapDriver.getConfiguration(), KSamplerMapReduce.class, propManagement);
// TODO it seems the centroid adapter is required to have been written,
// should this initialization be handled by the runner class rather than
// externally such as in the test?
final DataStore dataStore = store.getDataStoreOptions().createDataStore();
final InternalAdapterStore internalAdapterStore = store.getDataStoreOptions().createInternalAdapterStore();
dataStore.addType(adapter, SpatialDimensionalityTypeProvider.createIndexFromOptions(new SpatialOptions()));
mapDriver.getConfiguration().setClass(GeoWaveConfiguratorBase.enumToConfKey(KSamplerMapReduce.class, SampleParameters.Sample.SAMPLE_RANK_FUNCTION), TestSamplingMidRankFunction.class, SamplingRankFunction.class);
internalAdapterId = internalAdapterStore.getInitialAdapterId(testObjectAdapter.getTypeName());
other = internalAdapterStore.getInitialAdapterId(adapter.getTypeName());
JobContextAdapterStore.addDataAdapter(mapDriver.getConfiguration(), testObjectAdapter);
JobContextAdapterStore.addDataAdapter(mapDriver.getConfiguration(), adapter);
JobContextInternalAdapterStore.addTypeName(mapDriver.getConfiguration(), testObjectAdapter.getTypeName(), internalAdapterId);
JobContextInternalAdapterStore.addTypeName(mapDriver.getConfiguration(), adapter.getTypeName(), other);
mapDriver.getConfiguration().setInt(GeoWaveConfiguratorBase.enumToConfKey(KSamplerMapReduce.class, SampleParameters.Sample.SAMPLE_SIZE), 2);
reduceDriver.getConfiguration().setInt(GeoWaveConfiguratorBase.enumToConfKey(KSamplerMapReduce.class, SampleParameters.Sample.SAMPLE_SIZE), 2);
JobContextAdapterStore.addDataAdapter(reduceDriver.getConfiguration(), adapter);
JobContextAdapterStore.addDataAdapter(reduceDriver.getConfiguration(), testObjectAdapter);
JobContextInternalAdapterStore.addTypeName(reduceDriver.getConfiguration(), adapter.getTypeName(), other);
JobContextInternalAdapterStore.addTypeName(reduceDriver.getConfiguration(), testObjectAdapter.getTypeName(), internalAdapterId);
reduceDriver.getConfiguration().set(GeoWaveConfiguratorBase.enumToConfKey(KSamplerMapReduce.class, SampleParameters.Sample.DATA_TYPE_NAME), "altoids");
reduceDriver.getConfiguration().setClass(GeoWaveConfiguratorBase.enumToConfKey(KSamplerMapReduce.class, CentroidParameters.Centroid.EXTRACTOR_CLASS), TestObjectExtractor.class, CentroidExtractor.class);
mapDriver.getConfiguration().setClass(GeoWaveConfiguratorBase.enumToConfKey(KSamplerMapReduce.class, CentroidParameters.Centroid.WRAPPER_FACTORY_CLASS), TestObjectItemWrapperFactory.class, AnalyticItemWrapperFactory.class);
reduceDriver.getConfiguration().setClass(GeoWaveConfiguratorBase.enumToConfKey(KSamplerMapReduce.class, CentroidParameters.Centroid.WRAPPER_FACTORY_CLASS), TestObjectItemWrapperFactory.class, AnalyticItemWrapperFactory.class);
serializations();
}
use of org.locationtech.geowave.core.store.memory.MemoryStoreFactoryFamily in project geowave by locationtech.
the class IngestRunnerTest method setup.
@BeforeClass
public static void setup() throws IOException {
// Skip this test if we're on a Mac
org.junit.Assume.assumeTrue(isNotMac() && isGDALEnabled());
GeoWaveStoreFinder.getRegisteredStoreFactoryFamilies().put("memory", new MemoryStoreFactoryFamily());
InstallGdal.main(new String[] { System.getenv("GDAL_DIR") });
}
use of org.locationtech.geowave.core.store.memory.MemoryStoreFactoryFamily in project geowave by locationtech.
the class ConfigCacheIT method addStore.
@Test
public void addStore() {
final String storeName = new MemoryStoreFactoryFamily().getType();
final AddStoreCommand command = new AddStoreCommand();
command.setParameters("abc");
command.setMakeDefault(true);
command.setStoreType(storeName);
// This will load the params via SPI.
command.prepare(operationParams);
final DataStorePluginOptions options = command.getPluginOptions();
final MemoryRequiredOptions opts = (MemoryRequiredOptions) options.getFactoryOptions();
opts.setGeoWaveNamespace("namespace");
command.execute(operationParams);
final Properties props = ConfigOptions.loadProperties(configFile);
Assert.assertEquals("namespace", props.getProperty("store.abc.opts." + StoreFactoryOptions.GEOWAVE_NAMESPACE_OPTION));
Assert.assertEquals("abc", props.getProperty(DataStorePluginOptions.DEFAULT_PROPERTY_NAMESPACE));
}
use of org.locationtech.geowave.core.store.memory.MemoryStoreFactoryFamily in project geowave by locationtech.
the class ConfigCacheIT method before.
@Before
public void before() throws IOException {
configFile = File.createTempFile("test_config", null);
operationParams = new ManualOperationParams();
operationParams.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile);
GeoWaveStoreFinder.getRegisteredStoreFactoryFamilies().put("memory", new MemoryStoreFactoryFamily());
}
Aggregations