private static void verifyStats(final DataStorePluginOptions dataStore) throws Exception { final ListStatsCommand listStats = new ListStatsCommand(); listStats.setParameters("test", null); final File configFile = File.createTempFile("test_stats", null); final ManualOperationParams params = new ManualOperationParams(); params.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile); final AddStoreCommand addStore = new AddStoreCommand(); addStore.setParameters("test"); addStore.setPluginOptions(dataStore); addStore.execute(params); try { listStats.execute(params); } catch (final ParameterException e) { throw new RuntimeException(e); } }
@Override public void listStatsCommand( org.locationtech.geowave.service.grpc.protobuf.ListStatsCommandParametersProtos request, StreamObserver<org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.StringResponseProtos> responseObserver) { ListStatsCommand cmd = new ListStatsCommand(); Map<FieldDescriptor, Object> m = request.getAllFields(); GeoWaveGrpcServiceCommandUtil.setGrpcToCommandFields(m, cmd); final File configFile = GeoWaveGrpcServiceOptions.geowaveConfigFile; final OperationParams params = new ManualOperationParams(); params.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile); cmd.prepare(params); LOGGER.info("Executing ListStatsCommand..."); try { final String result = cmd.computeResults(params); final StringResponseProtos resp = StringResponseProtos.newBuilder().setResponseValue(result).build(); responseObserver.onNext(resp); responseObserver.onCompleted(); } catch (final Exception e) { LOGGER.error("Exception encountered executing command", e); } }