public class VagrantSSHTests {
@Test
public void testSSHExecute() {
Vagrant vagrant = new Vagrant(true);
File vagrantTempDir = VagrantTestUtils.createTempDir();
VagrantVmConfig vmConfig = new VagrantVmConfigBuilder()
.withLucid32Box()
.withName("UniTestVm").build();
VagrantEnvironmentConfig envConfig = new VagrantEnvironmentConfigBuilder()
.withVagrantVmConfig(vmConfig).build();
VagrantEnvironment environment = null;
try {
environment = vagrant.createEnvironment(vagrantTempDir, envConfig);
environment.up();
try {
VagrantSSHConnection connection = environment.getAllVms().iterator().next().createConnection();
connection.execute("touch /vagrant/testfile1", true);
File touchedFile = new File(vagrantTempDir, "testfile1");