public class CouchbaseMock extends Object
| Constructor and Description |
|---|
CouchbaseMock(int port,
List<BucketConfiguration> configs)
Create a new CouchbaseMock object.
|
CouchbaseMock(String hostname,
int port,
int numNodes,
int numVBuckets) |
CouchbaseMock(String hostname,
int port,
int numNodes,
int bucketStartPort,
int numVBuckets) |
CouchbaseMock(String hostname,
int port,
int numNodes,
int bucketStartPort,
int numVBuckets,
String bucketSpec,
int numReplicas) |
CouchbaseMock(String hostname,
int port,
int numNodes,
int numVBuckets,
String bucketSpec) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearInitialConfigs()
Clear the initial bucket configurations which were added during construction.
|
void |
createBucket(BucketConfiguration config)
Create a new bucket, and start it.
|
Authenticator |
getAuthenticator()
Get the authenticator object which can be used to verify credentials for access to the cluster
|
Map<String,Bucket> |
getBuckets()
Return the list of active buckets for inspection.
|
BucketConfiguration |
getDefaultConfig()
Get the default configuration for buckets.
|
MockCommandDispatcher |
getDispatcher() |
String |
getHttpHost()
Get the name of the host to which the REST API is bound
|
int |
getHttpPort()
Get The port of the http server providing the REST interface.
|
HarakiriMonitor |
getMonitor() |
String |
getPoolName() |
PoolsHandler |
getPoolsHandler() |
Map<String,User> |
getUsers() |
boolean |
isCccpBootstrap() |
static void |
main(String[] args) |
void |
removeBucket(String name)
Destroy a bucket
|
void |
start()
Start the mock.
|
void |
startHarakiriMonitor(InetSocketAddress address,
boolean terminate)
Tell the harakiri monitor to connect to the given address.
|
void |
startHarakiriMonitor(String host,
boolean terminate)
Start the monitor
see
startHarakiriMonitor(java.net.InetSocketAddress, boolean) |
void |
stop()
Stops the cluster.
|
void |
waitForStartup()
Wait until all initial buckets have been created
|
public CouchbaseMock(String hostname, int port, int numNodes, int bucketStartPort, int numVBuckets, String bucketSpec, int numReplicas) throws IOException
IOExceptionpublic CouchbaseMock(String hostname, int port, int numNodes, int bucketStartPort, int numVBuckets) throws IOException
IOExceptionpublic CouchbaseMock(String hostname, int port, int numNodes, int numVBuckets) throws IOException
IOExceptionpublic CouchbaseMock(String hostname, int port, int numNodes, int numVBuckets, String bucketSpec) throws IOException
IOExceptionpublic CouchbaseMock(int port,
List<BucketConfiguration> configs)
throws IOException
port - The REST port which the mock should listen on. If set to 0, a random available
port will be selectedconfigs - A list of bucket configurations which the mock should start when the
start() method is called.IOException - if an I/O error occurspublic boolean isCccpBootstrap()
public void startHarakiriMonitor(InetSocketAddress address, boolean terminate) throws IOException
address - The address the monitor should connect toterminate - Whether the application should exit when a disconnect is detected on the socketIOException - If the monitor could not listen on the given port, or if the monitor is already listeningpublic void startHarakiriMonitor(String host, boolean terminate) throws IOException
startHarakiriMonitor(java.net.InetSocketAddress, boolean)host - A string in the form of host:portterminate - Whether the application should terminate on disconnectIOException - If an I/O error occurspublic String getPoolName()
public Map<String,Bucket> getBuckets()
createBucket(BucketConfiguration) or removeBucket(String) to add or
remove bucketspublic void clearInitialConfigs()
start() to start up a blank cluster.public HarakiriMonitor getMonitor()
public MockCommandDispatcher getDispatcher()
public PoolsHandler getPoolsHandler()
public BucketConfiguration getDefaultConfig()
BucketConfigurationpublic void waitForStartup()
throws InterruptedException
InterruptedException - if interruptedpublic int getHttpPort()
public String getHttpHost()
public Authenticator getAuthenticator()
public void createBucket(BucketConfiguration config) throws BucketAlreadyExistsException, IOException
config - The bucket configuration to useBucketAlreadyExistsException - If the bucket already existsIOException - If an I/O error occurspublic void removeBucket(String name) throws FileNotFoundException
name - The name of the bucket to removeFileNotFoundException - If the bucket does not existpublic void start()
throws IOException
stop()IOException - If an I/O error occurspublic void stop()
public static void main(String[] args)
Copyright © 2017. All rights reserved.