Source:
<code>public void testMultiPublish() throws Exception { Path tempDir = Files.createTempDirectory("AccountStatsMySqlStoreTest"); Path localBackupFilePath = tempDir.resolve("localbackup"); StatsSnapshot snapshot = createStatsSnapshot(10, 10, 1, true); StatsHeader header = new StatsHeader(StatsHeader.StatsDescription.STORED_DATA_SIZE, System.currentTimeMillis(), 10, 10, null); StatsWrapper statsWrapper = new StatsWrapper(header, snapshot); ObjectMapper objectMapper = new ObjectMapper(); objectMapper.writeValue(localBackupFilePath.toFile(), statsWrapper); AccountStatsMySqlStore store = new AccountStatsMySqlStore(dataAccessor, clustername, hostname, localBackupFilePath.toString(), null, new MetricRegistry()); store.publish(statsWrapper); assertEquals("Write success count should be 0", 0, metrics.writeSuccessCount.getCount()); StatsSnapshot secondSnapshot = createStatsSnapshot(10, 10, 1, true); StatsWrapper secondStatsWrapper = new StatsWrapper(header, secondSnapshot); store.publish(secondStatsWrapper); assertEquals("Write success count should be 0", 0, metrics.writeSuccessCount.getCount()); assertTrue(secondStatsWrapper == store.getPreviousStats()); int partitionId = BASE_PARTITION_ID + 1; int accountId = BASE_ACCOUNT_ID + 1; <START> int containerId = BASE_CONTAINER_ID; <END> statsWrapper.getSnapshot() .getSubMap() .get("Partition[" + partitionId + "]") .getSubMap() .get("A[" + accountId + "]") .getSubMap() .put("C[" + containerId + "]", new StatsSnapshot((long) (DEFAULT_CONTAINER_USAGE + 1), null)); store.publish(statsWrapper); assertEquals("Write success count should be 1", 1, metrics.writeSuccessCount.getCount()); assertTrue(statsWrapper == store.getPreviousStats()); StatsSnapshot additionalSnapshot = createStatsSnapshot(1, 10, 1, true); secondStatsWrapper.getSnapshot() .getSubMap() .put("Partition[" + (BASE_PARTITION_ID + 10) + "]", additionalSnapshot.getSubMap().get("Partition[" + BASE_PARTITION_ID + "]")); store.publish(secondStatsWrapper); assertEquals("Write success count should be 12", 12, metrics.writeSuccessCount.getCount()); assertTrue(secondStatsWrapper == store.getPreviousStats()); }</code><technical_language>This containerId is redundant</technical_language>

Target:
public void testMultiPublish() throws Exception { Path tempDir = Files.createTempDirectory("AccountStatsMySqlStoreTest"); Path localBackupFilePath = tempDir.resolve("localbackup"); StatsSnapshot snapshot = createStatsSnapshot(10, 10, 1, true); StatsHeader header = new StatsHeader(StatsHeader.StatsDescription.STORED_DATA_SIZE, System.currentTimeMillis(), 10, 10, null); StatsWrapper statsWrapper = new StatsWrapper(header, snapshot); ObjectMapper objectMapper = new ObjectMapper(); objectMapper.writeValue(localBackupFilePath.toFile(), statsWrapper); AccountStatsMySqlStore store = new AccountStatsMySqlStore(dataAccessor, clusterName, hostname, localBackupFilePath.toString(), null, new MetricRegistry()); store.publish(statsWrapper); assertEquals("Write success count should be 0", 0, metrics.writeSuccessCount.getCount()); StatsSnapshot secondSnapshot = createStatsSnapshot(10, 10, 1, true); StatsWrapper secondStatsWrapper = new StatsWrapper(header, secondSnapshot); store.publish(secondStatsWrapper); assertEquals("Write success count should be 0", 0, metrics.writeSuccessCount.getCount()); assertTrue(secondStatsWrapper == store.getPreviousStats()); int partitionId = BASE_PARTITION_ID + 1; int accountId = BASE_ACCOUNT_ID + 1; statsWrapper.getSnapshot() .getSubMap() .get("Partition[" + partitionId + "]") .getSubMap() .get("A[" + accountId + "]") .getSubMap() .put("C[" + BASE_CONTAINER_ID + "]", new StatsSnapshot((long) (DEFAULT_CONTAINER_USAGE + 1), null)); store.publish(statsWrapper); assertEquals("Write success count should be 1", 1, metrics.writeSuccessCount.getCount()); assertTrue(statsWrapper == store.getPreviousStats()); StatsSnapshot additionalSnapshot = createStatsSnapshot(1, 10, 1, true); secondStatsWrapper.getSnapshot() .getSubMap() .put("Partition[" + (BASE_PARTITION_ID + 10) + "]", additionalSnapshot.getSubMap().get("Partition[" + BASE_PARTITION_ID + "]")); store.publish(secondStatsWrapper); assertEquals("Write success count should be 12", 12, metrics.writeSuccessCount.getCount()); assertTrue(secondStatsWrapper == store.getPreviousStats()); }