Skip to content
This repository has been archived by the owner on Jun 22, 2018. It is now read-only.

Commit

Permalink
remove obsolete numberOfSlaves() in MesosClusterConfig.Builder
Browse files Browse the repository at this point in the history
  • Loading branch information
sadovnikov committed Oct 13, 2015
1 parent 9c8cf2a commit 3c5480f
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 19 deletions.
1 change: 0 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ In this snippet we're configuring the Mesos cluster to start 3 slaves with diffe
public class MesosClusterTest {
@ClassRule
public static MesosCluster cluster = new MesosCluster(MesosClusterConfig.builder()
.numberOfSlaves(3)
.slaveResources(new String[]{"ports(*):[9200-9200,9300-9300]","ports(*):[9201-9201,9301-9301]","ports(*):[9202-9202,9302-9302]"})
.build());
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/containersol/minimesos/main/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ private static void doUp() {
} else {
MesosCluster cluster = new MesosCluster(
MesosClusterConfig.builder()
.numberOfSlaves(1)
.slaveResources(new String[]{"ports(*):[9200-9200,9300-9300]"})
.mesosImageTag(commandUp.getMesosImageTag())
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public static Builder builder() {
public static class Builder {

DockerClient dockerClient;
int numberOfSlaves = 3;
String[] slaveResources = new String[]{};
Integer mesosMasterPort = 5050;
String zkUrl = null;
Expand All @@ -69,11 +68,6 @@ public Builder dockerClient(DockerClient dockerClient) {
return this;
}

public Builder numberOfSlaves(int numberOfSlaves) {
this.numberOfSlaves = numberOfSlaves;
return this;
}

public Builder slaveResources(String[] slaveResources) {
this.slaveResources = slaveResources;
return this;
Expand Down Expand Up @@ -116,14 +110,6 @@ public Builder defaultDockerClient() {

public MesosClusterConfig build() {

if (numberOfSlaves <= 0) {
throw new IllegalStateException("At least one slave is required to run a mesos cluster");
}

if (slaveResources.length != numberOfSlaves) {
throw new IllegalStateException("Please provide one resource config for each slave");
}

if (dockerClient == null) {
defaultDockerClient();
if (dockerClient == null) {
Expand All @@ -135,11 +121,12 @@ public MesosClusterConfig build() {
zkUrl = "mesos";
}

return new MesosClusterConfig(dockerClient, numberOfSlaves, slaveResources, mesosMasterPort, extraEnvironmentVariables, zkUrl, mesosMasterImage, mesosSlaveImage, mesosImageTag);
return new MesosClusterConfig(dockerClient, slaveResources.length, slaveResources, mesosMasterPort, extraEnvironmentVariables, zkUrl, mesosMasterImage, mesosSlaveImage, mesosImageTag);
}
}

public int getNumberOfSlaves() {
return numberOfSlaves;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class ZooKeeper extends AbstractContainer {

private static final String MESOS_LOCAL_IMAGE = "jplock/zookeeper";
public static final String REGISTRY_TAG = "3.4.5";
public static final String REGISTRY_TAG = "latest";

private final String clusterId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class MesosClusterTest {
@ClassRule
public static final MesosCluster cluster = new MesosCluster(
MesosClusterConfig.builder()
.numberOfSlaves(3)
.zkUrl("mesos")
.slaveResources(new String[]{
"ports(*):[9201-9201, 9301-9301]; cpus(*):0.2; mem(*):256; disk(*):200",
Expand Down

0 comments on commit 3c5480f

Please sign in to comment.