Skip to content

Commit cea725e

Browse files
author
Alexandre Dutra
committed
Fixes for CCM tests after refactoring.
This commit fixes a few minor bugs and brings minor enhancements to the CCM test framework: - Prevent CCMBridge instance to be closed when it is evicted immediately after being loaded into cache. - Prevent vanilla CCM clusters from being evicted from cache. - Prevent tests from messing up with shared clusters. - Get rid of AddressTranslator for CCM and Scassandra clusters. - Additional tweaks to enable tests against DSE clusters. - Switch to per-method CCM creation in TokenIntegrationTest. - New DseCCMClusterTest to validate DSE setups.
1 parent a90bffa commit cea725e

38 files changed

Lines changed: 790 additions & 286 deletions
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
/*
2+
* Copyright (C) 2012-2015 DataStax Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.datastax.driver.core;
17+
18+
import java.io.Closeable;
19+
import java.io.File;
20+
import java.net.InetSocketAddress;
21+
import java.util.Map;
22+
23+
public interface CCMAccess extends Closeable {
24+
25+
// Inspection methods
26+
27+
/**
28+
* @return The CCM cluster name.
29+
*/
30+
String getClusterName();
31+
32+
/**
33+
* Returns the Cassandra version of this CCM cluster.
34+
* <p/>
35+
* By default the version is equal to {@link CCMBridge#getCassandraVersion()}.
36+
*
37+
* @return The version of this CCM cluster.
38+
*/
39+
VersionNumber getVersion();
40+
41+
/**
42+
* @return The config directory for this CCM cluster.
43+
*/
44+
File getCcmDir();
45+
46+
/**
47+
* @return The cluster directory for this CCM cluster.
48+
*/
49+
File getClusterDir();
50+
51+
/**
52+
* @param n the node number, starting with 1.
53+
* @return The node directory for this CCM cluster.
54+
*/
55+
File getNodeDir(int n);
56+
57+
/**
58+
* @param n the node number, starting with 1.
59+
* @return The node config directory for this CCM cluster.
60+
*/
61+
File getNodeConfDir(int n);
62+
63+
/**
64+
* @return The storage port for this CCM cluster.
65+
*/
66+
int getStoragePort();
67+
68+
/**
69+
* @return The thrift port for this CCM cluster.
70+
*/
71+
int getThriftPort();
72+
73+
/**
74+
* @return The binary port for this CCM cluster.
75+
*/
76+
int getBinaryPort();
77+
78+
/**
79+
* Signals that logs for this CCM cluster should be kept after the cluster is stopped.
80+
*/
81+
void setKeepLogs(boolean keepLogs);
82+
83+
/**
84+
* Returns the address of the {@code nth} host in the CCM cluster (counting from 1, i.e.,
85+
* {@code addressOfNode(1)} returns the address of the first node.
86+
* <p/>
87+
* In multi-DC setups, nodes are numbered in ascending order of their datacenter number.
88+
* E.g. with 2 DCs and 3 nodes in each DC, the first node in DC 2 is number 4.
89+
*
90+
* @return the address of the {@code nth} host in the cluster.
91+
*/
92+
InetSocketAddress addressOfNode(int n);
93+
94+
95+
// Methods altering the whole cluster
96+
97+
/**
98+
* Starts the cluster.
99+
*/
100+
void start();
101+
102+
/**
103+
* Stops the cluster.
104+
*/
105+
void stop();
106+
107+
/**
108+
* Aggressively stops the cluster.
109+
*/
110+
void forceStop();
111+
112+
/**
113+
* Alias for {@link #stop()}.
114+
*/
115+
@Override
116+
void close();
117+
118+
/**
119+
* Removes this CCM cluster and deletes all of its files.
120+
*/
121+
void remove();
122+
123+
/**
124+
* Updates the config files for all nodes in the CCM cluster.
125+
*/
126+
void updateConfig(Map<String, Object> configs);
127+
128+
/**
129+
* Updates the DSE config files for all nodes in the CCM cluster.
130+
*/
131+
void updateDSEConfig(Map<String, Object> configs);
132+
133+
134+
// Methods altering nodes
135+
136+
/**
137+
* Starts the {@code nth} host in the CCM cluster.
138+
*
139+
* @param n the node number (starting from 1).
140+
*/
141+
void start(int n);
142+
143+
/**
144+
* Stops the {@code nth} host in the CCM cluster.
145+
*
146+
* @param n the node number (starting from 1).
147+
*/
148+
void stop(int n);
149+
150+
/**
151+
* Aggressively stops the {@code nth} host in the CCM cluster.
152+
*
153+
* @param n the node number (starting from 1).
154+
*/
155+
void forceStop(int n);
156+
157+
/**
158+
* Removes the {@code nth} host in the CCM cluster.
159+
*
160+
* @param n the node number (starting from 1).
161+
*/
162+
void remove(int n);
163+
164+
/**
165+
* Adds the {@code nth} host in the CCM cluster.
166+
*
167+
* @param n the node number (starting from 1).
168+
*/
169+
void add(int n);
170+
171+
/**
172+
* Adds the {@code nth} host in the CCM cluster.
173+
*
174+
* @param n the node number (starting from 1).
175+
*/
176+
void add(int dc, int n);
177+
178+
/**
179+
* Decommissions the {@code nth} host in the CCM cluster.
180+
*
181+
* @param n the node number (starting from 1).
182+
*/
183+
void decommision(int n);
184+
185+
/**
186+
* Updates the {@code nth} host's config file in the CCM cluster.
187+
*
188+
* @param n the node number (starting from 1).
189+
*/
190+
void updateNodeConfig(int n, String key, Object value);
191+
192+
/**
193+
* Updates the {@code nth} host's config file in the CCM cluster.
194+
*
195+
* @param n the node number (starting from 1).
196+
*/
197+
void updateNodeConfig(int n, Map<String, Object> configs);
198+
199+
/**
200+
* Sets the workload for the {@code nth} host in the CCM cluster.
201+
*
202+
* @param n the node number (starting from 1).
203+
*/
204+
void setWorkload(int n, String workload);
205+
206+
207+
// Methods blocking until nodes are up or down
208+
209+
/**
210+
* Waits for a host to be up by pinging the TCP socket directly, without using the Java driver's API.
211+
*/
212+
void waitForUp(int node);
213+
214+
/**
215+
* Waits for a host to be down by pinging the TCP socket directly, without using the Java driver's API.
216+
*/
217+
void waitForDown(int node);
218+
219+
}

0 commit comments

Comments
 (0)