@Test public void verifyRow() throws Exception { final Properties p = getUTProperties(); final TimeSeriesWorkload wl = getWorkload(p, true); final TreeMap<String, String> validationTags = new TreeMap<String, String>(); final HashMap<String, ByteIterator> cells = new HashMap<String, ByteIterator>(); validationTags.put("AA", "AAAA"); cells.put("AA", new StringByteIterator("AAAA")); validationTags.put("AB", "AAAB"); cells.put("AB", new StringByteIterator("AAAB")); long hash = wl.validationFunction("AAAA", 1451606400L, validationTags); cells.put(TimeSeriesWorkload.TIMESTAMP_KEY_PROPERTY_DEFAULT, new NumericByteIterator(1451606400L)); cells.put(TimeSeriesWorkload.VALUE_KEY_PROPERTY_DEFAULT, new NumericByteIterator(hash)); assertEquals(wl.verifyRow("AAAA", cells), Status.OK); for (final ByteIterator it : cells.values()) { it.reset(); } cells.put(TimeSeriesWorkload.VALUE_KEY_PROPERTY_DEFAULT, new NumericByteIterator(hash + 1)); assertEquals(wl.verifyRow("AAAA", cells), Status.UNEXPECTED_STATE); for (final ByteIterator it : cells.values()) { it.reset(); } cells.remove(TimeSeriesWorkload.VALUE_KEY_PROPERTY_DEFAULT); assertEquals(wl.verifyRow("AAAA", cells), Status.UNEXPECTED_STATE); }
protected Status verifyRow(final String key, final Map<String, ByteIterator> cells) { Status verifyStatus = Status.UNEXPECTED_STATE; long startTime = System.nanoTime(); double value = 0; long timestamp = 0; final TreeMap<String, String> validationTags = new TreeMap<String, String>(); for (final Entry<String, ByteIterator> entry : cells.entrySet()) { if (entry.getKey().equals(timestampKey)) { final NumericByteIterator it = (NumericByteIterator) entry.getValue(); timestamp = it.getLong(); } else if (entry.getKey().equals(valueKey)) { final NumericByteIterator it = (NumericByteIterator) entry.getValue(); value = it.isFloatingPoint() ? it.getDouble() : it.getLong(); } else { validationTags.put(entry.getKey(), entry.getValue().toString()); } } if (validationFunction(key, timestamp, validationTags) == value) { verifyStatus = Status.OK; } long endTime = System.nanoTime(); measurements.measure("VERIFY", (int) (endTime - startTime) / 1000); measurements.reportStatus("VERIFY", verifyStatus); return verifyStatus; }
TimeSeriesWorkload extends Workload { protected Status verifyRow(final String key, final Map<String, ByteIterator> cells) { Status verifyStatus = Status.UNEXPECTED_STATE; long startTime = System.nanoTime(); double value = 0; long timestamp = 0; final TreeMap<String, String> validationTags = new TreeMap<String, String>(); for (final Entry<String, ByteIterator> entry : cells.entrySet()) { if (entry.getKey().equals(timestampKey)) { final NumericByteIterator it = (NumericByteIterator) entry.getValue(); timestamp = it.getLong(); } else if (entry.getKey().equals(valueKey)) { final NumericByteIterator it = (NumericByteIterator) entry.getValue(); value = it.isFloatingPoint() ? it.getDouble() : it.getLong(); } else { validationTags.put(entry.getKey(), entry.getValue().toString()); } } if (validationFunction(key, timestamp, validationTags) == value) { verifyStatus = Status.OK; } long endTime = System.nanoTime(); measurements.measure("VERIFY", (int) (endTime - startTime) / 1000); measurements.reportStatus("VERIFY", verifyStatus); return verifyStatus; } }
TimeSeriesWorkload extends Workload { protected Status verifyRow(final String key, final Map<String, ByteIterator> cells) { Status verifyStatus = Status.UNEXPECTED_STATE; long startTime = System.nanoTime(); double value = 0; long timestamp = 0; final TreeMap<String, String> validationTags = new TreeMap<String, String>(); for (final Entry<String, ByteIterator> entry : cells.entrySet()) { if (entry.getKey().equals(timestampKey)) { final NumericByteIterator it = (NumericByteIterator) entry.getValue(); timestamp = it.getLong(); } else if (entry.getKey().equals(valueKey)) { final NumericByteIterator it = (NumericByteIterator) entry.getValue(); value = it.isFloatingPoint() ? it.getDouble() : it.getLong(); } else { validationTags.put(entry.getKey(), entry.getValue().toString()); } } if (validationFunction(key, timestamp, validationTags) == value) { verifyStatus = Status.OK; } long endTime = System.nanoTime(); measurements.measure("VERIFY", (int) (endTime - startTime) / 1000); measurements.reportStatus("VERIFY", verifyStatus); return verifyStatus; }  }
TimeSeriesWorkload extends Workload { protected Status verifyRow(final String key, final Map<String, ByteIterator> cells) { Status verifyStatus = Status.UNEXPECTED_STATE; long startTime = System.nanoTime(); double value = 0; long timestamp = 0; final TreeMap<String, String> validationTags = new TreeMap<String, String>(); for (final Entry<String, ByteIterator> entry : cells.entrySet()) { if (entry.getKey().equals(timestampKey)) { final NumericByteIterator it = (NumericByteIterator) entry.getValue(); timestamp = it.getLong(); } else if (entry.getKey().equals(valueKey)) { final NumericByteIterator it = (NumericByteIterator) entry.getValue(); value = it.isFloatingPoint() ? it.getDouble() : it.getLong(); } else { validationTags.put(entry.getKey(), entry.getValue().toString()); } } if (validationFunction(key, timestamp, validationTags) == value) { verifyStatus = Status.OK; } long endTime = System.nanoTime(); measurements.measure("VERIFY", (int) (endTime - startTime) / 1000); measurements.reportStatus("VERIFY", verifyStatus); return verifyStatus; }  @Override void init(final Properties p); @Override Object initThread(Properties p, int mythreadid, int threadcount); @Override boolean doInsert(DB db, Object threadstate); @Override boolean doTransaction(DB db, Object threadstate); }
TimeSeriesWorkload extends Workload { protected Status verifyRow(final String key, final Map<String, ByteIterator> cells) { Status verifyStatus = Status.UNEXPECTED_STATE; long startTime = System.nanoTime(); double value = 0; long timestamp = 0; final TreeMap<String, String> validationTags = new TreeMap<String, String>(); for (final Entry<String, ByteIterator> entry : cells.entrySet()) { if (entry.getKey().equals(timestampKey)) { final NumericByteIterator it = (NumericByteIterator) entry.getValue(); timestamp = it.getLong(); } else if (entry.getKey().equals(valueKey)) { final NumericByteIterator it = (NumericByteIterator) entry.getValue(); value = it.isFloatingPoint() ? it.getDouble() : it.getLong(); } else { validationTags.put(entry.getKey(), entry.getValue().toString()); } } if (validationFunction(key, timestamp, validationTags) == value) { verifyStatus = Status.OK; } long endTime = System.nanoTime(); measurements.measure("VERIFY", (int) (endTime - startTime) / 1000); measurements.reportStatus("VERIFY", verifyStatus); return verifyStatus; }  @Override void init(final Properties p); @Override Object initThread(Properties p, int mythreadid, int threadcount); @Override boolean doInsert(DB db, Object threadstate); @Override boolean doTransaction(DB db, Object threadstate); static final String TIMESTAMP_KEY_PROPERTY; static final String TIMESTAMP_KEY_PROPERTY_DEFAULT; static final String VALUE_KEY_PROPERTY; static final String VALUE_KEY_PROPERTY_DEFAULT; static final String TIMESTAMP_INTERVAL_PROPERTY; static final String TIMESTAMP_INTERVAL_PROPERTY_DEFAULT; static final String TIMESTAMP_UNITS_PROPERTY; static final String TIMESTAMP_UNITS_PROPERTY_DEFAULT; static final String TAG_COUNT_PROPERTY; static final String TAG_COUNT_PROPERTY_DEFAULT; static final String TAG_CARDINALITY_PROPERTY; static final String TAG_CARDINALITY_PROPERTY_DEFAULT; static final String TAG_KEY_LENGTH_PROPERTY; static final String TAG_KEY_LENGTH_PROPERTY_DEFAULT; static final String TAG_VALUE_LENGTH_PROPERTY; static final String TAG_VALUE_LENGTH_PROPERTY_DEFAULT; static final String PAIR_DELIMITER_PROPERTY; static final String PAIR_DELIMITER_PROPERTY_DEFAULT; static final String DELETE_DELIMITER_PROPERTY; static final String DELETE_DELIMITER_PROPERTY_DEFAULT; static final String RANDOMIZE_TIMESTAMP_ORDER_PROPERTY; static final String RANDOMIZE_TIMESTAMP_ORDER_PROPERTY_DEFAULT; static final String RANDOMIZE_TIMESERIES_ORDER_PROPERTY; static final String RANDOMIZE_TIMESERIES_ORDER_PROPERTY_DEFAULT; static final String VALUE_TYPE_PROPERTY; static final String VALUE_TYPE_PROPERTY_DEFAULT; static final String SPARSITY_PROPERTY; static final String SPARSITY_PROPERTY_DEFAULT; static final String DELAYED_SERIES_PROPERTY; static final String DELAYED_SERIES_PROPERTY_DEFAULT; static final String DELAYED_INTERVALS_PROPERTY; static final String DELAYED_INTERVALS_PROPERTY_DEFAULT; static final String QUERY_TIMESPAN_PROPERTY; static final String QUERY_TIMESPAN_PROPERTY_DEFAULT; static final String QUERY_RANDOM_TIMESPAN_PROPERTY; static final String QUERY_RANDOM_TIMESPAN_PROPERTY_DEFAULT; static final String QUERY_TIMESPAN_DELIMITER_PROPERTY; static final String QUERY_TIMESPAN_DELIMITER_PROPERTY_DEFAULT; static final String GROUPBY_KEY_PROPERTY; static final String GROUPBY_KEY_PROPERTY_DEFAULT; static final String GROUPBY_PROPERTY; static final String GROUPBY_KEYS_PROPERTY; static final String DOWNSAMPLING_KEY_PROPERTY; static final String DOWNSAMPLING_KEY_PROPERTY_DEFAULT; static final String DOWNSAMPLING_FUNCTION_PROPERTY; static final String DOWNSAMPLING_INTERVAL_PROPERTY; }