Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEODE-10088: serverGroups support #941

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions clicache/integration-test2/Cluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class Cluster : IDisposable
private bool started_;
private List<Locator> locators_;
private string name_;
private string groups_;
internal int jmxManagerPort = Framework.FreeTcpPort();
internal string keyStore_ = Config.SslServerKeyPath + "/server_keystore_chained.jks";
internal string keyStorePassword_ = "apachegeode";
Expand All @@ -53,12 +54,13 @@ internal PoolFactory ApplyLocators(PoolFactory poolFactory)
return poolFactory;
}

public Cluster(ITestOutputHelper output, string name, int locatorCount, int serverCount)
public Cluster(ITestOutputHelper output, string name, int locatorCount, int serverCount, string groups = "")
{
started_ = false;
Gfsh = new GfshExecute(output);
UseSSL = false;
name_ = name;
groups_ = groups;
locatorCount_ = locatorCount;
serverCount_ = serverCount;
locators_ = new List<Locator>();
Expand All @@ -85,7 +87,7 @@ private bool StartServers()
for (var i = 0; i < serverCount_; i++)
{
var server = new Server(this, locators_,
name_ + "/server/" + i.ToString());
name_ + "/server/" + i.ToString(), groups_);
var localResult = server.Start();
if (localResult != 0)
{
Expand Down Expand Up @@ -126,7 +128,7 @@ public void Dispose()
}
}

public Cache CreateCache(IDictionary<string, string> properties)
public Cache CreateCache(IDictionary<string, string> properties, string serverGroup = "")
{
var cacheFactory = new CacheFactory();

Expand All @@ -141,7 +143,9 @@ public Cache CreateCache(IDictionary<string, string> properties)

var cache = cacheFactory.Create();

ApplyLocators(cache.GetPoolFactory()).Create("default");
ApplyLocators(cache.GetPoolFactory())
.SetServerGroup(serverGroup)
.Create("default");

return cache;
}
Expand Down Expand Up @@ -243,12 +247,14 @@ public class Server
private string name_;
private List<Locator> locators_;
private bool started_;
private string groups_;

public Server(Cluster cluster, List<Locator> locators, string name)
public Server(Cluster cluster, List<Locator> locators, string name, string groups)
{
cluster_ = cluster;
locators_ = locators;
name_ = name;
groups_ = groups;
var address = new Address();
address.address = "localhost";
address.port = 0;
Expand All @@ -269,6 +275,7 @@ public int Start()
.withName(name_.Replace('/', '_'))
.withBindAddress(Address.address)
.withPort(Address.port)
.withGroups(groups_)
.withMaxHeap("1g");
if (cluster_.UseSSL)
{
Expand Down
8 changes: 7 additions & 1 deletion clicache/integration-test2/Gfsh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ public Server withDir(string dir)
return this;
}

public Server withBindAddress(string bindAddress)
public Server withGroups(string groups)
{
command_ += " --group=" + groups;
return this;
}

public Server withBindAddress(string bindAddress)
{
command_ += " --bind-address=" + bindAddress;
return this;
Expand Down