Merge branch 'cassandra-2.2' into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f791c269 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f791c269 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f791c269 Branch: refs/heads/trunk Commit: f791c2690df0cee4f6308872917f6f5f572a3b1e Parents: 5e7f60f 4d90573 Author: Aleksey Yeschenko <alek...@yeschenko.com> Authored: Thu Aug 31 14:46:30 2017 +0100 Committer: Aleksey Yeschenko <alek...@yeschenko.com> Committed: Thu Aug 31 14:46:30 2017 +0100 ---------------------------------------------------------------------- .../org/apache/cassandra/metrics/HintedHandOffMetricsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f791c269/test/unit/org/apache/cassandra/metrics/HintedHandOffMetricsTest.java ---------------------------------------------------------------------- diff --cc test/unit/org/apache/cassandra/metrics/HintedHandOffMetricsTest.java index a2c9cf9,0000000..1d3863a mode 100644,000000..100644 --- a/test/unit/org/apache/cassandra/metrics/HintedHandOffMetricsTest.java +++ b/test/unit/org/apache/cassandra/metrics/HintedHandOffMetricsTest.java @@@ -1,63 -1,0 +1,63 @@@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.cassandra.metrics; + +import java.net.InetAddress; +import java.util.Map; +import java.util.UUID; + +import org.junit.BeforeClass; +import org.junit.Test; + +import com.google.common.collect.Iterators; + +import org.apache.cassandra.config.DatabaseDescriptor; +import org.apache.cassandra.cql3.UntypedResultSet; +import org.apache.cassandra.db.SystemKeyspace; +import org.apache.cassandra.db.marshal.Int32Type; +import org.apache.cassandra.db.marshal.UUIDType; +import org.apache.cassandra.hints.HintsService; + +import static org.junit.Assert.assertEquals; +import static org.apache.cassandra.cql3.QueryProcessor.executeInternal; + +public class HintedHandOffMetricsTest +{ + @BeforeClass + public static void initDD() + { + DatabaseDescriptor.setDaemonInitialized(); + } + + @Test + public void testHintsMetrics() throws Exception + { + DatabaseDescriptor.getHintsDirectory().mkdirs(); + + for (int i = 0; i < 99; i++) - HintsService.instance.metrics.incrPastWindow(InetAddress.getLocalHost()); ++ HintsService.instance.metrics.incrPastWindow(InetAddress.getByName("127.0.0.1")); + HintsService.instance.metrics.log(); + + UntypedResultSet rows = executeInternal("SELECT hints_dropped FROM system." + SystemKeyspace.PEER_EVENTS); + Map<UUID, Integer> returned = rows.one().getMap("hints_dropped", UUIDType.instance, Int32Type.instance); + assertEquals(Iterators.getLast(returned.values().iterator()).intValue(), 99); + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org