/
InfinispanServerDriver.java
149 lines (119 loc) · 4.07 KB
/
InfinispanServerDriver.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package org.infinispan.server.test.core;
import java.io.File;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import javax.management.MBeanServerConnection;
import org.infinispan.client.hotrod.RemoteCacheManager;
import org.infinispan.client.hotrod.configuration.ConfigurationBuilder;
import org.infinispan.client.rest.configuration.RestClientConfigurationBuilder;
import org.infinispan.lifecycle.ComponentStatus;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;
/**
* @author Tristan Tarrant <tristan@infinispan.org>
* @since 11.0
**/
public interface InfinispanServerDriver {
Log log = LogFactory.getLog(InfinispanServerDriver.class);
ComponentStatus getStatus();
InfinispanServerTestConfiguration getConfiguration();
/**
* Prepares a named server configuration
* @param name the name of the server configuration
*/
void prepare(String name);
/**
* Starts a prepared server configuration
* @param name the name of the server configuration
*/
void start(String name);
/**
* Stops a running server configuration
* @param name the name of the server configuration
*/
void stop(String name);
/**
* Determines whether a specific server is running as part of a server configuration
* @param server the
* @return true if the server is running, false otherwise
*/
boolean isRunning(int server);
/**
* Returns an InetSocketAddress for connecting to a specific port on a specific server. The implementation will need
* to provide a specific mapping (e.g. port offset).
*
* @param server the index of the server
* @param port the service port
* @return an unresolved InetSocketAddress pointing to the actual running service
*/
InetSocketAddress getServerSocket(int server, int port);
/**
* Returns an InetAddress that points to a specific server.
*
* @param server the index of the server
* @return an InetAddress pointing to the server's address
*/
InetAddress getServerAddress(int server);
File getCertificateFile(String name);
File getRootDir();
File getConfDir();
void applyKeyStore(ConfigurationBuilder builder, String certificateName);
void applyKeyStore(RestClientConfigurationBuilder builder, String certificateName);
void applyTrustStore(ConfigurationBuilder builder, String certificateName);
void applyTrustStore(RestClientConfigurationBuilder builder, String certificateName);
/**
* Pauses a server. Equivalent to kill -SIGSTOP
*
* @param server the index of the server
*/
void pause(int server);
/**
* Resumes a paused server. Equivalent to kill -SIGCONT
*
* @param server the index of the server
*/
void resume(int server);
/**
* Gracefully stops a running server
*
* @param server the index of the server
*/
void stop(int server);
/**
* Forcefully stops a server. Equivalent to kill -SIGKILL
*
* @param server the index of the server
*/
void kill(int server);
/**
* Restarts a previously stopped server.
*
* @param server the index of the server
*/
void restart(int server);
/**
* Restarts all of the nodes
*/
void restartCluster();
/**
* Returns a {@link MBeanServerConnection} to the specified server
*
* @param server the index of the server
*/
MBeanServerConnection getJmxConnection(int server);
RemoteCacheManager createRemoteCacheManager(ConfigurationBuilder builder);
/**
* Returns the amount of time in seconds that we should wait for a server start/stop operation. This may vary
* depending on the type of driver (embedded, container)
*
* @return the number of seconds after which a server start/stop is considered to timeout
*/
int getTimeout();
/**
* Synchronizes files from the server to the local filesystem
* @param server the server
* @param dir the path relative to the server root
*/
void syncFilesFromServer(int server, String dir);
String syncFilesToServer(int server, String path);
}