You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2015/04/13 11:50:52 UTC

[1/2] jclouds-labs git commit: JClouds Profitbricks provider - LoadBalancer API

Repository: jclouds-labs
Updated Branches:
  refs/heads/master 29435e1c3 -> 823df74ff


http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerResponseHandlerTest.java
new file mode 100644
index 0000000..365383b
--- /dev/null
+++ b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerResponseHandlerTest.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.http.parser.loadbalancer;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import org.jclouds.date.DateCodec;
+import org.jclouds.date.DateCodecFactory;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.profitbricks.domain.Firewall;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+import org.jclouds.profitbricks.domain.LoadBalancer.Algorithm;
+import org.jclouds.profitbricks.domain.ProvisioningState;
+import org.jclouds.profitbricks.domain.Server;
+import org.jclouds.profitbricks.domain.Storage;
+import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "LoadBalancerResponseHandlerTest")
+public class LoadBalancerResponseHandlerTest extends BaseResponseHandlerTest<LoadBalancer> {
+
+   @Override
+   protected ParseSax<LoadBalancer> createParser() {
+      return factory.create(injector.getInstance(LoadBalancerResponseHandler.class));
+   }
+
+   protected DateCodecFactory createDateParser() {
+      return injector.getInstance(DateCodecFactory.class);
+   }
+
+   @Test
+   public void testParseResponseFromGetLoadbalancer() {
+      ParseSax<LoadBalancer> parser = createParser();
+
+      LoadBalancer actual = parser.parse(payloadFromResource("/loadbalancer/loadbalancer.xml"));
+      assertNotNull(actual, "Parsed content returned null");
+
+      DateCodec dateParser = createDateParser().iso8601();
+
+      List<Storage> emptyStorages = Lists.newArrayList();
+
+      List<Server> balancedServers = Lists.newArrayList();
+      balancedServers.add(Server.builder()
+              .activate(true)
+              .balancedNicId("balanced-nic-id")
+              .id("server-id")
+              .name("server-name")
+              .storages(emptyStorages)
+              .build());
+      List<Firewall> firewalls = Lists.newArrayList();
+      firewalls.add(Firewall.builder()
+              .id("firewall-id")
+              .nicId("nic-id")
+              .active(false)
+              .state(ProvisioningState.AVAILABLE)
+              .build());
+
+      LoadBalancer expected = LoadBalancer.builder()
+              .id("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
+              .loadBalancerAlgorithm(Algorithm.ROUND_ROBIN)
+              .name("load-balancer-name")
+              .dataCenterId("datacenter-id")
+              .dataCenterVersion("datacenter-version")
+              .internetAccess(true)
+              .ip("192.168.0.1")
+              .lanId("lan-id")
+              .state(ProvisioningState.AVAILABLE)
+              .creationTime(dateParser.toDate("2014-12-12T03:08:35.629Z"))
+              .lastModificationTime(dateParser.toDate("2014-12-12T03:08:35.629Z"))
+              .firewalls(firewalls)
+              .balancedServers(balancedServers)
+              .build();
+
+      assertEquals(actual, expected);
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerInfoResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerInfoResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerInfoResponseHandlerTest.java
index eb8feb9..88124e7 100644
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerInfoResponseHandlerTest.java
+++ b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerInfoResponseHandlerTest.java
@@ -74,6 +74,8 @@ public class ServerInfoResponseHandlerTest extends BaseResponseHandlerTest<Serve
               .isNicHotUnPlug(true)
               .isDiscVirtioHotPlug(true)
               .isDiscVirtioHotUnPlug(true)
+              .activate(true)
+              .balancedNicId("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
               .storages(ImmutableList.<Storage>of(
                               Storage.builder()
                               .bootDevice(Boolean.TRUE)

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerListResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerListResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerListResponseHandlerTest.java
index 9f759cf..1442ba9 100644
--- a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerListResponseHandlerTest.java
+++ b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/server/ServerListResponseHandlerTest.java
@@ -77,6 +77,8 @@ public class ServerListResponseHandlerTest extends BaseResponseHandlerTest<List<
               .isNicHotUnPlug(true)
               .isDiscVirtioHotPlug(true)
               .isDiscVirtioHotUnPlug(true)
+              .activate(true)
+              .balancedNicId("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
               .storages(ImmutableList.<Storage>of(
                               Storage.builder()
                               .bootDevice(Boolean.TRUE)
@@ -128,6 +130,8 @@ public class ServerListResponseHandlerTest extends BaseResponseHandlerTest<List<
               .isNicHotUnPlug(true)
               .isDiscVirtioHotPlug(true)
               .isDiscVirtioHotUnPlug(true)
+              .activate(true)
+              .balancedNicId("qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh")
               .storages(ImmutableList.<Storage>of(
                               Storage.builder()
                               .bootDevice(Boolean.TRUE)

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/resources/loadbalancer/loadbalancer-create.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/loadbalancer/loadbalancer-create.xml b/profitbricks/src/test/resources/loadbalancer/loadbalancer-create.xml
new file mode 100644
index 0000000..14ad678
--- /dev/null
+++ b/profitbricks/src/test/resources/loadbalancer/loadbalancer-create.xml
@@ -0,0 +1,17 @@
+<soapenv:Envelope
+  xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
+  xmlns:ws='http://ws.api.profitbricks.com/'>
+    <soapenv:Header />
+    <soapenv:Body>
+        <ws:createLoadBalancer>
+            <request>
+                <dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</dataCenterId>
+                <loadBalancerName>load-balancer-name</loadBalancerName>
+                <loadBalancerAlgorithm>ROUND_ROBIN</loadBalancerAlgorithm>
+                <ip>192.168.0.1</ip>
+                <lanId>lan-id</lanId>
+                <serverIds>server-ids</serverIds>
+            </request>
+        </ws:createLoadBalancer>
+    </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/resources/loadbalancer/loadbalancer-delete.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/loadbalancer/loadbalancer-delete.xml b/profitbricks/src/test/resources/loadbalancer/loadbalancer-delete.xml
new file mode 100644
index 0000000..b699be6
--- /dev/null
+++ b/profitbricks/src/test/resources/loadbalancer/loadbalancer-delete.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
+  <S:Body>
+    <ns2:deleteLoadBalancerResponse xmlns:ns2="http://ws.api.profitbricks.com/">
+      <return>
+        <requestId>request-id</requestId>
+        <dataCenterId>datacenter-id</dataCenterId>
+        <dataCenterVersion>datacenter-version</dataCenterVersion>
+      </return>
+    </ns2:deleteLoadBalancerResponse>
+  </S:Body>
+</S:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/resources/loadbalancer/loadbalancer-deregister.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/loadbalancer/loadbalancer-deregister.xml b/profitbricks/src/test/resources/loadbalancer/loadbalancer-deregister.xml
new file mode 100644
index 0000000..ee03c47
--- /dev/null
+++ b/profitbricks/src/test/resources/loadbalancer/loadbalancer-deregister.xml
@@ -0,0 +1,14 @@
+<soapenv:Envelope
+  xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
+  xmlns:ws='http://ws.api.profitbricks.com/'>
+    <soapenv:Header />
+    <soapenv:Body>
+        <ws:deregisterServersOnLoadBalancer>
+			<request>
+                <serverIds>1</serverIds>
+                <serverIds>2</serverIds>
+                <loadBalancerId>load-balancer-id</loadBalancerId>
+			<request>
+        </ws:deregisterServersOnLoadBalancer>
+    </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/resources/loadbalancer/loadbalancer-register.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/loadbalancer/loadbalancer-register.xml b/profitbricks/src/test/resources/loadbalancer/loadbalancer-register.xml
new file mode 100644
index 0000000..48a1ff1
--- /dev/null
+++ b/profitbricks/src/test/resources/loadbalancer/loadbalancer-register.xml
@@ -0,0 +1,13 @@
+<soapenv:Envelope
+  xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
+  xmlns:ws='http://ws.api.profitbricks.com/'>
+    <soapenv:Header/>
+    <soapenv:Body>
+        <ws:registerServersOnLoadBalancer>
+			<request>
+                <serverIds>1234</serverIds>
+                <loadBalancerId>load-balancer-id</loadBalancerId>
+			</request>
+        </ws:registerServersOnLoadBalancer>
+    </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/resources/loadbalancer/loadbalancer-update.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/loadbalancer/loadbalancer-update.xml b/profitbricks/src/test/resources/loadbalancer/loadbalancer-update.xml
new file mode 100644
index 0000000..7a39dea
--- /dev/null
+++ b/profitbricks/src/test/resources/loadbalancer/loadbalancer-update.xml
@@ -0,0 +1,15 @@
+<soapenv:Envelope
+  xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
+  xmlns:ws='http://ws.api.profitbricks.com/'>
+    <soapenv:Header />
+    <soapenv:Body>
+        <ws:updateLoadBalancer>
+            <request>
+                <loadBalancerId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</loadBalancerId>
+                <loadBalancerName>load-balancer-name</loadBalancerName>
+                <loadBalancerAlgorithm>ROUND_ROBIN</loadBalancerAlgorithm>
+                <ip>192.168.0.1</ip>              
+            </request>
+        </ws:updateLoadBalancer>
+    </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/resources/loadbalancer/loadbalancer.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/loadbalancer/loadbalancer.xml b/profitbricks/src/test/resources/loadbalancer/loadbalancer.xml
new file mode 100644
index 0000000..501e470
--- /dev/null
+++ b/profitbricks/src/test/resources/loadbalancer/loadbalancer.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
+    <S:Body>
+        <ns2:getLoadBalancerResponse xmlns:ns2="http://ws.api.profitbricks.com/">
+            <return>
+                <dataCenterId>datacenter-id</dataCenterId>
+                <dataCenterVersion>datacenter-version</dataCenterVersion>
+                <loadBalancerId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</loadBalancerId>
+                <loadBalancerName>load-balancer-name</loadBalancerName>
+                <loadBalancerAlgorithm>ROUND_ROBIN</loadBalancerAlgorithm>
+                <internetAccess>true</internetAccess>
+                <ip>192.168.0.1</ip>
+                <lanId>lan-id</lanId>
+                <balancedServers>
+                    <activate>true</activate>
+                    <balancedNicId>balanced-nic-id</balancedNicId>
+                    <serverId>server-id</serverId>
+                    <serverName>server-name</serverName>
+                </balancedServers>
+                <provisioningState>AVAILABLE</provisioningState>
+                <creationTime>2014-12-12T03:08:35.629Z</creationTime>
+                <lastModificationTime>2014-12-12T03:08:35.629Z</lastModificationTime>
+                <firewall>
+                    <active>false</active>
+                    <firewallId>firewall-id</firewallId>
+                    <nicId>nic-id</nicId>
+                    <provisioningState>AVAILABLE</provisioningState>
+                </firewall>
+            </return>
+        </ns2:getLoadBalancerResponse>
+    </S:Body>
+</S:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/resources/loadbalancer/loadbalancers.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/loadbalancer/loadbalancers.xml b/profitbricks/src/test/resources/loadbalancer/loadbalancers.xml
new file mode 100644
index 0000000..155a1e3
--- /dev/null
+++ b/profitbricks/src/test/resources/loadbalancer/loadbalancers.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
+    <S:Body>
+        <ns2:getAllLoadBalancersResponse xmlns:ns2="http://ws.api.profitbricks.com/">
+            <return>
+                <dataCenterId>datacenter-id</dataCenterId>
+                <dataCenterVersion>datacenter-version</dataCenterVersion>
+                <loadBalancerId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</loadBalancerId>
+                <loadBalancerName>load-1234567890-name</loadBalancerName>
+                <loadBalancerAlgorithm>ROUND_ROBIN</loadBalancerAlgorithm>
+                <internetAccess>true</internetAccess>
+                <ip>192.168.0.1</ip>
+                <lanId>lan-id</lanId>
+                <balancedServers>
+                    <activate>true</activate>
+                    <balancedNicId>balanced-nic-id</balancedNicId>
+                    <serverId>server-id</serverId>
+                    <serverName>server-name</serverName>
+                </balancedServers>
+                <provisioningState>AVAILABLE</provisioningState>
+                <creationTime>2014-12-04T07:09:23.138Z</creationTime>
+                <lastModificationTime>2014-12-04T07:09:23.138Z</lastModificationTime>
+                <firewall>
+                    <active>false</active>
+                    <firewallId>firewall-id</firewallId>
+                    <nicId>nic-id</nicId>
+                    <provisioningState>AVAILABLE</provisioningState>
+                </firewall>
+            </return>
+            <return>
+                <dataCenterId>datacenter-id</dataCenterId>
+                <dataCenterVersion>datacenter-version</dataCenterVersion>
+                <loadBalancerId>qqqqqqqq-wwww-rrrr-tttt-yyyyyyyyyyyy</loadBalancerId>
+                <loadBalancerName>load-balancer-name</loadBalancerName>
+                <loadBalancerAlgorithm>ROUND_ROBIN</loadBalancerAlgorithm>
+                <internetAccess>false</internetAccess>
+                <ip>192.168.0.1</ip>
+                <lanId>lan-id</lanId>
+                <balancedServers>
+                    <activate>false</activate>
+                    <balancedNicId>balanced-nic-id</balancedNicId>
+                    <serverId>server-id</serverId>
+                    <serverName>server-name</serverName>
+                </balancedServers>
+                <provisioningState>AVAILABLE</provisioningState>
+                <creationTime>2014-12-04T07:09:23.138Z</creationTime>
+                <lastModificationTime>2014-12-04T07:09:23.138Z</lastModificationTime>
+                <firewall>
+                    <active>false</active>
+                    <firewallId>firewall-id</firewallId>
+                    <nicId>nic-id</nicId>
+                    <provisioningState>AVAILABLE</provisioningState>
+                </firewall>
+            </return>
+        </ns2:getAllLoadBalancersResponse>
+    </S:Body>
+</S:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/resources/server/server.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/server/server.xml b/profitbricks/src/test/resources/server/server.xml
index 8fac75d..33fa824 100644
--- a/profitbricks/src/test/resources/server/server.xml
+++ b/profitbricks/src/test/resources/server/server.xml
@@ -12,6 +12,8 @@
                 <ram>4096</ram>
                 <internetAccess>true</internetAccess>
                 <ips>173.252.120.6</ips>
+				<balancedNicId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</balancedNicId>
+				<activate>true</activate>
                 <connectedStorages>
                     <bootDevice>true</bootDevice>
                     <busType>VIRTIO</busType>

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/resources/server/servers.xml
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/resources/server/servers.xml b/profitbricks/src/test/resources/server/servers.xml
index 5da090f..d38bc67 100644
--- a/profitbricks/src/test/resources/server/servers.xml
+++ b/profitbricks/src/test/resources/server/servers.xml
@@ -11,6 +11,8 @@
                 <ram>4096</ram>
                 <internetAccess>true</internetAccess>
                 <ips>173.252.120.6</ips>
+                <balancedNicId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</balancedNicId>
+                <activate>true</activate>
                 <connectedStorages>
                     <bootDevice>true</bootDevice>
                     <busType>VIRTIO</busType>
@@ -60,6 +62,8 @@
                 <ram>1024</ram>
                 <internetAccess>false</internetAccess>
                 <ips>202.69.181.241</ips>
+                <balancedNicId>qswdefrg-qaws-qaws-defe-rgrgdsvcxbrh</balancedNicId>
+                <activate>true</activate>
                 <connectedStorages>
                     <bootDevice>true</bootDevice>
                     <busType>VIRTIO</busType>


[2/2] jclouds-labs git commit: JClouds Profitbricks provider - LoadBalancer API

Posted by na...@apache.org.
JClouds Profitbricks provider - LoadBalancer API


Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/823df74f
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/823df74f
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/823df74f

Branch: refs/heads/master
Commit: 823df74ff86834694874fc2533f78498dc4b67f7
Parents: 29435e1
Author: jasminSPC <ja...@stackpointcloud.com>
Authored: Fri Apr 10 15:29:06 2015 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Mon Apr 13 11:46:55 2015 +0200

----------------------------------------------------------------------
 .../jclouds/profitbricks/ProfitBricksApi.java   |   5 +
 .../CreateLoadBalancerRequestBinder.java        |  51 +++
 .../DeregisterLoadBalancerRequestBinder.java    |  45 ++
 .../RegisterLoadBalancerRequestBinder.java      |  47 +++
 .../UpdateLoadBalancerRequestBinder.java        |  44 ++
 .../profitbricks/domain/LoadBalancer.java       | 406 +++++++++++++++++++
 .../org/jclouds/profitbricks/domain/Server.java |  27 +-
 .../profitbricks/features/LoadBalancerApi.java  |  90 ++++
 .../firewall/FirewallListResponseHandler.java   |   9 +-
 .../BaseLoadBalancerResponseHandler.java        | 111 +++++
 .../LoadBalancerListResponseHandler.java        |  70 ++++
 .../LoadBalancerResponseHandler.java            |  65 +++
 .../server/BaseServerResponseHandler.java       |  20 +-
 .../server/ServerListResponseHandler.java       |   2 +-
 .../CreateLoadBalancerRequestBinderTest.java    |  54 +++
 ...DeregisterLoadBalancerRequestBinderTest.java |  52 +++
 .../RegisterLoadBalancerRequestBinderTest.java  |  52 +++
 .../UpdateLoadBalancerRequestBinderTest.java    |  54 +++
 .../features/LoadbalancerApiLiveTest.java       | 135 ++++++
 .../features/LoadbalancerApiMockTest.java       | 285 +++++++++++++
 .../LoadBalancerListResponseHandlerTest.java    |  75 ++++
 .../LoadBalancerResponseHandlerTest.java        |  93 +++++
 .../server/ServerInfoResponseHandlerTest.java   |   2 +
 .../server/ServerListResponseHandlerTest.java   |   4 +
 .../loadbalancer/loadbalancer-create.xml        |  17 +
 .../loadbalancer/loadbalancer-delete.xml        |  12 +
 .../loadbalancer/loadbalancer-deregister.xml    |  14 +
 .../loadbalancer/loadbalancer-register.xml      |  13 +
 .../loadbalancer/loadbalancer-update.xml        |  15 +
 .../resources/loadbalancer/loadbalancer.xml     |  32 ++
 .../resources/loadbalancer/loadbalancers.xml    |  57 +++
 .../src/test/resources/server/server.xml        |   2 +
 .../src/test/resources/server/servers.xml       |   4 +
 33 files changed, 1950 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java b/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java
index 12da7ea..8755ed9 100644
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksApi.java
@@ -21,7 +21,9 @@ import org.jclouds.profitbricks.features.DataCenterApi;
 import org.jclouds.profitbricks.features.DrivesApi;
 import org.jclouds.profitbricks.features.FirewallApi;
 import org.jclouds.profitbricks.features.ImageApi;
+
 import org.jclouds.profitbricks.features.IpBlockApi;
+import org.jclouds.profitbricks.features.LoadBalancerApi;
 import org.jclouds.profitbricks.features.NicApi;
 import org.jclouds.profitbricks.features.ServerApi;
 import org.jclouds.profitbricks.features.SnapshotApi;
@@ -56,4 +58,7 @@ public interface ProfitBricksApi extends Closeable {
 
    @Delegate
    DrivesApi drivesApi();
+
+   @Delegate
+   LoadBalancerApi loadBalancerApi();
 }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinder.java
new file mode 100644
index 0000000..23e121e
--- /dev/null
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinder.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.binder.loadbalancer;
+
+import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+
+import static java.lang.String.format;
+
+public class CreateLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.CreatePayload> {
+
+   protected final StringBuilder requestBuilder;
+
+   CreateLoadBalancerRequestBinder() {
+      super("loadbalancer");
+      this.requestBuilder = new StringBuilder(128 * 4);
+   }
+
+   @Override
+   protected String createPayload(LoadBalancer.Request.CreatePayload payload) {
+      requestBuilder.append("<ws:createLoadBalancer>")
+              .append("<request>")
+              .append(format("<dataCenterId>%s</dataCenterId>", payload.dataCenterId()))
+              .append(format("<loadBalancerName>%s</loadBalancerName>", payload.loadBalancerName()))
+              .append(format("<loadBalancerAlgorithm>%s</loadBalancerAlgorithm>", payload.loadBalancerAlgorithm()))
+              .append(format("<ip>%s</ip>", payload.ip()))
+              .append(format("<lanId>%s</lanId>", payload.lanId()));
+      for (String serverId : payload.serverIds()) {
+         requestBuilder.append(format("<serverIds>%s</serverIds>", serverId));
+      }
+      requestBuilder
+              .append("</request>")
+              .append("</ws:createLoadBalancer>");
+
+      return requestBuilder.toString();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinder.java
new file mode 100644
index 0000000..92f2868
--- /dev/null
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinder.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.binder.loadbalancer;
+
+import static java.lang.String.format;
+import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+
+public class DeregisterLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.DeregisterPayload> {
+
+   protected final StringBuilder requestBuilder;
+
+   DeregisterLoadBalancerRequestBinder() {
+      super("loadbalancer");
+      this.requestBuilder = new StringBuilder(128 * 4);
+   }
+
+   @Override
+   protected String createPayload(LoadBalancer.Request.DeregisterPayload payload) {
+      requestBuilder.append("<ws:deregisterServersOnLoadBalancer>")
+              .append("<request>");
+      for (String s : payload.serverIds()) {
+         requestBuilder.append(format("<serverIds>%s</serverIds>", s));
+      }
+      requestBuilder.append(format("<loadBalancerId>%s</loadBalancerId>", payload.id()))
+              .append("</request>")
+              .append("</ws:deregisterServersOnLoadBalancer>");
+
+      return requestBuilder.toString();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinder.java
new file mode 100644
index 0000000..2e437f0
--- /dev/null
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinder.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.binder.loadbalancer;
+
+import static java.lang.String.format;
+import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+
+public class RegisterLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.RegisterPayload> {
+
+   protected final StringBuilder requestBuilder;
+
+   RegisterLoadBalancerRequestBinder() {
+      super("loadbalancer");
+      this.requestBuilder = new StringBuilder(128 * 4);
+   }
+
+   @Override
+   protected String createPayload(LoadBalancer.Request.RegisterPayload payload) {
+      requestBuilder
+              .append("<ws:registerServersOnLoadBalancer>").append("<request>")
+              .append(format("<loadBalancerId>%s</loadBalancerId>", payload.id()));
+
+      for (String s : payload.serverIds()) {
+         requestBuilder.append(format("<serverIds>%s</serverIds>", s));
+      }
+      requestBuilder
+              .append("</request>")
+              .append("</ws:registerServersOnLoadBalancer>");
+
+      return requestBuilder.toString().replaceAll("\\s+", "");
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinder.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinder.java b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinder.java
new file mode 100644
index 0000000..0496655
--- /dev/null
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinder.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.binder.loadbalancer;
+
+import org.jclouds.profitbricks.binder.BaseProfitBricksRequestBinder;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+
+import static java.lang.String.format;
+
+public class UpdateLoadBalancerRequestBinder extends BaseProfitBricksRequestBinder<LoadBalancer.Request.UpdatePayload> {
+
+   protected final StringBuilder requestBuilder;
+
+   UpdateLoadBalancerRequestBinder() {
+      super("loadbalancer");
+      this.requestBuilder = new StringBuilder(128 * 4);
+   }
+
+   @Override
+   protected String createPayload(LoadBalancer.Request.UpdatePayload payload) {
+      return requestBuilder.append("<ws:updateLoadBalancer>")
+              .append("<request>")
+              .append(format("<loadBalancerId>%s</loadBalancerId>", payload.id()))
+              .append(formatIfNotEmpty("<loadBalancerName>%s</loadBalancerName>", payload.name()))
+              .append(formatIfNotEmpty("<loadBalancerAlgorithm>%s</loadBalancerAlgorithm>", payload.loadBalancerAlgorithm()))
+              .append(formatIfNotEmpty("<ip>%s</ip>", payload.ip()))
+              .append("</request>")
+              .append("</ws:updateLoadBalancer>").toString();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/domain/LoadBalancer.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/LoadBalancer.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/LoadBalancer.java
new file mode 100644
index 0000000..bc118ea
--- /dev/null
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/LoadBalancer.java
@@ -0,0 +1,406 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.domain;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.base.Enums;
+import static com.google.common.base.Preconditions.checkArgument;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import static com.google.common.net.InetAddresses.isInetAddress;
+import org.jclouds.javax.annotation.Nullable;
+
+import java.util.Date;
+import java.util.List;
+
+@AutoValue
+public abstract class LoadBalancer {
+
+   public enum Algorithm {
+
+      ROUND_ROBIN, UNRECOGNIZED;
+
+      public static Algorithm
+              fromValue(String value) {
+         return Enums.getIfPresent(Algorithm.class, value).or(UNRECOGNIZED);
+      }
+   }
+
+   @Nullable
+   public abstract String id();
+
+   @Nullable
+   public abstract String name();
+
+   @Nullable
+   public abstract Algorithm loadBalancerAlgorithm();
+
+   @Nullable
+   public abstract String dataCenterId();
+
+   @Nullable
+   public abstract String dataCenterVersion();
+
+   @Nullable
+   public abstract Boolean internetAccess();
+
+   @Nullable
+   public abstract String ip();
+
+   @Nullable
+   public abstract String lanId();
+
+   @Nullable
+   public abstract ProvisioningState state();
+
+   @Nullable
+   public abstract Date creationTime();
+
+   @Nullable
+   public abstract Date lastModificationTime();
+
+   @Nullable
+   public abstract List<Server> balancedServers();
+
+   @Nullable
+   public abstract List<Firewall> firewalls();
+
+   public static LoadBalancer create(String id, String name, Algorithm loadBalancerAlgorithm,
+           String dataCenterId, String dataCenterVersion, boolean internetAccess,
+           String ip, String lanId, ProvisioningState state, Date creationTime, Date lastModificationTime, List<Server> balancedServers, List<Firewall> firewalls) {
+      return new AutoValue_LoadBalancer(id, name, loadBalancerAlgorithm, dataCenterId, dataCenterVersion, internetAccess, ip, lanId, state, creationTime, lastModificationTime,
+              balancedServers != null ? ImmutableList.copyOf(balancedServers) : ImmutableList.<Server>of(),
+              firewalls != null ? ImmutableList.copyOf(firewalls) : ImmutableList.<Firewall>of());
+   }
+
+   public static Builder builder() {
+      return new Builder();
+   }
+
+   private static void checkIp(String ip) {
+      if (ip != null)
+         checkArgument(isInetAddress(ip), "Invalid IP");
+   }
+
+   public static class Builder {
+
+      private String id;
+
+      private String name;
+
+      private Algorithm loadBalancerAlgorithm;
+
+      private String dataCenterId;
+
+      private String dataCenterVersion;
+
+      private boolean internetAccess;
+
+      private String ip;
+
+      private String lanId;
+
+      private ProvisioningState state;
+
+      private Date creationTime;
+
+      private Date lastModificationTime;
+
+      public List<Server> balancedServers;
+
+      private List<Firewall> firewalls;
+
+      public Builder id(String id) {
+         this.id = id;
+         return this;
+      }
+
+      public Builder name(String name) {
+         this.name = name;
+         return this;
+      }
+
+      public Builder loadBalancerAlgorithm(Algorithm loadBalancerAlgorithm) {
+         this.loadBalancerAlgorithm = loadBalancerAlgorithm;
+         return this;
+      }
+
+      public Builder dataCenterId(String dataCenterId) {
+         this.dataCenterId = dataCenterId;
+         return this;
+      }
+
+      public Builder dataCenterVersion(String dataCenterVersion) {
+         this.dataCenterVersion = dataCenterVersion;
+         return this;
+      }
+
+      public Builder internetAccess(boolean internetAccess) {
+         this.internetAccess = internetAccess;
+         return this;
+      }
+
+      public Builder ip(String ip) {
+         this.ip = ip;
+         return this;
+      }
+
+      public Builder lanId(String lanId) {
+         this.lanId = lanId;
+         return this;
+      }
+
+      public Builder creationTime(Date creationTime) {
+         this.creationTime = creationTime;
+         return this;
+      }
+
+      public Builder state(ProvisioningState state) {
+         this.state = state;
+         return this;
+      }
+
+      public Builder lastModificationTime(Date lastModificationTime) {
+         this.lastModificationTime = lastModificationTime;
+         return this;
+      }
+
+      public Builder balancedServers(List<Server> balancedServers) {
+         this.balancedServers = balancedServers;
+         return this;
+      }
+
+      public Builder firewalls(List<Firewall> firewalls) {
+         this.firewalls = firewalls;
+         return this;
+      }
+
+      public LoadBalancer build() {
+         checkIp(ip);
+         return LoadBalancer.create(id, name, loadBalancerAlgorithm, dataCenterId, dataCenterVersion, internetAccess, ip, lanId, state, creationTime, lastModificationTime, balancedServers, firewalls);
+      }
+
+      public Builder fromLoadBalancer(LoadBalancer in) {
+         return this.id(in.id()).name(in.name()).loadBalancerAlgorithm(in.loadBalancerAlgorithm())
+                 .dataCenterId(in.dataCenterId()).dataCenterVersion(in.dataCenterVersion()).internetAccess(in.internetAccess())
+                 .ip(in.ip()).lanId(in.lanId()).state(in.state()).creationTime(in.creationTime()).lastModificationTime(in.lastModificationTime()).balancedServers(in.balancedServers()).firewalls(in.firewalls());
+      }
+   }
+
+   public static final class Request {
+
+      public static CreatePayload.Builder creatingBuilder() {
+         return new CreatePayload.Builder();
+      }
+
+      public static UpdatePayload.Builder updatingBuilder() {
+         return new UpdatePayload.Builder();
+      }
+
+      public static RegisterPayload.Builder registerBuilder() {
+         return new RegisterPayload.Builder();
+      }
+
+      public static DeregisterPayload.Builder deregisterBuilder() {
+         return new DeregisterPayload.Builder();
+      }
+
+      @AutoValue
+      public abstract static class CreatePayload {
+
+         public abstract String dataCenterId();
+
+         public abstract String loadBalancerName();
+
+         public abstract Algorithm loadBalancerAlgorithm();
+
+         public abstract String ip();
+
+         public abstract String lanId();
+
+         public abstract List<String> serverIds();
+
+         public static CreatePayload create(String dataCenterId, String loadBalancerName, Algorithm loadBalancerAlgorithm, String ip, String lanId, List<String> serverIds) {
+            return new AutoValue_LoadBalancer_Request_CreatePayload(dataCenterId, loadBalancerName, loadBalancerAlgorithm, ip, lanId,
+                    serverIds != null ? ImmutableList.copyOf(serverIds) : Lists.<String>newArrayList());
+         }
+
+         public static class Builder {
+
+            public String dataCenterId;
+            public String loadBalancerName;
+            public Algorithm loadBalancerAlgorithm;
+            public String ip;
+            public String lanId;
+            public List<String> serverIds;
+
+            public Builder dataCenterId(String dataCenterId) {
+               this.dataCenterId = dataCenterId;
+               return this;
+            }
+
+            public Builder loadBalancerName(String loadBalancerName) {
+               this.loadBalancerName = loadBalancerName;
+               return this;
+            }
+
+            public Builder loadBalancerAlgorithm(Algorithm loadBalancerAlgorithm) {
+               this.loadBalancerAlgorithm = loadBalancerAlgorithm;
+               return this;
+            }
+
+            public Builder ip(String ip) {
+               this.ip = ip;
+               return this;
+            }
+
+            public Builder lanId(String lanId) {
+               this.lanId = lanId;
+               return this;
+            }
+
+            public Builder serverIds(List<String> serverIds) {
+               this.serverIds = serverIds;
+               return this;
+            }
+
+            public CreatePayload build() {
+               checkIp(ip);
+               return CreatePayload.create(dataCenterId, loadBalancerName, loadBalancerAlgorithm, ip, lanId, serverIds);
+            }
+         }
+      }
+
+      @AutoValue
+      public abstract static class RegisterPayload {
+
+         public abstract List<String> serverIds();
+
+         public abstract String id();
+
+         public static RegisterPayload create(List<String> serverIds, String id) {
+            return new AutoValue_LoadBalancer_Request_RegisterPayload(
+                    serverIds != null ? ImmutableList.copyOf(serverIds) : Lists.<String>newArrayList(), id);
+         }
+
+         public static class Builder {
+
+            public List<String> serverIds;
+            public String id;
+
+            public Builder serverIds(List<String> serverIds) {
+               this.serverIds = serverIds;
+               return this;
+            }
+
+            public Builder id(String id) {
+               this.id = id;
+               return this;
+            }
+
+            public RegisterPayload build() {
+               return RegisterPayload.create(serverIds, id);
+            }
+         }
+      }
+
+      @AutoValue
+      public abstract static class DeregisterPayload {
+
+         public abstract List<String> serverIds();
+
+         public abstract String id();
+
+         public static DeregisterPayload create(List<String> serverIds, String id) {
+            return new AutoValue_LoadBalancer_Request_DeregisterPayload(
+                    serverIds != null ? ImmutableList.copyOf(serverIds) : Lists.<String>newArrayList(), id);
+         }
+
+         public static class Builder {
+
+            public List<String> serverIds;
+            public String id;
+
+            public Builder serverIds(List<String> serverIds) {
+               this.serverIds = serverIds;
+               return this;
+            }
+
+            public Builder id(String id) {
+               this.id = id;
+               return this;
+            }
+
+            public DeregisterPayload build() {
+               return DeregisterPayload.create(serverIds, id);
+            }
+         }
+      }
+
+      @AutoValue
+      public abstract static class UpdatePayload {
+
+         public abstract String id();
+
+         public abstract String name();
+
+         public abstract Algorithm loadBalancerAlgorithm();
+
+         public abstract String ip();
+
+         public static UpdatePayload create(String id, String name, Algorithm loadBalancerAlgorithm, String ip) {
+            return new AutoValue_LoadBalancer_Request_UpdatePayload(id, name, loadBalancerAlgorithm, ip);
+         }
+
+         public static class Builder {
+
+            public String id;
+
+            public String name;
+
+            public Algorithm loadBalancerAlgorithm;
+
+            public String ip;
+
+            public Builder id(String id) {
+               this.id = id;
+               return this;
+            }
+
+            public Builder loadBalancerName(String loadBalancerName) {
+               this.name = loadBalancerName;
+               return this;
+            }
+
+            public Builder loadBalancerAlgorithm(Algorithm loadBalancerAlgorithm) {
+               this.loadBalancerAlgorithm = loadBalancerAlgorithm;
+               return this;
+            }
+
+            public Builder ip(String ip) {
+               this.ip = ip;
+               return this;
+            }
+
+            public UpdatePayload build() {
+               checkIp(ip);
+               return UpdatePayload.create(id, name, loadBalancerAlgorithm, ip);
+            }
+         }
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Server.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Server.java b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Server.java
index 1074fcd..ee1212a 100644
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Server.java
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/domain/Server.java
@@ -61,6 +61,7 @@ public abstract class Server implements ServerCommonProperties {
    @Nullable
    public abstract Boolean hasInternetAccess();
 
+   @Nullable
    public abstract ProvisioningState state();
 
    @Nullable
@@ -84,14 +85,20 @@ public abstract class Server implements ServerCommonProperties {
    @Nullable
    public abstract List<Nic> nics();
 
+   @Nullable
+   public abstract String balancedNicId();
+
+   @Nullable
+   public abstract Boolean activate();
+
    public static Server create(String id, String name, int cores, int ram, Boolean hasInternetAccess, ProvisioningState state,
            Status status, OsType osType, AvailabilityZone availabilityZone, Date creationTime, Date lastModificationTime,
            List<Storage> storages, List<Nic> nics, Boolean isCpuHotPlug, Boolean isRamHotPlug, Boolean isNicHotPlug,
-           Boolean isNicHotUnPlug, Boolean isDiscVirtioHotPlug, Boolean isDiscVirtioHotUnPlug) {
+           Boolean isNicHotUnPlug, Boolean isDiscVirtioHotPlug, Boolean isDiscVirtioHotUnPlug, String balancedNicId, boolean activate) {
       return new AutoValue_Server(isCpuHotPlug, isRamHotPlug, isNicHotPlug, isNicHotUnPlug, isDiscVirtioHotPlug, isDiscVirtioHotUnPlug,
               cores, ram, id, name, hasInternetAccess, state, status, osType, availabilityZone, creationTime, lastModificationTime,
               storages != null ? ImmutableList.copyOf(storages) : Lists.<Storage>newArrayList(),
-              nics != null ? ImmutableList.copyOf(nics) : Lists.<Nic>newArrayList());
+              nics != null ? ImmutableList.copyOf(nics) : Lists.<Nic>newArrayList(), balancedNicId, activate);
 
    }
 
@@ -178,6 +185,8 @@ public abstract class Server implements ServerCommonProperties {
       private Boolean hasInternetAccess;
       private List<Storage> storages;
       private List<Nic> nics;
+      private boolean activate;
+      private String balancedNicId;
 
       public DescribingBuilder id(String id) {
          this.id = id;
@@ -229,11 +238,21 @@ public abstract class Server implements ServerCommonProperties {
          return this;
       }
 
+      public DescribingBuilder balancedNicId(String balancedNicId) {
+         this.balancedNicId = balancedNicId;
+         return this;
+      }
+
+      public DescribingBuilder activate(boolean activate) {
+         this.activate = activate;
+         return this;
+      }
+
       @Override
       public Server build() {
          return Server.create(id, name, cores, ram, hasInternetAccess, state, status, osType, zone, creationTime,
                  lastModificationTime, storages, nics, cpuHotPlug, ramHotPlug, nicHotPlug, nicHotUnPlug,
-                 discVirtioHotPlug, discVirtioHotUnPlug);
+                 discVirtioHotPlug, discVirtioHotUnPlug, balancedNicId, activate);
       }
 
       private DescribingBuilder fromServer(Server in) {
@@ -242,7 +261,7 @@ public abstract class Server implements ServerCommonProperties {
                  .isDiscVirtioHotUnPlug(in.isDiscVirtioHotUnPlug()).isNicHotPlug(in.isNicHotPlug())
                  .isNicHotUnPlug(in.isNicHotUnPlug()).isRamHotPlug(in.isRamHotPlug())
                  .lastModificationTime(in.lastModificationTime()).name(in.name()).osType(in.osType()).ram(in.ram())
-                 .state(in.state()).status(in.status()).storages(in.storages()).nics(in.nics());
+                 .state(in.state()).status(in.status()).storages(in.storages()).nics(in.nics()).balancedNicId(in.balancedNicId()).activate(in.activate());
       }
 
       @Override

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/features/LoadBalancerApi.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/features/LoadBalancerApi.java b/profitbricks/src/main/java/org/jclouds/profitbricks/features/LoadBalancerApi.java
new file mode 100644
index 0000000..cbac54a
--- /dev/null
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/features/LoadBalancerApi.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.features;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import java.util.List;
+import org.jclouds.Fallbacks;
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.profitbricks.binder.loadbalancer.CreateLoadBalancerRequestBinder;
+import org.jclouds.profitbricks.binder.loadbalancer.DeregisterLoadBalancerRequestBinder;
+import org.jclouds.profitbricks.binder.loadbalancer.RegisterLoadBalancerRequestBinder;
+import org.jclouds.profitbricks.binder.loadbalancer.UpdateLoadBalancerRequestBinder;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+import org.jclouds.profitbricks.http.filters.ProfitBricksSoapMessageEnvelope;
+import org.jclouds.profitbricks.http.parser.RequestIdOnlyResponseHandler;
+import org.jclouds.profitbricks.http.parser.loadbalancer.LoadBalancerListResponseHandler;
+import org.jclouds.profitbricks.http.parser.loadbalancer.LoadBalancerResponseHandler;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+
+@RequestFilters({BasicAuthentication.class, ProfitBricksSoapMessageEnvelope.class})
+@Consumes(MediaType.TEXT_XML)
+@Produces(MediaType.TEXT_XML)
+public interface LoadBalancerApi {
+
+   @POST
+   @Named("loadbalancer:getall")
+   @Payload("<ws:getAllLoadBalancers/>")
+   @XMLResponseParser(LoadBalancerListResponseHandler.class)
+   @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
+   List<LoadBalancer> getAllLoadBalancers();
+
+   @POST
+   @Named("loadbalancer:get")
+   @Payload("<ws:getLoadBalancer><loadBalancerId>{id}</loadBalancerId></ws:getLoadBalancer>")
+   @XMLResponseParser(LoadBalancerResponseHandler.class)
+   @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+   LoadBalancer getLoadBalancer(@PayloadParam("id") String identifier);
+
+   @POST
+   @Named("loadbalancer:create")
+   @MapBinder(CreateLoadBalancerRequestBinder.class)
+   @XMLResponseParser(RequestIdOnlyResponseHandler.class)
+   String createLoadBalancer(@PayloadParam("loadbalancer") LoadBalancer.Request.CreatePayload payload);
+
+   @POST
+   @Named("loadbalancer:register")
+   @MapBinder(RegisterLoadBalancerRequestBinder.class)
+   @XMLResponseParser(LoadBalancerResponseHandler.class)
+   LoadBalancer registerLoadBalancer(@PayloadParam("loadbalancer") LoadBalancer.Request.RegisterPayload payload);
+
+   @POST
+   @Named("loadbalancer:Deregister")
+   @MapBinder(DeregisterLoadBalancerRequestBinder.class)
+   @XMLResponseParser(LoadBalancerResponseHandler.class)
+   LoadBalancer deregisterLoadBalancer(@PayloadParam("loadbalancer") LoadBalancer.Request.DeregisterPayload payload);
+
+   @POST
+   @Named("loadbalancer:delete")
+   @Payload("<ws:deleteLoadBalancer><loadBalancerId>{id}</loadBalancerId></ws:deleteLoadBalancer>")
+   boolean deleteLoadbalancer(@PayloadParam("id") String id);
+
+   @POST
+   @Named("loadbalancer:update")
+   @MapBinder(UpdateLoadBalancerRequestBinder.class)
+   @XMLResponseParser(LoadBalancerResponseHandler.class)
+   LoadBalancer updateLoadBalancer(@PayloadParam("loadbalancer") LoadBalancer.Request.UpdatePayload payload);
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/FirewallListResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/FirewallListResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/FirewallListResponseHandler.java
index 6d8b292..e096148 100644
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/FirewallListResponseHandler.java
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/firewall/FirewallListResponseHandler.java
@@ -28,7 +28,7 @@ import org.xml.sax.SAXException;
 
 public class FirewallListResponseHandler extends BaseFirewallResponseHandler<List<Firewall>> {
 
-   private final List<Firewall> firewalls;
+   private List<Firewall> firewalls;
 
    @Inject
    FirewallListResponseHandler(FirewallRuleListResponseHandler firewallRuleListResponseHandler) {
@@ -42,7 +42,7 @@ public class FirewallListResponseHandler extends BaseFirewallResponseHandler<Lis
          firewallRuleListResponseHandler.endElement(uri, localName, qName);
       else {
          setPropertyOnEndTag(qName);
-         if ("return".equals(qName)) {
+         if ("return".equals(qName) || "firewall".equals(qName)) {
             firewalls.add(builder
                     .rules(firewallRuleListResponseHandler.getResult())
                     .build());
@@ -57,6 +57,11 @@ public class FirewallListResponseHandler extends BaseFirewallResponseHandler<Lis
    }
 
    @Override
+   public void reset() {
+      this.firewalls = Lists.newArrayList();
+   }
+
+   @Override
    public List<Firewall> getResult() {
       return firewalls;
    }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/BaseLoadBalancerResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/BaseLoadBalancerResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/BaseLoadBalancerResponseHandler.java
new file mode 100644
index 0000000..e093977
--- /dev/null
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/BaseLoadBalancerResponseHandler.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.http.parser.loadbalancer;
+
+import java.util.Date;
+import org.jclouds.date.DateCodec;
+import org.jclouds.date.DateCodecFactory;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+import org.jclouds.profitbricks.domain.LoadBalancer.Algorithm;
+import org.jclouds.profitbricks.domain.ProvisioningState;
+import org.jclouds.profitbricks.http.parser.BaseProfitBricksResponseHandler;
+import org.jclouds.profitbricks.http.parser.firewall.FirewallListResponseHandler;
+import org.jclouds.profitbricks.http.parser.server.ServerListResponseHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public abstract class BaseLoadBalancerResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
+
+   protected final ServerListResponseHandler balancedServerResponseHandler;
+   protected final FirewallListResponseHandler firewallListResponseHandler;
+
+   protected LoadBalancer.Builder builder;
+   protected final DateCodec dateCodec;
+
+   protected boolean useBalancedServerParser = false;
+   protected boolean useFirewallParser = false;
+
+   protected BaseLoadBalancerResponseHandler(DateCodecFactory dateCodec,
+           ServerListResponseHandler balancedServerResponseHandler, FirewallListResponseHandler firewallResponseHandler) {
+
+      if (dateCodec == null)
+         throw new NullPointerException("DateCodecFactory cannot be null");
+      if (balancedServerResponseHandler == null)
+         throw new NullPointerException("BalancedServerResponseHandler cannot be null");
+      if (firewallResponseHandler == null)
+         throw new NullPointerException("FirewallListResponseHandler cannot be null");
+
+      this.dateCodec = dateCodec.iso8601();
+      this.builder = LoadBalancer.builder();
+
+      this.balancedServerResponseHandler = balancedServerResponseHandler;
+      this.firewallListResponseHandler = firewallResponseHandler;
+   }
+
+   @Override
+   public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+      if ("balancedServers".equals(qName))
+         useBalancedServerParser = true;
+      if ("firewall".equals(qName))
+         useFirewallParser = true;
+
+      if (useBalancedServerParser)
+         balancedServerResponseHandler.startElement(uri, localName, qName, attributes);
+      else if (useFirewallParser)
+         firewallListResponseHandler.startElement(uri, localName, qName, attributes);
+   }
+
+   @Override
+   public void characters(char[] ch, int start, int length) {
+      if (useBalancedServerParser)
+         balancedServerResponseHandler.characters(ch, start, length);
+      else if (useFirewallParser)
+         firewallListResponseHandler.characters(ch, start, length);
+      else
+         super.characters(ch, start, length);
+   }
+
+   protected final Date textToIso8601Date() {
+      return dateCodec.toDate(textToStringValue());
+   }
+
+   @Override
+   protected void setPropertyOnEndTag(String qName) {
+      if ("loadBalancerId".equals(qName))
+         builder.id(textToStringValue());
+      else if ("loadBalancerName".equals(qName))
+         builder.name(textToStringValue());
+      else if ("loadBalancerAlgorithm".equals(qName))
+         builder.loadBalancerAlgorithm(Algorithm.fromValue(textToStringValue()));
+      else if ("dataCenterId".equals(qName))
+         builder.dataCenterId(textToStringValue());
+      else if ("dataCenterVersion".equals(qName))
+         builder.dataCenterVersion(textToStringValue());
+      else if ("internetAccess".equals(qName))
+         builder.internetAccess(textToBooleanValue());
+      else if ("ip".equals(qName))
+         builder.ip(textToStringValue());
+      else if ("lanId".equals(qName))
+         builder.lanId(textToStringValue());
+      else if ("provisioningState".equals(qName))
+         builder.state(ProvisioningState.fromValue(textToStringValue()));
+      else if ("creationTime".equals(qName))
+         builder.creationTime(textToIso8601Date());
+      else if ("lastModificationTime".equals(qName))
+         builder.lastModificationTime(textToIso8601Date());
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerListResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerListResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerListResponseHandler.java
new file mode 100644
index 0000000..4b31e8a
--- /dev/null
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerListResponseHandler.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.http.parser.loadbalancer;
+
+import autovalue.shaded.com.google.common.common.collect.Lists;
+import com.google.inject.Inject;
+import java.util.List;
+import org.jclouds.date.DateCodecFactory;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+import org.jclouds.profitbricks.http.parser.firewall.FirewallListResponseHandler;
+import org.jclouds.profitbricks.http.parser.server.ServerListResponseHandler;
+import org.xml.sax.SAXException;
+
+public class LoadBalancerListResponseHandler extends BaseLoadBalancerResponseHandler<List<LoadBalancer>> {
+
+   private final List<LoadBalancer> loadBalancers;
+
+   @Inject
+   LoadBalancerListResponseHandler(DateCodecFactory dateCodec, ServerListResponseHandler balancedServerResponseHandler, FirewallListResponseHandler firewallListResponseHandler) {
+      super(dateCodec, balancedServerResponseHandler, firewallListResponseHandler);
+      this.loadBalancers = Lists.newArrayList();
+   }
+
+   @Override
+   public void endElement(String uri, String localName, String qName) throws SAXException {
+      if (useBalancedServerParser) {
+         balancedServerResponseHandler.endElement(uri, localName, qName);
+      } else if (useFirewallParser) {
+         firewallListResponseHandler.endElement(uri, localName, qName);
+      } else {
+         setPropertyOnEndTag(qName);
+         if ("return".equals(qName)) {
+            loadBalancers.add(builder
+                    .firewalls(firewallListResponseHandler.getResult())
+                    .balancedServers(balancedServerResponseHandler.getResult())
+                    .build());
+
+            balancedServerResponseHandler.reset();
+            firewallListResponseHandler.reset();
+            builder = LoadBalancer.builder();
+         }
+         clearTextBuffer();
+      }
+      if ("firewall".equals(qName)) {
+         useFirewallParser = false;
+      } else if ("balancedServers".equals(qName)) {
+         useBalancedServerParser = false;
+      }
+
+   }
+
+   @Override
+   public List<LoadBalancer> getResult() {
+      return loadBalancers;
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerResponseHandler.java
new file mode 100644
index 0000000..8c79512
--- /dev/null
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerResponseHandler.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.http.parser.loadbalancer;
+
+import com.google.inject.Inject;
+import org.jclouds.date.DateCodecFactory;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+import org.jclouds.profitbricks.http.parser.firewall.FirewallListResponseHandler;
+import org.jclouds.profitbricks.http.parser.server.ServerListResponseHandler;
+import org.xml.sax.SAXException;
+
+public class LoadBalancerResponseHandler extends BaseLoadBalancerResponseHandler<LoadBalancer> {
+
+   private boolean done = false;
+
+   @Inject
+   LoadBalancerResponseHandler(DateCodecFactory dateCodec, ServerListResponseHandler serverListResponseHandler, FirewallListResponseHandler firewallListResponseHandler) {
+      super(dateCodec, serverListResponseHandler, firewallListResponseHandler);
+   }
+
+   @Override
+   public void endElement(String uri, String localName, String qName) throws SAXException {
+      if (done)
+         return;
+
+      if (useBalancedServerParser)
+         balancedServerResponseHandler.endElement(uri, localName, qName);
+      else if (useFirewallParser)
+         firewallListResponseHandler.endElement(uri, localName, qName);
+      else {
+         setPropertyOnEndTag(qName);
+         if ("return".equals(qName)) {
+            done = true;
+            builder.balancedServers(balancedServerResponseHandler.getResult());
+            builder.firewalls(firewallListResponseHandler.getResult());
+         }
+         clearTextBuffer();
+      }
+
+      if ("balancedServers".equals(qName))
+         useBalancedServerParser = false;
+      else if ("firewall".equals(qName))
+         useFirewallParser = false;
+
+   }
+
+   @Override
+   public LoadBalancer getResult() {
+      return builder.build();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/BaseServerResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/BaseServerResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/BaseServerResponseHandler.java
index 69a34b1..60fb4bf 100644
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/BaseServerResponseHandler.java
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/BaseServerResponseHandler.java
@@ -17,11 +17,7 @@
 package org.jclouds.profitbricks.http.parser.server;
 
 import java.util.Date;
-
 import org.jclouds.date.DateCodec;
-
-import com.google.inject.Inject;
-
 import org.jclouds.date.DateCodecFactory;
 import org.jclouds.profitbricks.domain.AvailabilityZone;
 import org.jclouds.profitbricks.domain.OsType;
@@ -35,8 +31,8 @@ import org.xml.sax.SAXException;
 
 public abstract class BaseServerResponseHandler<T> extends BaseProfitBricksResponseHandler<T> {
 
-   protected final StorageListResponseHandler storageListResponseHandler;
-   protected final NicListResponseHandler nicListResponseHandler;
+   protected StorageListResponseHandler storageListResponseHandler;
+   protected NicListResponseHandler nicListResponseHandler;
 
    protected Server.DescribingBuilder builder;
 
@@ -45,9 +41,15 @@ public abstract class BaseServerResponseHandler<T> extends BaseProfitBricksRespo
    protected boolean useStorageParser = false;
    protected boolean useNicParser = false;
 
-   @Inject
    BaseServerResponseHandler(DateCodecFactory dateCodec, StorageListResponseHandler storageListResponseHandler,
            NicListResponseHandler nicListResponseHandler) {
+      if (dateCodec == null)
+         throw new NullPointerException("DateCodecFactory cannot be null");
+      if (storageListResponseHandler == null)
+         throw new NullPointerException("StorageListResponseHandler cannot be null");
+      if (nicListResponseHandler == null)
+         throw new NullPointerException("NicListResponseHandler cannot be null");
+
       this.dateCodec = dateCodec.iso8601();
       this.storageListResponseHandler = storageListResponseHandler;
       this.nicListResponseHandler = nicListResponseHandler;
@@ -119,6 +121,10 @@ public abstract class BaseServerResponseHandler<T> extends BaseProfitBricksRespo
          builder.isDiscVirtioHotPlug(textToBooleanValue());
       else if ("discVirtioHotUnPlug".equals(qName))
          builder.isDiscVirtioHotUnPlug(textToBooleanValue());
+      else if ("activate".equals(qName))
+         builder.activate(textToBooleanValue());
+      else if ("balancedNicId".equals(qName))
+         builder.balancedNicId(textToStringValue());
    }
 
 }

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerListResponseHandler.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerListResponseHandler.java b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerListResponseHandler.java
index d7d50ab..362e378 100644
--- a/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerListResponseHandler.java
+++ b/profitbricks/src/main/java/org/jclouds/profitbricks/http/parser/server/ServerListResponseHandler.java
@@ -47,7 +47,7 @@ public class ServerListResponseHandler extends BaseServerResponseHandler<List<Se
          nicListResponseHandler.endElement(uri, localName, qName);
       else {
          setPropertyOnEndTag(qName);
-         if ("return".equals(qName) || "servers".equals(qName)) {
+         if ("return".equals(qName) || "servers".equals(qName) || "balancedServers".equals(qName)) {
             servers.add(builder
                     .storages(storageListResponseHandler.getResult())
                     .nics(nicListResponseHandler.getResult())

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinderTest.java
new file mode 100644
index 0000000..f959be1
--- /dev/null
+++ b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/CreateLoadBalancerRequestBinderTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.binder.loadbalancer;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import org.testng.annotations.Test;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+import org.jclouds.profitbricks.domain.LoadBalancer.Algorithm;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+@Test(groups = "unit", testName = "CreateLoadBalancerRequestBinderTest")
+public class CreateLoadBalancerRequestBinderTest {
+
+   @Test
+   public void testCreatePayload() {
+      CreateLoadBalancerRequestBinder binder = new CreateLoadBalancerRequestBinder();
+
+      List<String> serverIds = Lists.newArrayList();
+      serverIds.add("server-ids");
+
+      String actual = binder.createPayload(LoadBalancer.Request.CreatePayload.create("datacenter-id", "load-balancer-name", Algorithm.ROUND_ROBIN, "-ip", "lan-id", serverIds));
+
+      assertNotNull(actual, "Binder returned null payload");
+      assertEquals(expectedPayload, actual);
+   }
+
+   private final String expectedPayload
+           = ("<ws:createLoadBalancer>\n"
+           + "            <request>\n"
+           + "                <dataCenterId>datacenter-id</dataCenterId>\n"
+           + "                <loadBalancerName>load-balancer-name</loadBalancerName>\n"
+           + "                <loadBalancerAlgorithm>ROUND_ROBIN</loadBalancerAlgorithm>\n"
+           + "                <ip>-ip</ip>\n"
+           + "                <lanId>lan-id</lanId>\n"
+           + "                <serverIds>server-ids</serverIds>\n"
+           + "            </request>\n"
+           + "        </ws:createLoadBalancer>").replaceAll("\\s+", "");
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinderTest.java
new file mode 100644
index 0000000..dbf0271
--- /dev/null
+++ b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/DeregisterLoadBalancerRequestBinderTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.binder.loadbalancer;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "DeregisterLoadBalancerRequestBinderTest")
+public class DeregisterLoadBalancerRequestBinderTest {
+
+   @Test
+   public void testDeregisterPayload() {
+      DeregisterLoadBalancerRequestBinder binder = new DeregisterLoadBalancerRequestBinder();
+      List<String> serverIds = Lists.newArrayList();
+      serverIds.add("1");
+      serverIds.add("2");
+
+      LoadBalancer.Request.DeregisterPayload payload = LoadBalancer.Request.DeregisterPayload.create(serverIds, "load-balancer-id");
+
+      String actual = binder.createPayload(payload);
+
+      assertNotNull(actual, "Binder returned null payload");
+      assertEquals(expectedPayload, actual);
+   }
+
+   private final String expectedPayload
+           = ("        <ws:deregisterServersOnLoadBalancer>\n"
+           + "             <request>"
+           + "                <serverIds>1</serverIds>\n"
+           + "                <serverIds>2</serverIds>\n"
+           + "                <loadBalancerId>load-balancer-id</loadBalancerId>\n"
+           + "             </request>"
+           + "        </ws:deregisterServersOnLoadBalancer>").replaceAll("\\s+", "");
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinderTest.java
new file mode 100644
index 0000000..2bbf6fd
--- /dev/null
+++ b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/RegisterLoadBalancerRequestBinderTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.binder.loadbalancer;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "RegisterLoadBalancerRequestBinderTest")
+public class RegisterLoadBalancerRequestBinderTest {
+
+   @Test
+   public void testRegisterPayload() {
+      RegisterLoadBalancerRequestBinder binder = new RegisterLoadBalancerRequestBinder();
+      List<String> serverIds = Lists.newArrayList();
+      serverIds.add("1");
+      serverIds.add("2");
+
+      LoadBalancer.Request.RegisterPayload payload = LoadBalancer.Request.RegisterPayload.create(serverIds, "load-balancer-id");
+
+      String actual = binder.createPayload(payload);
+
+      assertNotNull(actual, "Binder returned null payload");
+      assertEquals(expectedPayload, actual);
+   }
+
+   private final String expectedPayload
+           = ("        <ws:registerServersOnLoadBalancer>\n"
+           + "             <request>"
+           + "                <loadBalancerId>load-balancer-id</loadBalancerId>\n"
+           + "                <serverIds>1</serverIds>\n"
+           + "                <serverIds>2</serverIds>\n"
+           + "             </request>"
+           + "        </ws:registerServersOnLoadBalancer>").replaceAll("\\s+", "");
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinderTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinderTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinderTest.java
new file mode 100644
index 0000000..21c08d0
--- /dev/null
+++ b/profitbricks/src/test/java/org/jclouds/profitbricks/binder/loadbalancer/UpdateLoadBalancerRequestBinderTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.binder.loadbalancer;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "UpdateLoadBalancerRequestBinderTest")
+public class UpdateLoadBalancerRequestBinderTest {
+
+   @Test
+   public void testDeregisterPayload() {
+      UpdateLoadBalancerRequestBinder binder = new UpdateLoadBalancerRequestBinder();
+      List<String> serverIds = Lists.newArrayList();
+      serverIds.add("1");
+      serverIds.add("2");
+
+      LoadBalancer.Request.UpdatePayload payload = LoadBalancer.Request.UpdatePayload.create("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", "load-balancer-name",
+              LoadBalancer.Algorithm.ROUND_ROBIN, "ip");
+
+      String actual = binder.createPayload(payload);
+
+      assertNotNull(actual, "Binder returned null payload");
+      assertEquals(expectedPayload, actual);
+   }
+
+   private final String expectedPayload
+           = ("        <ws:updateLoadBalancer>\n"
+           + "            <request>\n"
+           + "                <loadBalancerId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</loadBalancerId>\n"
+           + "                <loadBalancerName>load-balancer-name</loadBalancerName>\n"
+           + "                <loadBalancerAlgorithm>ROUND_ROBIN</loadBalancerAlgorithm>\n"
+           + "                <ip>ip</ip>              \n"
+           + "            </request>\n"
+           + "        </ws:updateLoadBalancer>").replaceAll("\\s+", "");
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadbalancerApiLiveTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadbalancerApiLiveTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadbalancerApiLiveTest.java
new file mode 100644
index 0000000..a79f9ae
--- /dev/null
+++ b/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadbalancerApiLiveTest.java
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.features;
+
+import com.google.common.collect.Iterables;
+import java.util.List;
+import org.assertj.core.util.Lists;
+import org.jclouds.profitbricks.BaseProfitBricksLiveTest;
+import org.jclouds.profitbricks.domain.DataCenter;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+import org.jclouds.profitbricks.domain.LoadBalancer.Algorithm;
+import org.jclouds.profitbricks.domain.Server;
+import org.testng.Assert;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "LoadbalancerApiLiveTest")
+public class LoadbalancerApiLiveTest extends BaseProfitBricksLiveTest {
+
+   private String dataCenterId;
+   private String loadBalancerID;
+   private String serverId;
+
+   @Override
+   protected void initialize() {
+      super.initialize();
+      List<DataCenter> dataCenters = api.dataCenterApi().getAllDataCenters();
+      assertFalse(dataCenters.isEmpty(), "At least 1 datacenter has to be available for loadbalancer testing.");
+
+      dataCenterId = Iterables.getFirst(dataCenters, null).id();
+
+      List<Server> servers = api.serverApi().getAllServers();
+      assertFalse(servers.isEmpty(), "At least 1 server has to be available for loadbalancer testing.");
+
+      serverId = Iterables.getFirst(servers, null).id();
+   }
+
+   @Test
+   public void testCreateLoadBalancer() {
+      List<String> serverIds = com.google.common.collect.Lists.newArrayList();
+      serverIds.add("server-ids");
+
+      LoadBalancer.Request.CreatePayload payload = LoadBalancer.Request.creatingBuilder()
+              .dataCenterId(dataCenterId)
+              .loadBalancerName("testName")
+              .loadBalancerAlgorithm(Algorithm.ROUND_ROBIN)
+              .ip("0.0.0.1")
+              .lanId("1")
+              .serverIds(serverIds)
+              .build();
+
+      String requestId = api.loadBalancerApi().createLoadBalancer(payload);
+
+      assertNotNull(requestId);
+   }
+
+   @Test(dependsOnMethods = "testCreateLoadBalancer")
+   public void testGetAllLoadBalancers() {
+      List<LoadBalancer> loadBalancers = api.loadBalancerApi().getAllLoadBalancers();
+
+      assertFalse(loadBalancers.isEmpty());
+   }
+
+   @Test(dependsOnMethods = "testCreateLoadBalancer")
+   public void testGetLoadBalancer() {
+      LoadBalancer loadBalancer = api.loadBalancerApi().getLoadBalancer(loadBalancerID);
+
+      assertNotNull(loadBalancer);
+   }
+
+   @Test(dependsOnMethods = "testCreateLoadBalancer")
+   public void testRegisterLoadBalancer() {
+      List<String> serverIds = Lists.newArrayList();
+      serverIds.add(serverId);
+
+      LoadBalancer.Request.RegisterPayload payload = LoadBalancer.Request.registerBuilder()
+              .id(loadBalancerID)
+              .serverIds(serverIds)
+              .build();
+
+      LoadBalancer loadBalancer = api.loadBalancerApi().registerLoadBalancer(payload);
+
+      assertNotNull(loadBalancer);
+   }
+
+   @Test(dependsOnMethods = "testRegisterLoadBalancer")
+   public void testDeregisterLoadBalancer() {
+      List<String> serverIds = Lists.newArrayList();
+      serverIds.add(serverId);
+
+      LoadBalancer.Request.DeregisterPayload payload = LoadBalancer.Request.deregisterBuilder()
+              .id(loadBalancerID)
+              .serverIds(serverIds)
+              .build();
+
+      LoadBalancer loadBalancer = api.loadBalancerApi().deregisterLoadBalancer(payload);
+
+      assertNotNull(loadBalancer);
+   }
+
+   @Test(dependsOnMethods = "testCreateLoadBalancer")
+   public void testUpdateLoadBalancer() {
+      LoadBalancer.Request.UpdatePayload payload = LoadBalancer.Request.updatingBuilder()
+              .id(loadBalancerID)
+              .loadBalancerName("whatever")
+              .build();
+
+      LoadBalancer loadBalancer = api.loadBalancerApi().updateLoadBalancer(payload);
+
+      assertNotNull(loadBalancer);
+   }
+
+   @AfterClass(alwaysRun = true)
+   public void testDeleteLoadBalancer() {
+      boolean result = api.loadBalancerApi().deleteLoadbalancer(loadBalancerID);
+
+      Assert.assertTrue(result);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadbalancerApiMockTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadbalancerApiMockTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadbalancerApiMockTest.java
new file mode 100644
index 0000000..f91083a
--- /dev/null
+++ b/profitbricks/src/test/java/org/jclouds/profitbricks/features/LoadbalancerApiMockTest.java
@@ -0,0 +1,285 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.features;
+
+import com.google.common.collect.Lists;
+import com.squareup.okhttp.mockwebserver.MockResponse;
+import com.squareup.okhttp.mockwebserver.MockWebServer;
+import java.util.List;
+import org.jclouds.profitbricks.ProfitBricksApi;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+import org.jclouds.profitbricks.domain.LoadBalancer.Algorithm;
+import org.jclouds.profitbricks.internal.BaseProfitBricksMockTest;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "LoadbalancerApiMockTest")
+public class LoadbalancerApiMockTest extends BaseProfitBricksMockTest {
+
+   @Test
+   public void testGetAllLoadBalancers() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancers.xml")));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      LoadBalancerApi api = pbApi.loadBalancerApi();
+
+      try {
+         List<LoadBalancer> loadBalancerList = api.getAllLoadBalancers();
+
+         assertRequestHasCommonProperties(server.takeRequest(), "<ws:getAllLoadBalancers/>");
+         assertNotNull(loadBalancerList);
+         assertTrue(loadBalancerList.size() == 2);
+
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testGetAllLoadBalancersReturning404() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setResponseCode(404));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      LoadBalancerApi api = pbApi.loadBalancerApi();
+
+      try {
+         List<LoadBalancer> loadBalancerList = api.getAllLoadBalancers();
+
+         assertRequestHasCommonProperties(server.takeRequest());
+         assertTrue(loadBalancerList.isEmpty());
+
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testGetLoadBalancer() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer.xml")));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      LoadBalancerApi api = pbApi.loadBalancerApi();
+
+      String id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
+
+      String content = "<ws:getLoadBalancer><loadBalancerId>" + id + "</loadBalancerId></ws:getLoadBalancer>";
+      try {
+         LoadBalancer loadBalancer = api.getLoadBalancer(id);
+
+         assertRequestHasCommonProperties(server.takeRequest(), content);
+         assertNotNull(loadBalancer);
+         assertEquals(loadBalancer.id(), id);
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testGetNonExistingLoadBalancer() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setResponseCode(404));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      LoadBalancerApi api = pbApi.loadBalancerApi();
+
+      String id = "random-non-existing-id";
+
+      try {
+         LoadBalancer loadBalancer = api.getLoadBalancer(id);
+
+         assertRequestHasCommonProperties(server.takeRequest());
+         assertNull(loadBalancer);
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testCreateLoadBalancer() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer-create.xml")));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      LoadBalancerApi api = pbApi.loadBalancerApi();
+
+      String content = "<ws:createLoadBalancer>"
+              + "<request>"
+              + "<dataCenterId>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeeee</dataCenterId>"
+              + "<loadBalancerName>load-balancer-name</loadBalancerName>"
+              + "<loadBalancerAlgorithm>ROUND_ROBIN</loadBalancerAlgorithm>"
+              + "<ip>192.168.0.1</ip>"
+              + "<lanId>lan-id</lanId>"
+              + "<serverIds>server-ids</serverIds>"
+              + "</request>"
+              + "</ws:createLoadBalancer>";
+
+      try {
+         List<String> serverIds = Lists.newArrayList();
+         serverIds.add("server-ids");
+         String requestId = api.createLoadBalancer(LoadBalancer.Request.creatingBuilder()
+                 .dataCenterId("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeeee")
+                 .loadBalancerName("load-balancer-name")
+                 .loadBalancerAlgorithm(Algorithm.ROUND_ROBIN)
+                 .ip("192.168.0.1")
+                 .lanId("lan-id")
+                 .serverIds(serverIds)
+                 .build());
+
+         assertRequestHasCommonProperties(server.takeRequest(), content);
+
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testUpdateLoadBalancer() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer-create.xml")));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      LoadBalancerApi api = pbApi.loadBalancerApi();
+
+      String id = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
+      String newName = "Apache";
+
+      String content = "<ws:updateLoadBalancer>"
+              + "<request>"
+              + "<loadBalancerId>" + id + "</loadBalancerId>"
+              + "<loadBalancerName>load-balancer-name</loadBalancerName>"
+              + "<loadBalancerAlgorithm>ROUND_ROBIN</loadBalancerAlgorithm>"
+              + "<ip>192.168.0.1</ip>"
+              + "</request>"
+              + "</ws:updateLoadBalancer>";
+
+      try {
+         LoadBalancer.Request.UpdatePayload toUpdate = LoadBalancer.Request.updatingBuilder()
+                 .id(id)
+                 .loadBalancerName("load-balancer-name")
+                 .loadBalancerAlgorithm(Algorithm.ROUND_ROBIN)
+                 .ip("192.168.0.1")
+                 .build();
+
+         LoadBalancer loadBalancer = api.updateLoadBalancer(toUpdate);
+
+         assertRequestHasCommonProperties(server.takeRequest(), content);
+         assertNotNull(loadBalancer);
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+
+   }
+
+   @Test
+   public void testRegisterLoadBalancer() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer-register.xml")));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      LoadBalancerApi api = pbApi.loadBalancerApi();
+
+      String content = "<ws:registerServersOnLoadBalancer>"
+              + "<request>"
+              + "<loadBalancerId>1234</loadBalancerId>"
+              + "<serverIds>1</serverIds>"
+              + "<serverIds>2</serverIds>"
+              + "</request>"
+              + "</ws:registerServersOnLoadBalancer>";
+
+      try {
+         List<String> serverIds = Lists.newArrayList();
+         serverIds.add("1");
+         serverIds.add("2");
+         LoadBalancer.Request.RegisterPayload payload = LoadBalancer.Request.registerBuilder()
+                 .id("1234")
+                 .serverIds(serverIds)
+                 .build();
+
+         LoadBalancer loadbalancer = api.registerLoadBalancer(payload);
+
+         assertRequestHasCommonProperties(server.takeRequest(), content);
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testDeregisterLoadBalancer() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer-update.xml")));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      LoadBalancerApi api = pbApi.loadBalancerApi();
+
+      String content = "<ws:deregisterServersOnLoadBalancer>"
+              + "<request>"
+              + "<serverIds>1</serverIds>"
+              + "<serverIds>2</serverIds>"
+              + "<loadBalancerId>load-balancer-id</loadBalancerId>"
+              + "</request>"
+              + "</ws:deregisterServersOnLoadBalancer>";
+
+      try {
+         List<String> serverIds = Lists.newArrayList();
+         serverIds.add("1");
+         serverIds.add("2");
+         LoadBalancer loadbalancer = api.deregisterLoadBalancer(LoadBalancer.Request.DeregisterPayload.create(serverIds, "load-balancer-id"));
+
+         assertRequestHasCommonProperties(server.takeRequest(), content);
+         assertNotNull(loadbalancer);
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+
+   @Test
+   public void testDeleteLoadBalancer() throws Exception {
+      MockWebServer server = mockWebServer();
+      server.enqueue(new MockResponse().setBody(payloadFromResource("/loadbalancer/loadbalancer-register.xml")));
+
+      ProfitBricksApi pbApi = api(server.getUrl(rootUrl));
+      LoadBalancerApi api = pbApi.loadBalancerApi();
+
+      String loadBalancerId = "qwertyui-qwer-qwer-qwer-qwertyyuiiop";
+
+      String content = "<ws:deleteLoadBalancer><loadBalancerId>" + loadBalancerId + "</loadBalancerId></ws:deleteLoadBalancer>";
+
+      try {
+         boolean done = api.deleteLoadbalancer(loadBalancerId);
+
+         assertRequestHasCommonProperties(server.takeRequest(), content);
+         assertTrue(done);
+      } finally {
+         pbApi.close();
+         server.shutdown();
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/823df74f/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerListResponseHandlerTest.java
----------------------------------------------------------------------
diff --git a/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerListResponseHandlerTest.java b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerListResponseHandlerTest.java
new file mode 100644
index 0000000..cec0999
--- /dev/null
+++ b/profitbricks/src/test/java/org/jclouds/profitbricks/http/parser/loadbalancer/LoadBalancerListResponseHandlerTest.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jclouds.profitbricks.http.parser.loadbalancer;
+
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.jclouds.date.DateCodec;
+import org.jclouds.date.DateCodecFactory;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.profitbricks.domain.Firewall;
+import org.jclouds.profitbricks.domain.LoadBalancer;
+import org.jclouds.profitbricks.domain.LoadBalancer.Algorithm;
+import org.jclouds.profitbricks.domain.ProvisioningState;
+import org.jclouds.profitbricks.domain.Server;
+import org.jclouds.profitbricks.http.parser.BaseResponseHandlerTest;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "LoadBalancerListResponseHandlerTest")
+public class LoadBalancerListResponseHandlerTest extends BaseResponseHandlerTest<List<LoadBalancer>> {
+
+   @Override
+   protected ParseSax<List<LoadBalancer>> createParser() {
+      return factory.create(injector.getInstance(LoadBalancerListResponseHandler.class));
+   }
+
+   protected DateCodecFactory createDateParser() {
+      return injector.getInstance(DateCodecFactory.class);
+   }
+
+   @Test
+   public void testParseResponseFromGetAllLoadbalancer() {
+      ParseSax<List<LoadBalancer>> parser = createParser();
+
+      List<LoadBalancer> actual = parser.parse(payloadFromResource("/loadbalancer/loadbalancers.xml"));
+      assertNotNull(actual, "Parsed content returned null");
+
+      DateCodec dateParser = createDateParser().iso8601();
+
+      List<LoadBalancer> expected = ImmutableList.<LoadBalancer>of(LoadBalancer.builder().id("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee").loadBalancerAlgorithm(Algorithm.ROUND_ROBIN).name("load-1234567890-name")
+              .dataCenterId("datacenter-id").dataCenterVersion("datacenter-version").internetAccess(true).ip("192.168.0.1").lanId("lan-id").state(ProvisioningState.AVAILABLE).creationTime(dateParser.toDate("2014-12-04T07:09:23.138Z")).lastModificationTime(dateParser.toDate("2014-12-04T07:09:23.138Z"))
+              .firewalls(ImmutableList.<Firewall>of(
+                              Firewall.builder().id("firewall-id").nicId("nic-id").active(false).state(ProvisioningState.AVAILABLE).build()
+                      ))
+              .balancedServers(ImmutableList.<Server>of(
+                              Server.builder().activate(true).balancedNicId("balanced-nic-id").id("server-id").name("server-name").build()
+                      )).build(),
+              LoadBalancer.builder().id("qqqqqqqq-wwww-rrrr-tttt-yyyyyyyyyyyy").loadBalancerAlgorithm(Algorithm.ROUND_ROBIN).name("load-balancer-name")
+              .dataCenterId("datacenter-id").dataCenterVersion("datacenter-version").internetAccess(false).ip("192.168.0.1").lanId("lan-id").state(ProvisioningState.AVAILABLE).creationTime(dateParser.toDate("2014-12-04T07:09:23.138Z")).lastModificationTime(dateParser.toDate("2014-12-04T07:09:23.138Z"))
+              .firewalls(ImmutableList.<Firewall>of(
+                              Firewall.builder().id("firewall-id").nicId("nic-id").active(false).state(ProvisioningState.AVAILABLE).build()
+                      ))
+              .balancedServers(ImmutableList.<Server>of(
+                              Server.builder().activate(false).balancedNicId("balanced-nic-id").id("server-id").name("server-name").build()
+                      ))
+              .build()
+      );
+      assertEquals(actual, expected);
+   }
+}