Skip to content

Commit

Permalink
Update TableDeviceSchemaCacheTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Caideyipi committed Oct 17, 2024
1 parent e0fcd60 commit 703d01c
Showing 1 changed file with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,6 @@ public void testLastCache() {

@Test
public void testUpdateNonExistWhenWriting() {
final String database = "db1";
final String database2 = "db2";

final String table1 = "t1";
final String table2 = "t2";
final String[] device0 = new String[] {"hebei", "p_1", "d_0"};

final TimeValuePair tv3 = new TimeValuePair(1L, new TsPrimitiveType.TsInt(3));
Expand All @@ -468,31 +463,31 @@ public void testUpdateNonExistWhenWriting() {
final TableDeviceSchemaCache cache = TableDeviceSchemaCache.getInstance();

cache.updateLastCacheIfExists(
database, convertIdValuesToDeviceID(table2, device0), testMeasurements, testTimeValuePairs);
database1, convertIdValuesToDeviceID(table2, device0), testMeasurements, testTimeValuePairs);
cache.updateLastCacheIfExists(
database2,
convertIdValuesToDeviceID(table1, device0),
testMeasurements,
testTimeValuePairs);

Assert.assertNull(
cache.getLastEntry(database, convertIdValuesToDeviceID(table2, device0), "s2"));
cache.getLastEntry(database1, convertIdValuesToDeviceID(table2, device0), "s2"));
Assert.assertNull(
cache.getLastEntry(database2, convertIdValuesToDeviceID(table1, device0), "s2"));

updateLastCache4Query(
cache,
database,
database1,
convertIdValuesToDeviceID(table1, device0),
new String[] {"s0"},
new TimeValuePair[] {new TimeValuePair(0L, new TsPrimitiveType.TsInt(2))});
cache.updateLastCacheIfExists(
database, convertIdValuesToDeviceID(table1, device0), testMeasurements, testTimeValuePairs);
database1, convertIdValuesToDeviceID(table1, device0), testMeasurements, testTimeValuePairs);

Assert.assertEquals(
tv3, cache.getLastEntry(database, convertIdValuesToDeviceID(table1, device0), "s0"));
tv3, cache.getLastEntry(database1, convertIdValuesToDeviceID(table1, device0), "s0"));
Assert.assertNull(
cache.getLastEntry(database, convertIdValuesToDeviceID(table1, device0), "s2"));
cache.getLastEntry(database1, convertIdValuesToDeviceID(table1, device0), "s2"));
}

private void updateLastCache4Query(
Expand Down

0 comments on commit 703d01c

Please sign in to comment.