Package com.guigarage.vagrant

Examples of com.guigarage.vagrant.Vagrant


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");
View Full Code Here


    }
  }
 
  @Test
  public void testSSHUpload() {
    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();
        File tempFile = File.createTempFile("vagrant", "test");
        try {
View Full Code Here

      FileUtils.writeStringToFile(vagrantFile, vagrantfileContent, false);
    } catch (IOException e) {
      throw new VagrantException("Error while creating "
          + this.getClass().getSimpleName(), e);
    }
    Vagrant vagrant = new Vagrant(true);
    environment = vagrant.createEnvironment(vagrantDir);
  }
View Full Code Here

          .create()
          .withVagrantEnvironmentConfig(environmentConfig)
          .withVagrantFolderTemplateConfiguration(
              folderTemplateConfiguration).build();

      Vagrant vagrant = new Vagrant(true);
      VagrantEnvironment environment = null;
      try {
        environment = vagrant.createEnvironment(vagrantPath,
            vagrantConfiguration);
        File vagrantFolder = new File(environment.getRootPath());
        File createdFolder = new File(vagrantFolder, "testFolder");
        Assert.assertEquals(true, createdFolder.exists());
        Assert.assertEquals(true, createdFolder.isDirectory());
View Full Code Here

          .create()
          .withVagrantEnvironmentConfig(environmentConfig)
          .withVagrantFolderTemplateConfiguration(
              folderTemplateConfiguration).build();

      Vagrant vagrant = new Vagrant(true);
      VagrantEnvironment environment = null;
      try {
        environment = vagrant.createEnvironment(vagrantPath,
            vagrantConfiguration);
        File vagrantFolder = new File(environment.getRootPath());
        File createdFolder = new File(vagrantFolder, "testFolder");
        Assert.assertEquals(true, createdFolder.exists());
        Assert.assertEquals(true, createdFolder.isDirectory());
View Full Code Here

      VagrantConfiguration vagrantConfiguration = VagrantConfigurationBuilder
          .create()
          .withVagrantEnvironmentConfig(environmentConfig)
          .build();

      Vagrant vagrant = new Vagrant(true);
      try {
        vagrant.createEnvironment(vagrantPath,
            vagrantConfiguration);
      } catch (IOException e) {
        e.printStackTrace();
        Assert.fail(e.getMessage());
      }
View Full Code Here

    try {
      ArrayList<VagrantVmConfig> vmConfigs = new ArrayList<>();
      vmConfigs.add(new VagrantVmConfig("unitTestVm", null, null, null, null, null, null, false));
      VagrantEnvironmentConfig config = new VagrantEnvironmentConfig(
          vmConfigs);
      Vagrant vagrant = new Vagrant(true);
      File tempDir = VagrantTestUtils.createTempDir();
      VagrantEnvironment env = vagrant.createEnvironment(tempDir, config);
      VagrantVm vm = env.getAllVms().iterator().next();
      Assert.assertEquals("unitTestVm", vm.getName());
    } catch (Exception e) {
      e.printStackTrace();
      Assert.fail("");
View Full Code Here

TOP

Related Classes of com.guigarage.vagrant.Vagrant

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.