Repository: docker-java/docker-java
Pull request #234 (2015-05-29 22:35:17)

Fix volumesFrom
Volumes must be an array. 

KostyaSha: @marcuslinke if container api sync attempt is bad, then could you at least merge VolumesFrom fix?
KostyaSha: Sorry, lost integration tests. Will better split PRs.
KostyaSha: Split 2 commits to 2 PRs.

Patch:
diff --git a/src/main/java/com/github/dockerjava/api/command/StartContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/StartContainerCmd.java
index e76598e3..aeddfd0b 100644
--- a/src/main/java/com/github/dockerjava/api/command/StartContainerCmd.java
+++ b/src/main/java/com/github/dockerjava/api/command/StartContainerCmd.java
@@ -10,6 +10,7 @@ import com.github.dockerjava.api.model.LxcConf;
 import com.github.dockerjava.api.model.PortBinding;
 import com.github.dockerjava.api.model.Ports;
 import com.github.dockerjava.api.model.RestartPolicy;
+import com.github.dockerjava.api.model.VolumesFrom;
 
 /**
  * Start a container.
@@ -56,7 +57,7 @@ public interface StartContainerCmd extends DockerCmd<Void> {
 
 	public RestartPolicy getRestartPolicy();
 
-	public String getVolumesFrom();
+	public VolumesFrom[] getVolumesFrom();
 
 	public Boolean isPrivileged();
 
@@ -165,6 +166,6 @@ public interface StartContainerCmd extends DockerCmd<Void> {
 	public StartContainerCmd withRestartPolicy(RestartPolicy restartPolicy);
 
 	@Deprecated
-	public StartContainerCmd withVolumesFrom(String volumesFrom);
+	public StartContainerCmd withVolumesFrom(VolumesFrom... volumesFrom);
 
 }
diff --git a/src/main/java/com/github/dockerjava/core/command/StartContainerCmdImpl.java b/src/main/java/com/github/dockerjava/core/command/StartContainerCmdImpl.java
index dba35fb9..27fca12f 100644
--- a/src/main/java/com/github/dockerjava/core/command/StartContainerCmdImpl.java
+++ b/src/main/java/com/github/dockerjava/core/command/StartContainerCmdImpl.java
@@ -21,6 +21,7 @@ import com.github.dockerjava.api.model.LxcConf;
 import com.github.dockerjava.api.model.PortBinding;
 import com.github.dockerjava.api.model.Ports;
 import com.github.dockerjava.api.model.RestartPolicy;
+import com.github.dockerjava.api.model.VolumesFrom;
 
 
 /**
@@ -57,7 +58,7 @@ public class StartContainerCmdImpl extends AbstrDockerCmd<StartContainerCmd, Voi
 	private String[] dnsSearch;
 
 	@JsonProperty("VolumesFrom")
-	private String volumesFrom;
+	private VolumesFrom[] volumesFrom;
 	
 	@JsonProperty("NetworkMode")          
     private String networkMode;
@@ -125,7 +126,7 @@ public class StartContainerCmdImpl extends AbstrDockerCmd<StartContainerCmd, Voi
 	}
 
 	@Override
-	public String getVolumesFrom() {
+	public VolumesFrom[] getVolumesFrom() {
 		return volumesFrom;
 	}
 
@@ -232,7 +233,7 @@ public class StartContainerCmdImpl extends AbstrDockerCmd<StartContainerCmd, Voi
 	}
 
 	@Override
-	public StartContainerCmd withVolumesFrom(String volumesFrom) {
+	public StartContainerCmd withVolumesFrom(VolumesFrom... volumesFrom) {
 		checkNotNull(volumesFrom, "volumesFrom was not specified");
 		this.volumesFrom = volumesFrom;
 		return this;


Test patch:
diff --git a/src/test/java/com/github/dockerjava/core/command/StartContainerCmdImplTest.java b/src/test/java/com/github/dockerjava/core/command/StartContainerCmdImplTest.java
index 045c008e..70108ae6 100644
--- a/src/test/java/com/github/dockerjava/core/command/StartContainerCmdImplTest.java
+++ b/src/test/java/com/github/dockerjava/core/command/StartContainerCmdImplTest.java
@@ -126,7 +126,7 @@ public class StartContainerCmdImplTest extends AbstractDockerClientTest {
 		LOG.info("Created container2 {}", container2.toString());
 
 		dockerClient.startContainerCmd(container2.getId())
-				.withVolumesFrom(container1Name).exec();
+				.withVolumesFrom(new VolumesFrom(container1Name)).exec();
 		LOG.info("Started container2 {}", container2.toString());
 
 		InspectContainerResponse inspectContainerResponse2 = dockerClient