target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testGetColumnCount() throws SQLException { metadata = new IoTDBResultMetadata(null, null, null); boolean flag = false; try { metadata.getColumnCount(); } catch (Exception e) { flag = true; } assertEquals(flag, true); List<String> columnInfoList = new ArrayList<>(); flag = false; try { metadata = new I... | @Override public int getColumnCount() throws SQLException { if (columnInfoList == null || columnInfoList.size() == 0) { throw new SQLException("No column exists"); } return columnInfoList.size(); } | IoTDBResultMetadata implements ResultSetMetaData { @Override public int getColumnCount() throws SQLException { if (columnInfoList == null || columnInfoList.size() == 0) { throw new SQLException("No column exists"); } return columnInfoList.size(); } } | IoTDBResultMetadata implements ResultSetMetaData { @Override public int getColumnCount() throws SQLException { if (columnInfoList == null || columnInfoList.size() == 0) { throw new SQLException("No column exists"); } return columnInfoList.size(); } IoTDBResultMetadata(List<String> columnInfoList, String operationType,
... | IoTDBResultMetadata implements ResultSetMetaData { @Override public int getColumnCount() throws SQLException { if (columnInfoList == null || columnInfoList.size() == 0) { throw new SQLException("No column exists"); } return columnInfoList.size(); } IoTDBResultMetadata(List<String> columnInfoList, String operationType,
... | IoTDBResultMetadata implements ResultSetMetaData { @Override public int getColumnCount() throws SQLException { if (columnInfoList == null || columnInfoList.size() == 0) { throw new SQLException("No column exists"); } return columnInfoList.size(); } IoTDBResultMetadata(List<String> columnInfoList, String operationType,
... |
@Test public void testGetColumnName() throws SQLException { metadata = new IoTDBResultMetadata(null, null, null); boolean flag = false; try { metadata.getColumnName(1); } catch (Exception e) { flag = true; } assertEquals(flag, true); List<String> columnInfoList = new ArrayList<>(); metadata = new IoTDBResultMetadata(co... | @Override public String getColumnName(int column) throws SQLException { return getColumnLabel(column); } | IoTDBResultMetadata implements ResultSetMetaData { @Override public String getColumnName(int column) throws SQLException { return getColumnLabel(column); } } | IoTDBResultMetadata implements ResultSetMetaData { @Override public String getColumnName(int column) throws SQLException { return getColumnLabel(column); } IoTDBResultMetadata(List<String> columnInfoList, String operationType,
List<String> columnTypeList); } | IoTDBResultMetadata implements ResultSetMetaData { @Override public String getColumnName(int column) throws SQLException { return getColumnLabel(column); } IoTDBResultMetadata(List<String> columnInfoList, String operationType,
List<String> columnTypeList); @Override boolean isWrapperFor(Class<?> arg0); @Override ... | IoTDBResultMetadata implements ResultSetMetaData { @Override public String getColumnName(int column) throws SQLException { return getColumnLabel(column); } IoTDBResultMetadata(List<String> columnInfoList, String operationType,
List<String> columnTypeList); @Override boolean isWrapperFor(Class<?> arg0); @Override ... |
@Test public void testGetColumnType() throws SQLException { metadata = new IoTDBResultMetadata(null, null, null); boolean flag = false; try { metadata.getColumnType(1); } catch (Exception e) { flag = true; } assertEquals(flag, true); List<String> columnInfoList = new ArrayList<>(); metadata = new IoTDBResultMetadata(co... | @Override public int getColumnType(int column) throws SQLException { if (columnInfoList == null || columnInfoList.size() == 0) { throw new SQLException("No column exists"); } if (column > columnInfoList.size()) { throw new SQLException(String.format("column %d does not exist", column)); } if (column <= 0) { throw new S... | IoTDBResultMetadata implements ResultSetMetaData { @Override public int getColumnType(int column) throws SQLException { if (columnInfoList == null || columnInfoList.size() == 0) { throw new SQLException("No column exists"); } if (column > columnInfoList.size()) { throw new SQLException(String.format("column %d does not... | IoTDBResultMetadata implements ResultSetMetaData { @Override public int getColumnType(int column) throws SQLException { if (columnInfoList == null || columnInfoList.size() == 0) { throw new SQLException("No column exists"); } if (column > columnInfoList.size()) { throw new SQLException(String.format("column %d does not... | IoTDBResultMetadata implements ResultSetMetaData { @Override public int getColumnType(int column) throws SQLException { if (columnInfoList == null || columnInfoList.size() == 0) { throw new SQLException("No column exists"); } if (column > columnInfoList.size()) { throw new SQLException(String.format("column %d does not... | IoTDBResultMetadata implements ResultSetMetaData { @Override public int getColumnType(int column) throws SQLException { if (columnInfoList == null || columnInfoList.size() == 0) { throw new SQLException("No column exists"); } if (column > columnInfoList.size()) { throw new SQLException(String.format("column %d does not... |
@Test public void testGetColumnTypeName() throws SQLException { String operationType = "sum"; metadata = new IoTDBResultMetadata(null, operationType, null); assertEquals(metadata.getColumnTypeName(1), operationType); } | @Override public String getColumnTypeName(int arg0) throws SQLException { return operationType; } | IoTDBResultMetadata implements ResultSetMetaData { @Override public String getColumnTypeName(int arg0) throws SQLException { return operationType; } } | IoTDBResultMetadata implements ResultSetMetaData { @Override public String getColumnTypeName(int arg0) throws SQLException { return operationType; } IoTDBResultMetadata(List<String> columnInfoList, String operationType,
List<String> columnTypeList); } | IoTDBResultMetadata implements ResultSetMetaData { @Override public String getColumnTypeName(int arg0) throws SQLException { return operationType; } IoTDBResultMetadata(List<String> columnInfoList, String operationType,
List<String> columnTypeList); @Override boolean isWrapperFor(Class<?> arg0); @Override T unwra... | IoTDBResultMetadata implements ResultSetMetaData { @Override public String getColumnTypeName(int arg0) throws SQLException { return operationType; } IoTDBResultMetadata(List<String> columnInfoList, String operationType,
List<String> columnTypeList); @Override boolean isWrapperFor(Class<?> arg0); @Override T unwra... |
@Test public void test() throws Exception { float value = 7.101f; Encoder encoder = new FloatEncoder(TSEncoding.RLE, TSDataType.FLOAT, 3); ByteArrayOutputStream baos = new ByteArrayOutputStream(); encoder.encode(value, baos); encoder.flush(baos); encoder.encode(value + 2, baos); encoder.flush(baos); ByteBuffer buffer =... | @Override public float readFloat(ByteBuffer buffer) { readMaxPointValue(buffer); int value = decoder.readInt(buffer); double result = value / maxPointValue; return (float) result; } | FloatDecoder extends Decoder { @Override public float readFloat(ByteBuffer buffer) { readMaxPointValue(buffer); int value = decoder.readInt(buffer); double result = value / maxPointValue; return (float) result; } } | FloatDecoder extends Decoder { @Override public float readFloat(ByteBuffer buffer) { readMaxPointValue(buffer); int value = decoder.readInt(buffer); double result = value / maxPointValue; return (float) result; } FloatDecoder(TSEncoding encodingType, TSDataType dataType); } | FloatDecoder extends Decoder { @Override public float readFloat(ByteBuffer buffer) { readMaxPointValue(buffer); int value = decoder.readInt(buffer); double result = value / maxPointValue; return (float) result; } FloatDecoder(TSEncoding encodingType, TSDataType dataType); @Override float readFloat(ByteBuffer buffer); @... | FloatDecoder extends Decoder { @Override public float readFloat(ByteBuffer buffer) { readMaxPointValue(buffer); int value = decoder.readInt(buffer); double result = value / maxPointValue; return (float) result; } FloatDecoder(TSEncoding encodingType, TSDataType dataType); @Override float readFloat(ByteBuffer buffer); @... |
@Test public void testSetTimeZone() throws TException, IoTDBSQLException { String timeZone = "Asia/Shanghai"; when(client.setTimeZone(any(TSSetTimeZoneReq.class))) .thenReturn(new TSSetTimeZoneResp(Status_SUCCESS)); connection.client = client; connection.setTimeZone(timeZone); assertEquals(connection.getTimeZone(), tim... | public void setTimeZone(String zoneId) throws TException, IoTDBSQLException { TSSetTimeZoneReq req = new TSSetTimeZoneReq(zoneId); TSSetTimeZoneResp resp = client.setTimeZone(req); Utils.verifySuccess(resp.getStatus()); this.zoneId = ZoneId.of(zoneId); } | IoTDBConnection implements Connection { public void setTimeZone(String zoneId) throws TException, IoTDBSQLException { TSSetTimeZoneReq req = new TSSetTimeZoneReq(zoneId); TSSetTimeZoneResp resp = client.setTimeZone(req); Utils.verifySuccess(resp.getStatus()); this.zoneId = ZoneId.of(zoneId); } } | IoTDBConnection implements Connection { public void setTimeZone(String zoneId) throws TException, IoTDBSQLException { TSSetTimeZoneReq req = new TSSetTimeZoneReq(zoneId); TSSetTimeZoneResp resp = client.setTimeZone(req); Utils.verifySuccess(resp.getStatus()); this.zoneId = ZoneId.of(zoneId); } IoTDBConnection(); IoTDB... | IoTDBConnection implements Connection { public void setTimeZone(String zoneId) throws TException, IoTDBSQLException { TSSetTimeZoneReq req = new TSSetTimeZoneReq(zoneId); TSSetTimeZoneResp resp = client.setTimeZone(req); Utils.verifySuccess(resp.getStatus()); this.zoneId = ZoneId.of(zoneId); } IoTDBConnection(); IoTDB... | IoTDBConnection implements Connection { public void setTimeZone(String zoneId) throws TException, IoTDBSQLException { TSSetTimeZoneReq req = new TSSetTimeZoneReq(zoneId); TSSetTimeZoneResp resp = client.setTimeZone(req); Utils.verifySuccess(resp.getStatus()); this.zoneId = ZoneId.of(zoneId); } IoTDBConnection(); IoTDB... |
@Test public void testGetTimeZone() throws IoTDBSQLException, TException { String timeZone = "GMT+:08:00"; when(client.getTimeZone()).thenReturn(new TSGetTimeZoneResp(Status_SUCCESS, timeZone)); connection.client = client; assertEquals(connection.getTimeZone(), timeZone); } | public String getTimeZone() throws TException, IoTDBSQLException { if (zoneId != null) { return zoneId.toString(); } TSGetTimeZoneResp resp = client.getTimeZone(); Utils.verifySuccess(resp.getStatus()); return resp.getTimeZone(); } | IoTDBConnection implements Connection { public String getTimeZone() throws TException, IoTDBSQLException { if (zoneId != null) { return zoneId.toString(); } TSGetTimeZoneResp resp = client.getTimeZone(); Utils.verifySuccess(resp.getStatus()); return resp.getTimeZone(); } } | IoTDBConnection implements Connection { public String getTimeZone() throws TException, IoTDBSQLException { if (zoneId != null) { return zoneId.toString(); } TSGetTimeZoneResp resp = client.getTimeZone(); Utils.verifySuccess(resp.getStatus()); return resp.getTimeZone(); } IoTDBConnection(); IoTDBConnection(String url, ... | IoTDBConnection implements Connection { public String getTimeZone() throws TException, IoTDBSQLException { if (zoneId != null) { return zoneId.toString(); } TSGetTimeZoneResp resp = client.getTimeZone(); Utils.verifySuccess(resp.getStatus()); return resp.getTimeZone(); } IoTDBConnection(); IoTDBConnection(String url, ... | IoTDBConnection implements Connection { public String getTimeZone() throws TException, IoTDBSQLException { if (zoneId != null) { return zoneId.toString(); } TSGetTimeZoneResp resp = client.getTimeZone(); Utils.verifySuccess(resp.getStatus()); return resp.getTimeZone(); } IoTDBConnection(); IoTDBConnection(String url, ... |
@Test public void testGetServerProperties() throws IoTDBSQLException, TException { final String version = "v0.1"; @SuppressWarnings("serial") final List<String> supportedAggregationTime = new ArrayList<String>() { { add("max_time"); add("min_time"); } }; when(client.getProperties()) .thenReturn(new ServerProperties(ver... | public ServerProperties getServerProperties() throws TException { return client.getProperties(); } | IoTDBConnection implements Connection { public ServerProperties getServerProperties() throws TException { return client.getProperties(); } } | IoTDBConnection implements Connection { public ServerProperties getServerProperties() throws TException { return client.getProperties(); } IoTDBConnection(); IoTDBConnection(String url, Properties info); } | IoTDBConnection implements Connection { public ServerProperties getServerProperties() throws TException { return client.getProperties(); } IoTDBConnection(); IoTDBConnection(String url, Properties info); static TSIService.Iface newSynchronizedClient(TSIService.Iface client); @Override boolean isWrapperFor(Class<?> arg... | IoTDBConnection implements Connection { public ServerProperties getServerProperties() throws TException { return client.getProperties(); } IoTDBConnection(); IoTDBConnection(String url, Properties info); static TSIService.Iface newSynchronizedClient(TSIService.Iface client); @Override boolean isWrapperFor(Class<?> arg... |
@Test public void testParseURL() throws IoTDBURLException { String userName = "test"; String userPwd = "test"; String host = "localhost"; int port = 6667; Properties properties = new Properties(); properties.setProperty(Config.AUTH_USER, userName); properties.setProperty(Config.AUTH_PASSWORD, userPwd); IoTDBConnectionP... | public static IoTDBConnectionParams parseUrl(String url, Properties info) throws IoTDBURLException { IoTDBConnectionParams params = new IoTDBConnectionParams(url); if (url.trim().equalsIgnoreCase(Config.IOTDB_URL_PREFIX)) { return params; } Pattern pattern = Pattern.compile("([^;]*):([^;]*)/"); Matcher matcher = patter... | Utils { public static IoTDBConnectionParams parseUrl(String url, Properties info) throws IoTDBURLException { IoTDBConnectionParams params = new IoTDBConnectionParams(url); if (url.trim().equalsIgnoreCase(Config.IOTDB_URL_PREFIX)) { return params; } Pattern pattern = Pattern.compile("([^;]*):([^;]*)/"); Matcher matcher ... | Utils { public static IoTDBConnectionParams parseUrl(String url, Properties info) throws IoTDBURLException { IoTDBConnectionParams params = new IoTDBConnectionParams(url); if (url.trim().equalsIgnoreCase(Config.IOTDB_URL_PREFIX)) { return params; } Pattern pattern = Pattern.compile("([^;]*):([^;]*)/"); Matcher matcher ... | Utils { public static IoTDBConnectionParams parseUrl(String url, Properties info) throws IoTDBURLException { IoTDBConnectionParams params = new IoTDBConnectionParams(url); if (url.trim().equalsIgnoreCase(Config.IOTDB_URL_PREFIX)) { return params; } Pattern pattern = Pattern.compile("([^;]*):([^;]*)/"); Matcher matcher ... | Utils { public static IoTDBConnectionParams parseUrl(String url, Properties info) throws IoTDBURLException { IoTDBConnectionParams params = new IoTDBConnectionParams(url); if (url.trim().equalsIgnoreCase(Config.IOTDB_URL_PREFIX)) { return params; } Pattern pattern = Pattern.compile("([^;]*):([^;]*)/"); Matcher matcher ... |
@Test public void testVerifySuccess() { try { Utils.verifySuccess(new TS_Status(TS_StatusCode.SUCCESS_STATUS)); } catch (Exception e) { fail(); } try { Utils.verifySuccess(new TS_Status(TS_StatusCode.ERROR_STATUS)); } catch (Exception e) { return; } fail(); } | public static void verifySuccess(TS_Status status) throws IoTDBSQLException { if (status.getStatusCode() != TS_StatusCode.SUCCESS_STATUS) { throw new IoTDBSQLException(status.errorMessage); } } | Utils { public static void verifySuccess(TS_Status status) throws IoTDBSQLException { if (status.getStatusCode() != TS_StatusCode.SUCCESS_STATUS) { throw new IoTDBSQLException(status.errorMessage); } } } | Utils { public static void verifySuccess(TS_Status status) throws IoTDBSQLException { if (status.getStatusCode() != TS_StatusCode.SUCCESS_STATUS) { throw new IoTDBSQLException(status.errorMessage); } } } | Utils { public static void verifySuccess(TS_Status status) throws IoTDBSQLException { if (status.getStatusCode() != TS_StatusCode.SUCCESS_STATUS) { throw new IoTDBSQLException(status.errorMessage); } } static IoTDBConnectionParams parseUrl(String url, Properties info); static void verifySuccess(TS_Status status); stat... | Utils { public static void verifySuccess(TS_Status status) throws IoTDBSQLException { if (status.getStatusCode() != TS_StatusCode.SUCCESS_STATUS) { throw new IoTDBSQLException(status.errorMessage); } } static IoTDBConnectionParams parseUrl(String url, Properties info); static void verifySuccess(TS_Status status); stat... |
@Test public void testConvertRowRecords() { final int DATA_TYPE_NUM = 6; Object[][] input = { {100L, "sensor1_boolean", TSDataType.BOOLEAN, false, "sensor1_int32", TSDataType.INT32, 100, "sensor1_int64", TSDataType.INT64, 9999999999L, "sensor1_float", TSDataType.FLOAT, 1.23f, "sensor1_double", TSDataType.DOUBLE, 100423... | public static List<RowRecord> convertRowRecords(TSQueryDataSet tsQueryDataSet) { List<RowRecord> records = new ArrayList<>(); for (TSRowRecord ts : tsQueryDataSet.getRecords()) { RowRecord r = new RowRecord(ts.getTimestamp()); int l = ts.getValuesSize(); for (int i = 0; i < l; i++) { TSDataValue value = ts.getValues().... | Utils { public static List<RowRecord> convertRowRecords(TSQueryDataSet tsQueryDataSet) { List<RowRecord> records = new ArrayList<>(); for (TSRowRecord ts : tsQueryDataSet.getRecords()) { RowRecord r = new RowRecord(ts.getTimestamp()); int l = ts.getValuesSize(); for (int i = 0; i < l; i++) { TSDataValue value = ts.getV... | Utils { public static List<RowRecord> convertRowRecords(TSQueryDataSet tsQueryDataSet) { List<RowRecord> records = new ArrayList<>(); for (TSRowRecord ts : tsQueryDataSet.getRecords()) { RowRecord r = new RowRecord(ts.getTimestamp()); int l = ts.getValuesSize(); for (int i = 0; i < l; i++) { TSDataValue value = ts.getV... | Utils { public static List<RowRecord> convertRowRecords(TSQueryDataSet tsQueryDataSet) { List<RowRecord> records = new ArrayList<>(); for (TSRowRecord ts : tsQueryDataSet.getRecords()) { RowRecord r = new RowRecord(ts.getTimestamp()); int l = ts.getValuesSize(); for (int i = 0; i < l; i++) { TSDataValue value = ts.getV... | Utils { public static List<RowRecord> convertRowRecords(TSQueryDataSet tsQueryDataSet) { List<RowRecord> records = new ArrayList<>(); for (TSRowRecord ts : tsQueryDataSet.getRecords()) { RowRecord r = new RowRecord(ts.getTimestamp()); int l = ts.getValuesSize(); for (int i = 0; i < l; i++) { TSDataValue value = ts.getV... |
@Test public void test() throws IOException { FakedPrioritySeriesReaderByTimestamp reader1 = new FakedPrioritySeriesReaderByTimestamp(100, 200, 5, 11); FakedPrioritySeriesReaderByTimestamp reader2 = new FakedPrioritySeriesReaderByTimestamp(850, 200, 7, 19); FakedPrioritySeriesReaderByTimestamp reader3 = new FakedPriori... | @Override public TsPrimitiveType getValueInTimestamp(long timestamp) throws IOException { if (hasCachedTimeValuePair) { if (cachedTimeValuePair.getTimestamp() == timestamp) { hasCachedTimeValuePair = false; return cachedTimeValuePair.getValue(); } else if (cachedTimeValuePair.getTimestamp() > timestamp) { return null; ... | PriorityMergeReaderByTimestamp extends PriorityMergeReader implements
EngineReaderByTimeStamp { @Override public TsPrimitiveType getValueInTimestamp(long timestamp) throws IOException { if (hasCachedTimeValuePair) { if (cachedTimeValuePair.getTimestamp() == timestamp) { hasCachedTimeValuePair = false; return cached... | PriorityMergeReaderByTimestamp extends PriorityMergeReader implements
EngineReaderByTimeStamp { @Override public TsPrimitiveType getValueInTimestamp(long timestamp) throws IOException { if (hasCachedTimeValuePair) { if (cachedTimeValuePair.getTimestamp() == timestamp) { hasCachedTimeValuePair = false; return cached... | PriorityMergeReaderByTimestamp extends PriorityMergeReader implements
EngineReaderByTimeStamp { @Override public TsPrimitiveType getValueInTimestamp(long timestamp) throws IOException { if (hasCachedTimeValuePair) { if (cachedTimeValuePair.getTimestamp() == timestamp) { hasCachedTimeValuePair = false; return cached... | PriorityMergeReaderByTimestamp extends PriorityMergeReader implements
EngineReaderByTimeStamp { @Override public TsPrimitiveType getValueInTimestamp(long timestamp) throws IOException { if (hasCachedTimeValuePair) { if (cachedTimeValuePair.getTimestamp() == timestamp) { hasCachedTimeValuePair = false; return cached... |
@Test public void testAddLeftNodePath() { MTree root = new MTree("root"); try { root.addTimeseriesPath("root.laptop.d1.s1", "INT32", "RLE", new String[0]); } catch (PathErrorException e) { e.printStackTrace(); fail(e.getMessage()); } try { root.addTimeseriesPath("root.laptop.d1.s1.b", "INT32", "RLE", new String[0]); } ... | public void addTimeseriesPath(String timeseriesPath, String dataType, String encoding, String[] args) throws PathErrorException { String[] nodeNames = timeseriesPath.trim().split(separator); if (nodeNames.length <= 1 || !nodeNames[0].equals(root.getName())) { throw new PathErrorException(String.format("Timeseries %s is... | MTree implements Serializable { public void addTimeseriesPath(String timeseriesPath, String dataType, String encoding, String[] args) throws PathErrorException { String[] nodeNames = timeseriesPath.trim().split(separator); if (nodeNames.length <= 1 || !nodeNames[0].equals(root.getName())) { throw new PathErrorException... | MTree implements Serializable { public void addTimeseriesPath(String timeseriesPath, String dataType, String encoding, String[] args) throws PathErrorException { String[] nodeNames = timeseriesPath.trim().split(separator); if (nodeNames.length <= 1 || !nodeNames[0].equals(root.getName())) { throw new PathErrorException... | MTree implements Serializable { public void addTimeseriesPath(String timeseriesPath, String dataType, String encoding, String[] args) throws PathErrorException { String[] nodeNames = timeseriesPath.trim().split(separator); if (nodeNames.length <= 1 || !nodeNames[0].equals(root.getName())) { throw new PathErrorException... | MTree implements Serializable { public void addTimeseriesPath(String timeseriesPath, String dataType, String encoding, String[] args) throws PathErrorException { String[] nodeNames = timeseriesPath.trim().split(separator); if (nodeNames.length <= 1 || !nodeNames[0].equals(root.getName())) { throw new PathErrorException... |
@Test public void testSetStorageGroup() { MTree root = new MTree("root"); try { root.setStorageGroup("root.laptop.d1"); assertEquals(true, root.isPathExist("root.laptop.d1")); assertEquals(true, root.checkFileNameByPath("root.laptop.d1")); assertEquals("root.laptop.d1", root.getFileNameByPath("root.laptop.d1")); assert... | public void setStorageGroup(String path) throws PathErrorException { String[] nodeNames = path.split(separator); MNode cur = root; if (nodeNames.length <= 1 || !nodeNames[0].equals(root.getName())) { throw new PathErrorException( String.format("The storage group can't be set to the %s node", path)); } int i = 1; while ... | MTree implements Serializable { public void setStorageGroup(String path) throws PathErrorException { String[] nodeNames = path.split(separator); MNode cur = root; if (nodeNames.length <= 1 || !nodeNames[0].equals(root.getName())) { throw new PathErrorException( String.format("The storage group can't be set to the %s no... | MTree implements Serializable { public void setStorageGroup(String path) throws PathErrorException { String[] nodeNames = path.split(separator); MNode cur = root; if (nodeNames.length <= 1 || !nodeNames[0].equals(root.getName())) { throw new PathErrorException( String.format("The storage group can't be set to the %s no... | MTree implements Serializable { public void setStorageGroup(String path) throws PathErrorException { String[] nodeNames = path.split(separator); MNode cur = root; if (nodeNames.length <= 1 || !nodeNames[0].equals(root.getName())) { throw new PathErrorException( String.format("The storage group can't be set to the %s no... | MTree implements Serializable { public void setStorageGroup(String path) throws PathErrorException { String[] nodeNames = path.split(separator); MNode cur = root; if (nodeNames.length <= 1 || !nodeNames[0].equals(root.getName())) { throw new PathErrorException( String.format("The storage group can't be set to the %s no... |
@Test public void testEquals() { assertEquals(processor1, processor3); assertFalse(processor1.equals(processor2)); } | @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Processor other = (Processor) obj; if (processorName == null) { if (other.processorName != null) { return false; } } else if (!processorName.equals(other... | Processor { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Processor other = (Processor) obj; if (processorName == null) { if (other.processorName != null) { return false; } } else if (!processorName.... | Processor { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Processor other = (Processor) obj; if (processorName == null) { if (other.processorName != null) { return false; } } else if (!processorName.... | Processor { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Processor other = (Processor) obj; if (processorName == null) { if (other.processorName != null) { return false; } } else if (!processorName.... | Processor { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Processor other = (Processor) obj; if (processorName == null) { if (other.processorName != null) { return false; } } else if (!processorName.... |
@Test public void testNegativeNumber() throws IOException { Encoder encoder = new SinglePrecisionEncoder(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); float value = -7.101f; encoder.encode(value, baos); encoder.encode(value - 2, baos); encoder.encode(value - 4, baos); encoder.flush(baos); encoder.encode(... | @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); @Override void reset(); @Override boolean hasNext(ByteBuffer buffer); } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); @Override void reset(); @Override boolean hasNext(ByteBuffer buffer); } |
@Test public void testOFFileMetadata() throws Exception { OFFileMetadata ofFileMetadata = OverflowTestHelper.createOFFileMetadata(); serialize(ofFileMetadata); OFFileMetadata deOFFileMetadata = deSerialize(); OverflowUtils.isOFFileMetadataEqual(ofFileMetadata, deOFFileMetadata); } | public OFFileMetadata() { } | OFFileMetadata { public OFFileMetadata() { } } | OFFileMetadata { public OFFileMetadata() { } OFFileMetadata(); OFFileMetadata(long lastFooterOffset, List<OFRowGroupListMetadata> rowGroupLists); } | OFFileMetadata { public OFFileMetadata() { } OFFileMetadata(); OFFileMetadata(long lastFooterOffset, List<OFRowGroupListMetadata> rowGroupLists); static OFFileMetadata deserializeFrom(InputStream inputStream); static OFFileMetadata deserializeFrom(ByteBuffer buffer); void addRowGroupListMetaData(OFRowGroupListMetadata... | OFFileMetadata { public OFFileMetadata() { } OFFileMetadata(); OFFileMetadata(long lastFooterOffset, List<OFRowGroupListMetadata> rowGroupLists); static OFFileMetadata deserializeFrom(InputStream inputStream); static OFFileMetadata deserializeFrom(ByteBuffer buffer); void addRowGroupListMetaData(OFRowGroupListMetadata... |
@Test public void testOFRowGroupListMetadata() throws Exception { OFRowGroupListMetadata ofRowGroupListMetadata = OverflowTestHelper .createOFRowGroupListMetadata(); serialize(ofRowGroupListMetadata); OFRowGroupListMetadata deOfRowGroupListMetadata = deSerialized(); OverflowUtils.isOFRowGroupListMetadataEqual(ofRowGrou... | private OFRowGroupListMetadata() { } | OFRowGroupListMetadata { private OFRowGroupListMetadata() { } } | OFRowGroupListMetadata { private OFRowGroupListMetadata() { } private OFRowGroupListMetadata(); OFRowGroupListMetadata(String deviceId); } | OFRowGroupListMetadata { private OFRowGroupListMetadata() { } private OFRowGroupListMetadata(); OFRowGroupListMetadata(String deviceId); static OFRowGroupListMetadata deserializeFrom(InputStream inputStream); static OFRowGroupListMetadata deserializeFrom(ByteBuffer buffer); void addSeriesListMetaData(OFSeriesListMeta... | OFRowGroupListMetadata { private OFRowGroupListMetadata() { } private OFRowGroupListMetadata(); OFRowGroupListMetadata(String deviceId); static OFRowGroupListMetadata deserializeFrom(InputStream inputStream); static OFRowGroupListMetadata deserializeFrom(ByteBuffer buffer); void addSeriesListMetaData(OFSeriesListMeta... |
@Test public void testRecovery() throws OverflowProcessorException, IOException { processor = new OverflowProcessor(processorName, parameters, OverflowTestUtils.getFileSchema()); processor.close(); processor.switchWorkToMerge(); assertEquals(true, processor.isMerge()); processor.clear(); OverflowProcessor overflowProce... | private void recovery(File parentFile) throws IOException { String[] subFilePaths = clearFile(parentFile.list()); if (subFilePaths.length == 0) { workResource = new OverflowResource(parentPath, String.valueOf(dataPahtCount.getAndIncrement())); return; } else if (subFilePaths.length == 1) { long count = Long.valueOf(sub... | OverflowProcessor extends Processor { private void recovery(File parentFile) throws IOException { String[] subFilePaths = clearFile(parentFile.list()); if (subFilePaths.length == 0) { workResource = new OverflowResource(parentPath, String.valueOf(dataPahtCount.getAndIncrement())); return; } else if (subFilePaths.length... | OverflowProcessor extends Processor { private void recovery(File parentFile) throws IOException { String[] subFilePaths = clearFile(parentFile.list()); if (subFilePaths.length == 0) { workResource = new OverflowResource(parentPath, String.valueOf(dataPahtCount.getAndIncrement())); return; } else if (subFilePaths.length... | OverflowProcessor extends Processor { private void recovery(File parentFile) throws IOException { String[] subFilePaths = clearFile(parentFile.list()); if (subFilePaths.length == 0) { workResource = new OverflowResource(parentPath, String.valueOf(dataPahtCount.getAndIncrement())); return; } else if (subFilePaths.length... | OverflowProcessor extends Processor { private void recovery(File parentFile) throws IOException { String[] subFilePaths = clearFile(parentFile.list()); if (subFilePaths.length == 0) { workResource = new OverflowResource(parentPath, String.valueOf(dataPahtCount.getAndIncrement())); return; } else if (subFilePaths.length... |
@Test public void testFileCutoff() throws IOException { File file = new File("testoverflowfile"); FileOutputStream fileOutputStream = new FileOutputStream(file); byte[] bytes = new byte[20]; fileOutputStream.write(bytes); fileOutputStream.close(); assertEquals(20, file.length()); OverflowIO overflowIO = new OverflowIO(... | public void close() throws IOException { overflowReadWriter.close(); } | OverflowIO extends TsFileIOWriter { public void close() throws IOException { overflowReadWriter.close(); } } | OverflowIO extends TsFileIOWriter { public void close() throws IOException { overflowReadWriter.close(); } OverflowIO(OverflowReadWriter overflowReadWriter); } | OverflowIO extends TsFileIOWriter { public void close() throws IOException { overflowReadWriter.close(); } OverflowIO(OverflowReadWriter overflowReadWriter); @Deprecated static InputStream readOneTimeSeriesChunk(ChunkMetaData chunkMetaData,
TsFileInput fileReader); @Deprecated ChunkMetaData flush(OverflowSeriesIm... | OverflowIO extends TsFileIOWriter { public void close() throws IOException { overflowReadWriter.close(); } OverflowIO(OverflowReadWriter overflowReadWriter); @Deprecated static InputStream readOneTimeSeriesChunk(ChunkMetaData chunkMetaData,
TsFileInput fileReader); @Deprecated ChunkMetaData flush(OverflowSeriesIm... |
@Test public void testInsert() { support.clear(); assertEquals(true, support.isEmptyOfMemTable()); OverflowTestUtils.produceInsertData(support); assertEquals(false, support.isEmptyOfMemTable()); int num = 1; for (TimeValuePair pair : support .queryOverflowInsertInMemory(deviceId1, measurementId1, dataType1) .getSortedT... | public void insert(TSRecord tsRecord) { for (DataPoint dataPoint : tsRecord.dataPointList) { memTable.write(tsRecord.deviceId, dataPoint.getMeasurementId(), dataPoint.getType(), tsRecord.time, dataPoint.getValue().toString()); } } | OverflowSupport { public void insert(TSRecord tsRecord) { for (DataPoint dataPoint : tsRecord.dataPointList) { memTable.write(tsRecord.deviceId, dataPoint.getMeasurementId(), dataPoint.getType(), tsRecord.time, dataPoint.getValue().toString()); } } } | OverflowSupport { public void insert(TSRecord tsRecord) { for (DataPoint dataPoint : tsRecord.dataPointList) { memTable.write(tsRecord.deviceId, dataPoint.getMeasurementId(), dataPoint.getType(), tsRecord.time, dataPoint.getValue().toString()); } } OverflowSupport(); } | OverflowSupport { public void insert(TSRecord tsRecord) { for (DataPoint dataPoint : tsRecord.dataPointList) { memTable.write(tsRecord.deviceId, dataPoint.getMeasurementId(), dataPoint.getType(), tsRecord.time, dataPoint.getValue().toString()); } } OverflowSupport(); void insert(TSRecord tsRecord); @Deprecated void upd... | OverflowSupport { public void insert(TSRecord tsRecord) { for (DataPoint dataPoint : tsRecord.dataPointList) { memTable.write(tsRecord.deviceId, dataPoint.getMeasurementId(), dataPoint.getType(), tsRecord.time, dataPoint.getValue().toString()); } } OverflowSupport(); void insert(TSRecord tsRecord); @Deprecated void upd... |
@Test public void testNewFixedThreadPool() throws InterruptedException, ExecutionException { String reason = "NewFixedThreadPool"; Thread.UncaughtExceptionHandler handler = new TestExceptionHandler(reason); int threadCount = 5; latch = new CountDownLatch(threadCount); ExecutorService exec = IoTDBThreadPoolFactory .newF... | public static ExecutorService newFixedThreadPool(int nthreads, String poolName) { return Executors.newFixedThreadPool(nthreads, new IoTThreadFactory(poolName)); } | IoTDBThreadPoolFactory { public static ExecutorService newFixedThreadPool(int nthreads, String poolName) { return Executors.newFixedThreadPool(nthreads, new IoTThreadFactory(poolName)); } } | IoTDBThreadPoolFactory { public static ExecutorService newFixedThreadPool(int nthreads, String poolName) { return Executors.newFixedThreadPool(nthreads, new IoTThreadFactory(poolName)); } } | IoTDBThreadPoolFactory { public static ExecutorService newFixedThreadPool(int nthreads, String poolName) { return Executors.newFixedThreadPool(nthreads, new IoTThreadFactory(poolName)); } static ExecutorService newFixedThreadPool(int nthreads, String poolName); static ExecutorService newFixedThreadPool(int nthreads, S... | IoTDBThreadPoolFactory { public static ExecutorService newFixedThreadPool(int nthreads, String poolName) { return Executors.newFixedThreadPool(nthreads, new IoTThreadFactory(poolName)); } static ExecutorService newFixedThreadPool(int nthreads, String poolName); static ExecutorService newFixedThreadPool(int nthreads, S... |
@Test public void testNewSingleThreadExecutor() throws InterruptedException { String reason = "NewSingleThreadExecutor"; Thread.UncaughtExceptionHandler handler = new TestExceptionHandler(reason); int threadCount = 1; latch = new CountDownLatch(threadCount); ExecutorService exec = IoTDBThreadPoolFactory.newSingleThread... | public static ExecutorService newSingleThreadExecutor(String poolName) { return Executors.newSingleThreadExecutor(new IoTThreadFactory(poolName)); } | IoTDBThreadPoolFactory { public static ExecutorService newSingleThreadExecutor(String poolName) { return Executors.newSingleThreadExecutor(new IoTThreadFactory(poolName)); } } | IoTDBThreadPoolFactory { public static ExecutorService newSingleThreadExecutor(String poolName) { return Executors.newSingleThreadExecutor(new IoTThreadFactory(poolName)); } } | IoTDBThreadPoolFactory { public static ExecutorService newSingleThreadExecutor(String poolName) { return Executors.newSingleThreadExecutor(new IoTThreadFactory(poolName)); } static ExecutorService newFixedThreadPool(int nthreads, String poolName); static ExecutorService newFixedThreadPool(int nthreads, String poolName... | IoTDBThreadPoolFactory { public static ExecutorService newSingleThreadExecutor(String poolName) { return Executors.newSingleThreadExecutor(new IoTThreadFactory(poolName)); } static ExecutorService newFixedThreadPool(int nthreads, String poolName); static ExecutorService newFixedThreadPool(int nthreads, String poolName... |
@Test public void testNewCachedThreadPool() throws InterruptedException { String reason = "NewCachedThreadPool"; Thread.UncaughtExceptionHandler handler = new TestExceptionHandler(reason); int threadCount = 10; latch = new CountDownLatch(threadCount); ExecutorService exec = IoTDBThreadPoolFactory.newCachedThreadPool(PO... | public static ExecutorService newCachedThreadPool(String poolName) { return Executors.newCachedThreadPool(new IoTThreadFactory(poolName)); } | IoTDBThreadPoolFactory { public static ExecutorService newCachedThreadPool(String poolName) { return Executors.newCachedThreadPool(new IoTThreadFactory(poolName)); } } | IoTDBThreadPoolFactory { public static ExecutorService newCachedThreadPool(String poolName) { return Executors.newCachedThreadPool(new IoTThreadFactory(poolName)); } } | IoTDBThreadPoolFactory { public static ExecutorService newCachedThreadPool(String poolName) { return Executors.newCachedThreadPool(new IoTThreadFactory(poolName)); } static ExecutorService newFixedThreadPool(int nthreads, String poolName); static ExecutorService newFixedThreadPool(int nthreads, String poolName,
... | IoTDBThreadPoolFactory { public static ExecutorService newCachedThreadPool(String poolName) { return Executors.newCachedThreadPool(new IoTThreadFactory(poolName)); } static ExecutorService newFixedThreadPool(int nthreads, String poolName); static ExecutorService newFixedThreadPool(int nthreads, String poolName,
... |
@Test public void testNewSingleThreadScheduledExecutor() throws InterruptedException { String reason = "NewSingleThreadScheduledExecutor"; Thread.UncaughtExceptionHandler handler = new TestExceptionHandler(reason); int threadCount = 1; latch = new CountDownLatch(threadCount); ScheduledExecutorService exec = IoTDBThread... | public static ScheduledExecutorService newSingleThreadScheduledExecutor(String poolName) { return Executors.newSingleThreadScheduledExecutor(new IoTThreadFactory(poolName)); } | IoTDBThreadPoolFactory { public static ScheduledExecutorService newSingleThreadScheduledExecutor(String poolName) { return Executors.newSingleThreadScheduledExecutor(new IoTThreadFactory(poolName)); } } | IoTDBThreadPoolFactory { public static ScheduledExecutorService newSingleThreadScheduledExecutor(String poolName) { return Executors.newSingleThreadScheduledExecutor(new IoTThreadFactory(poolName)); } } | IoTDBThreadPoolFactory { public static ScheduledExecutorService newSingleThreadScheduledExecutor(String poolName) { return Executors.newSingleThreadScheduledExecutor(new IoTThreadFactory(poolName)); } static ExecutorService newFixedThreadPool(int nthreads, String poolName); static ExecutorService newFixedThreadPool(in... | IoTDBThreadPoolFactory { public static ScheduledExecutorService newSingleThreadScheduledExecutor(String poolName) { return Executors.newSingleThreadScheduledExecutor(new IoTThreadFactory(poolName)); } static ExecutorService newFixedThreadPool(int nthreads, String poolName); static ExecutorService newFixedThreadPool(in... |
@Test public void testNewScheduledThreadPool() throws InterruptedException { String reason = "NewScheduledThreadPool"; Thread.UncaughtExceptionHandler handler = new TestExceptionHandler(reason); int threadCount = 10; latch = new CountDownLatch(threadCount); ScheduledExecutorService exec = IoTDBThreadPoolFactory .newSch... | public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, String poolName) { return Executors.newScheduledThreadPool(corePoolSize, new IoTThreadFactory(poolName)); } | IoTDBThreadPoolFactory { public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, String poolName) { return Executors.newScheduledThreadPool(corePoolSize, new IoTThreadFactory(poolName)); } } | IoTDBThreadPoolFactory { public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, String poolName) { return Executors.newScheduledThreadPool(corePoolSize, new IoTThreadFactory(poolName)); } } | IoTDBThreadPoolFactory { public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, String poolName) { return Executors.newScheduledThreadPool(corePoolSize, new IoTThreadFactory(poolName)); } static ExecutorService newFixedThreadPool(int nthreads, String poolName); static ExecutorService newFixedT... | IoTDBThreadPoolFactory { public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, String poolName) { return Executors.newScheduledThreadPool(corePoolSize, new IoTThreadFactory(poolName)); } static ExecutorService newFixedThreadPool(int nthreads, String poolName); static ExecutorService newFixedT... |
@Test public void testZeroNumber() throws IOException { Encoder encoder = new DoublePrecisionEncoder(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); double value = 0f; encoder.encode(value, baos); encoder.encode(value, baos); encoder.encode(value, baos); encoder.flush(baos); encoder.encode(value, baos); en... | @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); @Override void reset(); @Override boolean hasNext(ByteBuffer buffer); } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); @Override void reset(); @Override boolean hasNext(ByteBuffer buffer); } |
@Test public void testCreateJDBCClientThreadPool() throws InterruptedException { String reason = "CreateJDBCClientThreadPool"; TThreadPoolServer.Args args = new Args(null); args.maxWorkerThreads = 100; args.minWorkerThreads = 10; args.stopTimeoutVal = 10; args.stopTimeoutUnit = TimeUnit.SECONDS; Thread.UncaughtExceptio... | public static ExecutorService createJDBCClientThreadPool(Args args, String poolName) { SynchronousQueue<Runnable> executorQueue = new SynchronousQueue<Runnable>(); return new ThreadPoolExecutor(args.minWorkerThreads, args.maxWorkerThreads, args.stopTimeoutVal, args.stopTimeoutUnit, executorQueue, new IoTThreadFactory(p... | IoTDBThreadPoolFactory { public static ExecutorService createJDBCClientThreadPool(Args args, String poolName) { SynchronousQueue<Runnable> executorQueue = new SynchronousQueue<Runnable>(); return new ThreadPoolExecutor(args.minWorkerThreads, args.maxWorkerThreads, args.stopTimeoutVal, args.stopTimeoutUnit, executorQueu... | IoTDBThreadPoolFactory { public static ExecutorService createJDBCClientThreadPool(Args args, String poolName) { SynchronousQueue<Runnable> executorQueue = new SynchronousQueue<Runnable>(); return new ThreadPoolExecutor(args.minWorkerThreads, args.maxWorkerThreads, args.stopTimeoutVal, args.stopTimeoutUnit, executorQueu... | IoTDBThreadPoolFactory { public static ExecutorService createJDBCClientThreadPool(Args args, String poolName) { SynchronousQueue<Runnable> executorQueue = new SynchronousQueue<Runnable>(); return new ThreadPoolExecutor(args.minWorkerThreads, args.maxWorkerThreads, args.stopTimeoutVal, args.stopTimeoutUnit, executorQueu... | IoTDBThreadPoolFactory { public static ExecutorService createJDBCClientThreadPool(Args args, String poolName) { SynchronousQueue<Runnable> executorQueue = new SynchronousQueue<Runnable>(); return new ThreadPoolExecutor(args.minWorkerThreads, args.maxWorkerThreads, args.stopTimeoutVal, args.stopTimeoutUnit, executorQueu... |
@Test public void testDataOpenFileNumWhenCreateFile() { if (os.startsWith(MAC_OS_NAME) || os.startsWith(LINUX_OS_NAME)) { totalOpenFileNumBefore = openFileNumUtil .get(OpenFileNumUtil.OpenFileNumStatistics.DATA_OPEN_FILE_NUM); for (int i = 0; i < testFileNum; i++) { fileList.add(new File(currDir + testFileName + i)); }... | public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } } | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } private OpenFileNumUtil(); } | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } private OpenFileNumUtil(); static OpenFileNumUtil getInstance(); int get(OpenFileNumStatistics ... | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } private OpenFileNumUtil(); static OpenFileNumUtil getInstance(); int get(OpenFileNumStatistics ... |
@Test public void testDataOpenFileNumWhenCreateFileWriter() { if (os.startsWith(MAC_OS_NAME) || os.startsWith(LINUX_OS_NAME)) { for (int i = 0; i < testFileNum; i++) { fileList.add(new File(currDir + testFileName + i)); } totalOpenFileNumBefore = openFileNumUtil .get(OpenFileNumUtil.OpenFileNumStatistics.DATA_OPEN_FILE... | public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } } | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } private OpenFileNumUtil(); } | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } private OpenFileNumUtil(); static OpenFileNumUtil getInstance(); int get(OpenFileNumStatistics ... | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } private OpenFileNumUtil(); static OpenFileNumUtil getInstance(); int get(OpenFileNumStatistics ... |
@Test public void testDataOpenFileNumWhenFileWriterWriting() { if (os.startsWith(MAC_OS_NAME) || os.startsWith(LINUX_OS_NAME)) { for (int i = 0; i < testFileNum; i++) { fileList.add(new File(currDir + testFileName + i)); } for (File file : fileList) { if (file.exists()) { try { fileWriterList.add(new FileWriter(file));... | public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } } | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } private OpenFileNumUtil(); } | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } private OpenFileNumUtil(); static OpenFileNumUtil getInstance(); int get(OpenFileNumStatistics ... | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } private OpenFileNumUtil(); static OpenFileNumUtil getInstance(); int get(OpenFileNumStatistics ... |
@Test public void testDataOpenFileNumWhenFileWriterClose() { if (os.startsWith(MAC_OS_NAME) || os.startsWith(LINUX_OS_NAME)) { for (int i = 0; i < testFileNum; i++) { fileList.add(new File(currDir + testFileName + i)); } for (File file : fileList) { if (file.exists()) { try { fileWriterList.add(new FileWriter(file)); }... | public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } } | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } private OpenFileNumUtil(); } | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } private OpenFileNumUtil(); static OpenFileNumUtil getInstance(); int get(OpenFileNumStatistics ... | OpenFileNumUtil { public int get(OpenFileNumStatistics statistics) { EnumMap<OpenFileNumStatistics, Integer> statisticsMap = getStatisticMap(); return statisticsMap.getOrDefault(statistics, UNKNOWN_STATISTICS_ERROR_CODE); } private OpenFileNumUtil(); static OpenFileNumUtil getInstance(); int get(OpenFileNumStatistics ... |
@Test public void testParseTimeFormatNow() throws LogicalOperatorException { long now = generator.parseTimeFormat(SQLConstant.NOW_FUNC); for (int i = 0; i <= 12; i++) { ZoneOffset offset1, offset2; if (i < 10) { offset1 = ZoneOffset.of("+0" + i + ":00"); offset2 = ZoneOffset.of("-0" + i + ":00"); } else { offset1 = Zon... | public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.currentTimeMillis(); } tr... | LogicalGenerator { public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.curren... | LogicalGenerator { public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.curren... | LogicalGenerator { public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.curren... | LogicalGenerator { public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.curren... |
@Test(expected = LogicalOperatorException.class) public void testParseTimeFormatFail1() throws LogicalOperatorException { generator.parseTimeFormat(null); } | public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.currentTimeMillis(); } tr... | LogicalGenerator { public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.curren... | LogicalGenerator { public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.curren... | LogicalGenerator { public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.curren... | LogicalGenerator { public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.curren... |
@Test(expected = LogicalOperatorException.class) public void testParseTimeFormatFail2() throws LogicalOperatorException { generator.parseTimeFormat(""); } | public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.currentTimeMillis(); } tr... | LogicalGenerator { public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.curren... | LogicalGenerator { public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.curren... | LogicalGenerator { public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.curren... | LogicalGenerator { public long parseTimeFormat(String timestampStr) throws LogicalOperatorException { if (timestampStr == null || timestampStr.trim().equals("")) { throw new LogicalOperatorException("input timestamp cannot be empty"); } if (timestampStr.toLowerCase().equals(SQLConstant.NOW_FUNC)) { return System.curren... |
@Test public void testBackupNowLocalFileInfo() throws IOException { Map<String, Set<String>> allFileList = new HashMap<>(); Random r = new Random(0); for (int i = 0; i < 3; i++) { for (int j = 0; j < 5; j++) { if (!allFileList.containsKey(String.valueOf(i))) { allFileList.put(String.valueOf(i), new HashSet<>()); } Stri... | public void backupNowLocalFileInfo(String backupFile) { BufferedWriter bufferedWriter = null; try { bufferedWriter = new BufferedWriter(new FileWriter(backupFile)); for (Entry<String, Set<String>> entry : nowLocalFiles.entrySet()) { for (String file : entry.getValue()) { bufferedWriter.write(file + "\n"); } } } catch (... | FileManager { public void backupNowLocalFileInfo(String backupFile) { BufferedWriter bufferedWriter = null; try { bufferedWriter = new BufferedWriter(new FileWriter(backupFile)); for (Entry<String, Set<String>> entry : nowLocalFiles.entrySet()) { for (String file : entry.getValue()) { bufferedWriter.write(file + "\n");... | FileManager { public void backupNowLocalFileInfo(String backupFile) { BufferedWriter bufferedWriter = null; try { bufferedWriter = new BufferedWriter(new FileWriter(backupFile)); for (Entry<String, Set<String>> entry : nowLocalFiles.entrySet()) { for (String file : entry.getValue()) { bufferedWriter.write(file + "\n");... | FileManager { public void backupNowLocalFileInfo(String backupFile) { BufferedWriter bufferedWriter = null; try { bufferedWriter = new BufferedWriter(new FileWriter(backupFile)); for (Entry<String, Set<String>> entry : nowLocalFiles.entrySet()) { for (String file : entry.getValue()) { bufferedWriter.write(file + "\n");... | FileManager { public void backupNowLocalFileInfo(String backupFile) { BufferedWriter bufferedWriter = null; try { bufferedWriter = new BufferedWriter(new FileWriter(backupFile)); for (Entry<String, Set<String>> entry : nowLocalFiles.entrySet()) { for (String file : entry.getValue()) { bufferedWriter.write(file + "\n");... |
@Test public void testGetNowLocalFileList() throws IOException { Map<String, Set<String>> allFileList = new HashMap<>(); Map<String, Set<String>> fileList = new HashMap<>(); manager.getNowLocalFileList(new String[]{SENDER_FILE_PATH_TEST}); fileList = manager.getNowLocalFiles(); assert (isEmpty(fileList)); Random r = ne... | public void getNowLocalFileList(String[] paths) { for (String path : paths) { if (!new File(path).exists()) { continue; } File[] listFiles = new File(path).listFiles(); for (File storageGroup : listFiles) { if (storageGroup.isDirectory() && !storageGroup.getName().equals("postback")) { if (!nowLocalFiles.containsKey(st... | FileManager { public void getNowLocalFileList(String[] paths) { for (String path : paths) { if (!new File(path).exists()) { continue; } File[] listFiles = new File(path).listFiles(); for (File storageGroup : listFiles) { if (storageGroup.isDirectory() && !storageGroup.getName().equals("postback")) { if (!nowLocalFiles.... | FileManager { public void getNowLocalFileList(String[] paths) { for (String path : paths) { if (!new File(path).exists()) { continue; } File[] listFiles = new File(path).listFiles(); for (File storageGroup : listFiles) { if (storageGroup.isDirectory() && !storageGroup.getName().equals("postback")) { if (!nowLocalFiles.... | FileManager { public void getNowLocalFileList(String[] paths) { for (String path : paths) { if (!new File(path).exists()) { continue; } File[] listFiles = new File(path).listFiles(); for (File storageGroup : listFiles) { if (storageGroup.isDirectory() && !storageGroup.getName().equals("postback")) { if (!nowLocalFiles.... | FileManager { public void getNowLocalFileList(String[] paths) { for (String path : paths) { if (!new File(path).exists()) { continue; } File[] listFiles = new File(path).listFiles(); for (File storageGroup : listFiles) { if (storageGroup.isDirectory() && !storageGroup.getName().equals("postback")) { if (!nowLocalFiles.... |
@Test public void testFloat() throws IOException { Encoder encoder = new SinglePrecisionEncoder(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); float value = 7.101f; int num = 10000; for (int i = 0; i < num; i++) { encoder.encode(value + 2 * i, baos); } encoder.flush(baos); ByteBuffer buffer = ByteBuffer.w... | @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); @Override void reset(); @Override boolean hasNext(ByteBuffer buffer); } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); @Override void reset(); @Override boolean hasNext(ByteBuffer buffer); } |
@Test public void testGetSendingFileList() throws IOException { Map<String, Set<String>> allFileList = new HashMap<>(); Map<String, Set<String>> newFileList = new HashMap<>(); Map<String, Set<String>> sendingFileList = new HashMap<>(); Set<String> lastlocalList = new HashSet<>(); manager.setNowLocalFiles(new HashMap<>(... | public void getSendingFileList() { for (Entry<String, Set<String>> entry : nowLocalFiles.entrySet()) { for (String path : entry.getValue()) { if (!lastLocalFiles.contains(path)) { sendingFiles.get(entry.getKey()).add(path); } } } LOGGER.info("IoTDB sender : Sender has got list of sending files."); for (Entry<String, Se... | FileManager { public void getSendingFileList() { for (Entry<String, Set<String>> entry : nowLocalFiles.entrySet()) { for (String path : entry.getValue()) { if (!lastLocalFiles.contains(path)) { sendingFiles.get(entry.getKey()).add(path); } } } LOGGER.info("IoTDB sender : Sender has got list of sending files."); for (En... | FileManager { public void getSendingFileList() { for (Entry<String, Set<String>> entry : nowLocalFiles.entrySet()) { for (String path : entry.getValue()) { if (!lastLocalFiles.contains(path)) { sendingFiles.get(entry.getKey()).add(path); } } } LOGGER.info("IoTDB sender : Sender has got list of sending files."); for (En... | FileManager { public void getSendingFileList() { for (Entry<String, Set<String>> entry : nowLocalFiles.entrySet()) { for (String path : entry.getValue()) { if (!lastLocalFiles.contains(path)) { sendingFiles.get(entry.getKey()).add(path); } } } LOGGER.info("IoTDB sender : Sender has got list of sending files."); for (En... | FileManager { public void getSendingFileList() { for (Entry<String, Set<String>> entry : nowLocalFiles.entrySet()) { for (String path : entry.getValue()) { if (!lastLocalFiles.contains(path)) { sendingFiles.get(entry.getKey()).add(path); } } } LOGGER.info("IoTDB sender : Sender has got list of sending files."); for (En... |
@Test public void testDouble() throws IOException { Encoder encoder = new DoublePrecisionEncoder(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); double value = 7.101f; int num = 1000; for (int i = 0; i < num; i++) { encoder.encode(value + 2 * i, baos); } encoder.flush(baos); ByteBuffer buffer = ByteBuffer.... | @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); @Override void reset(); @Override boolean hasNext(ByteBuffer buffer); } | GorillaDecoder extends Decoder { @Override public boolean hasNext(ByteBuffer buffer) throws IOException { if (buffer.remaining() > 0 || !isEnd) { return true; } return false; } GorillaDecoder(); @Override void reset(); @Override boolean hasNext(ByteBuffer buffer); } |
@Test public void testEqualsObject() { Pair<String, Integer> p1 = new Pair<String, Integer>("a", 123123); Pair<String, Integer> p2 = new Pair<String, Integer>("a", 123123); assertTrue(p1.equals(p2)); p1 = new Pair<String, Integer>("a", null); p2 = new Pair<String, Integer>("a", 123123); assertFalse(p1.equals(p2)); p1 =... | @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Pair<?, ?> other = (Pair<?, ?>) obj; if (left == null) { if (other.left != null) { return false; } } else if (!left.equals(other.left)) { return false; }... | Pair { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Pair<?, ?> other = (Pair<?, ?>) obj; if (left == null) { if (other.left != null) { return false; } } else if (!left.equals(other.left)) { return f... | Pair { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Pair<?, ?> other = (Pair<?, ?>) obj; if (left == null) { if (other.left != null) { return false; } } else if (!left.equals(other.left)) { return f... | Pair { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Pair<?, ?> other = (Pair<?, ?>) obj; if (left == null) { if (other.left != null) { return false; } } else if (!left.equals(other.left)) { return f... | Pair { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Pair<?, ?> other = (Pair<?, ?>) obj; if (left == null) { if (other.left != null) { return false; } } else if (!left.equals(other.left)) { return f... |
@Test void testGetTextBoxAlphaValue() { IconHelper.setTextBoxAlphaValue(200); assertEquals(IconHelper.getTextBoxAlphaValue(), 200); } | public static int getTextBoxAlphaValue() { return textBoxAlphaValue; } | IconHelper { public static int getTextBoxAlphaValue() { return textBoxAlphaValue; } } | IconHelper { public static int getTextBoxAlphaValue() { return textBoxAlphaValue; } private IconHelper(); } | IconHelper { public static int getTextBoxAlphaValue() { return textBoxAlphaValue; } private IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollingTextPadding(int rollingTextPadding); static SDImage createFolde... | IconHelper { public static int getTextBoxAlphaValue() { return textBoxAlphaValue; } private IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollingTextPadding(int rollingTextPadding); static SDImage createFolde... |
@Test void testCreateResizedCopy() { assertTrue(IconHelper.createResizedCopy(IconHelper.createColoredFrame(Color.GREEN).image, false) instanceof BufferedImage); } | public static BufferedImage createResizedCopy(BufferedImage originalImage, boolean preserveType) { int scaledWidth = StreamDeck.ICON_SIZE; int scaledHeight = StreamDeck.ICON_SIZE; if (originalImage.getWidth() != originalImage.getHeight()) { float scalerWidth = ((float) StreamDeck.ICON_SIZE) / originalImage.getWidth(); ... | IconHelper { public static BufferedImage createResizedCopy(BufferedImage originalImage, boolean preserveType) { int scaledWidth = StreamDeck.ICON_SIZE; int scaledHeight = StreamDeck.ICON_SIZE; if (originalImage.getWidth() != originalImage.getHeight()) { float scalerWidth = ((float) StreamDeck.ICON_SIZE) / originalImage... | IconHelper { public static BufferedImage createResizedCopy(BufferedImage originalImage, boolean preserveType) { int scaledWidth = StreamDeck.ICON_SIZE; int scaledHeight = StreamDeck.ICON_SIZE; if (originalImage.getWidth() != originalImage.getHeight()) { float scalerWidth = ((float) StreamDeck.ICON_SIZE) / originalImage... | IconHelper { public static BufferedImage createResizedCopy(BufferedImage originalImage, boolean preserveType) { int scaledWidth = StreamDeck.ICON_SIZE; int scaledHeight = StreamDeck.ICON_SIZE; if (originalImage.getWidth() != originalImage.getHeight()) { float scalerWidth = ((float) StreamDeck.ICON_SIZE) / originalImage... | IconHelper { public static BufferedImage createResizedCopy(BufferedImage originalImage, boolean preserveType) { int scaledWidth = StreamDeck.ICON_SIZE; int scaledHeight = StreamDeck.ICON_SIZE; if (originalImage.getWidth() != originalImage.getHeight()) { float scalerWidth = ((float) StreamDeck.ICON_SIZE) / originalImage... |
@Test void testFillBackground() { assertTrue(IconHelper.fillBackground(IconHelper.createColoredFrame(Color.GREEN).image, Color.GREEN) instanceof BufferedImage); } | public static BufferedImage fillBackground(BufferedImage img, Color color) { BufferedImage nImg = new BufferedImage(img.getWidth(), img.getHeight(), img.getType()); Graphics2D g = nImg.createGraphics(); g.setColor(color); g.fillRect(0, 0, nImg.getWidth(), nImg.getHeight()); g.drawImage(img, 0, 0, null); g.dispose(); re... | IconHelper { public static BufferedImage fillBackground(BufferedImage img, Color color) { BufferedImage nImg = new BufferedImage(img.getWidth(), img.getHeight(), img.getType()); Graphics2D g = nImg.createGraphics(); g.setColor(color); g.fillRect(0, 0, nImg.getWidth(), nImg.getHeight()); g.drawImage(img, 0, 0, null); g.... | IconHelper { public static BufferedImage fillBackground(BufferedImage img, Color color) { BufferedImage nImg = new BufferedImage(img.getWidth(), img.getHeight(), img.getType()); Graphics2D g = nImg.createGraphics(); g.setColor(color); g.fillRect(0, 0, nImg.getWidth(), nImg.getHeight()); g.drawImage(img, 0, 0, null); g.... | IconHelper { public static BufferedImage fillBackground(BufferedImage img, Color color) { BufferedImage nImg = new BufferedImage(img.getWidth(), img.getHeight(), img.getType()); Graphics2D g = nImg.createGraphics(); g.setColor(color); g.fillRect(0, 0, nImg.getWidth(), nImg.getHeight()); g.drawImage(img, 0, 0, null); g.... | IconHelper { public static BufferedImage fillBackground(BufferedImage img, Color color) { BufferedImage nImg = new BufferedImage(img.getWidth(), img.getHeight(), img.getType()); Graphics2D g = nImg.createGraphics(); g.setColor(color); g.fillRect(0, 0, nImg.getWidth(), nImg.getHeight()); g.drawImage(img, 0, 0, null); g.... |
@Test void testFlipHoriz() { assertTrue(IconHelper.flipHoriz(IconHelper.createColoredFrame(Color.GREEN).image) instanceof BufferedImage); } | public static BufferedImage flipHoriz(BufferedImage image) { BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_3BYTE_BGR); Graphics2D gg = newImage.createGraphics(); gg.drawImage(image, image.getHeight(), 0, -image.getWidth(), image.getHeight(), null); gg.dispose(); retu... | IconHelper { public static BufferedImage flipHoriz(BufferedImage image) { BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_3BYTE_BGR); Graphics2D gg = newImage.createGraphics(); gg.drawImage(image, image.getHeight(), 0, -image.getWidth(), image.getHeight(), null); gg.di... | IconHelper { public static BufferedImage flipHoriz(BufferedImage image) { BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_3BYTE_BGR); Graphics2D gg = newImage.createGraphics(); gg.drawImage(image, image.getHeight(), 0, -image.getWidth(), image.getHeight(), null); gg.di... | IconHelper { public static BufferedImage flipHoriz(BufferedImage image) { BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_3BYTE_BGR); Graphics2D gg = newImage.createGraphics(); gg.drawImage(image, image.getHeight(), 0, -image.getWidth(), image.getHeight(), null); gg.di... | IconHelper { public static BufferedImage flipHoriz(BufferedImage image) { BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_3BYTE_BGR); Graphics2D gg = newImage.createGraphics(); gg.drawImage(image, image.getHeight(), 0, -image.getWidth(), image.getHeight(), null); gg.di... |
@Test void testGetImage() { assertTrue(IconHelper.getImage(IconHelper.TEMP_BLACK_ICON) instanceof SDImage); } | public static SDImage getImage(String string) { if (imageCache == null) imageCache = new HashMap<>(); return imageCache.get(string); } | IconHelper { public static SDImage getImage(String string) { if (imageCache == null) imageCache = new HashMap<>(); return imageCache.get(string); } } | IconHelper { public static SDImage getImage(String string) { if (imageCache == null) imageCache = new HashMap<>(); return imageCache.get(string); } private IconHelper(); } | IconHelper { public static SDImage getImage(String string) { if (imageCache == null) imageCache = new HashMap<>(); return imageCache.get(string); } private IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollin... | IconHelper { public static SDImage getImage(String string) { if (imageCache == null) imageCache = new HashMap<>(); return imageCache.get(string); } private IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollin... |
@Test void testGetImageFromResource() { assertTrue(IconHelper.getImageFromResource("/resources/icons/frame.png") instanceof BufferedImage); } | public static BufferedImage getImageFromResource(String fileName) { BufferedImage buff = null; try (InputStream inS = IconHelper.class.getResourceAsStream(fileName)) { if (inS != null) { logger.debug("Loading image as resource: " + fileName); buff = ImageIO.read(inS); } else { logger.error("Image does not exist: " + fi... | IconHelper { public static BufferedImage getImageFromResource(String fileName) { BufferedImage buff = null; try (InputStream inS = IconHelper.class.getResourceAsStream(fileName)) { if (inS != null) { logger.debug("Loading image as resource: " + fileName); buff = ImageIO.read(inS); } else { logger.error("Image does not ... | IconHelper { public static BufferedImage getImageFromResource(String fileName) { BufferedImage buff = null; try (InputStream inS = IconHelper.class.getResourceAsStream(fileName)) { if (inS != null) { logger.debug("Loading image as resource: " + fileName); buff = ImageIO.read(inS); } else { logger.error("Image does not ... | IconHelper { public static BufferedImage getImageFromResource(String fileName) { BufferedImage buff = null; try (InputStream inS = IconHelper.class.getResourceAsStream(fileName)) { if (inS != null) { logger.debug("Loading image as resource: " + fileName); buff = ImageIO.read(inS); } else { logger.error("Image does not ... | IconHelper { public static BufferedImage getImageFromResource(String fileName) { BufferedImage buff = null; try (InputStream inS = IconHelper.class.getResourceAsStream(fileName)) { if (inS != null) { logger.debug("Loading image as resource: " + fileName); buff = ImageIO.read(inS); } else { logger.error("Image does not ... |
@Test void testLoadIconPackage() { } | public static IconPackage loadIconPackage(String pathToZip) throws IOException, URISyntaxException { if (packageCache.containsKey(pathToZip)) return packageCache.get(pathToZip); Path path = Paths.get(pathToZip); URI uri = new URI("jar", path.toUri().toString(), null); Map<String, String> env = new HashMap<>(); env.put(... | IconHelper { public static IconPackage loadIconPackage(String pathToZip) throws IOException, URISyntaxException { if (packageCache.containsKey(pathToZip)) return packageCache.get(pathToZip); Path path = Paths.get(pathToZip); URI uri = new URI("jar", path.toUri().toString(), null); Map<String, String> env = new HashMap<... | IconHelper { public static IconPackage loadIconPackage(String pathToZip) throws IOException, URISyntaxException { if (packageCache.containsKey(pathToZip)) return packageCache.get(pathToZip); Path path = Paths.get(pathToZip); URI uri = new URI("jar", path.toUri().toString(), null); Map<String, String> env = new HashMap<... | IconHelper { public static IconPackage loadIconPackage(String pathToZip) throws IOException, URISyntaxException { if (packageCache.containsKey(pathToZip)) return packageCache.get(pathToZip); Path path = Paths.get(pathToZip); URI uri = new URI("jar", path.toUri().toString(), null); Map<String, String> env = new HashMap<... | IconHelper { public static IconPackage loadIconPackage(String pathToZip) throws IOException, URISyntaxException { if (packageCache.containsKey(pathToZip)) return packageCache.get(pathToZip); Path path = Paths.get(pathToZip); URI uri = new URI("jar", path.toUri().toString(), null); Map<String, String> env = new HashMap<... |
@Test void testLoadImageSafeString() { assertTrue(IconHelper.loadImageSafe("/resources/icons/frame.png") instanceof SDImage); } | public static SDImage loadImageSafe(String path) { return loadImageSafe(path, false, null); } | IconHelper { public static SDImage loadImageSafe(String path) { return loadImageSafe(path, false, null); } } | IconHelper { public static SDImage loadImageSafe(String path) { return loadImageSafe(path, false, null); } private IconHelper(); } | IconHelper { public static SDImage loadImageSafe(String path) { return loadImageSafe(path, false, null); } private IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollingTextPadding(int rollingTextPadding); sta... | IconHelper { public static SDImage loadImageSafe(String path) { return loadImageSafe(path, false, null); } private IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollingTextPadding(int rollingTextPadding); sta... |
@Test void testLoadImageFromResource() { } | public static SDImage loadImageFromResource(String path) { if (imageCache.containsKey(path)) return imageCache.get(path); BufferedImage img = getImageFromResource(path); if (img != null) { SDImage imgData = convertImage(img); cache(path, imgData); return imgData; } return null; } | IconHelper { public static SDImage loadImageFromResource(String path) { if (imageCache.containsKey(path)) return imageCache.get(path); BufferedImage img = getImageFromResource(path); if (img != null) { SDImage imgData = convertImage(img); cache(path, imgData); return imgData; } return null; } } | IconHelper { public static SDImage loadImageFromResource(String path) { if (imageCache.containsKey(path)) return imageCache.get(path); BufferedImage img = getImageFromResource(path); if (img != null) { SDImage imgData = convertImage(img); cache(path, imgData); return imgData; } return null; } private IconHelper(); } | IconHelper { public static SDImage loadImageFromResource(String path) { if (imageCache.containsKey(path)) return imageCache.get(path); BufferedImage img = getImageFromResource(path); if (img != null) { SDImage imgData = convertImage(img); cache(path, imgData); return imgData; } return null; } private IconHelper(); sta... | IconHelper { public static SDImage loadImageFromResource(String path) { if (imageCache.containsKey(path)) return imageCache.get(path); BufferedImage img = getImageFromResource(path); if (img != null) { SDImage imgData = convertImage(img); cache(path, imgData); return imgData; } return null; } private IconHelper(); sta... |
@Test void testLoadImageFromResourceSafe() { } | public static SDImage loadImageFromResourceSafe(String path) { if (imageCache.containsKey(path)) return imageCache.get(path); BufferedImage img = getImageFromResource(path); if (img != null) { SDImage imgData = convertImage(img); cache(path, imgData); return imgData; } return IconHelper.getImage(TEMP_BLACK_ICON); } | IconHelper { public static SDImage loadImageFromResourceSafe(String path) { if (imageCache.containsKey(path)) return imageCache.get(path); BufferedImage img = getImageFromResource(path); if (img != null) { SDImage imgData = convertImage(img); cache(path, imgData); return imgData; } return IconHelper.getImage(TEMP_BLACK... | IconHelper { public static SDImage loadImageFromResourceSafe(String path) { if (imageCache.containsKey(path)) return imageCache.get(path); BufferedImage img = getImageFromResource(path); if (img != null) { SDImage imgData = convertImage(img); cache(path, imgData); return imgData; } return IconHelper.getImage(TEMP_BLACK... | IconHelper { public static SDImage loadImageFromResourceSafe(String path) { if (imageCache.containsKey(path)) return imageCache.get(path); BufferedImage img = getImageFromResource(path); if (img != null) { SDImage imgData = convertImage(img); cache(path, imgData); return imgData; } return IconHelper.getImage(TEMP_BLACK... | IconHelper { public static SDImage loadImageFromResourceSafe(String path) { if (imageCache.containsKey(path)) return imageCache.get(path); BufferedImage img = getImageFromResource(path); if (img != null) { SDImage imgData = convertImage(img); cache(path, imgData); return imgData; } return IconHelper.getImage(TEMP_BLACK... |
@Test void testLoadImagesFromGif() { } | public static SDImage[] loadImagesFromGif(String pathToGif) throws IOException { try { String[] imageatt = new String[] { "imageLeftPosition", "imageTopPosition", "imageWidth", "imageHeight" }; ImageReader reader = ImageIO.getImageReadersByFormatName("gif").next(); ImageInputStream ciis = ImageIO.createImageInputStream... | IconHelper { public static SDImage[] loadImagesFromGif(String pathToGif) throws IOException { try { String[] imageatt = new String[] { "imageLeftPosition", "imageTopPosition", "imageWidth", "imageHeight" }; ImageReader reader = ImageIO.getImageReadersByFormatName("gif").next(); ImageInputStream ciis = ImageIO.createIma... | IconHelper { public static SDImage[] loadImagesFromGif(String pathToGif) throws IOException { try { String[] imageatt = new String[] { "imageLeftPosition", "imageTopPosition", "imageWidth", "imageHeight" }; ImageReader reader = ImageIO.getImageReadersByFormatName("gif").next(); ImageInputStream ciis = ImageIO.createIma... | IconHelper { public static SDImage[] loadImagesFromGif(String pathToGif) throws IOException { try { String[] imageatt = new String[] { "imageLeftPosition", "imageTopPosition", "imageWidth", "imageHeight" }; ImageReader reader = ImageIO.getImageReadersByFormatName("gif").next(); ImageInputStream ciis = ImageIO.createIma... | IconHelper { public static SDImage[] loadImagesFromGif(String pathToGif) throws IOException { try { String[] imageatt = new String[] { "imageLeftPosition", "imageTopPosition", "imageWidth", "imageHeight" }; ImageReader reader = ImageIO.getImageReadersByFormatName("gif").next(); ImageInputStream ciis = ImageIO.createIma... |
@Test void testSetTextBoxAlphaValue() { IconHelper.setTextBoxAlphaValue(200); assertEquals(IconHelper.getTextBoxAlphaValue(), 200); } | public static void setTextBoxAlphaValue(int textBoxAlphaValue) { IconHelper.textBoxAlphaValue = textBoxAlphaValue; } | IconHelper { public static void setTextBoxAlphaValue(int textBoxAlphaValue) { IconHelper.textBoxAlphaValue = textBoxAlphaValue; } } | IconHelper { public static void setTextBoxAlphaValue(int textBoxAlphaValue) { IconHelper.textBoxAlphaValue = textBoxAlphaValue; } private IconHelper(); } | IconHelper { public static void setTextBoxAlphaValue(int textBoxAlphaValue) { IconHelper.textBoxAlphaValue = textBoxAlphaValue; } private IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollingTextPadding(int r... | IconHelper { public static void setTextBoxAlphaValue(int textBoxAlphaValue) { IconHelper.textBoxAlphaValue = textBoxAlphaValue; } private IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollingTextPadding(int r... |
@Test void testRotate180() { } | public static BufferedImage rotate180(BufferedImage inputImage) { int width = inputImage.getWidth(); int height = inputImage.getHeight(); BufferedImage returnImage = new BufferedImage(height, width, inputImage.getType()); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int nX = height - x - 1; int ... | IconHelper { public static BufferedImage rotate180(BufferedImage inputImage) { int width = inputImage.getWidth(); int height = inputImage.getHeight(); BufferedImage returnImage = new BufferedImage(height, width, inputImage.getType()); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int nX = height ... | IconHelper { public static BufferedImage rotate180(BufferedImage inputImage) { int width = inputImage.getWidth(); int height = inputImage.getHeight(); BufferedImage returnImage = new BufferedImage(height, width, inputImage.getType()); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int nX = height ... | IconHelper { public static BufferedImage rotate180(BufferedImage inputImage) { int width = inputImage.getWidth(); int height = inputImage.getHeight(); BufferedImage returnImage = new BufferedImage(height, width, inputImage.getType()); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int nX = height ... | IconHelper { public static BufferedImage rotate180(BufferedImage inputImage) { int width = inputImage.getWidth(); int height = inputImage.getHeight(); BufferedImage returnImage = new BufferedImage(height, width, inputImage.getType()); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int nX = height ... |
@Test void testGetRollingTextPadding() { IconHelper.setRollingTextPadding(8); assertEquals(IconHelper.getRollingTextPadding(), 8); } | public static int getRollingTextPadding() { return rollingTextPadding; } | IconHelper { public static int getRollingTextPadding() { return rollingTextPadding; } } | IconHelper { public static int getRollingTextPadding() { return rollingTextPadding; } private IconHelper(); } | IconHelper { public static int getRollingTextPadding() { return rollingTextPadding; } private IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollingTextPadding(int rollingTextPadding); static SDImage createFol... | IconHelper { public static int getRollingTextPadding() { return rollingTextPadding; } private IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollingTextPadding(int rollingTextPadding); static SDImage createFol... |
@Test void testSetRollingTextPadding() { IconHelper.setRollingTextPadding(8); assertEquals(IconHelper.getRollingTextPadding(), 8); } | public static void setRollingTextPadding(int rollingTextPadding) { IconHelper.rollingTextPadding = rollingTextPadding; } | IconHelper { public static void setRollingTextPadding(int rollingTextPadding) { IconHelper.rollingTextPadding = rollingTextPadding; } } | IconHelper { public static void setRollingTextPadding(int rollingTextPadding) { IconHelper.rollingTextPadding = rollingTextPadding; } private IconHelper(); } | IconHelper { public static void setRollingTextPadding(int rollingTextPadding) { IconHelper.rollingTextPadding = rollingTextPadding; } private IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollingTextPadding(i... | IconHelper { public static void setRollingTextPadding(int rollingTextPadding) { IconHelper.rollingTextPadding = rollingTextPadding; } private IconHelper(); static int getTextBoxAlphaValue(); static void setTextBoxAlphaValue(int textBoxAlphaValue); static int getRollingTextPadding(); static void setRollingTextPadding(i... |
@Test void testCreateFolderImage() { assertTrue(IconHelper.createFolderImage(Color.GREEN, true, Color.GREEN.darker()) instanceof SDImage); } | public static SDImage createFolderImage(Color background, boolean applyFrame, Color frameColor) { String folderKey = FOLDER_IMAGE_PREFIX + String.format("#%02x%02x%02x", background.getRed(), background.getGreen(), background.getBlue()); if(imageCache.containsKey(folderKey)) return imageCache.get(folderKey); BufferedIma... | IconHelper { public static SDImage createFolderImage(Color background, boolean applyFrame, Color frameColor) { String folderKey = FOLDER_IMAGE_PREFIX + String.format("#%02x%02x%02x", background.getRed(), background.getGreen(), background.getBlue()); if(imageCache.containsKey(folderKey)) return imageCache.get(folderKey)... | IconHelper { public static SDImage createFolderImage(Color background, boolean applyFrame, Color frameColor) { String folderKey = FOLDER_IMAGE_PREFIX + String.format("#%02x%02x%02x", background.getRed(), background.getGreen(), background.getBlue()); if(imageCache.containsKey(folderKey)) return imageCache.get(folderKey)... | IconHelper { public static SDImage createFolderImage(Color background, boolean applyFrame, Color frameColor) { String folderKey = FOLDER_IMAGE_PREFIX + String.format("#%02x%02x%02x", background.getRed(), background.getGreen(), background.getBlue()); if(imageCache.containsKey(folderKey)) return imageCache.get(folderKey)... | IconHelper { public static SDImage createFolderImage(Color background, boolean applyFrame, Color frameColor) { String folderKey = FOLDER_IMAGE_PREFIX + String.format("#%02x%02x%02x", background.getRed(), background.getGreen(), background.getBlue()); if(imageCache.containsKey(folderKey)) return imageCache.get(folderKey)... |
@Test void testCreateColoredFrame() { assertTrue(IconHelper.createColoredFrame(Color.GREEN) instanceof SDImage); } | public static SDImage createColoredFrame(Color borderColor) { String frameKey = FRAME_IMAGE_PREFIX + String.format("#%02x%02x%02x", borderColor.getRed(), borderColor.getGreen(), borderColor.getBlue()); if(imageCache.containsKey(frameKey)) return imageCache.get(frameKey); BufferedImage img = new BufferedImage(StreamDeck... | IconHelper { public static SDImage createColoredFrame(Color borderColor) { String frameKey = FRAME_IMAGE_PREFIX + String.format("#%02x%02x%02x", borderColor.getRed(), borderColor.getGreen(), borderColor.getBlue()); if(imageCache.containsKey(frameKey)) return imageCache.get(frameKey); BufferedImage img = new BufferedIma... | IconHelper { public static SDImage createColoredFrame(Color borderColor) { String frameKey = FRAME_IMAGE_PREFIX + String.format("#%02x%02x%02x", borderColor.getRed(), borderColor.getGreen(), borderColor.getBlue()); if(imageCache.containsKey(frameKey)) return imageCache.get(frameKey); BufferedImage img = new BufferedIma... | IconHelper { public static SDImage createColoredFrame(Color borderColor) { String frameKey = FRAME_IMAGE_PREFIX + String.format("#%02x%02x%02x", borderColor.getRed(), borderColor.getGreen(), borderColor.getBlue()); if(imageCache.containsKey(frameKey)) return imageCache.get(frameKey); BufferedImage img = new BufferedIma... | IconHelper { public static SDImage createColoredFrame(Color borderColor) { String frameKey = FRAME_IMAGE_PREFIX + String.format("#%02x%02x%02x", borderColor.getRed(), borderColor.getGreen(), borderColor.getBlue()); if(imageCache.containsKey(frameKey)) return imageCache.get(frameKey); BufferedImage img = new BufferedIma... |
@Test void testApplyAlpha() { IconHelper.applyAlpha(IconHelper.createColoredFrame(Color.GREEN).image, IconHelper.FRAME); assertTrue(true); } | public static void applyAlpha(BufferedImage image, BufferedImage mask) { int width = image.getWidth(); int height = image.getHeight(); int[] imagePixels = image.getRGB(0, 0, width, height, null, 0, width); int[] maskPixels = mask.getRGB(0, 0, width, height, null, 0, width); for (int i = 0; i < imagePixels.length; i++) ... | IconHelper { public static void applyAlpha(BufferedImage image, BufferedImage mask) { int width = image.getWidth(); int height = image.getHeight(); int[] imagePixels = image.getRGB(0, 0, width, height, null, 0, width); int[] maskPixels = mask.getRGB(0, 0, width, height, null, 0, width); for (int i = 0; i < imagePixels.... | IconHelper { public static void applyAlpha(BufferedImage image, BufferedImage mask) { int width = image.getWidth(); int height = image.getHeight(); int[] imagePixels = image.getRGB(0, 0, width, height, null, 0, width); int[] maskPixels = mask.getRGB(0, 0, width, height, null, 0, width); for (int i = 0; i < imagePixels.... | IconHelper { public static void applyAlpha(BufferedImage image, BufferedImage mask) { int width = image.getWidth(); int height = image.getHeight(); int[] imagePixels = image.getRGB(0, 0, width, height, null, 0, width); int[] maskPixels = mask.getRGB(0, 0, width, height, null, 0, width); for (int i = 0; i < imagePixels.... | IconHelper { public static void applyAlpha(BufferedImage image, BufferedImage mask) { int width = image.getWidth(); int height = image.getHeight(); int[] imagePixels = image.getRGB(0, 0, width, height, null, 0, width); int[] maskPixels = mask.getRGB(0, 0, width, height, null, 0, width); for (int i = 0; i < imagePixels.... |
@Test void testCacheImage() { assertTrue(IconHelper.cacheImage("TEST-PATH", IconHelper.createFolderImage(Color.GREEN, true, Color.GREEN.darker()).image) instanceof SDImage); } | public static SDImage cacheImage(String path, BufferedImage img) { int[] pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData(); byte[] imgData = new byte[StreamDeck.ICON_SIZE * StreamDeck.ICON_SIZE * 3]; int imgDataCount = 0; for (int i = 0; i < StreamDeck.ICON_SIZE * StreamDeck.ICON_SIZE; i++) { imgData... | IconHelper { public static SDImage cacheImage(String path, BufferedImage img) { int[] pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData(); byte[] imgData = new byte[StreamDeck.ICON_SIZE * StreamDeck.ICON_SIZE * 3]; int imgDataCount = 0; for (int i = 0; i < StreamDeck.ICON_SIZE * StreamDeck.ICON_SIZE; i... | IconHelper { public static SDImage cacheImage(String path, BufferedImage img) { int[] pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData(); byte[] imgData = new byte[StreamDeck.ICON_SIZE * StreamDeck.ICON_SIZE * 3]; int imgDataCount = 0; for (int i = 0; i < StreamDeck.ICON_SIZE * StreamDeck.ICON_SIZE; i... | IconHelper { public static SDImage cacheImage(String path, BufferedImage img) { int[] pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData(); byte[] imgData = new byte[StreamDeck.ICON_SIZE * StreamDeck.ICON_SIZE * 3]; int imgDataCount = 0; for (int i = 0; i < StreamDeck.ICON_SIZE * StreamDeck.ICON_SIZE; i... | IconHelper { public static SDImage cacheImage(String path, BufferedImage img) { int[] pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData(); byte[] imgData = new byte[StreamDeck.ICON_SIZE * StreamDeck.ICON_SIZE * 3]; int imgDataCount = 0; for (int i = 0; i < StreamDeck.ICON_SIZE * StreamDeck.ICON_SIZE; i... |
@Test void testApplyImage() { SDImage b1 = IconHelper.createFolderImage(Color.GREEN, true, Color.GREEN.darker()); BufferedImage b2 = IconHelper.createFolderImage(Color.GREEN, true, Color.GREEN.darker()).image; assertTrue(IconHelper.applyImage(b1, b2) instanceof SDImage); } | public static SDImage applyImage(SDImage imgData, BufferedImage apply) { BufferedImage img = new BufferedImage(StreamDeck.ICON_SIZE, StreamDeck.ICON_SIZE, imgData. image. getType()); Graphics2D g2d = img.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.draw... | IconHelper { public static SDImage applyImage(SDImage imgData, BufferedImage apply) { BufferedImage img = new BufferedImage(StreamDeck.ICON_SIZE, StreamDeck.ICON_SIZE, imgData. image. getType()); Graphics2D g2d = img.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_... | IconHelper { public static SDImage applyImage(SDImage imgData, BufferedImage apply) { BufferedImage img = new BufferedImage(StreamDeck.ICON_SIZE, StreamDeck.ICON_SIZE, imgData. image. getType()); Graphics2D g2d = img.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_... | IconHelper { public static SDImage applyImage(SDImage imgData, BufferedImage apply) { BufferedImage img = new BufferedImage(StreamDeck.ICON_SIZE, StreamDeck.ICON_SIZE, imgData. image. getType()); Graphics2D g2d = img.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_... | IconHelper { public static SDImage applyImage(SDImage imgData, BufferedImage apply) { BufferedImage img = new BufferedImage(StreamDeck.ICON_SIZE, StreamDeck.ICON_SIZE, imgData. image. getType()); Graphics2D g2d = img.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_... |
@Test void testApplyFrame() { assertTrue(IconHelper.applyFrame(IconHelper.createColoredFrame(Color.GREEN).image, Color.GREEN.darker()) instanceof BufferedImage); } | public static BufferedImage applyFrame(BufferedImage img, Color frameColor) { if(img.getWidth() > StreamDeck.ICON_SIZE || img.getHeight() > StreamDeck.ICON_SIZE) img = createResizedCopy(img, true); BufferedImage nImg = new BufferedImage(img.getWidth(), img.getHeight(), img.getType()); Graphics2D g = nImg.createGraphics... | IconHelper { public static BufferedImage applyFrame(BufferedImage img, Color frameColor) { if(img.getWidth() > StreamDeck.ICON_SIZE || img.getHeight() > StreamDeck.ICON_SIZE) img = createResizedCopy(img, true); BufferedImage nImg = new BufferedImage(img.getWidth(), img.getHeight(), img.getType()); Graphics2D g = nImg.c... | IconHelper { public static BufferedImage applyFrame(BufferedImage img, Color frameColor) { if(img.getWidth() > StreamDeck.ICON_SIZE || img.getHeight() > StreamDeck.ICON_SIZE) img = createResizedCopy(img, true); BufferedImage nImg = new BufferedImage(img.getWidth(), img.getHeight(), img.getType()); Graphics2D g = nImg.c... | IconHelper { public static BufferedImage applyFrame(BufferedImage img, Color frameColor) { if(img.getWidth() > StreamDeck.ICON_SIZE || img.getHeight() > StreamDeck.ICON_SIZE) img = createResizedCopy(img, true); BufferedImage nImg = new BufferedImage(img.getWidth(), img.getHeight(), img.getType()); Graphics2D g = nImg.c... | IconHelper { public static BufferedImage applyFrame(BufferedImage img, Color frameColor) { if(img.getWidth() > StreamDeck.ICON_SIZE || img.getHeight() > StreamDeck.ICON_SIZE) img = createResizedCopy(img, true); BufferedImage nImg = new BufferedImage(img.getWidth(), img.getHeight(), img.getType()); Graphics2D g = nImg.c... |
@Test public void testNegativeBitEncoding() { thrown.expect(IllegalArgumentException.class); new BitStream( 2).write(-1, 10); } | public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { long v2 = v << ... | BitStream { public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { lon... | BitStream { public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { lon... | BitStream { public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { lon... | BitStream { public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { lon... |
@Test public void testRunAtWithOverlappingOperations() { final int metricsDelaySecs = 0; offHeapChunkManagerTask = new OffHeapChunkManagerTask(chunkManager, metricsDelaySecs, 4 * 3600); assertTrue(chunkManager.getChunkMap().isEmpty()); offHeapChunkManagerTask.runAt(Instant.ofEpochSecond(startTimeSecs)); assertTrue(chun... | @VisibleForTesting void runAt(Instant instant) { LOG.info("Starting offHeapChunkManagerTask."); deleteStaleData(instant); detectReadOnlyChunks(instant); LOG.info("Finished offHeapChunkManagerTask."); } | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting void runAt(Instant instant) { LOG.info("Starting offHeapChunkManagerTask."); deleteStaleData(instant); detectReadOnlyChunks(instant); LOG.info("Finished offHeapChunkManagerTask."); } } | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting void runAt(Instant instant) { LOG.info("Starting offHeapChunkManagerTask."); deleteStaleData(instant); detectReadOnlyChunks(instant); LOG.info("Finished offHeapChunkManagerTask."); } OffHeapChunkManagerTask(ChunkManager chunkManager); OffHeapChunkManager... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting void runAt(Instant instant) { LOG.info("Starting offHeapChunkManagerTask."); deleteStaleData(instant); detectReadOnlyChunks(instant); LOG.info("Finished offHeapChunkManagerTask."); } OffHeapChunkManagerTask(ChunkManager chunkManager); OffHeapChunkManager... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting void runAt(Instant instant) { LOG.info("Starting offHeapChunkManagerTask."); deleteStaleData(instant); detectReadOnlyChunks(instant); LOG.info("Finished offHeapChunkManagerTask."); } OffHeapChunkManagerTask(ChunkManager chunkManager); OffHeapChunkManager... |
@Test(expected = ReadOnlyChunkInsertionException.class) public void testInsertionIntoOffHeapStore() { assertTrue(chunkManager.getChunkMap().isEmpty()); chunkManager.addMetric(MetricUtils.makeMetricString( testMetricName, inputTagString1, startTimeSecs + 1, testValue)); assertEquals(1, chunkManager.getChunkMap().size())... | @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyChunks = new ArrayList<>(); for (Map.Entry<Long... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... |
@Test(expected = IllegalArgumentException.class) public void testNegativeOffset() { offHeapChunkManagerTask.detectChunksPastCutOff(-1); } | @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyChunks = new ArrayList<>(); for (Map.Entry<Long... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... |
@Test(expected = IllegalArgumentException.class) public void testZeroOffset() { offHeapChunkManagerTask.detectChunksPastCutOff(0); } | @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyChunks = new ArrayList<>(); for (Map.Entry<Long... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... |
@Test public void testDeleteStaleChunks() { assertTrue(chunkManager.getChunkMap().isEmpty()); assertEquals(0, offHeapChunkManagerTask.deleteStaleChunks(startTimeSecs)); assertEquals(0, offHeapChunkManagerTask.deleteStaleChunks(startTimeSecs + 1)); assertEquals(0, offHeapChunkManagerTask.deleteStaleChunks(startTimeSecs ... | int deleteStaleChunks(long staleDataCutoffSecs) { if (staleDataCutoffSecs <= 0) { throw new IllegalArgumentException("staleDateCutOffSecs can't be negative."); } LOG.info("stale data cut off secs is {}.", staleDataCutoffSecs); List<Map.Entry<Long, Chunk>> staleChunks = new ArrayList<>(); for (Map.Entry<Long, Chunk> chu... | OffHeapChunkManagerTask implements Runnable { int deleteStaleChunks(long staleDataCutoffSecs) { if (staleDataCutoffSecs <= 0) { throw new IllegalArgumentException("staleDateCutOffSecs can't be negative."); } LOG.info("stale data cut off secs is {}.", staleDataCutoffSecs); List<Map.Entry<Long, Chunk>> staleChunks = new ... | OffHeapChunkManagerTask implements Runnable { int deleteStaleChunks(long staleDataCutoffSecs) { if (staleDataCutoffSecs <= 0) { throw new IllegalArgumentException("staleDateCutOffSecs can't be negative."); } LOG.info("stale data cut off secs is {}.", staleDataCutoffSecs); List<Map.Entry<Long, Chunk>> staleChunks = new ... | OffHeapChunkManagerTask implements Runnable { int deleteStaleChunks(long staleDataCutoffSecs) { if (staleDataCutoffSecs <= 0) { throw new IllegalArgumentException("staleDateCutOffSecs can't be negative."); } LOG.info("stale data cut off secs is {}.", staleDataCutoffSecs); List<Map.Entry<Long, Chunk>> staleChunks = new ... | OffHeapChunkManagerTask implements Runnable { int deleteStaleChunks(long staleDataCutoffSecs) { if (staleDataCutoffSecs <= 0) { throw new IllegalArgumentException("staleDateCutOffSecs can't be negative."); } LOG.info("stale data cut off secs is {}.", staleDataCutoffSecs); List<Map.Entry<Long, Chunk>> staleChunks = new ... |
@Test public void testDeleteStaleData() { assertTrue(chunkManager.getChunkMap().isEmpty()); assertEquals(0, deleteStaleData(startTimeSecs)); assertEquals(0, deleteStaleData(startTimeSecs + 1)); assertEquals(0, deleteStaleData(startTimeSecs + 3600 * 2)); assertEquals(0, deleteStaleData(startTimeSecs + 3600 * 3)); chunkM... | int deleteStaleData(Instant startInstant) { final long staleCutoffSecs = startInstant.minusSeconds(this.staleDataDelaySecs).getEpochSecond(); return deleteStaleChunks(staleCutoffSecs); } | OffHeapChunkManagerTask implements Runnable { int deleteStaleData(Instant startInstant) { final long staleCutoffSecs = startInstant.minusSeconds(this.staleDataDelaySecs).getEpochSecond(); return deleteStaleChunks(staleCutoffSecs); } } | OffHeapChunkManagerTask implements Runnable { int deleteStaleData(Instant startInstant) { final long staleCutoffSecs = startInstant.minusSeconds(this.staleDataDelaySecs).getEpochSecond(); return deleteStaleChunks(staleCutoffSecs); } OffHeapChunkManagerTask(ChunkManager chunkManager); OffHeapChunkManagerTask(ChunkManag... | OffHeapChunkManagerTask implements Runnable { int deleteStaleData(Instant startInstant) { final long staleCutoffSecs = startInstant.minusSeconds(this.staleDataDelaySecs).getEpochSecond(); return deleteStaleChunks(staleCutoffSecs); } OffHeapChunkManagerTask(ChunkManager chunkManager); OffHeapChunkManagerTask(ChunkManag... | OffHeapChunkManagerTask implements Runnable { int deleteStaleData(Instant startInstant) { final long staleCutoffSecs = startInstant.minusSeconds(this.staleDataDelaySecs).getEpochSecond(); return deleteStaleChunks(staleCutoffSecs); } OffHeapChunkManagerTask(ChunkManager chunkManager); OffHeapChunkManagerTask(ChunkManag... |
@Test public void testChunkWithRawMetricData() { long currentTs = Instant.now().getEpochSecond(); long previousHourTs = Instant.now().minusSeconds(3600).getEpochSecond(); final Query emptyQuery = new Query("test", Collections.emptyList()); assertTrue( chunkManager.query(emptyQuery, currentTs, previousHourTs, QueryAggre... | public List<TimeSeries> query(Query query, long startTsSecs, long endTsSecs, QueryAggregation queryAggregation) { return queryAroundChunkBoundaries(query, startTsSecs, endTsSecs, queryAggregation); } | ChunkManager { public List<TimeSeries> query(Query query, long startTsSecs, long endTsSecs, QueryAggregation queryAggregation) { return queryAroundChunkBoundaries(query, startTsSecs, endTsSecs, queryAggregation); } } | ChunkManager { public List<TimeSeries> query(Query query, long startTsSecs, long endTsSecs, QueryAggregation queryAggregation) { return queryAroundChunkBoundaries(query, startTsSecs, endTsSecs, queryAggregation); } ChunkManager(String chunkDataPrefix, int expectedTagStoreSize); ChunkManager(String chunkDataPrefix, int... | ChunkManager { public List<TimeSeries> query(Query query, long startTsSecs, long endTsSecs, QueryAggregation queryAggregation) { return queryAroundChunkBoundaries(query, startTsSecs, endTsSecs, queryAggregation); } ChunkManager(String chunkDataPrefix, int expectedTagStoreSize); ChunkManager(String chunkDataPrefix, int... | ChunkManager { public List<TimeSeries> query(Query query, long startTsSecs, long endTsSecs, QueryAggregation queryAggregation) { return queryAroundChunkBoundaries(query, startTsSecs, endTsSecs, queryAggregation); } ChunkManager(String chunkDataPrefix, int expectedTagStoreSize); ChunkManager(String chunkDataPrefix, int... |
@Test(expected = IllegalArgumentException.class) public void testInvalidMetricName() { chunkManager.addMetric("random"); } | public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric = new Metric(m... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... |
@Test public void testMetricMissingTags() { String metric = "put a.b.c.d-e 1465530393 0"; chunkManager.addMetric(metric); } | public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric = new Metric(m... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... |
@Test(expected = IllegalArgumentException.class) public void testMetricInvalidTs() { String metric = "put a.b.c.d-e 1465530393a 0"; chunkManager.addMetric(metric); } | public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric = new Metric(m... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... |
@Test public void testZeroBitEncoding() { thrown.expect(IllegalArgumentException.class); new BitStream( 2).write(0, 10); } | public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { long v2 = v << ... | BitStream { public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { lon... | BitStream { public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { lon... | BitStream { public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { lon... | BitStream { public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { lon... |
@Test(expected = IllegalArgumentException.class) public void testMetricInvalidValue() { String metric = "put a.b.c.d-e 1465530393 a0"; chunkManager.addMetric(metric); } | public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric = new Metric(m... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... |
@Test(expected = IllegalArgumentException.class) public void testMetricInvalidTag() { String metric = "put a.b.c.d-e 1465530393 0 a"; chunkManager.addMetric(metric); } | public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric = new Metric(m... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... |
@Test(expected = IllegalArgumentException.class) public void testMissingMetricName() { String metric = "put 1465530393 0"; chunkManager.addMetric(metric); } | public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric = new Metric(m... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... |
@Test(expected = IllegalArgumentException.class) public void testMissingValue() { String metric = "put a.b 1465530393 c=d"; chunkManager.addMetric(metric); } | public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric = new Metric(m... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... |
@Test(expected = IllegalArgumentException.class) public void testMissingTs() { String metric = "put a.b 5.1 c=d"; chunkManager.addMetric(metric); } | public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric = new Metric(m... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... | ChunkManager { public void addMetric(final String metricString) { try { String[] metricParts = metricString.split(" "); if (metricParts.length > 1 && metricParts[0].equals("put")) { String metricName = metricParts[1].trim(); List<String> rawTags = Arrays.asList(metricParts).subList(4, metricParts.length); Metric metric... |
@Test public void testRemoveStaleChunks() { final Map.Entry<Long, Chunk> fakeMapEntry = new Map.Entry<Long, Chunk>() { @Override public Long getKey() { return 100L; } @Override public Chunk getValue() { return null; } @Override public Chunk setValue(Chunk value) { return null; } }; assertTrue(chunkManager.getChunkMap()... | public void removeStaleChunks(List<Map.Entry<Long, Chunk>> staleChunks) { LOG.info("Stale chunks to be removed are: {}", staleChunks); if (chunkMap.isEmpty()) { LOG.warn("Possible bug or race condition. There are no chunks in chunk map."); } staleChunks.forEach(entry -> { try { if (chunkMap.containsKey(entry.getKey()))... | ChunkManager { public void removeStaleChunks(List<Map.Entry<Long, Chunk>> staleChunks) { LOG.info("Stale chunks to be removed are: {}", staleChunks); if (chunkMap.isEmpty()) { LOG.warn("Possible bug or race condition. There are no chunks in chunk map."); } staleChunks.forEach(entry -> { try { if (chunkMap.containsKey(e... | ChunkManager { public void removeStaleChunks(List<Map.Entry<Long, Chunk>> staleChunks) { LOG.info("Stale chunks to be removed are: {}", staleChunks); if (chunkMap.isEmpty()) { LOG.warn("Possible bug or race condition. There are no chunks in chunk map."); } staleChunks.forEach(entry -> { try { if (chunkMap.containsKey(e... | ChunkManager { public void removeStaleChunks(List<Map.Entry<Long, Chunk>> staleChunks) { LOG.info("Stale chunks to be removed are: {}", staleChunks); if (chunkMap.isEmpty()) { LOG.warn("Possible bug or race condition. There are no chunks in chunk map."); } staleChunks.forEach(entry -> { try { if (chunkMap.containsKey(e... | ChunkManager { public void removeStaleChunks(List<Map.Entry<Long, Chunk>> staleChunks) { LOG.info("Stale chunks to be removed are: {}", staleChunks); if (chunkMap.isEmpty()) { LOG.warn("Possible bug or race condition. There are no chunks in chunk map."); } staleChunks.forEach(entry -> { try { if (chunkMap.containsKey(e... |
@Test public void testGet() { ids.add(store.getOrCreate(new Metric(METRIC1, Collections.singletonList("k1=v1")))); ids.add(store.getOrCreate(new Metric(METRIC2, Collections.singletonList("k1=v1")))); ids.add(store.getOrCreate(new Metric(METRIC1, Collections.singletonList("k1=v2")))); ids.add(store.getOrCreate(new Metri... | @Override public Optional<Integer> get(Metric m) { if (metricIndex.containsKey(m.fullMetricName)) { return Optional.of(lookupMetricIndex(m.fullMetricName).getIntIterator().next()); } return Optional.empty(); } | InvertedIndexTagStore implements TagStore { @Override public Optional<Integer> get(Metric m) { if (metricIndex.containsKey(m.fullMetricName)) { return Optional.of(lookupMetricIndex(m.fullMetricName).getIntIterator().next()); } return Optional.empty(); } } | InvertedIndexTagStore implements TagStore { @Override public Optional<Integer> get(Metric m) { if (metricIndex.containsKey(m.fullMetricName)) { return Optional.of(lookupMetricIndex(m.fullMetricName).getIntIterator().next()); } return Optional.empty(); } InvertedIndexTagStore(); InvertedIndexTagStore(int metricIdMapCap... | InvertedIndexTagStore implements TagStore { @Override public Optional<Integer> get(Metric m) { if (metricIndex.containsKey(m.fullMetricName)) { return Optional.of(lookupMetricIndex(m.fullMetricName).getIntIterator().next()); } return Optional.empty(); } InvertedIndexTagStore(); InvertedIndexTagStore(int metricIdMapCap... | InvertedIndexTagStore implements TagStore { @Override public Optional<Integer> get(Metric m) { if (metricIndex.containsKey(m.fullMetricName)) { return Optional.of(lookupMetricIndex(m.fullMetricName).getIntIterator().next()); } return Optional.empty(); } InvertedIndexTagStore(); InvertedIndexTagStore(int metricIdMapCap... |
@Test(expected = PatternSyntaxException.class) public void testFailedRegExQuery() { ids.add(store.getOrCreate( new Metric(METRIC1, Collections.singletonList("host=ogg-01.ops.ankh.morpork.com")))); query(makeRegExQuery(METRIC1, HOST_TAG, "ogg-\\d(3.ops.ankh.morpork.com")); } | @Override public int getOrCreate(final Metric m) { Optional<Integer> optionalMetric = get(m); return optionalMetric.isPresent() ? optionalMetric.get() : create(m); } | InvertedIndexTagStore implements TagStore { @Override public int getOrCreate(final Metric m) { Optional<Integer> optionalMetric = get(m); return optionalMetric.isPresent() ? optionalMetric.get() : create(m); } } | InvertedIndexTagStore implements TagStore { @Override public int getOrCreate(final Metric m) { Optional<Integer> optionalMetric = get(m); return optionalMetric.isPresent() ? optionalMetric.get() : create(m); } InvertedIndexTagStore(); InvertedIndexTagStore(int metricIdMapCapacity, int initialIndexSize); InvertedIndex... | InvertedIndexTagStore implements TagStore { @Override public int getOrCreate(final Metric m) { Optional<Integer> optionalMetric = get(m); return optionalMetric.isPresent() ? optionalMetric.get() : create(m); } InvertedIndexTagStore(); InvertedIndexTagStore(int metricIdMapCapacity, int initialIndexSize); InvertedIndex... | InvertedIndexTagStore implements TagStore { @Override public int getOrCreate(final Metric m) { Optional<Integer> optionalMetric = get(m); return optionalMetric.isPresent() ? optionalMetric.get() : create(m); } InvertedIndexTagStore(); InvertedIndexTagStore(int metricIdMapCapacity, int initialIndexSize); InvertedIndex... |
@Test public void testTagMatcherCreation() { TagMatcher m2 = new TagMatcher(MatchType.WILDCARD, testTag); assertEquals(testTag, m2.tag); assertEquals(MatchType.WILDCARD, m2.type); TagMatcher m4 = TagMatcher.wildcardMatch(testKey, "*"); assertEquals(new Tag(testKey, "*"), m4.tag); assertEquals(MatchType.WILDCARD, m4.typ... | public static TagMatcher wildcardMatch(String key, String wildcardString) { return createWildCardTagMatcher(key, wildcardString, MatchType.WILDCARD); } | TagMatcher { public static TagMatcher wildcardMatch(String key, String wildcardString) { return createWildCardTagMatcher(key, wildcardString, MatchType.WILDCARD); } } | TagMatcher { public static TagMatcher wildcardMatch(String key, String wildcardString) { return createWildCardTagMatcher(key, wildcardString, MatchType.WILDCARD); } TagMatcher(MatchType type, Tag tag); } | TagMatcher { public static TagMatcher wildcardMatch(String key, String wildcardString) { return createWildCardTagMatcher(key, wildcardString, MatchType.WILDCARD); } TagMatcher(MatchType type, Tag tag); @Override boolean equals(Object o); @Override int hashCode(); static TagMatcher exactMatch(Tag tag); static TagMatcher... | TagMatcher { public static TagMatcher wildcardMatch(String key, String wildcardString) { return createWildCardTagMatcher(key, wildcardString, MatchType.WILDCARD); } TagMatcher(MatchType type, Tag tag); @Override boolean equals(Object o); @Override int hashCode(); static TagMatcher exactMatch(Tag tag); static TagMatcher... |
@Test public void testTagParse() { testInvalidTagParse("a"); testInvalidTagParse("a="); testInvalidTagParse("=a"); testInvalidTagParse("="); Tag t = Tag.parseTag("k=v"); assertEquals("k", t.key); assertEquals("v", t.value); assertEquals("k=v", t.rawTag); Tag t1 = Tag.parseTag("k=v=1"); assertEquals("k", t1.key); assert... | public static Tag parseTag(String rawTag) { int index = getDelimiterIndex(rawTag); String key = rawTag.substring(0, index); String value = rawTag.substring(index + 1); if (key.isEmpty() || value.isEmpty()) { throw new IllegalArgumentException("Invalid rawTag" + rawTag); } return new Tag(key, value, rawTag); } | Tag implements Comparable<Tag> { public static Tag parseTag(String rawTag) { int index = getDelimiterIndex(rawTag); String key = rawTag.substring(0, index); String value = rawTag.substring(index + 1); if (key.isEmpty() || value.isEmpty()) { throw new IllegalArgumentException("Invalid rawTag" + rawTag); } return new Tag... | Tag implements Comparable<Tag> { public static Tag parseTag(String rawTag) { int index = getDelimiterIndex(rawTag); String key = rawTag.substring(0, index); String value = rawTag.substring(index + 1); if (key.isEmpty() || value.isEmpty()) { throw new IllegalArgumentException("Invalid rawTag" + rawTag); } return new Tag... | Tag implements Comparable<Tag> { public static Tag parseTag(String rawTag) { int index = getDelimiterIndex(rawTag); String key = rawTag.substring(0, index); String value = rawTag.substring(index + 1); if (key.isEmpty() || value.isEmpty()) { throw new IllegalArgumentException("Invalid rawTag" + rawTag); } return new Tag... | Tag implements Comparable<Tag> { public static Tag parseTag(String rawTag) { int index = getDelimiterIndex(rawTag); String key = rawTag.substring(0, index); String value = rawTag.substring(index + 1); if (key.isEmpty() || value.isEmpty()) { throw new IllegalArgumentException("Invalid rawTag" + rawTag); } return new Tag... |
@Test public void test9ByteEncoding() { thrown.expect(IllegalArgumentException.class); new BitStream( 2).write(65, 10); } | public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { long v2 = v << ... | BitStream { public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { lon... | BitStream { public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { lon... | BitStream { public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { lon... | BitStream { public void write(int n, long v) { if (n < 1 || n > 64) { throw new IllegalArgumentException( String.format("Unable to write %s bits to value %d", n, v)); } reserve(n); long v1 = v << 64 - n >>> shift; data[index] = data[index] | v1; shift += n; if (shift >= 64) { shift -= 64; index++; if (shift != 0) { lon... |
@Test public void testQuery() { Query q = new Query(metric, Arrays.asList(tagMatcher1)); assertEquals(metric, q.metricName); assertEquals(1, q.tagMatchers.size()); assertEquals(tagMatcher1, q.tagMatchers.get(0)); Query q1 = Query.parse(metric); assertEquals(metric, q1.metricName); assertTrue(q1.tagMatchers.isEmpty()); ... | public Query(final String metricName, final List<TagMatcher> tagMatchers) { if (metricName == null || metricName.isEmpty() || tagMatchers == null) { throw new IllegalArgumentException("metric name or tag matcher can't be null."); } final Map<String, List<TagMatcher>> tagNameMap = tagMatchers.stream() .map(t -> new Simp... | Query { public Query(final String metricName, final List<TagMatcher> tagMatchers) { if (metricName == null || metricName.isEmpty() || tagMatchers == null) { throw new IllegalArgumentException("metric name or tag matcher can't be null."); } final Map<String, List<TagMatcher>> tagNameMap = tagMatchers.stream() .map(t -> ... | Query { public Query(final String metricName, final List<TagMatcher> tagMatchers) { if (metricName == null || metricName.isEmpty() || tagMatchers == null) { throw new IllegalArgumentException("metric name or tag matcher can't be null."); } final Map<String, List<TagMatcher>> tagNameMap = tagMatchers.stream() .map(t -> ... | Query { public Query(final String metricName, final List<TagMatcher> tagMatchers) { if (metricName == null || metricName.isEmpty() || tagMatchers == null) { throw new IllegalArgumentException("metric name or tag matcher can't be null."); } final Map<String, List<TagMatcher>> tagNameMap = tagMatchers.stream() .map(t -> ... | Query { public Query(final String metricName, final List<TagMatcher> tagMatchers) { if (metricName == null || metricName.isEmpty() || tagMatchers == null) { throw new IllegalArgumentException("metric name or tag matcher can't be null."); } final Map<String, List<TagMatcher>> tagNameMap = tagMatchers.stream() .map(t -> ... |
@Test(expected = IllegalArgumentException.class) public void testDuplicateTagKeysUsingParse() { Query.parse("metric k1=v1 k1=v2"); } | public static Query parse(String s) { List<String> splits = Arrays.asList(s.split(" ")); String metricName = splits.get(0); List<TagMatcher> matchers = new ArrayList<>(); for (String s2 : splits.subList(1, splits.size())) { Tag tag = Tag.parseTag(s2); if (tag.value.equals("*")) { matchers.add(TagMatcher.wildcardMatch(t... | Query { public static Query parse(String s) { List<String> splits = Arrays.asList(s.split(" ")); String metricName = splits.get(0); List<TagMatcher> matchers = new ArrayList<>(); for (String s2 : splits.subList(1, splits.size())) { Tag tag = Tag.parseTag(s2); if (tag.value.equals("*")) { matchers.add(TagMatcher.wildcar... | Query { public static Query parse(String s) { List<String> splits = Arrays.asList(s.split(" ")); String metricName = splits.get(0); List<TagMatcher> matchers = new ArrayList<>(); for (String s2 : splits.subList(1, splits.size())) { Tag tag = Tag.parseTag(s2); if (tag.value.equals("*")) { matchers.add(TagMatcher.wildcar... | Query { public static Query parse(String s) { List<String> splits = Arrays.asList(s.split(" ")); String metricName = splits.get(0); List<TagMatcher> matchers = new ArrayList<>(); for (String s2 : splits.subList(1, splits.size())) { Tag tag = Tag.parseTag(s2); if (tag.value.equals("*")) { matchers.add(TagMatcher.wildcar... | Query { public static Query parse(String s) { List<String> splits = Arrays.asList(s.split(" ")); String metricName = splits.get(0); List<TagMatcher> matchers = new ArrayList<>(); for (String s2 : splits.subList(1, splits.size())) { Tag tag = Tag.parseTag(s2); if (tag.value.equals("*")) { matchers.add(TagMatcher.wildcar... |
@Test public void testEmpty() { MetricStore store = new OffHeapVarBitMetricStore(1, testFileName); assertTrue(store.getSeries(1).isEmpty()); assertTrue(store.getSeries(2).isEmpty()); } | @Override public List<Point> getSeries(long uuid) { final LongValue key = Values.newHeapInstance(LongValue.class); key.setValue(uuid); if (timeSeries.containsKey(key)) { ByteBuffer serializedValues = timeSeries.get(key); TimeSeriesIterator iterator = VarBitTimeSeries.deserialize(serializedValues); return iterator.getPo... | OffHeapVarBitMetricStore implements MetricStore { @Override public List<Point> getSeries(long uuid) { final LongValue key = Values.newHeapInstance(LongValue.class); key.setValue(uuid); if (timeSeries.containsKey(key)) { ByteBuffer serializedValues = timeSeries.get(key); TimeSeriesIterator iterator = VarBitTimeSeries.de... | OffHeapVarBitMetricStore implements MetricStore { @Override public List<Point> getSeries(long uuid) { final LongValue key = Values.newHeapInstance(LongValue.class); key.setValue(uuid); if (timeSeries.containsKey(key)) { ByteBuffer serializedValues = timeSeries.get(key); TimeSeriesIterator iterator = VarBitTimeSeries.de... | OffHeapVarBitMetricStore implements MetricStore { @Override public List<Point> getSeries(long uuid) { final LongValue key = Values.newHeapInstance(LongValue.class); key.setValue(uuid); if (timeSeries.containsKey(key)) { ByteBuffer serializedValues = timeSeries.get(key); TimeSeriesIterator iterator = VarBitTimeSeries.de... | OffHeapVarBitMetricStore implements MetricStore { @Override public List<Point> getSeries(long uuid) { final LongValue key = Values.newHeapInstance(LongValue.class); key.setValue(uuid); if (timeSeries.containsKey(key)) { ByteBuffer serializedValues = timeSeries.get(key); TimeSeriesIterator iterator = VarBitTimeSeries.de... |
@Test(expected = UnsupportedOperationException.class) public void testReadOnlyStore() { MetricStore store = new OffHeapVarBitMetricStore(1, testFileName); store.addPoint(1, 1, 1); } | public void addPoint(long uuid, ByteBuffer series) { LongValue key = Values.newHeapInstance(LongValue.class); key.setValue(uuid); timeSeries.put(key, series); } | OffHeapVarBitMetricStore implements MetricStore { public void addPoint(long uuid, ByteBuffer series) { LongValue key = Values.newHeapInstance(LongValue.class); key.setValue(uuid); timeSeries.put(key, series); } } | OffHeapVarBitMetricStore implements MetricStore { public void addPoint(long uuid, ByteBuffer series) { LongValue key = Values.newHeapInstance(LongValue.class); key.setValue(uuid); timeSeries.put(key, series); } OffHeapVarBitMetricStore(long size, String chunkInfo); OffHeapVarBitMetricStore(long size, int valueSize, St... | OffHeapVarBitMetricStore implements MetricStore { public void addPoint(long uuid, ByteBuffer series) { LongValue key = Values.newHeapInstance(LongValue.class); key.setValue(uuid); timeSeries.put(key, series); } OffHeapVarBitMetricStore(long size, String chunkInfo); OffHeapVarBitMetricStore(long size, int valueSize, St... | OffHeapVarBitMetricStore implements MetricStore { public void addPoint(long uuid, ByteBuffer series) { LongValue key = Values.newHeapInstance(LongValue.class); key.setValue(uuid); timeSeries.put(key, series); } OffHeapVarBitMetricStore(long size, String chunkInfo); OffHeapVarBitMetricStore(long size, int valueSize, St... |
@Test public void testMinTimestamp() { VarBitTimeSeries series = new VarBitTimeSeries(); thrown.expect(IllegalArgumentException.class); series.append(-1, 1); } | public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp, value); } size++;... | VarBitTimeSeries { public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp... | VarBitTimeSeries { public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp... | VarBitTimeSeries { public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp... | VarBitTimeSeries { public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp... |
@Test public void testMaxTimestamp() { VarBitTimeSeries series = new VarBitTimeSeries(); thrown.expect(IllegalArgumentException.class); series.append(-1, 1); } | public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp, value); } size++;... | VarBitTimeSeries { public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp... | VarBitTimeSeries { public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp... | VarBitTimeSeries { public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp... | VarBitTimeSeries { public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp... |
@Test(expected = IllegalArgumentException.class) public void testTimestampEncodingOverflow() { VarBitTimeSeries series = new VarBitTimeSeries(); int i = 10; long ts1 = 1477678600L; long ts2 = 14776780L; long ts3 = 1477678580L; series.append(ts1, i); series.append(ts2, i); series.append(ts3, i); } | public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp, value); } size++;... | VarBitTimeSeries { public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp... | VarBitTimeSeries { public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp... | VarBitTimeSeries { public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp... | VarBitTimeSeries { public synchronized void append(long timestamp, double value) { if (timestamp < 0 || timestamp > MAX_UNIX_TIMESTAMP) { throw new IllegalArgumentException("Timestamp is not a valid unix timestamp: " + timestamp); } if (size == 0) { appendFirstPoint(timestamp, value); } else { appendNextPoint(timestamp... |
@Test public void testEmptyPoints() { VarBitTimeSeries series = new VarBitTimeSeries(); TimeSeriesIterator dr = series.read(); List<Point> points = dr.getPoints(); assertTrue(points.isEmpty()); } | public synchronized TimeSeriesIterator read() { return new CachingVarBitTimeSeriesIterator(size, timestamps.read(), values.read()); } | VarBitTimeSeries { public synchronized TimeSeriesIterator read() { return new CachingVarBitTimeSeriesIterator(size, timestamps.read(), values.read()); } } | VarBitTimeSeries { public synchronized TimeSeriesIterator read() { return new CachingVarBitTimeSeriesIterator(size, timestamps.read(), values.read()); } VarBitTimeSeries(); } | VarBitTimeSeries { public synchronized TimeSeriesIterator read() { return new CachingVarBitTimeSeriesIterator(size, timestamps.read(), values.read()); } VarBitTimeSeries(); synchronized void append(long timestamp, double value); synchronized TimeSeriesIterator read(); Map<String, Double> getStats(); int getSerializedBy... | VarBitTimeSeries { public synchronized TimeSeriesIterator read() { return new CachingVarBitTimeSeriesIterator(size, timestamps.read(), values.read()); } VarBitTimeSeries(); synchronized void append(long timestamp, double value); synchronized TimeSeriesIterator read(); Map<String, Double> getStats(); int getSerializedBy... |
@Test public void testEmpty() { MetricStore store = new VarBitMetricStore(); assertTrue(store.getSeries(1).isEmpty()); assertTrue(store.getSeries(2).isEmpty()); } | @Override public List<Point> getSeries(long uuid) { mu.readLock().lock(); try { VarBitTimeSeries s = series.get(uuid); if (s == null) { return Collections.emptyList(); } return s.read().getPoints(); } finally { mu.readLock().unlock(); } } | VarBitMetricStore implements MetricStore { @Override public List<Point> getSeries(long uuid) { mu.readLock().lock(); try { VarBitTimeSeries s = series.get(uuid); if (s == null) { return Collections.emptyList(); } return s.read().getPoints(); } finally { mu.readLock().unlock(); } } } | VarBitMetricStore implements MetricStore { @Override public List<Point> getSeries(long uuid) { mu.readLock().lock(); try { VarBitTimeSeries s = series.get(uuid); if (s == null) { return Collections.emptyList(); } return s.read().getPoints(); } finally { mu.readLock().unlock(); } } VarBitMetricStore(); VarBitMetricStor... | VarBitMetricStore implements MetricStore { @Override public List<Point> getSeries(long uuid) { mu.readLock().lock(); try { VarBitTimeSeries s = series.get(uuid); if (s == null) { return Collections.emptyList(); } return s.read().getPoints(); } finally { mu.readLock().unlock(); } } VarBitMetricStore(); VarBitMetricStor... | VarBitMetricStore implements MetricStore { @Override public List<Point> getSeries(long uuid) { mu.readLock().lock(); try { VarBitTimeSeries s = series.get(uuid); if (s == null) { return Collections.emptyList(); } return s.read().getPoints(); } finally { mu.readLock().unlock(); } } VarBitMetricStore(); VarBitMetricStor... |
@Test public void testChunkContainsData() { assertTrue(chunk.containsDataInTimeRange(startTime - 1, endTime + 1)); assertTrue(chunk.containsDataInTimeRange(startTime + 1, endTime + 1)); assertTrue(chunk.containsDataInTimeRange(startTime + 1, endTime - 1)); assertTrue(chunk.containsDataInTimeRange(startTime - 1, endTime... | @Override public boolean containsDataInTimeRange(long startTs, long endTs) { return (chunkInfo.startTimeSecs <= startTs && chunkInfo.endTimeSecs >= startTs) || (chunkInfo.startTimeSecs <= endTs && chunkInfo.endTimeSecs >= endTs) || (chunkInfo.startTimeSecs >= startTs && chunkInfo.endTimeSecs <= endTs); } | ChunkImpl implements Chunk { @Override public boolean containsDataInTimeRange(long startTs, long endTs) { return (chunkInfo.startTimeSecs <= startTs && chunkInfo.endTimeSecs >= startTs) || (chunkInfo.startTimeSecs <= endTs && chunkInfo.endTimeSecs >= endTs) || (chunkInfo.startTimeSecs >= startTs && chunkInfo.endTimeSec... | ChunkImpl implements Chunk { @Override public boolean containsDataInTimeRange(long startTs, long endTs) { return (chunkInfo.startTimeSecs <= startTs && chunkInfo.endTimeSecs >= startTs) || (chunkInfo.startTimeSecs <= endTs && chunkInfo.endTimeSecs >= endTs) || (chunkInfo.startTimeSecs >= startTs && chunkInfo.endTimeSec... | ChunkImpl implements Chunk { @Override public boolean containsDataInTimeRange(long startTs, long endTs) { return (chunkInfo.startTimeSecs <= startTs && chunkInfo.endTimeSecs >= startTs) || (chunkInfo.startTimeSecs <= endTs && chunkInfo.endTimeSecs >= endTs) || (chunkInfo.startTimeSecs >= startTs && chunkInfo.endTimeSec... | ChunkImpl implements Chunk { @Override public boolean containsDataInTimeRange(long startTs, long endTs) { return (chunkInfo.startTimeSecs <= startTs && chunkInfo.endTimeSecs >= startTs) || (chunkInfo.startTimeSecs <= endTs && chunkInfo.endTimeSecs >= endTs) || (chunkInfo.startTimeSecs >= startTs && chunkInfo.endTimeSec... |
@Test public void testChunkIngestion() { final String testMetricName1 = "testMetric1"; final String expectedMetricName1 = testMetricName1 + " dc=dc1 host=h1"; final String queryTagString = " host=h1 dc=dc1"; String inputTagString = "host=h1 dc=dc1"; parseAndAddOpenTSDBMetric(makeMetricString(testMetricName1, inputTagSt... | @Override public List<TimeSeries> query(Query query) { return store.getSeries(query); } | ChunkImpl implements Chunk { @Override public List<TimeSeries> query(Query query) { return store.getSeries(query); } } | ChunkImpl implements Chunk { @Override public List<TimeSeries> query(Query query) { return store.getSeries(query); } ChunkImpl(MetricAndTagStore store, ChunkInfo chunkInfo); } | ChunkImpl implements Chunk { @Override public List<TimeSeries> query(Query query) { return store.getSeries(query); } ChunkImpl(MetricAndTagStore store, ChunkInfo chunkInfo); @Override List<TimeSeries> query(Query query); @Override void addPoint(Metric metric, long ts, double value); @Override ChunkInfo info(); @Overrid... | ChunkImpl implements Chunk { @Override public List<TimeSeries> query(Query query) { return store.getSeries(query); } ChunkImpl(MetricAndTagStore store, ChunkInfo chunkInfo); @Override List<TimeSeries> query(Query query); @Override void addPoint(Metric metric, long ts, double value); @Override ChunkInfo info(); @Overrid... |
@Test public void testMultipleTimeSeriesResponse() { setUp(); final String testMetricName1 = "testMetric1"; final List<String> testTags1 = Arrays.asList("host=h1", "dc=dc1"); final List<String> testTags2 = Arrays.asList("host=h2", "dc=dc1"); assertTrue(chunk.query(new Query("test", Collections.emptyList())).isEmpty());... | @Override public List<TimeSeries> query(Query query) { return store.getSeries(query); } | ChunkImpl implements Chunk { @Override public List<TimeSeries> query(Query query) { return store.getSeries(query); } } | ChunkImpl implements Chunk { @Override public List<TimeSeries> query(Query query) { return store.getSeries(query); } ChunkImpl(MetricAndTagStore store, ChunkInfo chunkInfo); } | ChunkImpl implements Chunk { @Override public List<TimeSeries> query(Query query) { return store.getSeries(query); } ChunkImpl(MetricAndTagStore store, ChunkInfo chunkInfo); @Override List<TimeSeries> query(Query query); @Override void addPoint(Metric metric, long ts, double value); @Override ChunkInfo info(); @Overrid... | ChunkImpl implements Chunk { @Override public List<TimeSeries> query(Query query) { return store.getSeries(query); } ChunkImpl(MetricAndTagStore store, ChunkInfo chunkInfo); @Override List<TimeSeries> query(Query query); @Override void addPoint(Metric metric, long ts, double value); @Override ChunkInfo info(); @Overrid... |
@Test public void testDetectChunksPastCutOff() { assertTrue(chunkManager.getChunkMap().isEmpty()); assertEquals(0, offHeapChunkManagerTask.detectChunksPastCutOff(startTimeSecs)); assertEquals(0, offHeapChunkManagerTask.detectChunksPastCutOff(startTimeSecs + 1)); assertEquals(0, offHeapChunkManagerTask.detectChunksPastC... | @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyChunks = new ArrayList<>(); for (Map.Entry<Long... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectChunksPastCutOff(long offHeapCutoffSecs) { if (offHeapCutoffSecs <= 0) { throw new IllegalArgumentException("offHeapCutoffSecs can't be negative."); } LOG.info("offHeapCutOffSecs is {}", offHeapCutoffSecs); List<Map.Entry<Long, Chunk>> readOnlyC... |
@Test public void testDetectReadOnlyChunksWithDefaultValues() { assertTrue(chunkManager.getChunkMap().isEmpty()); assertEquals(0, detectReadOnlyChunks(startTimeSecs)); assertEquals(0, detectReadOnlyChunks(startTimeSecs + 1)); assertEquals(0, detectReadOnlyChunks(startTimeSecs + 3600 * 2)); assertEquals(0, detectReadOnl... | @VisibleForTesting int detectReadOnlyChunks(Instant startInstant) { int secondsToSubtract = this.metricsDelay; final long offHeapCutoffSecs = startInstant.minusSeconds(secondsToSubtract).getEpochSecond(); return detectChunksPastCutOff(offHeapCutoffSecs); } | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectReadOnlyChunks(Instant startInstant) { int secondsToSubtract = this.metricsDelay; final long offHeapCutoffSecs = startInstant.minusSeconds(secondsToSubtract).getEpochSecond(); return detectChunksPastCutOff(offHeapCutoffSecs); } } | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectReadOnlyChunks(Instant startInstant) { int secondsToSubtract = this.metricsDelay; final long offHeapCutoffSecs = startInstant.minusSeconds(secondsToSubtract).getEpochSecond(); return detectChunksPastCutOff(offHeapCutoffSecs); } OffHeapChunkManag... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectReadOnlyChunks(Instant startInstant) { int secondsToSubtract = this.metricsDelay; final long offHeapCutoffSecs = startInstant.minusSeconds(secondsToSubtract).getEpochSecond(); return detectChunksPastCutOff(offHeapCutoffSecs); } OffHeapChunkManag... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting int detectReadOnlyChunks(Instant startInstant) { int secondsToSubtract = this.metricsDelay; final long offHeapCutoffSecs = startInstant.minusSeconds(secondsToSubtract).getEpochSecond(); return detectChunksPastCutOff(offHeapCutoffSecs); } OffHeapChunkManag... |
@Test public void testRunAtWithOneChunk() { assertTrue(chunkManager.getChunkMap().isEmpty()); offHeapChunkManagerTask.runAt(Instant.ofEpochSecond(startTimeSecs)); assertTrue(chunkManager.getChunkMap().isEmpty()); assertEquals(0, getReadOnlyChunkCount(chunkManager)); chunkManager.addMetric(MetricUtils.makeMetricString( ... | @VisibleForTesting void runAt(Instant instant) { LOG.info("Starting offHeapChunkManagerTask."); deleteStaleData(instant); detectReadOnlyChunks(instant); LOG.info("Finished offHeapChunkManagerTask."); } | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting void runAt(Instant instant) { LOG.info("Starting offHeapChunkManagerTask."); deleteStaleData(instant); detectReadOnlyChunks(instant); LOG.info("Finished offHeapChunkManagerTask."); } } | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting void runAt(Instant instant) { LOG.info("Starting offHeapChunkManagerTask."); deleteStaleData(instant); detectReadOnlyChunks(instant); LOG.info("Finished offHeapChunkManagerTask."); } OffHeapChunkManagerTask(ChunkManager chunkManager); OffHeapChunkManager... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting void runAt(Instant instant) { LOG.info("Starting offHeapChunkManagerTask."); deleteStaleData(instant); detectReadOnlyChunks(instant); LOG.info("Finished offHeapChunkManagerTask."); } OffHeapChunkManagerTask(ChunkManager chunkManager); OffHeapChunkManager... | OffHeapChunkManagerTask implements Runnable { @VisibleForTesting void runAt(Instant instant) { LOG.info("Starting offHeapChunkManagerTask."); deleteStaleData(instant); detectReadOnlyChunks(instant); LOG.info("Finished offHeapChunkManagerTask."); } OffHeapChunkManagerTask(ChunkManager chunkManager); OffHeapChunkManager... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.