use of org.apache.cassandra.locator.InetAddressAndPort in project cassandra by apache.
the class StreamingMetricsTest method checkDataSent.
private long checkDataSent(Cluster cluster, int node, int peer) {
InetAddressAndPort address = getNodeAddress(cluster, peer);
return cluster.get(node).callOnInstance(() -> {
StreamingMetrics metrics = StreamingMetrics.get(address);
long outgoingBytes = metrics.outgoingBytes.getCount();
assertThat(outgoingBytes).describedAs("There should be data streamed from node" + node + " to node" + peer).isGreaterThan(0);
return outgoingBytes;
});
}
use of org.apache.cassandra.locator.InetAddressAndPort in project cassandra by apache.
the class VirtualTableFromInternode method readCommandAccessVirtualTable.
@Test
public void readCommandAccessVirtualTable() {
CLUSTER.get(1).runOnInstance(() -> {
boolean didWork = false;
for (InetAddressAndPort address : Gossiper.instance.getLiveMembers()) {
didWork = true;
UntypedResultSet rs = QueryProcessor.executeAsync(address, "SELECT * FROM system_views.settings").syncUninterruptibly().getNow();
assertThat(rs.isEmpty()).isFalse();
for (UntypedResultSet.Row row : rs) {
String name = row.getString("name");
switch(name) {
case "broadcast_address":
case "rpc_address":
assertThat(row.getString("value")).isEqualTo(address.getAddress().getHostAddress());
break;
}
}
}
assertThat(didWork).isTrue();
});
}
use of org.apache.cassandra.locator.InetAddressAndPort in project cassandra by apache.
the class SystemKeyspaceTest method testNonLocalToken.
@Test
public void testNonLocalToken() throws UnknownHostException {
BytesToken token = new BytesToken(ByteBufferUtil.bytes("token3"));
InetAddressAndPort address = InetAddressAndPort.getByName("127.0.0.2");
SystemKeyspace.updateTokens(address, Collections.<Token>singletonList(token));
assert SystemKeyspace.loadTokens().get(address).contains(token);
SystemKeyspace.removeEndpoint(address);
assert !SystemKeyspace.loadTokens().containsValue(token);
}
use of org.apache.cassandra.locator.InetAddressAndPort in project cassandra by apache.
the class ReadCommandTest method copyMultipleTransientAsDigestQuery.
@Test(expected = IllegalArgumentException.class)
public void copyMultipleTransientAsDigestQuery() {
ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(CF6);
DecoratedKey key = Util.dk("key");
Token token = key.getToken();
// Address is unimportant for this test
InetAddressAndPort addr = FBUtilities.getBroadcastAddressAndPort();
ReadCommand readCommand = Util.cmd(cfs, key).build();
readCommand.copyAsDigestQuery(EndpointsForToken.of(token, ReplicaUtils.trans(addr, token), ReplicaUtils.full(addr, token)));
}
use of org.apache.cassandra.locator.InetAddressAndPort in project cassandra by apache.
the class ReadCommandTest method copyMultipleFullAsTransientTest.
@Test(expected = IllegalArgumentException.class)
public void copyMultipleFullAsTransientTest() {
ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(CF6);
DecoratedKey key = Util.dk("key");
Token token = key.getToken();
// Address is unimportant for this test
InetAddressAndPort addr = FBUtilities.getBroadcastAddressAndPort();
ReadCommand readCommand = Util.cmd(cfs, key).build();
readCommand.copyAsTransientQuery(EndpointsForToken.of(token, ReplicaUtils.trans(addr, token), ReplicaUtils.full(addr, token)));
}
Aggregations