Vagrant-Binding is a Java wrapper for Vagrant that allows configuring and managing virtual machines from Java code. It provides fluent builder APIs to define VM configurations and manage their lifecycle. Vagrant-Binding integrates with Puppet for configuration management and provides JUnit support to start/stop VMs for tests. It can also access the Puppet Forge to install modules during tests. The goal is to manage test environments and software configurations programmatically.
2. About me
•Hendrik Ebbers
•Lead of development at SIC GmbH in
Dortmund, Germany
•Lead of JUG Dortmund
•DataFX, JFXtras Contributor @hendrikEbbers
www.guigarage.com
hendrik.ebbers@web.de
5. Vagrant
Vagrant
•configure virtual machines by script
•create new instances on the fly
manage
create
•manage the VM lifecycle
•http://www.vagrantup.com
VM
15. Vagrant & Puppet
•define your VM with Vagrant & configure it
with Puppet
•Puppet is pre-installed on Vagrant boxes
16. Vagrant & Puppet
Vagrantfile
Vagrant::Config.run do |config|
config.vm.box = "lucid32"
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "manifests"
puppet.manifest_file = "my_manifest.pp"
end
end ppet script
path to Pu
20. Builder API
VagrantVmConfig vmConfig = new VagrantVmConfigBuilder()
! ! ! ! .withLucid32Box()
! ! ! ! .withName("myLittleVm") builder API for VM
! ! ! ! .withHostOnlyIp("192.168.50.4")
! ! ! ! .build();
builder API available
VagrantEnvironment environment = ...;
environment.up(); manage VM lifecycle
! ! !
environment.getVm(0).createConnection().execute("touch /tmp1");
environment.destroy(); ssh connection
21. JUnit support
st not reachable?
@Test
public void testJdbc() { what if ho
dbHandler = new MySql(ip, db, user, pwd);
dbHandler.createMyTable();
what if table already
dbHandler.insertRow(); exists?
assertEquals(1, dbHandler.getRowCount());
dbHandler.close(); parallel proces
ses?
}
22. JUnit support
@Rule JUnit annotation manage VM lifecycle
public VagrantTestRule testRule =
new VagrantTestRule(createConfig());
public static VagrantConfiguration createConfig() {
//Configure VM with MySQL-Server & static ip
} use builder API for VM spec
ification
create VM start VM run UnitTest destroy VM
23. QA Portal with Vagrant
•Manage all test machines with Vagrant & Puppet
•Manage lifecycle with Java
state: down
Super App Nightly Build with MySQL
Default installation of the App with MySQL DB Server
state: running
Super App Nightly Build with Oracle DB started by: John
Default installation of the App with Oracle DB Server
state: down
Super App Nightly Build without Database
Use this to check the default Errors in UI at startup