provisionr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject [17/21] PROVISIONR-20. Change groupId from com.axemblr.provisionr to org.apache.provisionr
Date Mon, 01 Apr 2013 08:52:40 GMT
http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/pool/MachineBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/pool/MachineBuilder.java b/api/src/main/java/org/apache/provisionr/api/pool/MachineBuilder.java
new file mode 100644
index 0000000..74697e5
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/pool/MachineBuilder.java
@@ -0,0 +1,76 @@
+/*
+ * 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.api.pool;
+
+import org.apache.provisionr.api.util.BuilderWithOptions;
+import static com.google.common.base.Preconditions.checkArgument;
+
+public class MachineBuilder extends BuilderWithOptions<MachineBuilder> {
+
+    private String externalId;
+    private String publicDnsName;
+    private String publicIp;
+    private String privateDnsName;
+    private String privateIp;
+    private int sshPort = 22;
+
+    @Override
+    protected MachineBuilder getThis() {
+        return this;
+    }
+
+    public MachineBuilder localhost() {
+        return externalId("local-1").publicDnsName("localhost").publicIp("127.0.0.1")
+            .privateDnsName("localhost").privateIp("127.0.0.1").sshPort(22);
+    }
+
+    public MachineBuilder externalId(String externalId) {
+        this.externalId = externalId;
+        return this;
+    }
+
+    public MachineBuilder publicDnsName(String publicDnsName) {
+        this.publicDnsName = publicDnsName;
+        return this;
+    }
+
+    public MachineBuilder publicIp(String publicIp) {
+        this.publicIp = publicIp;
+        return this;
+    }
+
+    public MachineBuilder privateDnsName(String privateDnsName) {
+        this.privateDnsName = privateDnsName;
+        return this;
+    }
+
+    public MachineBuilder privateIp(String privateIp) {
+        this.privateIp = privateIp;
+        return this;
+    }
+
+    public MachineBuilder sshPort(int sshPort) {
+        checkArgument(sshPort > 0 && sshPort < 65535, "invalid port number for ssh");
+        this.sshPort = sshPort;
+        return this;
+    }
+
+    public Machine createMachine() {
+        return new Machine(externalId, publicDnsName, publicIp,
+            privateDnsName, privateIp, sshPort, buildOptions());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/pool/Pool.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/pool/Pool.java b/api/src/main/java/org/apache/provisionr/api/pool/Pool.java
new file mode 100644
index 0000000..5b06c36
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/pool/Pool.java
@@ -0,0 +1,146 @@
+/*
+ * 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.api.pool;
+
+import org.apache.provisionr.api.access.AdminAccess;
+import org.apache.provisionr.api.hardware.Hardware;
+import org.apache.provisionr.api.network.Network;
+import org.apache.provisionr.api.provider.Provider;
+import org.apache.provisionr.api.software.Software;
+import org.apache.provisionr.api.util.WithOptions;
+import com.google.common.base.Objects;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.util.Map;
+
+public class Pool extends WithOptions {
+
+    public static PoolBuilder builder() {
+        return new PoolBuilder();
+    }
+
+    private final Provider provider;
+    private final Network network;
+
+    private final AdminAccess adminAccess;
+    private final Software software;
+    private final Hardware hardware;
+
+    private final int minSize;
+    private final int expectedSize;
+
+    private final int bootstrapTimeInSeconds;
+
+    Pool(Provider provider, Network network, AdminAccess adminAccess, Software software, Hardware hardware,
+         int minSize, int expectedSize, int bootstrapTimeInSeconds,
+         Map<String, String> options
+    ) {
+        super(options);
+
+        checkArgument(minSize > 0, "minSize should be positive");
+        checkArgument(minSize <= expectedSize, "minSize should be smaller or equal to expectedSize");
+        checkArgument(bootstrapTimeInSeconds > 0, "bootstrapTimeInSeconds should be positive");
+
+        this.provider = checkNotNull(provider, "provider is null");
+        this.network = checkNotNull(network, "network is null");
+        this.adminAccess = checkNotNull(adminAccess, "adminAccess is null");
+        this.software = checkNotNull(software, "software is null");
+        this.hardware = checkNotNull(hardware, "hardware is null");
+        this.minSize = minSize;
+        this.expectedSize = expectedSize;
+        this.bootstrapTimeInSeconds = bootstrapTimeInSeconds;
+    }
+
+    public Provider getProvider() {
+        return provider;
+    }
+
+    public Network getNetwork() {
+        return network;
+    }
+
+    public AdminAccess getAdminAccess() {
+        return adminAccess;
+    }
+
+    public Software getSoftware() {
+        return software;
+    }
+
+    public Hardware getHardware() {
+        return hardware;
+    }
+
+    public int getMinSize() {
+        return minSize;
+    }
+
+    public int getExpectedSize() {
+        return expectedSize;
+    }
+
+    /**
+     * The maximum amount of time to go from 0 to minSize
+     */
+    public int getBootstrapTimeInSeconds() {
+        return bootstrapTimeInSeconds;
+    }
+
+    public PoolBuilder toBuilder() {
+        return builder().provider(provider).network(network).adminAccess(adminAccess).software(software)
+            .hardware(hardware).minSize(minSize).expectedSize(expectedSize)
+            .bootstrapTimeInSeconds(bootstrapTimeInSeconds).options(getOptions());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(provider, network, adminAccess, software, hardware,
+            minSize, expectedSize, bootstrapTimeInSeconds, getOptions());
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final Pool other = (Pool) obj;
+        return Objects.equal(this.provider, other.provider) && Objects.equal(this.network, other.network)
+            && Objects.equal(this.adminAccess, other.adminAccess) && Objects.equal(this.software, other.software)
+            && Objects.equal(this.hardware, other.hardware) && Objects.equal(this.minSize, other.minSize)
+            && Objects.equal(this.expectedSize, other.expectedSize)
+            && Objects.equal(this.bootstrapTimeInSeconds, other.bootstrapTimeInSeconds)
+            && Objects.equal(this.getOptions(), other.getOptions());
+    }
+
+    @Override
+    public String toString() {
+        return "Pool{" +
+            "provider=" + provider +
+            ", network=" + network +
+            ", adminAccess=" + adminAccess +
+            ", software=" + software +
+            ", hardware=" + hardware +
+            ", minSize=" + minSize +
+            ", expectedSize=" + expectedSize +
+            ", bootstrapTimeInSeconds=" + bootstrapTimeInSeconds +
+            ", options=" + getOptions() +
+            '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/pool/PoolBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/pool/PoolBuilder.java b/api/src/main/java/org/apache/provisionr/api/pool/PoolBuilder.java
new file mode 100644
index 0000000..56462a6
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/pool/PoolBuilder.java
@@ -0,0 +1,94 @@
+/*
+ * 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.api.pool;
+
+import org.apache.provisionr.api.access.AdminAccess;
+import org.apache.provisionr.api.hardware.Hardware;
+import org.apache.provisionr.api.network.Network;
+import org.apache.provisionr.api.software.Software;
+import org.apache.provisionr.api.provider.Provider;
+import org.apache.provisionr.api.util.BuilderWithOptions;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public class PoolBuilder extends BuilderWithOptions<PoolBuilder> {
+
+    private Provider provider;
+    private Network network;
+
+    private AdminAccess adminAccess;
+    private Software software;
+    private Hardware hardware;
+
+    private int minSize = -1;
+    private int expectedSize = -1;
+
+    private int bootstrapTimeInSeconds = 15 * 60;
+
+    @Override
+    protected PoolBuilder getThis() {
+        return this;
+    }
+
+    public PoolBuilder provider(Provider provider) {
+        this.provider = checkNotNull(provider, "provider is null");
+        return this;
+    }
+
+    public PoolBuilder network(Network network) {
+        this.network = checkNotNull(network, "network is null");
+        return this;
+    }
+
+    public PoolBuilder adminAccess(AdminAccess adminAccess) {
+        this.adminAccess = checkNotNull(adminAccess, "adminAccess is null");
+        return this;
+    }
+
+    public PoolBuilder software(Software software) {
+        this.software = checkNotNull(software, "software is null");
+        return this;
+    }
+
+    public PoolBuilder hardware(Hardware hardware) {
+        this.hardware = checkNotNull(hardware, "hardware is null");
+        return this;
+    }
+
+    public PoolBuilder minSize(int minSize) {
+        checkArgument(minSize > 0, "minSize should be positive");
+        this.minSize = minSize;
+        return this;
+    }
+
+    public PoolBuilder expectedSize(int expectedSize) {
+        checkArgument(expectedSize > 0, "expectedSize should be positive");
+        this.expectedSize = expectedSize;
+        return this;
+    }
+
+    public PoolBuilder bootstrapTimeInSeconds(int bootstrapTimeInSeconds) {
+        checkArgument(bootstrapTimeInSeconds > 0, "bootstrapTimeInSeconds should be positive");
+        this.bootstrapTimeInSeconds = bootstrapTimeInSeconds;
+        return this;
+    }
+
+    public Pool createPool() {
+        return new Pool(provider, network, adminAccess, software, hardware, minSize,
+            expectedSize, bootstrapTimeInSeconds, buildOptions());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/provider/Provider.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/provider/Provider.java b/api/src/main/java/org/apache/provisionr/api/provider/Provider.java
new file mode 100644
index 0000000..ab39c3e
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/provider/Provider.java
@@ -0,0 +1,109 @@
+/*
+ * 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.api.provider;
+
+import org.apache.provisionr.api.util.WithOptions;
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.util.Map;
+
+public class Provider extends WithOptions {
+
+    public static ProviderBuilder builder() {
+        return new ProviderBuilder();
+    }
+
+    private final String id;
+    private final Optional<String> endpoint;
+
+    private final String accessKey;
+    private final String secretKey;
+
+    Provider(String id, Optional<String> endpoint, String accessKey,
+             String secretKey, Map<String, String> options) {
+        super(options);
+        this.id = checkNotNull(id, "id is null");
+        this.endpoint = checkNotNull(endpoint, "endpoint is null");
+        this.accessKey = checkNotNull(accessKey, "accessKey is null");
+        this.secretKey = checkNotNull(secretKey, "secretKey is null");
+    }
+
+    /**
+     * Unique provider ID
+     */
+    public String getId() {
+        return id;
+    }
+
+    /**
+     * API endpoint for this provider
+     */
+    public Optional<String> getEndpoint() {
+        return endpoint;
+    }
+
+    /**
+     * API access key
+     */
+    public String getAccessKey() {
+        return accessKey;
+    }
+
+    /**
+     * API secret key
+     */
+    public String getSecretKey() {
+        return secretKey;
+    }
+
+    public ProviderBuilder toBuilder() {
+        return builder().id(id).endpoint(endpoint).accessKey(accessKey)
+            .secretKey(secretKey).options(getOptions());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(id, endpoint, accessKey, secretKey, getOptions());
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final Provider other = (Provider) obj;
+        return Objects.equal(this.id, other.id)
+            && Objects.equal(this.endpoint, other.endpoint)
+            && Objects.equal(this.accessKey, other.accessKey)
+            && Objects.equal(this.secretKey, other.secretKey)
+            && Objects.equal(this.getOptions(), other.getOptions());
+    }
+
+    @Override
+    public String toString() {
+        return "Provider{" +
+            "id='" + id + '\'' +
+            ", endpoint='" + endpoint.or("") + '\'' +
+            ", accessKey='" + accessKey + '\'' +
+            ", options='" + getOptions() + '\'' +
+            '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/provider/ProviderBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/provider/ProviderBuilder.java b/api/src/main/java/org/apache/provisionr/api/provider/ProviderBuilder.java
new file mode 100644
index 0000000..44c1237
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/provider/ProviderBuilder.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.api.provider;
+
+import org.apache.provisionr.api.util.BuilderWithOptions;
+import com.google.common.base.Optional;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public class ProviderBuilder extends BuilderWithOptions<ProviderBuilder> {
+
+    private String id;
+    private Optional<String> endpoint = Optional.absent();
+    private String accessKey;
+    private String secretKey;
+
+    @Override
+    protected ProviderBuilder getThis() {
+        return this;
+    }
+
+    public ProviderBuilder id(String id) {
+        this.id = checkNotNull(id, "id is null");
+        return this;
+    }
+
+    public ProviderBuilder endpoint(Optional<String> endpoint) {
+        this.endpoint = checkNotNull(endpoint, "endpoint is null");
+        return this;
+    }
+
+    public ProviderBuilder endpoint(String endpoint) {
+        this.endpoint = Optional.of(endpoint);
+        return this;
+    }
+
+    public ProviderBuilder accessKey(String accessKey) {
+        this.accessKey = checkNotNull(accessKey, "accessKey is null");
+        return this;
+    }
+
+    public ProviderBuilder secretKey(String secretKey) {
+        this.secretKey = checkNotNull(secretKey, "secretKey is null");
+        return this;
+    }
+
+    public Provider createProvider() {
+        return new Provider(id, endpoint, accessKey, secretKey, buildOptions());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/software/Repository.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/software/Repository.java b/api/src/main/java/org/apache/provisionr/api/software/Repository.java
new file mode 100644
index 0000000..c9583f8
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/software/Repository.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.api.software;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.collect.ImmutableList;
+import java.io.Serializable;
+import java.util.List;
+
+public class Repository implements Serializable {
+
+    public static RepositoryBuilder builder() {
+        return new RepositoryBuilder();
+    }
+
+    private final String name;
+    private final List<String> entries;
+
+    private final Optional<String> key;
+
+    Repository(String name, List<String> entries, Optional<String> key) {
+        this.name = checkNotNull(name, "name is null");
+        this.entries = ImmutableList.copyOf(entries);
+        this.key = checkNotNull(key, "key is null");
+    }
+
+    /**
+     * The name of the repository
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * List of entries (text lines) used to describe this repository
+     */
+    public List<String> getEntries() {
+        return entries;
+    }
+
+    /**
+     * PGP key used for package signing. This should be the actual key
+     * and not a link to an external resource
+     */
+    public Optional<String> getKey() {
+        return key;
+    }
+
+    public RepositoryBuilder toBuilder() {
+        return builder().name(name).entries(entries).key(key);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(name, entries, key);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || getClass() != obj.getClass()) {
+            return false;
+        }
+        final Repository other = (Repository) obj;
+        return Objects.equal(this.name, other.name) && Objects.equal(this.entries, other.entries)
+            && Objects.equal(this.key, other.key);
+    }
+
+    @Override
+    public String toString() {
+        return "Repository{" +
+            "name='" + name + '\'' +
+            ", entries=" + entries +
+            ", key='" + key + '\'' +
+            '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/software/RepositoryBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/software/RepositoryBuilder.java b/api/src/main/java/org/apache/provisionr/api/software/RepositoryBuilder.java
new file mode 100644
index 0000000..17ab7b6
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/software/RepositoryBuilder.java
@@ -0,0 +1,59 @@
+/*
+ * 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.api.software;
+
+import com.google.common.base.Optional;
+import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+
+public class RepositoryBuilder {
+
+    private String name;
+    private ImmutableList.Builder<String> entries = ImmutableList.builder();
+
+    private Optional<String> key = Optional.absent();
+
+    public RepositoryBuilder name(String name) {
+        this.name = checkNotNull(name, "name is null");
+        return this;
+    }
+
+    public RepositoryBuilder entries(List<String> entries) {
+        this.entries = ImmutableList.<String>builder().addAll(entries);
+        return this;
+    }
+
+    public RepositoryBuilder addEntry(String entry) {
+        this.entries.add(entry);
+        return this;
+    }
+
+    public RepositoryBuilder key(Optional<String> key) {
+        this.key = checkNotNull(key, "key is null");
+        return this;
+    }
+
+    public RepositoryBuilder key(String key) {
+        this.key = Optional.of(key);
+        return this;
+    }
+
+    public Repository createRepository() {
+        return new Repository(name, entries.build(), key);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/software/Software.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/software/Software.java b/api/src/main/java/org/apache/provisionr/api/software/Software.java
new file mode 100644
index 0000000..56cc1c4
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/software/Software.java
@@ -0,0 +1,124 @@
+/*
+ * 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.api.software;
+
+import org.apache.provisionr.api.util.WithOptions;
+import com.google.common.base.Objects;
+import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Define the software environment for all the machines in the pool
+ */
+public class Software extends WithOptions {
+
+    public static SoftwareBuilder builder() {
+        return new SoftwareBuilder();
+    }
+
+    private final String imageId;
+    private final boolean cachedImage;
+
+    private final Map<String, String> files;
+    private final List<String> packages;
+    private final List<Repository> repositories;
+
+    Software(String imageId, boolean cachedImage, Map<String, String> files, List<String> packages,
+             List<Repository> repositories, Map<String, String> options) {
+        super(options);
+        this.imageId = checkNotNull(imageId, "The supplied imageId was null");
+        this.cachedImage = cachedImage;
+        this.files = ImmutableMap.copyOf(files);
+        this.packages = ImmutableList.copyOf(packages);
+        this.repositories = ImmutableList.copyOf(repositories);
+    }
+
+    public String getImageId() {
+        return imageId;
+    }
+
+    public boolean isCachedImage() {
+        return cachedImage;
+    }
+
+    /**
+     * Map of remote files that need to be available on the local filesystem
+     */
+    public Map<String, String> getFiles() {
+        return files;
+    }
+
+    /**
+     * List of packages that should be installed
+     * <p/>
+     * This list can also include paths to local files
+     */
+    public List<String> getPackages() {
+        return packages;
+    }
+
+    /**
+     * List of custom repositories to add to the system before
+     * installing any packages
+     */
+    public List<Repository> getRepositories() {
+        return repositories;
+    }
+
+    public SoftwareBuilder toBuilder() {
+        return builder().imageId(imageId).files(files)
+            .packages(packages).repositories(repositories).options(getOptions());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(imageId, cachedImage, files, packages, repositories, getOptions());
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+
+        final Software other = (Software) obj;
+        return Objects.equal(this.imageId, other.imageId)
+            && Objects.equal(this.cachedImage, other.cachedImage)
+            && Objects.equal(this.files, other.files)
+            && Objects.equal(this.packages, other.packages)
+            && Objects.equal(this.repositories, other.repositories)
+            && Objects.equal(this.getOptions(), other.getOptions());
+    }
+
+    @Override
+    public String toString() {
+        return "Software{" +
+            "imageId='" + imageId + '\'' +
+            ", cachedImage=" + cachedImage +
+            ", files=" + files +
+            ", packages=" + packages +
+            ", repositories=" + repositories +
+            ", options=" + getOptions() +
+            '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/software/SoftwareBuilder.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/software/SoftwareBuilder.java b/api/src/main/java/org/apache/provisionr/api/software/SoftwareBuilder.java
new file mode 100644
index 0000000..96e1e66
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/software/SoftwareBuilder.java
@@ -0,0 +1,89 @@
+/*
+ * 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.api.software;
+
+import org.apache.provisionr.api.util.BuilderWithOptions;
+import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import java.util.Map;
+
+public class SoftwareBuilder extends BuilderWithOptions<SoftwareBuilder> {
+
+    private String imageId = "default";
+    private boolean cachedImage = false;
+
+    private ImmutableMap.Builder<String, String> files = ImmutableMap.builder();
+    private ImmutableList.Builder<String> packages = ImmutableList.builder();
+    private ImmutableList.Builder<Repository> repositories = ImmutableList.builder();
+
+    @Override
+    protected SoftwareBuilder getThis() {
+        return this;
+    }
+
+    public SoftwareBuilder imageId(String imageId) {
+        this.imageId = checkNotNull(imageId, "The imageId was null");
+        return this;
+    }
+
+    public SoftwareBuilder cachedImage(boolean cachedImage) {
+        this.cachedImage = cachedImage;
+        return this;
+    }
+
+    public SoftwareBuilder files(Map<String, String> files) {
+        this.files = ImmutableMap.<String, String>builder().putAll(files);
+        return this;
+    }
+
+    public SoftwareBuilder file(String sourceUrl, String destinationPath) {
+        this.files.put(sourceUrl, destinationPath);
+        return this;
+    }
+
+    public SoftwareBuilder packages(Iterable<String> packages) {
+        this.packages = ImmutableList.<String>builder().addAll(packages);
+        return this;
+    }
+
+    public SoftwareBuilder packages(String... packages) {
+        this.packages = ImmutableList.<String>builder().addAll(Lists.newArrayList(packages));
+        return this;
+    }
+
+    public SoftwareBuilder addPackage(String pkg) {
+        this.packages.add(pkg);
+        return this;
+    }
+
+    public SoftwareBuilder repositories(Iterable<Repository> repositories) {
+        this.repositories = ImmutableList.<Repository>builder().addAll(repositories);
+        return this;
+    }
+
+    public SoftwareBuilder repository(Repository repository) {
+        this.repositories.add(repository);
+        return this;
+    }
+
+    public Software createSoftware() {
+        return new Software(imageId, cachedImage, files.build(), packages.build(),
+            repositories.build(), buildOptions());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/util/BuilderWithOptions.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/util/BuilderWithOptions.java b/api/src/main/java/org/apache/provisionr/api/util/BuilderWithOptions.java
new file mode 100644
index 0000000..97c9012
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/util/BuilderWithOptions.java
@@ -0,0 +1,89 @@
+/*
+ * 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.api.util;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.io.Closeables;
+import com.google.common.io.Resources;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Base class useful for creating builders for objects that accept
+ * an arbitrary map of options (key, value string pairs)
+ */
+public abstract class BuilderWithOptions<P extends BuilderWithOptions<P>> {
+
+    private ImmutableMap.Builder<String, String> options = ImmutableMap.builder();
+
+    /**
+     * Override this method to return 'this' to allow builder method chaining
+     */
+    protected abstract P getThis();
+
+    /**
+     * Replace options with the ones supplied as argument
+     */
+    public P options(Map<String, String> options) {
+        this.options = ImmutableMap.<String, String>builder().putAll(options);
+        return getThis();
+    }
+
+    /**
+     * Replace options with the ones extracted from the Properties object
+     */
+    public P options(Properties properties) {
+        this.options = ImmutableMap.builder();
+        for (String key : properties.stringPropertyNames()) {
+            options.put(key, properties.getProperty(key));
+        }
+        return getThis();
+    }
+
+    /**
+     * Load options from a properties file available as a resource on the classpath
+     */
+    public P optionsFromResource(String resource) {
+        Properties properties = new Properties();
+        ByteArrayInputStream in = null;
+        try {
+            in = new ByteArrayInputStream(Resources.toByteArray(Resources.getResource(resource)));
+            properties.load(in);
+            return options(properties);
+
+        } catch (IOException e) {
+            throw Throwables.propagate(e);
+        } finally {
+            Closeables.closeQuietly(in);
+        }
+    }
+
+    /**
+     * Add a new option
+     */
+    public P option(String key, String value) {
+        this.options.put(key, value);
+        return getThis();
+    }
+
+    protected Map<String, String> buildOptions() {
+        return options.build();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/main/java/org/apache/provisionr/api/util/WithOptions.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/provisionr/api/util/WithOptions.java b/api/src/main/java/org/apache/provisionr/api/util/WithOptions.java
new file mode 100644
index 0000000..668b6c5
--- /dev/null
+++ b/api/src/main/java/org/apache/provisionr/api/util/WithOptions.java
@@ -0,0 +1,44 @@
+/*
+ * 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.api.util;
+
+import com.google.common.base.Optional;
+import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.collect.ImmutableMap;
+import java.io.Serializable;
+import java.util.Map;
+
+public abstract class WithOptions implements Serializable {
+
+    private final Map<String, String> options;
+
+    public WithOptions(Map<String, String> options) {
+        this.options = ImmutableMap.copyOf(options);
+    }
+
+    public Map<String, String> getOptions() {
+        return options;
+    }
+
+    public String getOption(String key) {
+        return options.get(checkNotNull(key, "key is null"));
+    }
+
+    public String getOptionOr(String key, String value) {
+        return Optional.fromNullable(getOption(key)).or(value);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/com/axemblr/provisionr/api/AssertSerializable.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/com/axemblr/provisionr/api/AssertSerializable.java b/api/src/test/java/com/axemblr/provisionr/api/AssertSerializable.java
deleted file mode 100644
index b05fccd..0000000
--- a/api/src/test/java/com/axemblr/provisionr/api/AssertSerializable.java
+++ /dev/null
@@ -1,54 +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.api;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import static org.fest.assertions.api.Assertions.assertThat;
-
-/**
- * @see <a href="http://stackoverflow.com/questions/3840356" />
- */
-public class AssertSerializable {
-
-    public static <T extends Serializable> void assertSerializable(T instance, Class<T> klass) {
-        try {
-            assertThat(unpickle(pickle(instance), klass)).isEqualTo(instance);
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    private static <T extends Serializable> byte[] pickle(T instance) throws IOException {
-        ByteArrayOutputStream backingStream = new ByteArrayOutputStream();
-        ObjectOutputStream out = new ObjectOutputStream(backingStream);
-        out.writeObject(instance);
-        out.close();
-        return backingStream.toByteArray();
-    }
-
-    private static <T extends Serializable> T unpickle(byte[] bytes, Class<T> klass) throws IOException, ClassNotFoundException {
-        ByteArrayInputStream backingStream = new ByteArrayInputStream(bytes);
-        ObjectInputStream in = new ObjectInputStream(backingStream);
-        Object o = in.readObject();
-        return klass.cast(o);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/com/axemblr/provisionr/api/access/AdminAccessTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/com/axemblr/provisionr/api/access/AdminAccessTest.java b/api/src/test/java/com/axemblr/provisionr/api/access/AdminAccessTest.java
deleted file mode 100644
index d89b0b8..0000000
--- a/api/src/test/java/com/axemblr/provisionr/api/access/AdminAccessTest.java
+++ /dev/null
@@ -1,35 +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.api.access;
-
-import static com.axemblr.provisionr.api.AssertSerializable.assertSerializable;
-import static org.fest.assertions.api.Assertions.assertThat;
-import org.junit.Test;
-
-public class AdminAccessTest {
-
-    @Test
-    public void testSerialization() {
-        AdminAccess adminAccess = AdminAccess.builder().username("admin").publicKey("ssh-rsa AAAAB3N")
-            .privateKey("-----BEGIN RSA PRIVATE KEY-----\n").createAdminAccess();
-
-        assertThat(adminAccess.getUsername()).isEqualTo("admin");
-        assertThat(adminAccess.toBuilder().createAdminAccess()).isEqualTo(adminAccess);
-
-        assertSerializable(adminAccess, AdminAccess.class);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/com/axemblr/provisionr/api/network/NetworkTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/com/axemblr/provisionr/api/network/NetworkTest.java b/api/src/test/java/com/axemblr/provisionr/api/network/NetworkTest.java
deleted file mode 100644
index 24a99f1..0000000
--- a/api/src/test/java/com/axemblr/provisionr/api/network/NetworkTest.java
+++ /dev/null
@@ -1,42 +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.api.network;
-
-import static com.axemblr.provisionr.api.AssertSerializable.assertSerializable;
-import static org.fest.assertions.api.Assertions.assertThat;
-import org.junit.Test;
-
-public class NetworkTest {
-
-    @Test
-    public void testSerialization() {
-        final Rule sshRule = Rule.builder().anySource().port(22).tcp().createRule();
-
-        Network network = Network.builder().type("default")
-            .addRules(
-                sshRule,
-                Rule.builder().anySource().port(80).tcp().createRule(),
-                Rule.builder().anySource().protocol(Protocol.ICMP).createRule())
-            .createNetwork();
-
-        assertThat(network.getType()).isEqualTo("default");
-        assertThat(network.getIngress()).contains(sshRule);
-        assertThat(network.toBuilder().createNetwork()).isEqualTo(network);
-
-        assertSerializable(network, Network.class);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/com/axemblr/provisionr/api/network/RuleTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/com/axemblr/provisionr/api/network/RuleTest.java b/api/src/test/java/com/axemblr/provisionr/api/network/RuleTest.java
deleted file mode 100644
index 5e1afac..0000000
--- a/api/src/test/java/com/axemblr/provisionr/api/network/RuleTest.java
+++ /dev/null
@@ -1,31 +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.api.network;
-
-import static com.axemblr.provisionr.api.AssertSerializable.assertSerializable;
-import static org.fest.assertions.api.Assertions.assertThat;
-import org.junit.Test;
-
-public class RuleTest {
-
-    @Test
-    public void testSerialization() {
-        Rule rule = Rule.builder().anySource().port(80).protocol(Protocol.UDP).createRule();
-        assertThat(rule.toBuilder().createRule()).isEqualTo(rule);
-        assertSerializable(rule, Rule.class);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/com/axemblr/provisionr/api/pool/MachineTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/com/axemblr/provisionr/api/pool/MachineTest.java b/api/src/test/java/com/axemblr/provisionr/api/pool/MachineTest.java
deleted file mode 100644
index 1f0e69d..0000000
--- a/api/src/test/java/com/axemblr/provisionr/api/pool/MachineTest.java
+++ /dev/null
@@ -1,42 +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.api.pool;
-
-import static com.axemblr.provisionr.api.AssertSerializable.assertSerializable;
-import static org.fest.assertions.api.Assertions.assertThat;
-import org.junit.Test;
-
-public class MachineTest {
-
-    @Test
-    public void testSerialization() {
-        final Machine machine = Machine.builder()
-            .externalId("i-12345")
-            .publicDnsName("machine1.example.com")
-            .publicIp("62.231.75.237")
-            .privateDnsName("something.internal")
-            .privateIp("10.0.3.45")
-            .option("key", "value")
-            .createMachine();
-
-        assertThat(machine.getPrivateIp()).startsWith("10.0");
-        assertThat(machine.getSshPort()).isEqualTo(22);
-        assertThat(machine.toBuilder().createMachine()).isEqualTo(machine);
-
-        assertSerializable(machine, Machine.class);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/com/axemblr/provisionr/api/pool/PoolTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/com/axemblr/provisionr/api/pool/PoolTest.java b/api/src/test/java/com/axemblr/provisionr/api/pool/PoolTest.java
deleted file mode 100644
index 583ce70..0000000
--- a/api/src/test/java/com/axemblr/provisionr/api/pool/PoolTest.java
+++ /dev/null
@@ -1,67 +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.api.pool;
-
-import static com.axemblr.provisionr.api.AssertSerializable.assertSerializable;
-import static org.fest.assertions.api.Assertions.assertThat;
-
-import com.axemblr.provisionr.api.access.AdminAccess;
-import com.axemblr.provisionr.api.hardware.Hardware;
-import com.axemblr.provisionr.api.network.Network;
-import com.axemblr.provisionr.api.network.Rule;
-import com.axemblr.provisionr.api.provider.Provider;
-import com.axemblr.provisionr.api.software.Software;
-
-import org.junit.Test;
-
-public class PoolTest {
-
-    @Test
-    public void testSerialization() {
-        final Provider provider = Provider.builder()
-            .id("amazon").accessKey("access").secretKey("secret")
-            .createProvider();
-
-        final Network network = Network.builder().addRules(
-            Rule.builder().anySource().port(22).tcp().createRule(),
-            Rule.builder().anySource().port(8088).tcp().createRule()
-        ).createNetwork();
-
-        final AdminAccess adminAccess = AdminAccess.builder().username("admin").publicKey("ssh-rsa AAAAB3N")
-            .privateKey("-----BEGIN RSA PRIVATE KEY-----\n").createAdminAccess();
-
-        final Software software = Software.builder()
-            .packages("hadoop-0.20", "hadoop-0.20-native").createSoftware();
-
-        Pool pool = Pool.builder()
-            .provider(provider)
-            .network(network)
-            .adminAccess(adminAccess)
-            .software(software)
-            .hardware(Hardware.builder().type("large").createHardware())
-            .minSize(20)
-            .expectedSize(25)
-            .bootstrapTimeInSeconds(60 * 15)
-            .createPool();
-
-
-        assertThat(pool.getSoftware().getPackages()).contains("hadoop-0.20");
-        assertThat(pool.toBuilder().createPool()).isEqualTo(pool);
-
-        assertSerializable(pool, Pool.class);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/com/axemblr/provisionr/api/provider/ProviderTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/com/axemblr/provisionr/api/provider/ProviderTest.java b/api/src/test/java/com/axemblr/provisionr/api/provider/ProviderTest.java
deleted file mode 100644
index 0e42626..0000000
--- a/api/src/test/java/com/axemblr/provisionr/api/provider/ProviderTest.java
+++ /dev/null
@@ -1,38 +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.api.provider;
-
-import static com.axemblr.provisionr.api.AssertSerializable.assertSerializable;
-import static org.fest.assertions.api.Assertions.assertThat;
-import org.junit.Test;
-
-public class ProviderTest {
-
-    @Test
-    public void testSerialization() {
-        Provider provider = Provider.builder()
-            .id("aws-ec2").accessKey("access").secretKey("secret")
-            .option("location", "eu-west-1").createProvider();
-
-        assertThat(provider.getAccessKey()).isEqualTo("access");
-        assertThat(provider.getOptions()).containsKey("location");
-        assertThat(provider.toBuilder().createProvider()).isEqualTo(provider);
-
-        assertSerializable(provider, Provider.class);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/com/axemblr/provisionr/api/software/RepositoryTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/com/axemblr/provisionr/api/software/RepositoryTest.java b/api/src/test/java/com/axemblr/provisionr/api/software/RepositoryTest.java
deleted file mode 100644
index 0712fd0..0000000
--- a/api/src/test/java/com/axemblr/provisionr/api/software/RepositoryTest.java
+++ /dev/null
@@ -1,39 +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.api.software;
-
-import static com.axemblr.provisionr.api.AssertSerializable.assertSerializable;
-import static org.fest.assertions.api.Assertions.assertThat;
-import org.junit.Test;
-
-public class RepositoryTest {
-
-    @Test
-    public void testSerialization() {
-        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();
-
-        assertThat(repository.toBuilder().createRepository()).isEqualTo(repository);
-        assertSerializable(repository, Repository.class);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/com/axemblr/provisionr/api/software/SoftwareTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/com/axemblr/provisionr/api/software/SoftwareTest.java b/api/src/test/java/com/axemblr/provisionr/api/software/SoftwareTest.java
deleted file mode 100644
index 7179ed7..0000000
--- a/api/src/test/java/com/axemblr/provisionr/api/software/SoftwareTest.java
+++ /dev/null
@@ -1,49 +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.api.software;
-
-import static com.axemblr.provisionr.api.AssertSerializable.assertSerializable;
-import static org.fest.assertions.api.Assertions.assertThat;
-import org.junit.Test;
-
-public class SoftwareTest {
-
-    @Test
-    public void testSerialization() {
-        final 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();
-
-        Software software = Software.builder()
-            .imageId("default")
-            .repository(repository)
-            .packages("vim", "git-core", "bigtop-utils")
-            .file("http://bin.axemblr.com/something.tar.gz", "/root/something.tar.gz")
-            .option("provider", "specific")
-            .createSoftware();
-
-        assertThat(software.getImageId()).isEqualTo("default");
-        assertThat(software.toBuilder().createSoftware()).isEqualTo(software);
-
-        assertSerializable(software, Software.class);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/com/axemblr/provisionr/api/util/BuilderWithOptionsTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/com/axemblr/provisionr/api/util/BuilderWithOptionsTest.java b/api/src/test/java/com/axemblr/provisionr/api/util/BuilderWithOptionsTest.java
deleted file mode 100644
index acb4b1b..0000000
--- a/api/src/test/java/com/axemblr/provisionr/api/util/BuilderWithOptionsTest.java
+++ /dev/null
@@ -1,59 +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.api.util;
-
-import com.google.common.collect.ImmutableMap;
-import java.util.Properties;
-import static org.fest.assertions.api.Assertions.assertThat;
-import org.junit.Test;
-
-public class BuilderWithOptionsTest {
-
-    public static class TestBuilder extends BuilderWithOptions<TestBuilder> {
-        @Override
-        protected TestBuilder getThis() {
-            return this;
-        }
-    }
-
-    @Test
-    public void testSetOptionsFromMap() {
-        TestBuilder builder = new TestBuilder().options(ImmutableMap.of("K1", "V1", "K2", "V2"));
-        assertThat(builder.buildOptions()).containsKey("K2").containsValue("V1");
-    }
-
-    @Test
-    public void testSetSingleOption() {
-        TestBuilder builder = new TestBuilder().option("K1", "V1").option("K2", "V2");
-        assertThat(builder.buildOptions()).containsKey("K1").containsValue("V2");
-    }
-
-    @Test
-    public void testLoadOptionsFromProperties() {
-        Properties properties = new Properties();
-        properties.setProperty("K1", "V1");
-
-        TestBuilder builder = new TestBuilder().options(properties);
-        assertThat(builder.buildOptions()).containsKey("K1").containsValue("V1");
-    }
-
-    @Test
-    public void testLoadOptionsFromResource() {
-        TestBuilder builder = new TestBuilder().optionsFromResource("builder.properties");
-        assertThat(builder.buildOptions()).containsKey("key1").containsValue("value2");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/org/apache/provisionr/api/AssertSerializable.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/provisionr/api/AssertSerializable.java b/api/src/test/java/org/apache/provisionr/api/AssertSerializable.java
new file mode 100644
index 0000000..0252c7b
--- /dev/null
+++ b/api/src/test/java/org/apache/provisionr/api/AssertSerializable.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.api;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+/**
+ * @see <a href="http://stackoverflow.com/questions/3840356" />
+ */
+public class AssertSerializable {
+
+    public static <T extends Serializable> void assertSerializable(T instance, Class<T> klass) {
+        try {
+            assertThat(unpickle(pickle(instance), klass)).isEqualTo(instance);
+        } catch (Exception e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    private static <T extends Serializable> byte[] pickle(T instance) throws IOException {
+        ByteArrayOutputStream backingStream = new ByteArrayOutputStream();
+        ObjectOutputStream out = new ObjectOutputStream(backingStream);
+        out.writeObject(instance);
+        out.close();
+        return backingStream.toByteArray();
+    }
+
+    private static <T extends Serializable> T unpickle(byte[] bytes, Class<T> klass) throws IOException, ClassNotFoundException {
+        ByteArrayInputStream backingStream = new ByteArrayInputStream(bytes);
+        ObjectInputStream in = new ObjectInputStream(backingStream);
+        Object o = in.readObject();
+        return klass.cast(o);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/org/apache/provisionr/api/access/AdminAccessTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/provisionr/api/access/AdminAccessTest.java b/api/src/test/java/org/apache/provisionr/api/access/AdminAccessTest.java
new file mode 100644
index 0000000..5972bf0
--- /dev/null
+++ b/api/src/test/java/org/apache/provisionr/api/access/AdminAccessTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.api.access;
+
+import static org.apache.provisionr.api.AssertSerializable.assertSerializable;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+
+public class AdminAccessTest {
+
+    @Test
+    public void testSerialization() {
+        AdminAccess adminAccess = AdminAccess.builder().username("admin").publicKey("ssh-rsa AAAAB3N")
+            .privateKey("-----BEGIN RSA PRIVATE KEY-----\n").createAdminAccess();
+
+        assertThat(adminAccess.getUsername()).isEqualTo("admin");
+        assertThat(adminAccess.toBuilder().createAdminAccess()).isEqualTo(adminAccess);
+
+        assertSerializable(adminAccess, AdminAccess.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/org/apache/provisionr/api/network/NetworkTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/provisionr/api/network/NetworkTest.java b/api/src/test/java/org/apache/provisionr/api/network/NetworkTest.java
new file mode 100644
index 0000000..acf7cf4
--- /dev/null
+++ b/api/src/test/java/org/apache/provisionr/api/network/NetworkTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.api.network;
+
+import static org.apache.provisionr.api.AssertSerializable.assertSerializable;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+
+public class NetworkTest {
+
+    @Test
+    public void testSerialization() {
+        final Rule sshRule = Rule.builder().anySource().port(22).tcp().createRule();
+
+        Network network = Network.builder().type("default")
+            .addRules(
+                sshRule,
+                Rule.builder().anySource().port(80).tcp().createRule(),
+                Rule.builder().anySource().protocol(Protocol.ICMP).createRule())
+            .createNetwork();
+
+        assertThat(network.getType()).isEqualTo("default");
+        assertThat(network.getIngress()).contains(sshRule);
+        assertThat(network.toBuilder().createNetwork()).isEqualTo(network);
+
+        assertSerializable(network, Network.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/org/apache/provisionr/api/network/RuleTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/provisionr/api/network/RuleTest.java b/api/src/test/java/org/apache/provisionr/api/network/RuleTest.java
new file mode 100644
index 0000000..b212292
--- /dev/null
+++ b/api/src/test/java/org/apache/provisionr/api/network/RuleTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.api.network;
+
+import static org.apache.provisionr.api.AssertSerializable.assertSerializable;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+
+public class RuleTest {
+
+    @Test
+    public void testSerialization() {
+        Rule rule = Rule.builder().anySource().port(80).protocol(Protocol.UDP).createRule();
+        assertThat(rule.toBuilder().createRule()).isEqualTo(rule);
+        assertSerializable(rule, Rule.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/org/apache/provisionr/api/pool/MachineTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/provisionr/api/pool/MachineTest.java b/api/src/test/java/org/apache/provisionr/api/pool/MachineTest.java
new file mode 100644
index 0000000..18e764c
--- /dev/null
+++ b/api/src/test/java/org/apache/provisionr/api/pool/MachineTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.api.pool;
+
+import static org.apache.provisionr.api.AssertSerializable.assertSerializable;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+
+public class MachineTest {
+
+    @Test
+    public void testSerialization() {
+        final Machine machine = Machine.builder()
+            .externalId("i-12345")
+            .publicDnsName("machine1.example.com")
+            .publicIp("62.231.75.237")
+            .privateDnsName("something.internal")
+            .privateIp("10.0.3.45")
+            .option("key", "value")
+            .createMachine();
+
+        assertThat(machine.getPrivateIp()).startsWith("10.0");
+        assertThat(machine.getSshPort()).isEqualTo(22);
+        assertThat(machine.toBuilder().createMachine()).isEqualTo(machine);
+
+        assertSerializable(machine, Machine.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/org/apache/provisionr/api/pool/PoolTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/provisionr/api/pool/PoolTest.java b/api/src/test/java/org/apache/provisionr/api/pool/PoolTest.java
new file mode 100644
index 0000000..3c83d31
--- /dev/null
+++ b/api/src/test/java/org/apache/provisionr/api/pool/PoolTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.api.pool;
+
+import static org.apache.provisionr.api.AssertSerializable.assertSerializable;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.apache.provisionr.api.access.AdminAccess;
+import org.apache.provisionr.api.hardware.Hardware;
+import org.apache.provisionr.api.network.Network;
+import org.apache.provisionr.api.network.Rule;
+import org.apache.provisionr.api.provider.Provider;
+import org.apache.provisionr.api.software.Software;
+
+import org.junit.Test;
+
+public class PoolTest {
+
+    @Test
+    public void testSerialization() {
+        final Provider provider = Provider.builder()
+            .id("amazon").accessKey("access").secretKey("secret")
+            .createProvider();
+
+        final Network network = Network.builder().addRules(
+            Rule.builder().anySource().port(22).tcp().createRule(),
+            Rule.builder().anySource().port(8088).tcp().createRule()
+        ).createNetwork();
+
+        final AdminAccess adminAccess = AdminAccess.builder().username("admin").publicKey("ssh-rsa AAAAB3N")
+            .privateKey("-----BEGIN RSA PRIVATE KEY-----\n").createAdminAccess();
+
+        final Software software = Software.builder()
+            .packages("hadoop-0.20", "hadoop-0.20-native").createSoftware();
+
+        Pool pool = Pool.builder()
+            .provider(provider)
+            .network(network)
+            .adminAccess(adminAccess)
+            .software(software)
+            .hardware(Hardware.builder().type("large").createHardware())
+            .minSize(20)
+            .expectedSize(25)
+            .bootstrapTimeInSeconds(60 * 15)
+            .createPool();
+
+
+        assertThat(pool.getSoftware().getPackages()).contains("hadoop-0.20");
+        assertThat(pool.toBuilder().createPool()).isEqualTo(pool);
+
+        assertSerializable(pool, Pool.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/org/apache/provisionr/api/provider/ProviderTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/provisionr/api/provider/ProviderTest.java b/api/src/test/java/org/apache/provisionr/api/provider/ProviderTest.java
new file mode 100644
index 0000000..0e43d2d
--- /dev/null
+++ b/api/src/test/java/org/apache/provisionr/api/provider/ProviderTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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.api.provider;
+
+import static org.apache.provisionr.api.AssertSerializable.assertSerializable;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+
+public class ProviderTest {
+
+    @Test
+    public void testSerialization() {
+        Provider provider = Provider.builder()
+            .id("aws-ec2").accessKey("access").secretKey("secret")
+            .option("location", "eu-west-1").createProvider();
+
+        assertThat(provider.getAccessKey()).isEqualTo("access");
+        assertThat(provider.getOptions()).containsKey("location");
+        assertThat(provider.toBuilder().createProvider()).isEqualTo(provider);
+
+        assertSerializable(provider, Provider.class);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/org/apache/provisionr/api/software/RepositoryTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/provisionr/api/software/RepositoryTest.java b/api/src/test/java/org/apache/provisionr/api/software/RepositoryTest.java
new file mode 100644
index 0000000..69009b1
--- /dev/null
+++ b/api/src/test/java/org/apache/provisionr/api/software/RepositoryTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.api.software;
+
+import static org.apache.provisionr.api.AssertSerializable.assertSerializable;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+
+public class RepositoryTest {
+
+    @Test
+    public void testSerialization() {
+        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();
+
+        assertThat(repository.toBuilder().createRepository()).isEqualTo(repository);
+        assertSerializable(repository, Repository.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/org/apache/provisionr/api/software/SoftwareTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/provisionr/api/software/SoftwareTest.java b/api/src/test/java/org/apache/provisionr/api/software/SoftwareTest.java
new file mode 100644
index 0000000..10f125b
--- /dev/null
+++ b/api/src/test/java/org/apache/provisionr/api/software/SoftwareTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.api.software;
+
+import static org.apache.provisionr.api.AssertSerializable.assertSerializable;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+
+public class SoftwareTest {
+
+    @Test
+    public void testSerialization() {
+        final 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();
+
+        Software software = Software.builder()
+            .imageId("default")
+            .repository(repository)
+            .packages("vim", "git-core", "bigtop-utils")
+            .file("http://provisionr.incubator.apache.org/something.tar.gz", "/root/something.tar.gz")
+            .option("provider", "specific")
+            .createSoftware();
+
+        assertThat(software.getImageId()).isEqualTo("default");
+        assertThat(software.toBuilder().createSoftware()).isEqualTo(software);
+
+        assertSerializable(software, Software.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/api/src/test/java/org/apache/provisionr/api/util/BuilderWithOptionsTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/provisionr/api/util/BuilderWithOptionsTest.java b/api/src/test/java/org/apache/provisionr/api/util/BuilderWithOptionsTest.java
new file mode 100644
index 0000000..95f37f3
--- /dev/null
+++ b/api/src/test/java/org/apache/provisionr/api/util/BuilderWithOptionsTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.api.util;
+
+import com.google.common.collect.ImmutableMap;
+import java.util.Properties;
+import static org.fest.assertions.api.Assertions.assertThat;
+import org.junit.Test;
+
+public class BuilderWithOptionsTest {
+
+    public static class TestBuilder extends BuilderWithOptions<TestBuilder> {
+        @Override
+        protected TestBuilder getThis() {
+            return this;
+        }
+    }
+
+    @Test
+    public void testSetOptionsFromMap() {
+        TestBuilder builder = new TestBuilder().options(ImmutableMap.of("K1", "V1", "K2", "V2"));
+        assertThat(builder.buildOptions()).containsKey("K2").containsValue("V1");
+    }
+
+    @Test
+    public void testSetSingleOption() {
+        TestBuilder builder = new TestBuilder().option("K1", "V1").option("K2", "V2");
+        assertThat(builder.buildOptions()).containsKey("K1").containsValue("V2");
+    }
+
+    @Test
+    public void testLoadOptionsFromProperties() {
+        Properties properties = new Properties();
+        properties.setProperty("K1", "V1");
+
+        TestBuilder builder = new TestBuilder().options(properties);
+        assertThat(builder.buildOptions()).containsKey("K1").containsValue("V1");
+    }
+
+    @Test
+    public void testLoadOptionsFromResource() {
+        TestBuilder builder = new TestBuilder().optionsFromResource("builder.properties");
+        assertThat(builder.buildOptions()).containsKey("key1").containsValue("value2");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/console/pom.xml
----------------------------------------------------------------------
diff --git a/console/pom.xml b/console/pom.xml
index c0d08d3..14bee96 100644
--- a/console/pom.xml
+++ b/console/pom.xml
@@ -15,16 +15,17 @@
   ~ limitations under the License.
   -->
 
-<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">
+<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>
-        <groupId>com.axemblr.provisionr</groupId>
+        <groupId>org.apache.provisionr</groupId>
         <artifactId>provisionr-parent</artifactId>
         <version>0.4.0-SNAPSHOT</version>
         <relativePath>../parent</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <name>Axemblr Provisionr :: Web Console &amp; REST API</name>
+    <name>Apache Provisionr :: Web Console &amp; REST API</name>
     <description>A basic web console and a REST API</description>
 
     <artifactId>provisionr-console</artifactId>
@@ -32,11 +33,11 @@
 
     <dependencies>
         <dependency>
-            <groupId>com.axemblr.provisionr</groupId>
+            <groupId>org.apache.provisionr</groupId>
             <artifactId>provisionr-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.axemblr.provisionr</groupId>
+            <groupId>org.apache.provisionr</groupId>
             <artifactId>provisionr-core</artifactId>
         </dependency>
     </dependencies>
@@ -74,7 +75,7 @@
                                     <classifier>features</classifier>
                                 </artifact>
                                 <artifact>
-                                    <file>${project.build.directory}/classes/com.axemblr.provisionr.console.cfg</file>
+                                    <file>${project.build.directory}/classes/org.apache.provisionr.console.cfg</file>
                                     <type>cfg</type>
                                     <classifier>defaults</classifier>
                                 </artifact>
@@ -100,7 +101,7 @@
                                 <descriptor>file:${project.build.directory}/classes/features.xml</descriptor>
                             </descriptors>
                             <features>
-                                <feature>axemblr-provisionr-console</feature>
+                                <feature>provisionr-console</feature>
                             </features>
                             <repository>target/features-repo</repository>
                         </configuration>

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/console/src/main/java/com/axemblr/provisionr/client/ProvisionrClient.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/com/axemblr/provisionr/client/ProvisionrClient.java b/console/src/main/java/com/axemblr/provisionr/client/ProvisionrClient.java
deleted file mode 100644
index 03be678..0000000
--- a/console/src/main/java/com/axemblr/provisionr/client/ProvisionrClient.java
+++ /dev/null
@@ -1,34 +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.client;
-
-import com.axemblr.provisionr.api.Provisionr;
-import static com.google.common.base.Preconditions.checkNotNull;
-import java.util.List;
-
-public class ProvisionrClient {
-
-    private final List<Provisionr> services;
-
-    public ProvisionrClient(List<Provisionr> services) {
-        this.services = checkNotNull(services, "services is null");
-    }
-
-    public List<Provisionr> getServices() {
-        return services;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/6ba40c4b/console/src/main/java/org/apache/provisionr/client/ProvisionrClient.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/provisionr/client/ProvisionrClient.java b/console/src/main/java/org/apache/provisionr/client/ProvisionrClient.java
new file mode 100644
index 0000000..64ca3d6
--- /dev/null
+++ b/console/src/main/java/org/apache/provisionr/client/ProvisionrClient.java
@@ -0,0 +1,34 @@
+/*
+ * 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.client;
+
+import org.apache.provisionr.api.Provisionr;
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.util.List;
+
+public class ProvisionrClient {
+
+    private final List<Provisionr> services;
+
+    public ProvisionrClient(List<Provisionr> services) {
+        this.services = checkNotNull(services, "services is null");
+    }
+
+    public List<Provisionr> getServices() {
+        return services;
+    }
+}


Mime
View raw message