provisionr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject [13/21] PROVISIONR-20. Change groupId from com.axemblr.provisionr to org.apache.provisionr
Date Mon, 01 Apr 2013 08:52:36 GMT
http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/com/axemblr/provisionr/core/activities/InstallRepositoriesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/axemblr/provisionr/core/activities/InstallRepositoriesTest.java b/core/src/test/java/com/axemblr/provisionr/core/activities/InstallRepositoriesTest.java
deleted file mode 100644
index 0893fe4..0000000
--- a/core/src/test/java/com/axemblr/provisionr/core/activities/InstallRepositoriesTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.axemblr.provisionr.core.activities;
-
-import com.axemblr.provisionr.api.pool.Pool;
-import com.axemblr.provisionr.api.software.Repository;
-import com.axemblr.provisionr.api.software.Software;
-import static org.fest.assertions.api.Assertions.assertThat;
-import org.junit.Test;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class InstallRepositoriesTest {
-
-    @Test
-    public void testCreatePuppetScript() throws Exception {
-        Repository repository = Repository.builder()
-            .name("bigtop")
-            .addEntry("deb http://bigtop.s3.amazonaws.com/releases/0.5.0/ubuntu/lucid/x86_64  bigtop contrib")
-            .key("-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
-                "Version: GnuPG v1.4.10 (GNU/Linux)\n" +
-                "\n" +
-                "[....]")
-            .createRepository();
-
-        Pool pool = mock(Pool.class);
-        when(pool.getSoftware()).thenReturn(Software.builder().repository(repository).createSoftware());
-
-        PuppetActivity activity = new InstallRepositories();
-        String content = activity.createPuppetScript(pool, null);
-
-        assertThat(content).contains("apt::repository { \"bigtop\":\n" +
-            "  content => \"deb http://bigtop.s3.amazonaws.com/releases/0.5.0/ubuntu/lucid/x86_64  bigtop contrib\\n\",\n" +
-            "  key => \"-----BEGIN PGP PUBLIC KEY BLOCK-----\\nVersion: GnuPG v1.4.10 (GNU/Linux)\\n\\n[....]\"\n" +
-            "}");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/com/axemblr/provisionr/core/activities/IsMachinePortOpenTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/axemblr/provisionr/core/activities/IsMachinePortOpenTest.java b/core/src/test/java/com/axemblr/provisionr/core/activities/IsMachinePortOpenTest.java
deleted file mode 100644
index 9c2d2f1..0000000
--- a/core/src/test/java/com/axemblr/provisionr/core/activities/IsMachinePortOpenTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.axemblr.provisionr.core.activities;
-
-import com.axemblr.provisionr.api.pool.Machine;
-import com.axemblr.provisionr.test.ProcessVariablesCollector;
-import java.io.IOException;
-import java.net.ServerSocket;
-import org.activiti.engine.delegate.DelegateExecution;
-import org.activiti.engine.delegate.JavaDelegate;
-import static org.fest.assertions.api.Assertions.assertThat;
-import org.junit.Test;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class IsMachinePortOpenTest {
-
-    private static final String RESULT = "result";
-
-    @Test
-    public void testWithRandomOpenPort() throws Exception {
-        DelegateExecution execution = mock(DelegateExecution.class);
-
-        when(execution.getVariable(eq(IsMachinePortOpen.MACHINE)))
-            .thenReturn(Machine.builder().localhost().createMachine());
-
-        ProcessVariablesCollector collector = new ProcessVariablesCollector();
-        collector.install(execution);
-
-        ServerSocket socket = null;
-        try {
-            socket = new ServerSocket(0);
-
-            JavaDelegate delegate = new IsMachinePortOpen(RESULT, socket.getLocalPort());
-            delegate.execute(execution);
-
-            assertThat((Boolean) collector.getVariable(RESULT)).isTrue();
-
-        } finally {
-            if (socket != null) {
-                socket.close();
-            }
-        }
-    }
-
-    @Test
-    public void testWithRandomClosedPort() throws Exception {
-        DelegateExecution execution = mock(DelegateExecution.class);
-
-        when(execution.getVariable(eq(IsMachinePortOpen.MACHINE)))
-            .thenReturn(Machine.builder().localhost().createMachine());
-
-        ProcessVariablesCollector collector = new ProcessVariablesCollector();
-        collector.install(execution);
-
-        JavaDelegate delegate = new IsMachinePortOpen(RESULT, findRandomNotUsedPort());
-        delegate.execute(execution);
-
-        assertThat((Boolean) collector.getVariable(RESULT)).isFalse();
-    }
-
-    private int findRandomNotUsedPort() throws IOException {
-        ServerSocket socket = null;
-        try {
-            socket = new ServerSocket(0);
-            return socket.getLocalPort();
-        } finally {
-            if (socket != null) {
-                socket.close();
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/com/axemblr/provisionr/core/activities/KillMachineSetUpProcessesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/axemblr/provisionr/core/activities/KillMachineSetUpProcessesTest.java b/core/src/test/java/com/axemblr/provisionr/core/activities/KillMachineSetUpProcessesTest.java
deleted file mode 100644
index 6b59891..0000000
--- a/core/src/test/java/com/axemblr/provisionr/core/activities/KillMachineSetUpProcessesTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.axemblr.provisionr.core.activities;
-
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.axemblr.provisionr.test.ProcessVariablesCollector;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-
-import java.util.List;
-import java.util.Map;
-
-import org.activiti.engine.RuntimeService;
-import org.activiti.engine.delegate.DelegateExecution;
-import org.activiti.engine.delegate.JavaDelegate;
-import org.activiti.engine.runtime.ProcessInstance;
-import org.junit.Test;
-
-public class KillMachineSetUpProcessesTest extends CheckProcessesTest {
-
-    private static final String PROCESS_IDS = "process_ids";
-
-    @Test
-    public void testWithAListOfEndedProcesses() throws Exception {
-        RuntimeService runtimeService = runTest(Lists.newArrayList("1", "2"), ImmutableMap.of(
-            "1", mockProcessInstance(/* ended= */ true),
-            "2", mockProcessInstance(/* ended= */ true)
-        ));
-        verify(runtimeService, never()).deleteProcessInstance(anyString(), anyString());
-    }
-
-    @Test
-    public void testWithAListOfActiveProcesses() throws Exception {
-        RuntimeService runtimeService = runTest(Lists.newArrayList("1", "2"), ImmutableMap.of(
-            "1", mockProcessInstance(/* ended= */ false),
-            "2", mockProcessInstance(/* ended= */ false)
-        ));
-        verify(runtimeService, times(2)).deleteProcessInstance(anyString(), anyString());
-    }
-
-    @Test
-    public void testWithAListOfActiveAndInactiveProcesses() throws Exception {
-        RuntimeService runtimeService = runTest(Lists.newArrayList("1", "2"), ImmutableMap.of(
-            "1", mockProcessInstance(/* ended= */ true),
-            "2", mockProcessInstance(/* ended= */ false)
-        ));
-
-        verify(runtimeService, times(1)).deleteProcessInstance(anyString(), anyString());
-    }
-
-    @Test
-    public void testWithAListOfActiveAndInvalidProcesses() throws Exception {
-        RuntimeService runtimeService = runTest(Lists.newArrayList("1", "invalid"), ImmutableMap.of(
-            "1", mockProcessInstance(/* ended= */ false)));
-        verify(runtimeService, times(1)).deleteProcessInstance(anyString(), anyString());
-    }
-
-    private RuntimeService runTest(List<String> processIds, Map<String, ProcessInstance> processMap) throws Exception {
-        DelegateExecution execution = mock(DelegateExecution.class);
-        when(execution.getVariable(eq(PROCESS_IDS))).thenReturn(processIds);
-
-        ProcessVariablesCollector collector = new ProcessVariablesCollector();
-        collector.install(execution);
-
-        RuntimeService runtimeService = mockRuntimeService(processMap, "invalid");
-
-        JavaDelegate delegate = new KillMachineSetUpProcesses(runtimeService, PROCESS_IDS);
-        delegate.execute(execution);
-
-        return runtimeService;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/com/axemblr/provisionr/core/activities/SpawnProcessForEachMachineTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/axemblr/provisionr/core/activities/SpawnProcessForEachMachineTest.java b/core/src/test/java/com/axemblr/provisionr/core/activities/SpawnProcessForEachMachineTest.java
deleted file mode 100644
index ccb2aa8..0000000
--- a/core/src/test/java/com/axemblr/provisionr/core/activities/SpawnProcessForEachMachineTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2013 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.axemblr.provisionr.core.activities;
-
-import static org.fest.assertions.api.Assertions.assertThat;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.withSettings;
-
-import com.axemblr.provisionr.api.pool.Machine;
-import com.axemblr.provisionr.api.pool.Pool;
-import com.axemblr.provisionr.api.software.Software;
-import com.axemblr.provisionr.core.CoreProcessVariables;
-import com.axemblr.provisionr.test.ProcessVariablesCollector;
-import com.google.common.collect.Lists;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.activiti.engine.ProcessEngine;
-import org.activiti.engine.delegate.DelegateExecution;
-import org.activiti.engine.delegate.JavaDelegate;
-import org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration;
-import org.junit.Test;
-
-public class SpawnProcessForEachMachineTest {
-
-    private static final String EMPTY_PROCESS_KEY = "empty";
-    private static final String RESULT = "result";
-
-    private static final String BUSINESS_KEY = UUID.randomUUID().toString();
-
-    @Test
-    public void testSpawnSampleProcessForLocalhost() throws Exception {
-        DelegateExecution execution = mock(DelegateExecution.class);
-        Pool pool = mock(Pool.class, withSettings().serializable());
-        Software software = mock(Software.class, withSettings().serializable());
-        when(software.isCachedImage()).thenReturn(false);
-        when(pool.getSoftware()).thenReturn(software);
-        when(execution.getVariable(eq(CoreProcessVariables.POOL))).thenReturn(pool);
-        when(execution.getVariable(eq(CoreProcessVariables.POOL_BUSINESS_KEY))).thenReturn(BUSINESS_KEY);
-
-        List<Machine> machines = Lists.newArrayList(
-            Machine.builder().localhost().createMachine(),
-            Machine.builder().localhost().externalId("local-2").createMachine()
-        );
-        when(execution.getVariable(eq(CoreProcessVariables.MACHINES))).thenReturn(machines);
-
-        ProcessVariablesCollector collector = new ProcessVariablesCollector();
-        collector.install(execution);
-
-        ProcessEngine processEngine = new StandaloneInMemProcessEngineConfiguration()
-            .setJobExecutorActivate(true).buildProcessEngine();
-        processEngine.getRepositoryService().createDeployment()
-            .addClasspathResource("diagrams/empty.bpmn20.xml").deploy();
-
-        try {
-            JavaDelegate delegate = new SpawnProcessForEachMachine(processEngine, EMPTY_PROCESS_KEY, "test", RESULT);
-            delegate.execute(execution);
-
-            @SuppressWarnings("unchecked")
-            List<String> processInstanceIds = (List<String>) collector.getVariable(RESULT);
-
-            assertThat(processInstanceIds).hasSize(2);
-
-        } finally {
-            processEngine.close();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/com/axemblr/provisionr/core/logging/StreamLoggerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/axemblr/provisionr/core/logging/StreamLoggerTest.java b/core/src/test/java/com/axemblr/provisionr/core/logging/StreamLoggerTest.java
deleted file mode 100644
index a17ebda..0000000
--- a/core/src/test/java/com/axemblr/provisionr/core/logging/StreamLoggerTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.axemblr.provisionr.core.logging;
-
-import com.axemblr.provisionr.core.Ssh;
-import com.google.common.base.Charsets;
-import com.google.common.collect.Lists;
-import java.io.ByteArrayInputStream;
-import java.util.List;
-import static org.fest.assertions.api.Assertions.assertThat;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Marker;
-import org.slf4j.MarkerFactory;
-
-public class StreamLoggerTest {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Ssh.class);
-
-    @Test
-    public void testStreamLogger() throws InterruptedException {
-        final List<String> lines = Lists.newCopyOnWriteArrayList();
-
-        final byte[] bytes = "line1\nline2\nline3".getBytes(Charsets.UTF_8);
-        ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
-
-        final StreamLogger logger = new StreamLogger(inputStream, LOG, MarkerFactory.getMarker("test")) {
-            @Override
-            protected void log(Logger logger, Marker marker, String line) {
-                logger.info(marker, line);  /* just for visual inspection */
-                lines.add(line);
-            }
-        };
-        logger.start();
-
-        logger.join();
-        assertThat(lines).contains("line1", "line2", "line3");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/com/axemblr/provisionr/core/templates/PoolTemplateInstallerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/axemblr/provisionr/core/templates/PoolTemplateInstallerTest.java b/core/src/test/java/com/axemblr/provisionr/core/templates/PoolTemplateInstallerTest.java
deleted file mode 100644
index 8aaa772..0000000
--- a/core/src/test/java/com/axemblr/provisionr/core/templates/PoolTemplateInstallerTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.axemblr.provisionr.core.templates;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.Dictionary;
-import org.apache.ibatis.io.Resources;
-import org.junit.Test;
-import org.mockito.Matchers;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.isNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-public class PoolTemplateInstallerTest {
-
-    @Test
-    public void testInstallAndUninstallTemplate() throws Exception {
-        BundleContext bundleContext = mock(BundleContext.class);
-
-        ServiceRegistration registration = mock(ServiceRegistration.class);
-        when(bundleContext.registerService(eq(PoolTemplate.class.getName()), any(),
-            Matchers.<Dictionary<String, ?>>any())).thenReturn(registration);
-
-        File file = getPathToCdh3Template();
-        PoolTemplateInstaller installer = new PoolTemplateInstaller(bundleContext);
-
-        installer.install(file);
-        verify(bundleContext).registerService(eq(PoolTemplate.class.getName()),
-            any(), (Dictionary<String, ?>) isNull());
-        verifyZeroInteractions(registration);
-
-        installer.uninstall(file);
-        verify(registration).unregister();
-    }
-
-    private File getPathToCdh3Template() throws URISyntaxException, IOException {
-        return new File(Resources.getResourceURL("com/axemblr/provisionr/core/templates/cdh3.xml").toURI());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/com/axemblr/provisionr/core/templates/xml/XmlTemplateTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/axemblr/provisionr/core/templates/xml/XmlTemplateTest.java b/core/src/test/java/com/axemblr/provisionr/core/templates/xml/XmlTemplateTest.java
deleted file mode 100644
index fe5ef06..0000000
--- a/core/src/test/java/com/axemblr/provisionr/core/templates/xml/XmlTemplateTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2013 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.axemblr.provisionr.core.templates.xml;
-
-import com.axemblr.provisionr.api.network.Network;
-import com.axemblr.provisionr.api.network.Rule;
-import com.axemblr.provisionr.api.software.Software;
-import com.axemblr.provisionr.core.BaseJaxbTest;
-import com.google.common.base.Charsets;
-import static com.google.common.collect.Lists.newArrayList;
-import com.google.common.io.Resources;
-import java.io.IOException;
-import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
-import static org.fest.assertions.api.Assertions.assertThat;
-import org.junit.Test;
-
-public class XmlTemplateTest extends BaseJaxbTest {
-
-    public static final String DEFAULT_JENKINS_TEMPLATE = "com/axemblr/provisionr/core/templates/jenkins.xml";
-
-    public static final String DEFAULT_CDH3_TEMPLATE = "com/axemblr/provisionr/core/templates/cdh3.xml";
-
-    @Test
-    public void testLoadDefaultCdh3Template() throws Exception {
-        XmlTemplate template = XmlTemplate.newXmlTemplate(readResource(DEFAULT_CDH3_TEMPLATE));
-
-        assertThat(template.getId()).isEqualTo("cdh3");
-        assertThat(template.getPackages()).contains("hue");
-        assertThat(template.getOsVersion()).isEqualTo("10.04 LTS");
-
-        assertThat(template.getRepositories()).hasSize(2);
-        assertThat(template.getFiles()).hasSize(1);
-    }
-
-    @Test
-    public void testApplyCdh3TemplateToNetworkAndSoftware() throws Exception {
-        XmlTemplate template = XmlTemplate.newXmlTemplate(readResource(DEFAULT_CDH3_TEMPLATE));
-
-        Network network = template.apply(Network.builder().createNetwork());
-        assertThat(network.getIngress()).contains(
-            Rule.builder().anySource().tcp().port(8080).createRule());
-
-
-        Software software = template.apply(Software.builder().createSoftware());
-        assertThat(software.getPackages()).contains("hue").contains("hadoop-0.20");
-
-        assertThat(software.getFiles()).hasSize(1);
-        assertThat(software.getRepositories()).hasSize(2);
-    }
-
-    @Test
-    public void testLoadDefaultJenkinsTemplate() throws Exception {
-        XmlTemplate template = XmlTemplate.newXmlTemplate(readResource(DEFAULT_JENKINS_TEMPLATE));
-
-        assertThat(template.getPorts()).contains(8080);
-        assertThat(template.getRepositories()).hasSize(1);
-
-        assertThat(template.getPackages()).contains("jenkins").contains("git-core");
-    }
-
-    @Test
-    public void testSerializeBasicTemplateAsXml() throws Exception {
-        XmlTemplate template = new XmlTemplate();
-        template.setId("jenkins");
-
-        template.setDescription("Just testing");
-        template.setOsVersion("10.04 LTS");
-
-        template.setPackages(newArrayList("jenkins", "git-core", "subversion"));
-        template.setPorts(newArrayList(8080, 22));
-
-        template.setFiles(newArrayList(
-            new FileEntry("http://google.com", "/opt/google.html")
-        ));
-
-        template.setRepositories(newArrayList(
-            new RepositoryEntry("jenkins", newArrayList("deb ..."), "-----BEGIN PGP PUBLIC KEY BLOCK----- ...")
-        ));
-
-        String actual = asXml(template);
-        assertXMLEqual(actual, readResource("templates/test.xml"), actual);
-    }
-
-    private String readResource(String resource) throws IOException {
-        return Resources.toString(Resources.getResource(resource), Charsets.UTF_8);
-    }
-
-    @Override
-    public Class[] getContextClasses() {
-        return new Class[]{XmlTemplate.class};
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/BaseJaxbTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/BaseJaxbTest.java b/core/src/test/java/org/apache/provisionr/core/BaseJaxbTest.java
new file mode 100644
index 0000000..3c1d05e
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/BaseJaxbTest.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.junit.Before;
+
+public abstract class BaseJaxbTest {
+
+    protected JAXBContext jaxb;
+
+    static {
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLUnit.setIgnoreComments(true);
+        XMLUnit.setIgnoreAttributeOrder(true);
+    }
+
+    @Before
+    public void setUp() throws JAXBException {
+        jaxb = JAXBContext.newInstance(getContextClasses());
+    }
+
+    public abstract Class[] getContextClasses();
+
+    /**
+     * Marshal an object as XML using a standard JAXB Context
+     */
+    protected String asXml(Object obj) throws Exception {
+        ByteArrayOutputStream outBytes = new ByteArrayOutputStream();
+        PrintStream out = new PrintStream(outBytes);
+
+        Marshaller marshaller = jaxb.createMarshaller();
+        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+
+        marshaller.marshal(obj, out);
+        return outBytes.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/ProvisionrSupportTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/ProvisionrSupportTest.java b/core/src/test/java/org/apache/provisionr/core/ProvisionrSupportTest.java
new file mode 100644
index 0000000..93eb226
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/ProvisionrSupportTest.java
@@ -0,0 +1,32 @@
+package org.apache.provisionr.core;
+
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.apache.provisionr.api.pool.Pool;
+
+import org.junit.Test;
+
+public class ProvisionrSupportTest {
+
+    @Test
+    public void testConvertTimeout() {
+        ProvisionrSupport provisionr = new ProvisionrSupportTestable();
+        assertThat(provisionr.convertTimeoutToISO8601TimeDuration(600)).isEqualTo("PT10M");
+        assertThat(provisionr.convertTimeoutToISO8601TimeDuration(601)).isEqualTo("PT601S");
+        assertThat(provisionr.convertTimeoutToISO8601TimeDuration(300)).isEqualTo("PT5M");
+        assertThat(provisionr.convertTimeoutToISO8601TimeDuration(42)).isEqualTo("PT42S");
+    }
+}
+
+class ProvisionrSupportTestable extends ProvisionrSupport {
+    @Override
+    public String getId() {
+        return null;
+    }
+    @Override
+    public String startPoolManagementProcess(String businessKey, Pool pool) {
+        return null;
+    }
+    @Override
+    public void destroyPool(String businessKey) {}
+};

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/SshLiveTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/SshLiveTest.java b/core/src/test/java/org/apache/provisionr/core/SshLiveTest.java
new file mode 100644
index 0000000..c1a002a
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/SshLiveTest.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core;
+
+import org.apache.provisionr.api.access.AdminAccess;
+import org.apache.provisionr.api.pool.Machine;
+import org.apache.provisionr.core.logging.StreamLogger;
+import com.google.common.collect.Lists;
+import com.google.common.io.CharStreams;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.List;
+import java.util.UUID;
+import net.schmizz.sshj.SSHClient;
+import net.schmizz.sshj.connection.channel.direct.Session;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+
+public class SshLiveTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(SshLiveTest.class);
+
+    private final Machine localhost = Machine.builder().localhost().createMachine();
+
+    private final AdminAccess adminAccess = AdminAccess.builder()
+        .asCurrentUser().createAdminAccess();
+
+    @Test
+    public void testConnectToLocalhostAndCollectOutput() throws IOException {
+        SSHClient client = Ssh.newClient(localhost, adminAccess, 1000);
+        try {
+            Session session = client.startSession();
+            try {
+                final Session.Command command = session.exec("echo 'stdout' && echo 'stderr' 1>&2");
+
+                String stdout = CharStreams.toString(new InputStreamReader(command.getInputStream()));
+                String stderr = CharStreams.toString(new InputStreamReader(command.getErrorStream()));
+
+                command.join();
+                assertThat(command.getExitStatus()).isEqualTo(0);
+                assertThat(command.getExitErrorMessage()).isNull();
+
+                assertThat(stdout).contains("stdout");
+                assertThat(stderr).contains("stderr");
+
+            } finally {
+                session.close();
+            }
+        } finally {
+            client.close();
+        }
+    }
+
+    @Test
+    public void testConnectStreamLoggerToCommand() throws IOException, InterruptedException {
+        SSHClient client = Ssh.newClient(localhost, adminAccess, 1000);
+        try {
+            Session session = client.startSession();
+            try {
+                final Session.Command command = session.exec("echo 'line1' && echo && echo 'line2'");
+                final List<String> lines = Lists.newCopyOnWriteArrayList();
+
+                StreamLogger logger = new StreamLogger(command.getInputStream(), LOG, MarkerFactory.getMarker("live")) {
+                    @Override
+                    protected void log(Logger logger, Marker marker, String line) {
+                        logger.info(marker, line);  /* just for visual inspection */
+                        lines.add(line);
+                    }
+                };
+                logger.start();
+
+                command.join();
+                logger.join();
+
+                assertThat(lines).hasSize(2).contains("line1", "line2");
+
+            } finally {
+                session.close();
+            }
+        } finally {
+            client.close();
+        }
+    }
+
+    @Test
+    public void testCreateFileOverSsh() throws IOException {
+        SSHClient client = Ssh.newClient(localhost, adminAccess, 1000);
+        try {
+            String destination = "/tmp/" + UUID.randomUUID().toString();
+            String content = UUID.randomUUID().toString();
+
+            Ssh.createFile(client, content, 0600, destination);
+
+            /* Check the file exists and has the expected content */
+            Session session = client.startSession();
+            try {
+                final Session.Command command = session.exec("set +x +e && cat " + destination);
+
+                String output = CharStreams.toString(new InputStreamReader(command.getInputStream()));
+                command.join();
+
+                assertThat(command.getExitStatus()).isEqualTo(0);
+                assertThat(output).contains(content);
+
+            } finally {
+                session.close();
+            }
+        } finally {
+            client.close();
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/activiti/AlwaysFailTask.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/activiti/AlwaysFailTask.java b/core/src/test/java/org/apache/provisionr/core/activiti/AlwaysFailTask.java
new file mode 100644
index 0000000..1cc2880
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/activiti/AlwaysFailTask.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core.activiti;
+
+import java.util.Date;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.activiti.engine.delegate.DelegateExecution;
+import org.activiti.engine.delegate.JavaDelegate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AlwaysFailTask implements JavaDelegate {
+
+    private static final Logger LOG = LoggerFactory.getLogger(AlwaysFailTask.class);
+
+    public static final AtomicInteger COUNTER = new AtomicInteger(0);
+
+    @Override
+    public void execute(DelegateExecution execution) throws Exception {
+        COUNTER.incrementAndGet();
+        throw new RuntimeException("Failing. Time is " + new Date());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/activiti/ConfigurableFailedJobCommandFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/activiti/ConfigurableFailedJobCommandFactoryTest.java b/core/src/test/java/org/apache/provisionr/core/activiti/ConfigurableFailedJobCommandFactoryTest.java
new file mode 100644
index 0000000..8954222
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/activiti/ConfigurableFailedJobCommandFactoryTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core.activiti;
+
+import com.google.common.base.Stopwatch;
+import java.util.concurrent.TimeUnit;
+import org.activiti.engine.ProcessEngine;
+import org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration;
+import org.activiti.engine.impl.jobexecutor.DefaultJobExecutor;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+
+public class ConfigurableFailedJobCommandFactoryTest {
+
+    @Test
+    public void testConfigurableNumberOfRetries() throws InterruptedException {
+        DefaultJobExecutor jobExecutor = new DefaultJobExecutor();
+
+        jobExecutor.setCorePoolSize(2);
+        jobExecutor.setQueueSize(2);
+        jobExecutor.setMaxJobsPerAcquisition(5);
+        jobExecutor.setWaitTimeInMillis(50);
+        jobExecutor.setLockTimeInMillis(180000);
+
+        ProcessEngine processEngine = new StandaloneInMemProcessEngineConfiguration()
+            .setJobExecutorActivate(true)
+            .setJobExecutor(jobExecutor)
+            .setFailedJobCommandFactory(new ConfigurableFailedJobCommandFactory(2, 1))
+            .buildProcessEngine();
+
+        processEngine.getRepositoryService().createDeployment()
+            .addClasspathResource("diagrams/alwaysFail.bpmn20.xml").deploy();
+
+        Stopwatch stopwatch = new Stopwatch().start();
+        processEngine.getRuntimeService().startProcessInstanceByKey("alwaysFail");
+
+        while (AlwaysFailTask.COUNTER.get() != 3 /* = 1 normal execution + 2 retries */) {
+            TimeUnit.MILLISECONDS.sleep(100);
+        }
+
+        stopwatch.stop();
+        assertThat(stopwatch.elapsedTime(TimeUnit.SECONDS)).isGreaterThanOrEqualTo(2);
+
+        processEngine.close();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/activities/CheckProcessesEndedTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/activities/CheckProcessesEndedTest.java b/core/src/test/java/org/apache/provisionr/core/activities/CheckProcessesEndedTest.java
new file mode 100644
index 0000000..f12f270
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/activities/CheckProcessesEndedTest.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core.activities;
+
+import org.apache.provisionr.test.ProcessVariablesCollector;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.delegate.DelegateExecution;
+import org.activiti.engine.delegate.JavaDelegate;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class CheckProcessesEndedTest extends CheckProcessesTest {
+
+    private static final String PROCESS_IDS = "process_ids";
+
+    private static final String RESULT = "result";
+
+    @Test
+    public void testWithAListOfEndedProcesses() throws Exception {
+        DelegateExecution execution = mock(DelegateExecution.class);
+        when(execution.getVariable(eq(PROCESS_IDS))).thenReturn(Lists.newArrayList("1", "2"));
+
+        ProcessVariablesCollector collector = new ProcessVariablesCollector();
+        collector.install(execution);
+
+        RuntimeService runtimeService = mockRuntimeService(ImmutableMap.of(
+            "1", mockProcessInstance(/* ended= */ true),
+            "2", mockProcessInstance(/* ended= */ true)
+        ));
+
+        JavaDelegate delegate = new CheckProcessesEnded(runtimeService, PROCESS_IDS, RESULT);
+        delegate.execute(execution);
+
+        assertThat((Boolean) collector.getVariable(RESULT)).isTrue();
+    }
+
+    @Test
+    public void testWithOneEndedAndOneStillRunning() throws Exception {
+        DelegateExecution execution = mock(DelegateExecution.class);
+        when(execution.getVariable(eq(PROCESS_IDS))).thenReturn(Lists.newArrayList("1", "2"));
+
+        ProcessVariablesCollector collector = new ProcessVariablesCollector();
+        collector.install(execution);
+
+        RuntimeService runtimeService = mockRuntimeService(ImmutableMap.of(
+            "1", mockProcessInstance(/* ended= */ true),
+            "2", mockProcessInstance(/* ended= */ false)
+        ));
+
+        JavaDelegate delegate = new CheckProcessesEnded(runtimeService, PROCESS_IDS, RESULT);
+        delegate.execute(execution);
+
+        assertThat((Boolean) collector.getVariable(RESULT)).isFalse();
+    }
+
+    /**
+     * We consider an invalid process instance ID as ended by default
+     */
+    @Test
+    public void testWithOneInvalidProcessId() throws Exception {
+        DelegateExecution execution = mock(DelegateExecution.class);
+        when(execution.getVariable(eq(PROCESS_IDS))).thenReturn(Lists.newArrayList("1", "invalid"));
+
+        ProcessVariablesCollector collector = new ProcessVariablesCollector();
+        collector.install(execution);
+
+        RuntimeService runtimeService = mockRuntimeService(ImmutableMap.of(
+            "1", mockProcessInstance(/* ended= */ true)), "invalid");
+
+        JavaDelegate delegate = new CheckProcessesEnded(runtimeService, PROCESS_IDS, RESULT);
+        delegate.execute(execution);
+
+        assertThat((Boolean) collector.getVariable(RESULT)).isTrue();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/activities/CheckProcessesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/activities/CheckProcessesTest.java b/core/src/test/java/org/apache/provisionr/core/activities/CheckProcessesTest.java
new file mode 100644
index 0000000..09e9185
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/activities/CheckProcessesTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core.activities;
+
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.Map;
+
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.runtime.ProcessInstanceQuery;
+
+public abstract class CheckProcessesTest {
+
+    protected RuntimeService mockRuntimeService(Map<String, ProcessInstance> instances, 
+                                              String... notFoundProcessInstanceIds) {
+        RuntimeService runtimeService = mock(RuntimeService.class);
+
+        ProcessInstanceQuery generalQuery = mock(ProcessInstanceQuery.class);
+        for (Map.Entry<String, ProcessInstance> entry : instances.entrySet()) {
+            ProcessInstanceQuery specificQuery = mock(ProcessInstanceQuery.class);
+            when(specificQuery.singleResult()).thenReturn(entry.getValue());
+
+            when(generalQuery.processInstanceId(eq(entry.getKey()))).thenReturn(specificQuery);
+        }
+        for (String notFound : notFoundProcessInstanceIds) {
+            /* create a mock that returns null for all method calls (default) */
+            when(generalQuery.processInstanceId(eq(notFound))).thenReturn(mock(ProcessInstanceQuery.class));
+        }
+        when(runtimeService.createProcessInstanceQuery()).thenReturn(generalQuery);
+
+        return runtimeService;
+    }
+
+    protected ProcessInstance mockProcessInstance(boolean ended) {
+        ProcessInstance processInstance = mock(ProcessInstance.class);
+        when(processInstance.isEnded()).thenReturn(ended);
+        return processInstance;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/activities/DownloadFilesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/activities/DownloadFilesTest.java b/core/src/test/java/org/apache/provisionr/core/activities/DownloadFilesTest.java
new file mode 100644
index 0000000..d8db56b
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/activities/DownloadFilesTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core.activities;
+
+import org.apache.provisionr.api.pool.Pool;
+import org.apache.provisionr.api.software.Software;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class DownloadFilesTest {
+
+    @Test
+    public void testCreatePuppetScript() throws Exception {
+        Software software = Software.builder()
+            .file("http://provisionr.incubator.apache.org/test.tar.gz", "/opt/test.tar.gz")
+            .file("http://google.com", "/opt/google.html")
+            .createSoftware();
+
+        Pool pool = mock(Pool.class);
+        when(pool.getSoftware()).thenReturn(software);
+
+        PuppetActivity activity = new DownloadFiles();
+        String content = activity.createPuppetScript(pool, null);
+
+        assertThat(content)
+            .contains("download_file {\"/opt/test.tar.gz\":\n" +
+                "  uri => \"http://provisionr.incubator.apache.org/test.tar.gz\"\n" +
+                "}")
+            .contains("download_file {\"/opt/google.html\":\n" +
+                "  uri => \"http://google.com\"\n" +
+                "}");
+
+        assertThat(activity.createAdditionalFiles(pool, null)).isEmpty();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/activities/InstallPackagesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/activities/InstallPackagesTest.java b/core/src/test/java/org/apache/provisionr/core/activities/InstallPackagesTest.java
new file mode 100644
index 0000000..2ec7eb6
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/activities/InstallPackagesTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core.activities;
+
+import org.apache.provisionr.api.pool.Pool;
+import org.apache.provisionr.api.software.Software;
+import org.apache.provisionr.core.activities.InstallPackages;
+import org.apache.provisionr.core.activities.PuppetActivity;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class InstallPackagesTest {
+
+    @Test
+    public void testCreatePuppetScript() throws Exception {
+        Pool pool = mock(Pool.class);
+        when(pool.getSoftware()).thenReturn(Software.builder()
+            .packages("git-core", "vim").createSoftware());
+
+        PuppetActivity activity = new InstallPackages();
+        String content = activity.createPuppetScript(pool, null);
+
+        assertThat(content).contains(
+            "Package { ensure => \"installed\" }\n" +
+                "\n" +
+                "package { \"git-core\": }\n" +
+                "package { \"vim\": }\n"
+        );
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/activities/InstallRepositoriesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/activities/InstallRepositoriesTest.java b/core/src/test/java/org/apache/provisionr/core/activities/InstallRepositoriesTest.java
new file mode 100644
index 0000000..1f2ee5c
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/activities/InstallRepositoriesTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core.activities;
+
+import org.apache.provisionr.api.pool.Pool;
+import org.apache.provisionr.api.software.Repository;
+import org.apache.provisionr.api.software.Software;
+import org.apache.provisionr.core.activities.InstallRepositories;
+import org.apache.provisionr.core.activities.PuppetActivity;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class InstallRepositoriesTest {
+
+    @Test
+    public void testCreatePuppetScript() throws Exception {
+        Repository repository = Repository.builder()
+            .name("bigtop")
+            .addEntry("deb http://bigtop.s3.amazonaws.com/releases/0.5.0/ubuntu/lucid/x86_64  bigtop contrib")
+            .key("-----BEGIN PGP PUBLIC KEY BLOCK-----\n" +
+                "Version: GnuPG v1.4.10 (GNU/Linux)\n" +
+                "\n" +
+                "[....]")
+            .createRepository();
+
+        Pool pool = mock(Pool.class);
+        when(pool.getSoftware()).thenReturn(Software.builder().repository(repository).createSoftware());
+
+        PuppetActivity activity = new InstallRepositories();
+        String content = activity.createPuppetScript(pool, null);
+
+        assertThat(content).contains("apt::repository { \"bigtop\":\n" +
+            "  content => \"deb http://bigtop.s3.amazonaws.com/releases/0.5.0/ubuntu/lucid/x86_64  bigtop contrib\\n\",\n" +
+            "  key => \"-----BEGIN PGP PUBLIC KEY BLOCK-----\\nVersion: GnuPG v1.4.10 (GNU/Linux)\\n\\n[....]\"\n" +
+            "}");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/activities/IsMachinePortOpenTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/activities/IsMachinePortOpenTest.java b/core/src/test/java/org/apache/provisionr/core/activities/IsMachinePortOpenTest.java
new file mode 100644
index 0000000..0c7364f
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/activities/IsMachinePortOpenTest.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core.activities;
+
+import org.apache.provisionr.api.pool.Machine;
+import org.apache.provisionr.test.ProcessVariablesCollector;
+import java.io.IOException;
+import java.net.ServerSocket;
+import org.activiti.engine.delegate.DelegateExecution;
+import org.activiti.engine.delegate.JavaDelegate;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class IsMachinePortOpenTest {
+
+    private static final String RESULT = "result";
+
+    @Test
+    public void testWithRandomOpenPort() throws Exception {
+        DelegateExecution execution = mock(DelegateExecution.class);
+
+        when(execution.getVariable(eq(IsMachinePortOpen.MACHINE)))
+            .thenReturn(Machine.builder().localhost().createMachine());
+
+        ProcessVariablesCollector collector = new ProcessVariablesCollector();
+        collector.install(execution);
+
+        ServerSocket socket = null;
+        try {
+            socket = new ServerSocket(0);
+
+            JavaDelegate delegate = new IsMachinePortOpen(RESULT, socket.getLocalPort());
+            delegate.execute(execution);
+
+            assertThat((Boolean) collector.getVariable(RESULT)).isTrue();
+
+        } finally {
+            if (socket != null) {
+                socket.close();
+            }
+        }
+    }
+
+    @Test
+    public void testWithRandomClosedPort() throws Exception {
+        DelegateExecution execution = mock(DelegateExecution.class);
+
+        when(execution.getVariable(eq(IsMachinePortOpen.MACHINE)))
+            .thenReturn(Machine.builder().localhost().createMachine());
+
+        ProcessVariablesCollector collector = new ProcessVariablesCollector();
+        collector.install(execution);
+
+        JavaDelegate delegate = new IsMachinePortOpen(RESULT, findRandomNotUsedPort());
+        delegate.execute(execution);
+
+        assertThat((Boolean) collector.getVariable(RESULT)).isFalse();
+    }
+
+    private int findRandomNotUsedPort() throws IOException {
+        ServerSocket socket = null;
+        try {
+            socket = new ServerSocket(0);
+            return socket.getLocalPort();
+        } finally {
+            if (socket != null) {
+                socket.close();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/activities/KillMachineSetUpProcessesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/activities/KillMachineSetUpProcessesTest.java b/core/src/test/java/org/apache/provisionr/core/activities/KillMachineSetUpProcessesTest.java
new file mode 100644
index 0000000..a6be2ec
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/activities/KillMachineSetUpProcessesTest.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core.activities;
+
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.provisionr.test.ProcessVariablesCollector;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+import java.util.Map;
+
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.delegate.DelegateExecution;
+import org.activiti.engine.delegate.JavaDelegate;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.junit.Test;
+
+public class KillMachineSetUpProcessesTest extends CheckProcessesTest {
+
+    private static final String PROCESS_IDS = "process_ids";
+
+    @Test
+    public void testWithAListOfEndedProcesses() throws Exception {
+        RuntimeService runtimeService = runTest(Lists.newArrayList("1", "2"), ImmutableMap.of(
+            "1", mockProcessInstance(/* ended= */ true),
+            "2", mockProcessInstance(/* ended= */ true)
+        ));
+        verify(runtimeService, never()).deleteProcessInstance(anyString(), anyString());
+    }
+
+    @Test
+    public void testWithAListOfActiveProcesses() throws Exception {
+        RuntimeService runtimeService = runTest(Lists.newArrayList("1", "2"), ImmutableMap.of(
+            "1", mockProcessInstance(/* ended= */ false),
+            "2", mockProcessInstance(/* ended= */ false)
+        ));
+        verify(runtimeService, times(2)).deleteProcessInstance(anyString(), anyString());
+    }
+
+    @Test
+    public void testWithAListOfActiveAndInactiveProcesses() throws Exception {
+        RuntimeService runtimeService = runTest(Lists.newArrayList("1", "2"), ImmutableMap.of(
+            "1", mockProcessInstance(/* ended= */ true),
+            "2", mockProcessInstance(/* ended= */ false)
+        ));
+
+        verify(runtimeService, times(1)).deleteProcessInstance(anyString(), anyString());
+    }
+
+    @Test
+    public void testWithAListOfActiveAndInvalidProcesses() throws Exception {
+        RuntimeService runtimeService = runTest(Lists.newArrayList("1", "invalid"), ImmutableMap.of(
+            "1", mockProcessInstance(/* ended= */ false)));
+        verify(runtimeService, times(1)).deleteProcessInstance(anyString(), anyString());
+    }
+
+    private RuntimeService runTest(List<String> processIds, Map<String, ProcessInstance> processMap) throws Exception {
+        DelegateExecution execution = mock(DelegateExecution.class);
+        when(execution.getVariable(eq(PROCESS_IDS))).thenReturn(processIds);
+
+        ProcessVariablesCollector collector = new ProcessVariablesCollector();
+        collector.install(execution);
+
+        RuntimeService runtimeService = mockRuntimeService(processMap, "invalid");
+
+        JavaDelegate delegate = new KillMachineSetUpProcesses(runtimeService, PROCESS_IDS);
+        delegate.execute(execution);
+
+        return runtimeService;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/activities/SpawnProcessForEachMachineTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/activities/SpawnProcessForEachMachineTest.java b/core/src/test/java/org/apache/provisionr/core/activities/SpawnProcessForEachMachineTest.java
new file mode 100644
index 0000000..544bb0c
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/activities/SpawnProcessForEachMachineTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2013 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core.activities;
+
+import static org.fest.assertions.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.withSettings;
+
+import org.apache.provisionr.api.pool.Machine;
+import org.apache.provisionr.api.pool.Pool;
+import org.apache.provisionr.api.software.Software;
+import org.apache.provisionr.core.CoreProcessVariables;
+import org.apache.provisionr.test.ProcessVariablesCollector;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.activiti.engine.ProcessEngine;
+import org.activiti.engine.delegate.DelegateExecution;
+import org.activiti.engine.delegate.JavaDelegate;
+import org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration;
+import org.junit.Test;
+
+public class SpawnProcessForEachMachineTest {
+
+    private static final String EMPTY_PROCESS_KEY = "empty";
+    private static final String RESULT = "result";
+
+    private static final String BUSINESS_KEY = UUID.randomUUID().toString();
+
+    @Test
+    public void testSpawnSampleProcessForLocalhost() throws Exception {
+        DelegateExecution execution = mock(DelegateExecution.class);
+        Pool pool = mock(Pool.class, withSettings().serializable());
+        Software software = mock(Software.class, withSettings().serializable());
+        when(software.isCachedImage()).thenReturn(false);
+        when(pool.getSoftware()).thenReturn(software);
+        when(execution.getVariable(eq(CoreProcessVariables.POOL))).thenReturn(pool);
+        when(execution.getVariable(eq(CoreProcessVariables.POOL_BUSINESS_KEY))).thenReturn(BUSINESS_KEY);
+
+        List<Machine> machines = Lists.newArrayList(
+            Machine.builder().localhost().createMachine(),
+            Machine.builder().localhost().externalId("local-2").createMachine()
+        );
+        when(execution.getVariable(eq(CoreProcessVariables.MACHINES))).thenReturn(machines);
+
+        ProcessVariablesCollector collector = new ProcessVariablesCollector();
+        collector.install(execution);
+
+        ProcessEngine processEngine = new StandaloneInMemProcessEngineConfiguration()
+            .setJobExecutorActivate(true).buildProcessEngine();
+        processEngine.getRepositoryService().createDeployment()
+            .addClasspathResource("diagrams/empty.bpmn20.xml").deploy();
+
+        try {
+            JavaDelegate delegate = new SpawnProcessForEachMachine(processEngine, EMPTY_PROCESS_KEY, "test", RESULT);
+            delegate.execute(execution);
+
+            @SuppressWarnings("unchecked")
+            List<String> processInstanceIds = (List<String>) collector.getVariable(RESULT);
+
+            assertThat(processInstanceIds).hasSize(2);
+
+        } finally {
+            processEngine.close();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/logging/StreamLoggerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/logging/StreamLoggerTest.java b/core/src/test/java/org/apache/provisionr/core/logging/StreamLoggerTest.java
new file mode 100644
index 0000000..c528afd
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/logging/StreamLoggerTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core.logging;
+
+import org.apache.provisionr.core.Ssh;
+import com.google.common.base.Charsets;
+import com.google.common.collect.Lists;
+import java.io.ByteArrayInputStream;
+import java.util.List;
+import org.apache.provisionr.core.logging.StreamLogger;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+
+public class StreamLoggerTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(Ssh.class);
+
+    @Test
+    public void testStreamLogger() throws InterruptedException {
+        final List<String> lines = Lists.newCopyOnWriteArrayList();
+
+        final byte[] bytes = "line1\nline2\nline3".getBytes(Charsets.UTF_8);
+        ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
+
+        final StreamLogger logger = new StreamLogger(inputStream, LOG, MarkerFactory.getMarker("test")) {
+            @Override
+            protected void log(Logger logger, Marker marker, String line) {
+                logger.info(marker, line);  /* just for visual inspection */
+                lines.add(line);
+            }
+        };
+        logger.start();
+
+        logger.join();
+        assertThat(lines).contains("line1", "line2", "line3");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/templates/PoolTemplateInstallerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/templates/PoolTemplateInstallerTest.java b/core/src/test/java/org/apache/provisionr/core/templates/PoolTemplateInstallerTest.java
new file mode 100644
index 0000000..8d89caa
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/templates/PoolTemplateInstallerTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2012 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core.templates;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.Dictionary;
+import org.apache.ibatis.io.Resources;
+import org.apache.provisionr.core.templates.PoolTemplate;
+import org.apache.provisionr.core.templates.PoolTemplateInstaller;
+import org.junit.Test;
+import org.mockito.Matchers;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.when;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+public class PoolTemplateInstallerTest {
+
+    @Test
+    public void testInstallAndUninstallTemplate() throws Exception {
+        BundleContext bundleContext = mock(BundleContext.class);
+
+        ServiceRegistration registration = mock(ServiceRegistration.class);
+        when(bundleContext.registerService(eq(PoolTemplate.class.getName()), any(),
+            Matchers.<Dictionary<String, ?>>any())).thenReturn(registration);
+
+        File file = getPathToCdh3Template();
+        PoolTemplateInstaller installer = new PoolTemplateInstaller(bundleContext);
+
+        installer.install(file);
+        verify(bundleContext).registerService(eq(PoolTemplate.class.getName()),
+            any(), (Dictionary<String, ?>) isNull());
+        verifyZeroInteractions(registration);
+
+        installer.uninstall(file);
+        verify(registration).unregister();
+    }
+
+    private File getPathToCdh3Template() throws URISyntaxException, IOException {
+        return new File(Resources.getResourceURL("org/apache/provisionr/core/templates/cdh3.xml").toURI());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/java/org/apache/provisionr/core/templates/xml/XmlTemplateTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/provisionr/core/templates/xml/XmlTemplateTest.java b/core/src/test/java/org/apache/provisionr/core/templates/xml/XmlTemplateTest.java
new file mode 100644
index 0000000..53b5037
--- /dev/null
+++ b/core/src/test/java/org/apache/provisionr/core/templates/xml/XmlTemplateTest.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2013 S.C. Axemblr Software Solutions S.R.L
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.provisionr.core.templates.xml;
+
+import com.google.common.base.Charsets;
+import static com.google.common.collect.Lists.newArrayList;
+import com.google.common.io.Resources;
+import java.io.IOException;
+import org.apache.provisionr.api.network.Network;
+import org.apache.provisionr.api.network.Rule;
+import org.apache.provisionr.api.software.Software;
+import org.apache.provisionr.core.BaseJaxbTest;
+import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+
+public class XmlTemplateTest extends BaseJaxbTest {
+
+    public static final String DEFAULT_JENKINS_TEMPLATE = "org/apache/provisionr/core/templates/jenkins.xml";
+
+    public static final String DEFAULT_CDH3_TEMPLATE = "org/apache/provisionr/core/templates/cdh3.xml";
+
+    @Test
+    public void testLoadDefaultCdh3Template() throws Exception {
+        XmlTemplate template = XmlTemplate.newXmlTemplate(readResource(DEFAULT_CDH3_TEMPLATE));
+
+        assertThat(template.getId()).isEqualTo("cdh3");
+        assertThat(template.getPackages()).contains("hue");
+        assertThat(template.getOsVersion()).isEqualTo("10.04 LTS");
+
+        assertThat(template.getRepositories()).hasSize(2);
+        assertThat(template.getFiles()).hasSize(1);
+    }
+
+    @Test
+    public void testApplyCdh3TemplateToNetworkAndSoftware() throws Exception {
+        XmlTemplate template = XmlTemplate.newXmlTemplate(readResource(DEFAULT_CDH3_TEMPLATE));
+
+        Network network = template.apply(Network.builder().createNetwork());
+        assertThat(network.getIngress()).contains(
+            Rule.builder().anySource().tcp().port(8080).createRule());
+
+
+        Software software = template.apply(Software.builder().createSoftware());
+        assertThat(software.getPackages()).contains("hue").contains("hadoop-0.20");
+
+        assertThat(software.getFiles()).hasSize(1);
+        assertThat(software.getRepositories()).hasSize(2);
+    }
+
+    @Test
+    public void testLoadDefaultJenkinsTemplate() throws Exception {
+        XmlTemplate template = XmlTemplate.newXmlTemplate(readResource(DEFAULT_JENKINS_TEMPLATE));
+
+        assertThat(template.getPorts()).contains(8080);
+        assertThat(template.getRepositories()).hasSize(1);
+
+        assertThat(template.getPackages()).contains("jenkins").contains("git-core");
+    }
+
+    @Test
+    public void testSerializeBasicTemplateAsXml() throws Exception {
+        XmlTemplate template = new XmlTemplate();
+        template.setId("jenkins");
+
+        template.setDescription("Just testing");
+        template.setOsVersion("10.04 LTS");
+
+        template.setPackages(newArrayList("jenkins", "git-core", "subversion"));
+        template.setPorts(newArrayList(8080, 22));
+
+        template.setFiles(newArrayList(
+            new FileEntry("http://google.com", "/opt/google.html")
+        ));
+
+        template.setRepositories(newArrayList(
+            new RepositoryEntry("jenkins", newArrayList("deb ..."), "-----BEGIN PGP PUBLIC KEY BLOCK----- ...")
+        ));
+
+        String actual = asXml(template);
+        assertXMLEqual(actual, readResource("templates/test.xml"), actual);
+    }
+
+    private String readResource(String resource) throws IOException {
+        return Resources.toString(Resources.getResource(resource), Charsets.UTF_8);
+    }
+
+    @Override
+    public Class[] getContextClasses() {
+        return new Class[]{XmlTemplate.class};
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/core/src/test/resources/diagrams/alwaysFail.bpmn20.xml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/diagrams/alwaysFail.bpmn20.xml b/core/src/test/resources/diagrams/alwaysFail.bpmn20.xml
index 77e61c5..8ebdf49 100644
--- a/core/src/test/resources/diagrams/alwaysFail.bpmn20.xml
+++ b/core/src/test/resources/diagrams/alwaysFail.bpmn20.xml
@@ -7,7 +7,7 @@
         <startEvent id="startevent1" name="Start"></startEvent>
         <endEvent id="endevent1" name="End"></endEvent>
         <serviceTask id="alwaysFailTask" name="Always Fail" activiti:async="true"
-                     activiti:class="com.axemblr.provisionr.core.activiti.AlwaysFailTask"></serviceTask>
+                     activiti:class="org.apache.provisionr.core.activiti.AlwaysFailTask"></serviceTask>
         <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="alwaysFailTask"></sequenceFlow>
         <sequenceFlow id="flow2" sourceRef="alwaysFailTask" targetRef="endevent1"></sequenceFlow>
     </process>

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/docs/Creating Pools of Virtual Machines - ApacheCon NA 2013.pdf
----------------------------------------------------------------------
diff --git a/docs/Creating Pools of Virtual Machines - ApacheCon NA 2013.pdf b/docs/Creating Pools of Virtual Machines - ApacheCon NA 2013.pdf
deleted file mode 100644
index 789f00e..0000000
Binary files a/docs/Creating Pools of Virtual Machines - ApacheCon NA 2013.pdf and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/docs/icla.pdf
----------------------------------------------------------------------
diff --git a/docs/icla.pdf b/docs/icla.pdf
deleted file mode 100644
index 865ca56..0000000
Binary files a/docs/icla.pdf and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/integration/rundeck/pom.xml
----------------------------------------------------------------------
diff --git a/integration/rundeck/pom.xml b/integration/rundeck/pom.xml
index 4b141b4..a1031c6 100644
--- a/integration/rundeck/pom.xml
+++ b/integration/rundeck/pom.xml
@@ -17,13 +17,13 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
         <artifactId>provisionr-parent</artifactId>
-        <groupId>com.axemblr.provisionr</groupId>
+        <groupId>org.apache.provisionr</groupId>
         <version>0.4.0-SNAPSHOT</version>
         <relativePath>../../parent/pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <name>Axemblr Provisionr :: Rundeck</name>
+    <name>Apache Provisionr :: Rundeck</name>
     <description>Integration with Rundeck (http://rundeck.org/). Provides a Resource Model endpoint</description>
 
     <artifactId>provisionr-rundeck</artifactId>
@@ -31,7 +31,7 @@
 
     <dependencies>
         <dependency>
-            <groupId>com.axemblr.provisionr</groupId>
+            <groupId>org.apache.provisionr</groupId>
             <artifactId>provisionr-core</artifactId>
         </dependency>
         <dependency>
@@ -121,7 +121,7 @@
                                 <descriptor>file:${project.build.directory}/classes/features.xml</descriptor>
                             </descriptors>
                             <features>
-                                <feature>axemblr-provisionr-core</feature>
+                                <feature>provisionr-core</feature>
                             </features>
                             <repository>target/features-repo</repository>
                         </configuration>

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/integration/rundeck/src/main/java/com/axemblr/provisionr/rundeck/Attribute.java
----------------------------------------------------------------------
diff --git a/integration/rundeck/src/main/java/com/axemblr/provisionr/rundeck/Attribute.java b/integration/rundeck/src/main/java/com/axemblr/provisionr/rundeck/Attribute.java
deleted file mode 100644
index 5419bdb..0000000
--- a/integration/rundeck/src/main/java/com/axemblr/provisionr/rundeck/Attribute.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2013 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.axemblr.provisionr.rundeck;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import javax.xml.bind.annotation.XmlAttribute;
-
-/**
- * An attribute allows you to add user-defined metadata
- *
- * @see <a href="http://rundeck.org/docs/manpages/man5/resource-v13.html#attribute" />
- */
-public class Attribute {
-
-    private String name;
-
-    private String value;
-
-    public Attribute() {
-    }
-
-    public Attribute(String name, String value) {
-        this.name = checkNotNull(name, "name is null");
-        this.value = checkNotNull(value, "value is null");
-    }
-
-    @XmlAttribute(name = "name")
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = checkNotNull(name, "name is null");
-    }
-
-    @XmlAttribute(name = "value")
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(String value) {
-        this.value = checkNotNull(value, "value is null");
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        Attribute attribute = (Attribute) o;
-
-        if (name != null ? !name.equals(attribute.name) : attribute.name != null) return false;
-        if (value != null ? !value.equals(attribute.value) : attribute.value != null) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = name != null ? name.hashCode() : 0;
-        result = 31 * result + (value != null ? value.hashCode() : 0);
-        return result;
-    }
-
-    @Override
-    public String toString() {
-        return "Attribute{" +
-            "name='" + name + '\'' +
-            ", value='" + value + '\'' +
-            '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/integration/rundeck/src/main/java/com/axemblr/provisionr/rundeck/Node.java
----------------------------------------------------------------------
diff --git a/integration/rundeck/src/main/java/com/axemblr/provisionr/rundeck/Node.java b/integration/rundeck/src/main/java/com/axemblr/provisionr/rundeck/Node.java
deleted file mode 100644
index 7bcf319..0000000
--- a/integration/rundeck/src/main/java/com/axemblr/provisionr/rundeck/Node.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2013 S.C. Axemblr Software Solutions S.R.L
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.axemblr.provisionr.rundeck;
-
-import com.google.common.base.Joiner;
-import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.common.collect.Lists;
-import java.util.List;
-import java.util.Map;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-
-/**
- * A Rundeck Resource Model is nothing more than just a list of nodes
- * with a predefined set of properties and an optional list of user defined attributes
- *
- * @see <a href="http://rundeck.org/docs/manpages/man5/resource-v13.html#node" />
- */
-public class Node {
-
-    /**
-     * The node name. This is a logical identifier from the node. (required)
-     */
-    private String name;
-
-    /**
-     * The hostname or IP address of the remote host. (required)
-     */
-    private String hostname;
-
-    /**
-     * Comma separated list of filtering tags. (optional)
-     */
-    private String tags;
-
-    /**
-     * The username used for the remote connection. (required)
-     */
-    private String username;
-
-    /**
-     * User defined attributes
-     */
-    private List<Attribute> attributes;
-
-    public Node() {
-    }
-
-    public Node(String name, String hostname, String username) {
-        this.name = checkNotNull(name, "name is null");
-        this.hostname = checkNotNull(hostname, "hostname is null");
-        this.username = checkNotNull(username, "username is null");
-    }
-
-    @XmlAttribute
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = checkNotNull(name, "name is null");
-    }
-
-    @XmlAttribute
-    public String getHostname() {
-        return hostname;
-    }
-
-    public void setHostname(String hostname) {
-        this.hostname = checkNotNull(hostname, "hostname is null");
-    }
-
-    @XmlAttribute
-    public String getTags() {
-        return tags;
-    }
-
-    public void setTags(String tags) {
-        this.tags = checkNotNull(tags, "tags is null");
-    }
-
-    public void setTags(Iterable<String> tags) {
-        setTags(Joiner.on(",").join(tags));
-    }
-
-    public void setTags(String[] tags) {
-        setTags(Joiner.on(",").join(tags));
-    }
-
-    @XmlAttribute
-    public String getUsername() {
-        return username;
-    }
-
-    public void setUsername(String username) {
-        this.username = checkNotNull(username, "username is null");
-    }
-
-    @XmlElement(name = "attribute")
-    public List<Attribute> getAttributes() {
-        return attributes;
-    }
-
-    public void setAttributes(List<Attribute> attributes) {
-        this.attributes = checkNotNull(attributes, "attributes is null");
-    }
-
-    public void setAttributes(Map<String, String> values) {
-        this.attributes = Lists.newArrayList();
-        for (Map.Entry<String, String> entry : values.entrySet()) {
-            this.attributes.add(new Attribute(entry.getKey(), entry.getValue()));
-        }
-    }
-
-    public void addAttribute(String name, String value) {
-        this.attributes.add(new Attribute(name, value));
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        Node node = (Node) o;
-
-        if (attributes != null ? !attributes.equals(node.attributes) : node.attributes != null) return false;
-        if (hostname != null ? !hostname.equals(node.hostname) : node.hostname != null) return false;
-        if (name != null ? !name.equals(node.name) : node.name != null) return false;
-        if (tags != null ? !tags.equals(node.tags) : node.tags != null) return false;
-        if (username != null ? !username.equals(node.username) : node.username != null) return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = name != null ? name.hashCode() : 0;
-        result = 31 * result + (hostname != null ? hostname.hashCode() : 0);
-        result = 31 * result + (tags != null ? tags.hashCode() : 0);
-        result = 31 * result + (username != null ? username.hashCode() : 0);
-        result = 31 * result + (attributes != null ? attributes.hashCode() : 0);
-        return result;
-    }
-
-    @Override
-    public String toString() {
-        return "Node{" +
-            "name='" + name + '\'' +
-            ", hostname='" + hostname + '\'' +
-            ", tags='" + tags + '\'' +
-            ", username='" + username + '\'' +
-            ", attributes=" + attributes +
-            '}';
-    }
-}


Mime
View raw message