Package com.guigarage.vagrant.model

Examples of com.guigarage.vagrant.model.VagrantEnvironment


        .withBoxUrl(VagrantUtils.getInstance().getLucid32Url())
        .withName("UniTestVm").build();
    VagrantEnvironmentConfig envConfig = new VagrantEnvironmentConfigBuilder()
        .withVagrantVmConfig(vmConfig).build();

    VagrantEnvironment environment = null;

    try {
      environment = vagrant.createEnvironment(vagrantTempDir, envConfig);
      environment.up();
    } catch (Exception exception) {
      exception.printStackTrace();
      Assert.fail(exception.getMessage());
    } finally {
      if(environment != null) {
        try {
          environment.removeBox(boxName);
          environment.destroy();
          try {
            FileUtils.forceDelete(vagrantTempDir);
          } catch (Exception e) {
            try {
              FileUtils.forceDeleteOnExit(vagrantTempDir);
            } catch (IOException e1) {
              System.err.println("Can not delete vagrantfolder: "
                  + vagrantTempDir);
            }
          }
        } catch (Exception removeException) {
          removeException.printStackTrace();
         
          String boxPath = null;
          try {
            boxPath = environment.getBoxesPath();
          } catch (Exception e) {
            //...
          }
          try {
            FileUtils.forceDelete(vagrantTempDir);
View Full Code Here


 
  public VagrantEnvironment createEnvironment() {
    RubyObject vagrantEnv = (RubyObject) scriptingContainer.runScriptlet("require 'rubygems'\n"
        + "require 'vagrant'\n"
        + "\n" + "return Vagrant::Environment.new");
    return new VagrantEnvironment(vagrantEnv);
  }
View Full Code Here

 
  public VagrantEnvironment createEnvironment(File path) {
    RubyObject vagrantEnv = (RubyObject) scriptingContainer.runScriptlet("require 'rubygems'\n"
        + "require 'vagrant'\n"
        + "\n" + "return Vagrant::Environment.new(:cwd => '" + path.getAbsolutePath() + "')");
    return new VagrantEnvironment(vagrantEnv);
  }
View Full Code Here

          .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());
        File createdFile = new File(createdFolder, "file.tmp");
        Assert.assertEquals(true, createdFile.exists());
View Full Code Here

          .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());
        File createdFile = new File(createdFolder, "file.tmp");
        Assert.assertEquals(true, createdFile.exists());
View Full Code Here

      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.model.VagrantEnvironment

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.